#2643 PR merged: Avoid false Error() exit in copy_binaries() in 390_copy_binaries_libraries.sh

Labels: fixed / solved / done, minor bug

jsmeix opened issue at 2021-07-01 14:21:

  • Type: Bug Fix

  • Impact: Low

  • How was this pull request tested?

Having PROGS+=( lvcreate ) in etc/rear/local.conf causes
false Error() exit in copy_binaries() in 390_copy_binaries_libraries.sh

# usr/sbin/rear -D mkrescue
...
Copying binaries and libraries
ERROR: Failed to copy '/sbin/lvcreate' to '/tmp/rear.hM0nwyMqPDhiprd/rootfs/bin'

The change in this pull request avoids this false Error() exit.

  • Brief description of the changes in this pull request:

Avoid false Error() exit in copy_binaries()
in build/GNU/Linux/390_copy_binaries_libraries.sh

ERROR: Failed to copy '/sbin/lvcreate' to '/tmp/rear.XXX/rootfs/bin'

when there is e.g. PROGS+=( lvcreate ) in etc/rear/local.conf
by skipping 'cp' errors in copy_binaries()
(regardless what the reason was why 'cp' failed)
but add the affected binary to REQUIRED_PROGS
to verify later that the binary actually exists in the recovery system.

jsmeix commented at 2021-07-01 14:38:

Without the change here and with PROGS+=( lvcreate ) in etc/rear/local.conf

# usr/sbin/rear -D mkrescue
...
Copying binaries and libraries
ERROR: Failed to copy '/sbin/lvcreate' to '/tmp/rear.hM0nwyMqPDhiprd/rootfs/bin'
...

# file /tmp/rear.hM0nwyMqPDhiprd/rootfs/bin/lvcreate
/tmp/rear.hM0nwyMqPDhiprd/rootfs/bin/lvcreate: broken symbolic link to lvm

With the change here:

# usr/sbin/rear -D mkrescue
...
Copying binaries and libraries
...
Testing that each program in the REQUIRED_PROGS array can be found as executable command within the recovery system
...

# file /tmp/rear.HNEDYS9lMFh5ZHZ/rootfs/bin/lvcreate
/tmp/rear.HNEDYS9lMFh5ZHZ/rootfs/bin/lvcreate: symbolic link to lvm

excerpts from var/log/rear/rear-linux-h9wr.log

++ PROGS+=(lvcreate)
...
++ ln -sf -v lvm /tmp/rear.HNEDYS9lMFh5ZHZ/rootfs/bin/lvcreate
'/tmp/rear.HNEDYS9lMFh5ZHZ/rootfs/bin/lvcreate' -> 'lvm'
...
2021-07-01 16:23:43.601029186 copy_binaries skipped binary '/sbin/lvcreate' (the binary gets verified later via REQUIRED_PROGS)
...
++ for required_program in "${REQUIRED_PROGS[@]}"
++ test lvcreate
+++ basename lvcreate
++ required_program=lvcreate
++ chroot /tmp/rear.HNEDYS9lMFh5ZHZ/rootfs /bin/bash --login -c 'type lvcreate'
lvcreate is /sbin/lvcreate

jsmeix commented at 2021-07-01 14:44:

@rear/contributors
if there are no objections I would like to merge it tomorrow afternoon.


[Export of Github issue for rear/rear.]