quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] [PATCH] backup-files: Fix hard link creation on Solaris


From: Jean Delvare
Subject: [Quilt-dev] [PATCH] backup-files: Fix hard link creation on Solaris
Date: Thu, 1 Dec 2022 11:41:18 +0100

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 <jdelvare@suse.de>
---
 quilt/fold.in                 |    2 +-
 quilt/scripts/backup-files.in |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

--- quilt.orig/quilt/scripts/backup-files.in
+++ quilt/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
 
--- quilt.orig/quilt/fold.in
+++ quilt/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


-- 
Jean Delvare
SUSE L3 Support



reply via email to

[Prev in Thread] Current Thread [Next in Thread]