base-files: sysupgrade: do not hide tar errors
authorLuiz Angelo Daros de Luca <luizluca@gmail.com>
Thu, 20 Oct 2022 02:12:49 +0000 (23:12 -0300)
committerRafał Miłecki <rafal@milecki.pl>
Mon, 19 Feb 2024 11:41:40 +0000 (12:41 +0100)
tar stderr was probably discarded only to remove this message:

  tar: removing leading '/' from member names

However, together with that, any other error would also be discarded.
It is easier to fix that allowing the error message to be printed.

In sysupgrade, the backup file list only uses absolute paths. That way,
the solution is to remove the leading '/' from all files (sed) and chdir
to / (option -C /)

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
package/base-files/files/sbin/sysupgrade

index 93150913024fb7c83abbcb2de361ce8c6578642a..eba11ce78ed5d45f700fbf3e8e8fd9b5d53f40c1 100755 (executable)
@@ -257,7 +257,8 @@ do_save_conffiles() {
 
        v "Saving config files..."
        [ "$VERBOSE" -gt 1 ] && TAR_V="v" || TAR_V=""
-       tar c${TAR_V}zf "$conf_tar" -T "$CONFFILES" 2>/dev/null
+       sed -i -e 's,^/,,' "$CONFFILES"
+       tar c${TAR_V}zf "$conf_tar" -C / -T "$CONFFILES"
        if [ "$?" -ne 0 ]; then
                echo "Failed to create the configuration backup."
                rm -f "$conf_tar"