Accepting request 972387 from home:berny:branches:Base:System

- gnulib-simple-backup-fix.patch: Add patch to make simple backups in correct
  directory; broken in 9.1.  See https://bugs.gnu.org/55029

OBS-URL: https://build.opensuse.org/request/show/972387
OBS-URL: https://build.opensuse.org/package/show/Base:System/coreutils?expand=0&rev=326
This commit is contained in:
Dirk Mueller 2022-04-25 08:23:28 +00:00 committed by Git OBS Bridge
parent 39d32b358a
commit e526ac1db9
3 changed files with 106 additions and 1 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Sun Apr 24 09:49:04 UTC 2022 - Bernhard Voelker <mail@bernhard-voelker.de>
- gnulib-simple-backup-fix.patch: Add patch to make simple backups in correct
directory; broken in 9.1. See https://bugs.gnu.org/55029
-------------------------------------------------------------------
Thu Apr 21 20:58:30 UTC 2022 - Dirk Müller <dmueller@suse.com>

View File

@ -63,9 +63,14 @@ Patch303: coreutils-tests-shorten-extreme-factor-tests.patch
Patch304: coreutils-use-python3.patch
Patch500: coreutils-disable_tests.patch
Patch501: coreutils-test_without_valgrind.patch
# Upstream patch - remove with version >9.0:
# Downstream patch to skip a test failing on OBS.
# tests: skip tests/rm/ext3-perf.sh temporarily as it hangs on OBS.
Patch810: coreutils-skip-tests-rm-ext3-perf.patch
# Upstream patch - remove with version >9.1:
Patch850: gnulib-simple-backup-fix.patch
BuildRequires: automake
BuildRequires: gmp-devel
BuildRequires: libacl-devel
@ -160,6 +165,7 @@ This package contains the documentation for the GNU Core Utilities.
%patch501
%patch810
%patch850
# ================================================
%build

View File

@ -0,0 +1,93 @@
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