SHA256
1
0
forked from pool/coreutils
coreutils/gnulib-simple-backup-fix.patch

94 lines
2.8 KiB
Diff
Raw Normal View History

- gnulib-simple-backup-fix.patch: Add patch to make simple backups in correct directory; broken in 9.1. See https://bugs.gnu.org/55029 - update to 9.1: * chmod -R no longer exits with error status when encountering symlinks. All files would be processed correctly, but the exit status was incorrect. * If 'cp -Z A B' checks B's status and some other process then removes B, cp no longer creates B with a too-generous SELinux security context before adjusting it to the correct value. * 'cp --preserve=ownership A B' no longer ignores the umask when creating B. Also, 'cp --preserve-xattr A B' is less likely to temporarily chmod u+w B. * 'id xyz' now uses the name 'xyz' to determine groups, instead of xyz's uid. * 'ls -v' and 'sort -V' no longer mishandle corner cases like "a..a" vs "a.+" or lines containing NULs. Their behavior now matches the documentation for file names like ".m4" that consist entirely of an extension, and the documentation has been clarified for unusual cases. * 'mv -T --backup=numbered A B/' no longer miscalculates the backup number for B when A is a directory, possibly inflooping. * cat now uses the copy_file_range syscall if available, when doing simple copies between regular files. This may be more efficient, by avoiding user space copies, and possibly employing copy offloading or reflinking. * chown and chroot now warn about usages like "chown root.root f", which have the nonstandard and long-obsolete "." separator that causes problems on platforms where user names contain ".". Applications should use ":" instead of ".". * cksum no longer allows abbreviated algorithm names, so that forward compatibility and robustness is improved. * date +'%-N' now suppresses excess trailing digits, instead of always padding them with zeros to 9 digits. It uses clock_getres and clock_gettime to infer the clock resolution. OBS-URL: https://build.opensuse.org/package/show/Base:System/coreutils?expand=0&rev=328
2022-04-26 10:21:31 +02:00
Upstream patch on top of coreutils-9.1; remove with >9.1.
Fixes: https://bugs.gnu.org/55029
Two commits:
* https://git.sv.gnu.org/cgit/coreutils.git/commit/?id=e087525091b
commit e087525091b8f0a15eb2354f71032597d5271599
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Wed Apr 20 19:44:56 2022 -0700
mv: test Bug#55029
* tests/mv/backup-dir.sh: New test for Bug#55029,
reported by Steve Ward.
* https://git.sv.gnu.org/cgit/gnulib.git/commit/?id=7347caeb9d90
commit 7347caeb9d902d3fca2c11f69a55a3e578d93bfe
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Wed Apr 20 19:34:57 2022 -0700
backupfile: fix bug when renaming simple backups
* lib/backupfile.c (backupfile_internal): Fix bug when RENAME
and when doing simple backups. Problem reported by Steve Ward in:
https://bugs.gnu.org/55029
---
NEWS | 8 ++++++++
lib/backupfile.c | 7 +++----
tests/mv/backup-dir.sh | 6 ++++++
3 files changed, 17 insertions(+), 4 deletions(-)
Index: lib/backupfile.c
===================================================================
--- lib/backupfile.c.orig
+++ lib/backupfile.c
@@ -332,7 +332,7 @@ backupfile_internal (int dir_fd, char co
return s;
DIR *dirp = NULL;
- int sdir = AT_FDCWD;
+ int sdir = dir_fd;
idx_t base_max = 0;
while (true)
{
@@ -371,10 +371,9 @@ backupfile_internal (int dir_fd, char co
if (! rename)
break;
- int olddirfd = sdir < 0 ? dir_fd : sdir;
- idx_t offset = sdir < 0 ? 0 : base_offset;
+ idx_t offset = backup_type == simple_backups ? 0 : base_offset;
unsigned flags = backup_type == simple_backups ? 0 : RENAME_NOREPLACE;
- if (renameatu (olddirfd, file + offset, sdir, s + offset, flags) == 0)
+ if (renameatu (sdir, file + offset, sdir, s + offset, flags) == 0)
break;
int e = errno;
if (! (e == EEXIST && extended))
Index: tests/mv/backup-dir.sh
===================================================================
--- tests/mv/backup-dir.sh.orig
+++ tests/mv/backup-dir.sh
@@ -36,4 +36,10 @@ mkdir C D E || framework_failure_
mv -T --backup=numbered C E/ || fail=1
mv -T --backup=numbered D E/ || fail=1
+# Bug#55029
+mkdir F && echo 1 >1 && echo 2 >2 && cp 1 F/X && cp 2 X || framework_failure_
+mv --backup=simple X F/ || fail=1
+compare 1 F/X~ || fail=1
+compare 2 F/X || fail=1
+
Exit $fail
Index: NEWS
===================================================================
--- NEWS.orig
+++ NEWS
@@ -1,5 +1,13 @@
GNU coreutils NEWS -*- outline -*-
+* Downstream changes on top of release 9.1
+
+** Bug fixes
+
+ 'mv --backup=simple f d/' no longer mistakenly backs up d/f to f~.
+ [bug introduced in coreutils-9.1]
+
+
* Noteworthy changes in release 9.1 (2022-04-15) [stable]
** Bug fixes