From 0801a6426fed320b94cd77508427a3edac8f7de5 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 6 Dec 2022 16:53:51 +0100 Subject: backup-files: Fix hard link creation on Solaris The ln defaults can be slightly different depending on the platform. While on Linux 'ln' defaults to 'ln -P', on Solaris (and possibly other platforms) it defaults to 'ln -L'. This difference is best resolved by explicitly using the '-P' flag. This fixes bug #63451: https://savannah.nongnu.org/bugs/index.php?63451 Credits to the anonymous reporter. [JD: Propagate the fix to all occurrences of 'ln'.] Signed-off-by: Jean Delvare --- quilt/fold.in | 2 +- quilt/scripts/backup-files.in | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/quilt/fold.in b/quilt/fold.in index 1f664ca..3a62fcf 100644 --- a/quilt/fold.in +++ b/quilt/fold.in @@ -109,7 +109,7 @@ then if ! [ -e "$backup_file" ] then if ! mkdir -p "$(dirname "$backup_file")" || - ! ln "$workdir/$file" "$backup_file" + ! ln -P "$workdir/$file" "$backup_file" then failed=1 break diff --git a/quilt/scripts/backup-files.in b/quilt/scripts/backup-files.in index edf2b1f..f2bf380 100644 --- a/quilt/scripts/backup-files.in +++ b/quilt/scripts/backup-files.in @@ -94,7 +94,7 @@ backup() if [ -n "$OPT_NOLINKS" -a "$(stat @STAT_HARDLINK@ "$file")" = 1 ]; then cp -p "$file" "$backup" else - ln "$file" "$backup" 2>&4 || cp -p "$file" "$backup" + ln -P "$file" "$backup" 2>&4 || cp -p "$file" "$backup" if [ -n "$OPT_NOLINKS" ]; then ensure_nolinks "$file" fi @@ -123,7 +123,7 @@ restore() if [ -L "$backup" ]; then ln -s "$(readlink "$backup")" "$file" else - ln "$backup" "$file" 2>&4 || cp -p "$backup" "$file" + ln -P "$backup" "$file" 2>&4 || cp -p "$backup" "$file" fi if [ -n "$OPT_TOUCH" -a ! -L "$file" ]; then @@ -186,7 +186,7 @@ restore_all() local backup=$OPT_PREFIX$file $ECHO "Restoring $file" - ln "$backup" "$file" 2>&4 || cp -p "$backup" "$file" + ln -P "$backup" "$file" 2>&4 || cp -p "$backup" "$file" done < "$NONEMPTY_FILES" fi -- cgit