Blame SOURCES/coreutils-8.30-renameatu.patch

f5e30c
From 57ee8db4fee8eb6772df1ff18d275594c0b034d4 Mon Sep 17 00:00:00 2001
f5e30c
From: Paul Eggert <eggert@cs.ucla.edu>
f5e30c
Date: Thu, 5 Jul 2018 09:22:09 -0700
f5e30c
Subject: [PATCH 1/2] renameatu: rename from renameat2
f5e30c
f5e30c
It's looking like Glibc will add a renameat2 function
f5e30c
that is incompatible with Gnulib renameat2; see:
f5e30c
https://sourceware.org/ml/libc-alpha/2018-07/msg00064.html
f5e30c
To help avoid future confusion, rename renameat2 to something else.
f5e30c
Use the name 'renameatu', as the Gnulib function is close to the
f5e30c
Glibc function.  Perhaps someday there will also be a renameat2
f5e30c
Gnulib module, which mimicks the future glibc renameat2, but that
f5e30c
can wait as nobody seems to need such a module now.
f5e30c
* NEWS: Mention this.
f5e30c
* lib/renameatu.c: Rename from lib/renameat2.c.
f5e30c
* lib/renameatu.h: Rename from lib/renameat2.h.
f5e30c
* modules/renameatu: Rename from modules/renameat2.
f5e30c
* modules/renameatu-tests: Rename from modules/renameat2-tests.
f5e30c
All uses of "renameat2" in identifiers or file name
f5e30c
changed to "renameatu", except for two instances in
f5e30c
lib/renameatu.c that deal with the Linux kernel's
f5e30c
renameat2 syscall.
f5e30c
f5e30c
Upstream-commit: 2522322e5304e7d86c63e607e2bc83c8d8b0a889
f5e30c
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
f5e30c
---
f5e30c
 gnulib-tests/gnulib.mk                             | 12 +++---
f5e30c
 .../{test-renameat2.c => test-renameatu.c}         | 48 +++++++++++-----------
f5e30c
 lib/backupfile.c                                   |  4 +-
f5e30c
 lib/gnulib.mk                                      | 10 ++---
f5e30c
 lib/renameat.c                                     |  4 +-
f5e30c
 lib/{renameat2.c => renameatu.c}                   |  9 ++--
f5e30c
 lib/{renameat2.h => renameatu.h}                   |  8 ++--
f5e30c
 7 files changed, 48 insertions(+), 47 deletions(-)
f5e30c
 rename gnulib-tests/{test-renameat2.c => test-renameatu.c} (80%)
f5e30c
 rename lib/{renameat2.c => renameatu.c} (94%)
f5e30c
 rename lib/{renameat2.h => renameatu.h} (84%)
f5e30c
f5e30c
diff --git a/gnulib-tests/gnulib.mk b/gnulib-tests/gnulib.mk
f5e30c
index be2b99e..891425b 100644
f5e30c
--- a/gnulib-tests/gnulib.mk
f5e30c
+++ b/gnulib-tests/gnulib.mk
f5e30c
@@ -1750,14 +1750,14 @@ EXTRA_DIST += test-rename.h test-renameat.c signature.h macros.h
f5e30c
 
f5e30c
 ## end   gnulib module renameat-tests
f5e30c
 
f5e30c
-## begin gnulib module renameat2-tests
f5e30c
+## begin gnulib module renameatu-tests
f5e30c
 
f5e30c
-TESTS += test-renameat2
f5e30c
-check_PROGRAMS += test-renameat2
f5e30c
-test_renameat2_LDADD = $(LDADD) @LIBINTL@
f5e30c
-EXTRA_DIST += test-rename.h test-renameat2.c signature.h macros.h
f5e30c
+TESTS += test-renameatu
f5e30c
+check_PROGRAMS += test-renameatu
f5e30c
+test_renameatu_LDADD = $(LDADD) @LIBINTL@
f5e30c
+EXTRA_DIST += test-rename.h test-renameatu.c signature.h macros.h
f5e30c
 
f5e30c
-## end   gnulib module renameat2-tests
f5e30c
+## end   gnulib module renameatu-tests
f5e30c
 
f5e30c
 ## begin gnulib module rmdir-tests
f5e30c
 
f5e30c
diff --git a/gnulib-tests/test-renameat2.c b/gnulib-tests/test-renameatu.c
f5e30c
similarity index 80%
f5e30c
rename from gnulib-tests/test-renameat2.c
f5e30c
rename to gnulib-tests/test-renameatu.c
f5e30c
index 0104890..988428b 100644
f5e30c
--- a/gnulib-tests/test-renameat2.c
f5e30c
+++ b/gnulib-tests/test-renameatu.c
f5e30c
@@ -1,4 +1,4 @@
f5e30c
-/* Test renameat2.
f5e30c
+/* Test renameatu.
f5e30c
    Copyright (C) 2009-2018 Free Software Foundation, Inc.
f5e30c
 
f5e30c
    This program is free software: you can redistribute it and/or modify
f5e30c
@@ -18,12 +18,12 @@
f5e30c
 
f5e30c
 #include <config.h>
f5e30c
 
f5e30c
-#include <renameat2.h>
f5e30c
+#include <renameatu.h>
f5e30c
 
f5e30c
 #include <stdio.h>
f5e30c
 
f5e30c
 #include "signature.h"
f5e30c
-SIGNATURE_CHECK (renameat2, int,
f5e30c
+SIGNATURE_CHECK (renameatu, int,
f5e30c
                  (int, char const *, int, char const *, unsigned int));
f5e30c
 
f5e30c
 #include <dirent.h>
f5e30c
@@ -39,18 +39,18 @@ SIGNATURE_CHECK (renameat2, int,
f5e30c
 #include "ignore-value.h"
f5e30c
 #include "macros.h"
f5e30c
 
f5e30c
-#define BASE "test-renameat2.t"
f5e30c
+#define BASE "test-renameatu.t"
f5e30c
 
f5e30c
 #include "test-rename.h"
f5e30c
 
f5e30c
 static int dfd1 = AT_FDCWD;
f5e30c
 static int dfd2 = AT_FDCWD;
f5e30c
 
f5e30c
-/* Wrapper to test renameat2 like rename.  */
f5e30c
+/* Wrapper to test renameatu like rename.  */
f5e30c
 static int
f5e30c
 do_rename (char const *name1, char const *name2)
f5e30c
 {
f5e30c
-  return renameat2 (dfd1, name1, dfd2, name2, 0);
f5e30c
+  return renameatu (dfd1, name1, dfd2, name2, 0);
f5e30c
 }
f5e30c
 
f5e30c
 int
f5e30c
@@ -67,24 +67,24 @@ main (void)
f5e30c
   /* Test behaviour for invalid file descriptors.  */
f5e30c
   {
f5e30c
     errno = 0;
f5e30c
-    ASSERT (renameat2 (-1, "foo", AT_FDCWD, "bar", 0) == -1);
f5e30c
+    ASSERT (renameatu (-1, "foo", AT_FDCWD, "bar", 0) == -1);
f5e30c
     ASSERT (errno == EBADF);
f5e30c
   }
f5e30c
   {
f5e30c
     close (99);
f5e30c
     errno = 0;
f5e30c
-    ASSERT (renameat2 (99, "foo", AT_FDCWD, "bar", 0) == -1);
f5e30c
+    ASSERT (renameatu (99, "foo", AT_FDCWD, "bar", 0) == -1);
f5e30c
     ASSERT (errno == EBADF);
f5e30c
   }
f5e30c
   ASSERT (close (creat (BASE "oo", 0600)) == 0);
f5e30c
   {
f5e30c
     errno = 0;
f5e30c
-    ASSERT (renameat2 (AT_FDCWD, BASE "oo", -1, "bar", 0) == -1);
f5e30c
+    ASSERT (renameatu (AT_FDCWD, BASE "oo", -1, "bar", 0) == -1);
f5e30c
     ASSERT (errno == EBADF);
f5e30c
   }
f5e30c
   {
f5e30c
     errno = 0;
f5e30c
-    ASSERT (renameat2 (AT_FDCWD, BASE "oo", 99, "bar", 0) == -1);
f5e30c
+    ASSERT (renameatu (AT_FDCWD, BASE "oo", 99, "bar", 0) == -1);
f5e30c
     ASSERT (errno == EBADF);
f5e30c
   }
f5e30c
   ASSERT (unlink (BASE "oo") == 0);
f5e30c
@@ -133,13 +133,13 @@ main (void)
f5e30c
 
f5e30c
       ASSERT (sprintf (strchr (file1, '\0') - 2, "%02d", i) == 2);
f5e30c
       ASSERT (sprintf (strchr (file2, '\0') - 2, "%02d", i + 1) == 2);
f5e30c
-      ASSERT (renameat2 (fd1, file1, fd2, file2, 0) == 0);
f5e30c
+      ASSERT (renameatu (fd1, file1, fd2, file2, 0) == 0);
f5e30c
       free (file1);
f5e30c
       free (file2);
f5e30c
     }
f5e30c
   dfd2 = open ("..", O_RDONLY);
f5e30c
   ASSERT (0 <= dfd2);
f5e30c
-  ASSERT (renameat2 (dfd, "../" BASE "16", dfd2, BASE "17", 0) == 0);
f5e30c
+  ASSERT (renameatu (dfd, "../" BASE "16", dfd2, BASE "17", 0) == 0);
f5e30c
   ASSERT (close (dfd2) == 0);
f5e30c
 
f5e30c
   /* Now we change back to the parent directory, and set dfd to ".";
f5e30c
@@ -152,47 +152,47 @@ main (void)
f5e30c
 
f5e30c
   ASSERT (close (creat (BASE "sub2/file", 0600)) == 0);
f5e30c
   errno = 0;
f5e30c
-  ASSERT (renameat2 (dfd, BASE "sub1", dfd, BASE "sub2", 0) == -1);
f5e30c
+  ASSERT (renameatu (dfd, BASE "sub1", dfd, BASE "sub2", 0) == -1);
f5e30c
   ASSERT (errno == EEXIST || errno == ENOTEMPTY);
f5e30c
   ASSERT (unlink (BASE "sub2/file") == 0);
f5e30c
   errno = 0;
f5e30c
-  ASSERT (renameat2 (dfd, BASE "sub2", dfd, BASE "sub1/.", 0) == -1);
f5e30c
+  ASSERT (renameatu (dfd, BASE "sub2", dfd, BASE "sub1/.", 0) == -1);
f5e30c
   ASSERT (errno == EINVAL || errno == EISDIR || errno == EBUSY
f5e30c
           || errno == ENOTEMPTY || errno == EEXIST
f5e30c
           || errno == ENOENT /* WSL */);
f5e30c
   errno = 0;
f5e30c
-  ASSERT (renameat2 (dfd, BASE "sub2/.", dfd, BASE "sub1", 0) == -1);
f5e30c
+  ASSERT (renameatu (dfd, BASE "sub2/.", dfd, BASE "sub1", 0) == -1);
f5e30c
   ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST
f5e30c
           || errno == ENOENT /* WSL */);
f5e30c
   errno = 0;
f5e30c
-  ASSERT (renameat2 (dfd, BASE "17", dfd, BASE "sub1", 0) == -1);
f5e30c
+  ASSERT (renameatu (dfd, BASE "17", dfd, BASE "sub1", 0) == -1);
f5e30c
   ASSERT (errno == EISDIR);
f5e30c
   errno = 0;
f5e30c
-  ASSERT (renameat2 (dfd, BASE "nosuch", dfd, BASE "18", 0) == -1);
f5e30c
+  ASSERT (renameatu (dfd, BASE "nosuch", dfd, BASE "18", 0) == -1);
f5e30c
   ASSERT (errno == ENOENT);
f5e30c
   errno = 0;
f5e30c
-  ASSERT (renameat2 (dfd, "", dfd, BASE "17", 0) == -1);
f5e30c
+  ASSERT (renameatu (dfd, "", dfd, BASE "17", 0) == -1);
f5e30c
   ASSERT (errno == ENOENT);
f5e30c
   errno = 0;
f5e30c
-  ASSERT (renameat2 (dfd, BASE "17", dfd, "", 0) == -1);
f5e30c
+  ASSERT (renameatu (dfd, BASE "17", dfd, "", 0) == -1);
f5e30c
   ASSERT (errno == ENOENT);
f5e30c
   errno = 0;
f5e30c
-  ASSERT (renameat2 (dfd, BASE "sub2", dfd, BASE "17", 0) == -1);
f5e30c
+  ASSERT (renameatu (dfd, BASE "sub2", dfd, BASE "17", 0) == -1);
f5e30c
   ASSERT (errno == ENOTDIR);
f5e30c
   errno = 0;
f5e30c
-  ASSERT (renameat2 (dfd, BASE "17/", dfd, BASE "18", 0) == -1);
f5e30c
+  ASSERT (renameatu (dfd, BASE "17/", dfd, BASE "18", 0) == -1);
f5e30c
   ASSERT (errno == ENOTDIR);
f5e30c
   errno = 0;
f5e30c
-  ASSERT (renameat2 (dfd, BASE "17", dfd, BASE "18/", 0) == -1);
f5e30c
+  ASSERT (renameatu (dfd, BASE "17", dfd, BASE "18/", 0) == -1);
f5e30c
   ASSERT (errno == ENOTDIR || errno == ENOENT);
f5e30c
 
f5e30c
   /* Finally, make sure we cannot overwrite existing files.  */
f5e30c
   ASSERT (close (creat (BASE "sub2/file", 0600)) == 0);
f5e30c
   errno = 0;
f5e30c
-  ASSERT ((renameat2 (dfd, BASE "sub2", dfd, BASE "sub1", RENAME_NOREPLACE)
f5e30c
+  ASSERT ((renameatu (dfd, BASE "sub2", dfd, BASE "sub1", RENAME_NOREPLACE)
f5e30c
            == -1)
f5e30c
           && errno == EEXIST);
f5e30c
-  ASSERT ((renameat2 (dfd, BASE "sub2/file", dfd, BASE "17", RENAME_NOREPLACE)
f5e30c
+  ASSERT ((renameatu (dfd, BASE "sub2/file", dfd, BASE "17", RENAME_NOREPLACE)
f5e30c
            == -1)
f5e30c
           && errno == EEXIST);
f5e30c
 
f5e30c
diff --git a/lib/backupfile.c b/lib/backupfile.c
f5e30c
index d438455..637be6c 100644
f5e30c
--- a/lib/backupfile.c
f5e30c
+++ b/lib/backupfile.c
f5e30c
@@ -23,7 +23,7 @@
f5e30c
 #include "backup-internal.h"
f5e30c
 
f5e30c
 #include "dirname.h"
f5e30c
-#include "renameat2.h"
f5e30c
+#include "renameatu.h"
f5e30c
 #include "xalloc-oversized.h"
f5e30c
 
f5e30c
 #include <fcntl.h>
f5e30c
@@ -353,7 +353,7 @@ backupfile_internal (char const *file, enum backup_type backup_type, bool rename
f5e30c
           base_offset = 0;
f5e30c
         }
f5e30c
       unsigned flags = backup_type == simple_backups ? 0 : RENAME_NOREPLACE;
f5e30c
-      if (renameat2 (AT_FDCWD, file, sdir, s + base_offset, flags) == 0)
f5e30c
+      if (renameatu (AT_FDCWD, file, sdir, s + base_offset, flags) == 0)
f5e30c
         break;
f5e30c
       int e = errno;
f5e30c
       if (e != EEXIST)
f5e30c
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
f5e30c
index 04473d5..0b747e3 100644
f5e30c
--- a/lib/gnulib.mk
f5e30c
+++ b/lib/gnulib.mk
f5e30c
@@ -21,7 +21,7 @@
f5e30c
 # the same distribution terms as the rest of that program.
f5e30c
 #
f5e30c
 # Generated by gnulib-tool.
f5e30c
-# Reproduce by: gnulib-tool --import --local-dir=gl --lib=libcoreutils --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=gnulib-tests --aux-dir=build-aux --with-tests --avoid=canonicalize-lgpl --avoid=dummy --makefile-name=gnulib.mk --no-conditional-dependencies --no-libtool --macro-prefix=gl acl alignof alloca announce-gen areadlink-with-size argmatch argv-iter assert autobuild backup-rename backupfile base32 base64 buffer-lcm c-strcase c-strtod c-strtold calloc-gnu canon-host canonicalize chown cloexec closein closeout config-h configmake crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 cycle-check d-ino d-type di-set diacrit dirfd dirname do-release-commit-and-tag dtoastr dup2 environ error euidaccess exclude exitfail explicit_bzero faccessat fadvise fchdir fchmodat fchownat fclose fcntl fcntl-safer fd-reopen fdatasync fdl fdopen fdutimensat file-has-acl file-type fileblocks filemode filenamecat filevercmp flexmember fnmatch-gnu fopen-safer fprintftime freopen freopen-safer fseeko fstatat fsusage fsync ftoastr ftruncate fts full-read full-write getgroups gethrxtime getline getloadavg getlogin getndelim2 getopt-gnu getpagesize getpass-gnu gettext-h gettime gettimeofday getugroups getusershell git-version-gen gitlog-to-changelog gnu-make gnu-web-doc-update gnumakefile gnupload group-member hard-locale hash hash-pjw heap host-os human idcache ignore-value inttostr inttypes isapipe isatty isblank largefile lchmod lchown ldtoastr lib-ignore linebuffer link link-follow linkat long-options lstat maintainer-makefile malloc-gnu manywarnings mbrlen mbrtowc mbsalign mbschr mbslen mbswidth memcasecmp memchr memcmp2 mempcpy memrchr mgetgroups mkancesdirs mkdir mkdir-p mkfifo mknod mkostemp mkstemp mktime modechange mountlist mpsort netinet_in non-recursive-gnulib-prefix-hack nproc nstrftime obstack open parse-datetime pathmax perl physmem pipe-posix pipe2 posix-shell posixtm posixver priv-set progname propername pthread putenv quote quotearg randint randperm read-file readlink readtokens readtokens0 readutmp realloc-gnu regex remove rename renameat renameat2 rmdir root-dev-ino rpmatch safe-read same save-cwd savedir savewd selinux-at setenv settime sig2str sigaction smack ssize_t stat-macros stat-size stat-time statat stdbool stdlib-safer stpcpy stpncpy strdup-posix strncat strnumcmp strsignal strtod strtoimax strtoumax symlinkat sys_ioctl sys_resource sys_stat sys_wait tempname termios time_rz timer-time timespec tzset uname unicodeio unistd-safer unlink-busy unlinkat unlocked-io unsetenv update-copyright uptime useless-if-before-free userspec utimecmp utimens vasprintf-posix vc-list-files verify verror version-etc-fsf wchar-single wcswidth wcwidth winsz-ioctl winsz-termios write-any-file xalloc xbinary-io xdectoint xfts xgetcwd xgetgroups xgethostname xmemcoll xnanosleep xprintf xprintf-posix xreadlink xstrtod xstrtoimax xstrtol xstrtold xstrtoumax year2038 yesno
f5e30c
+# Reproduce by: gnulib-tool --import --local-dir=gl --lib=libcoreutils --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=gnulib-tests --aux-dir=build-aux --with-tests --avoid=canonicalize-lgpl --avoid=dummy --makefile-name=gnulib.mk --no-conditional-dependencies --no-libtool --macro-prefix=gl acl alignof alloca announce-gen areadlink-with-size argmatch argv-iter assert autobuild backup-rename backupfile base32 base64 buffer-lcm c-strcase c-strtod c-strtold calloc-gnu canon-host canonicalize chown cloexec closein closeout config-h configmake crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 cycle-check d-ino d-type di-set diacrit dirfd dirname do-release-commit-and-tag dtoastr dup2 environ error euidaccess exclude exitfail explicit_bzero faccessat fadvise fchdir fchmodat fchownat fclose fcntl fcntl-safer fd-reopen fdatasync fdl fdopen fdutimensat file-has-acl file-type fileblocks filemode filenamecat filevercmp flexmember fnmatch-gnu fopen-safer fprintftime freopen freopen-safer fseeko fstatat fsusage fsync ftoastr ftruncate fts full-read full-write getgroups gethrxtime getline getloadavg getlogin getndelim2 getopt-gnu getpagesize getpass-gnu gettext-h gettime gettimeofday getugroups getusershell git-version-gen gitlog-to-changelog gnu-make gnu-web-doc-update gnumakefile gnupload group-member hard-locale hash hash-pjw heap host-os human idcache ignore-value inttostr inttypes isapipe isatty isblank largefile lchmod lchown ldtoastr lib-ignore linebuffer link link-follow linkat long-options lstat maintainer-makefile malloc-gnu manywarnings mbrlen mbrtowc mbsalign mbschr mbslen mbswidth memcasecmp memchr memcmp2 mempcpy memrchr mgetgroups mkancesdirs mkdir mkdir-p mkfifo mknod mkostemp mkstemp mktime modechange mountlist mpsort netinet_in non-recursive-gnulib-prefix-hack nproc nstrftime obstack open parse-datetime pathmax perl physmem pipe-posix pipe2 posix-shell posixtm posixver priv-set progname propername pthread putenv quote quotearg randint randperm read-file readlink readtokens readtokens0 readutmp realloc-gnu regex remove rename renameat renameatu rmdir root-dev-ino rpmatch safe-read same save-cwd savedir savewd selinux-at setenv settime sig2str sigaction smack ssize_t stat-macros stat-size stat-time statat stdbool stdlib-safer stpcpy stpncpy strdup-posix strncat strnumcmp strsignal strtod strtoimax strtoumax symlinkat sys_ioctl sys_resource sys_stat sys_wait tempname termios time_rz timer-time timespec tzset uname unicodeio unistd-safer unlink-busy unlinkat unlocked-io unsetenv update-copyright uptime useless-if-before-free userspec utimecmp utimens vasprintf-posix vc-list-files verify verror version-etc-fsf wchar-single wcswidth wcwidth winsz-ioctl winsz-termios write-any-file xalloc xbinary-io xdectoint xfts xgetcwd xgetgroups xgethostname xmemcoll xnanosleep xprintf xprintf-posix xreadlink xstrtod xstrtoimax xstrtol xstrtold xstrtoumax year2038 yesno
f5e30c
 
f5e30c
 
f5e30c
 MOSTLYCLEANFILES += lib/core lib/*.stackdump
f5e30c
@@ -3218,15 +3218,15 @@ EXTRA_lib_libcoreutils_a_SOURCES += lib/renameat.c
f5e30c
 
f5e30c
 ## end   gnulib module renameat
f5e30c
 
f5e30c
-## begin gnulib module renameat2
f5e30c
+## begin gnulib module renameatu
f5e30c
 
f5e30c
-lib_libcoreutils_a_SOURCES += lib/renameat2.c
f5e30c
+lib_libcoreutils_a_SOURCES += lib/renameatu.c
f5e30c
 
f5e30c
-EXTRA_DIST += lib/at-func2.c lib/renameat2.h
f5e30c
+EXTRA_DIST += lib/at-func2.c lib/renameatu.h
f5e30c
 
f5e30c
 EXTRA_lib_libcoreutils_a_SOURCES += lib/at-func2.c
f5e30c
 
f5e30c
-## end   gnulib module renameat2
f5e30c
+## end   gnulib module renameatu
f5e30c
 
f5e30c
 ## begin gnulib module rewinddir
f5e30c
 
f5e30c
diff --git a/lib/renameat.c b/lib/renameat.c
f5e30c
index 0cb7d33..67be22b 100644
f5e30c
--- a/lib/renameat.c
f5e30c
+++ b/lib/renameat.c
f5e30c
@@ -16,10 +16,10 @@
f5e30c
 
f5e30c
 #include <config.h>
f5e30c
 #include <stdio.h>
f5e30c
-#include "renameat2.h"
f5e30c
+#include "renameatu.h"
f5e30c
 
f5e30c
 int
f5e30c
 renameat (int fd1, char const *src, int fd2, char const *dst)
f5e30c
 {
f5e30c
-  return renameat2 (fd1, src, fd2, dst, 0);
f5e30c
+  return renameatu (fd1, src, fd2, dst, 0);
f5e30c
 }
f5e30c
diff --git a/lib/renameat2.c b/lib/renameatu.c
f5e30c
similarity index 94%
f5e30c
rename from lib/renameat2.c
f5e30c
rename to lib/renameatu.c
f5e30c
index a295ec3..b013ad6 100644
f5e30c
--- a/lib/renameat2.c
f5e30c
+++ b/lib/renameatu.c
f5e30c
@@ -18,7 +18,7 @@
f5e30c
 
f5e30c
 #include <config.h>
f5e30c
 
f5e30c
-#include "renameat2.h"
f5e30c
+#include "renameatu.h"
f5e30c
 
f5e30c
 #include <errno.h>
f5e30c
 #include <stdio.h>
f5e30c
@@ -68,10 +68,13 @@ rename_noreplace (char const *src, char const *dst)
f5e30c
    the restore_cwd fails, then give a diagnostic and exit nonzero.
f5e30c
 
f5e30c
    Obey FLAGS when doing the renaming.  If FLAGS is zero, this
f5e30c
-   function is equivalent to renameat (FD1, SRC, FD2, DST).  */
f5e30c
+   function is equivalent to renameat (FD1, SRC, FD2, DST).
f5e30c
+   Otherwise, attempt to implement FLAGS even if the implementation is
f5e30c
+   not atomic; this differs from the GNU/Linux native renameat2,
f5e30c
+   which fails if it cannot guarantee atomicity.  */
f5e30c
 
f5e30c
 int
f5e30c
-renameat2 (int fd1, char const *src, int fd2, char const *dst,
f5e30c
+renameatu (int fd1, char const *src, int fd2, char const *dst,
f5e30c
            unsigned int flags)
f5e30c
 {
f5e30c
   int ret_val = -1;
f5e30c
diff --git a/lib/renameat2.h b/lib/renameatu.h
f5e30c
similarity index 84%
f5e30c
rename from lib/renameat2.h
f5e30c
rename to lib/renameatu.h
f5e30c
index aba7966..7d79775 100644
f5e30c
--- a/lib/renameat2.h
f5e30c
+++ b/lib/renameatu.h
f5e30c
@@ -16,15 +16,13 @@
f5e30c
 
f5e30c
 /* written by Paul Eggert */
f5e30c
 
f5e30c
-/* Get RENAME_* macros from linux/fs.h if present, otherwise supply
f5e30c
+/* Get RENAME_* macros from <stdio.h> if present, otherwise supply
f5e30c
    the traditional Linux values.  */
f5e30c
-#if HAVE_LINUX_FS_H
f5e30c
-# include <linux/fs.h>
f5e30c
-#endif
f5e30c
+#include <stdio.h>
f5e30c
 #ifndef RENAME_NOREPLACE
f5e30c
 # define RENAME_NOREPLACE  (1 << 0)
f5e30c
 # define RENAME_EXCHANGE   (1 << 1)
f5e30c
 # define RENAME_WHITEOUT   (1 << 2)
f5e30c
 #endif
f5e30c
 
f5e30c
-extern int renameat2 (int, char const *, int, char const *, unsigned int);
f5e30c
+extern int renameatu (int, char const *, int, char const *, unsigned int);
f5e30c
-- 
f5e30c
2.14.4
f5e30c
f5e30c
f5e30c
From a6b7ff5ef538bbdff4550a56fed878e9cd951d6d Mon Sep 17 00:00:00 2001
f5e30c
From: Paul Eggert <eggert@cs.ucla.edu>
f5e30c
Date: Thu, 5 Jul 2018 09:33:48 -0700
f5e30c
Subject: [PATCH 2/2] build: update gnulib submodule to latest
f5e30c
f5e30c
* bootstrap.conf, src/copy.c, src/mv.c, src/shred.c:
f5e30c
Adjust to renaming of renameat2 to renameatu.
f5e30c
f5e30c
Upstream-commit: 439741053256618eb651e6d43919df29625b8714
f5e30c
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
f5e30c
---
f5e30c
 bootstrap.conf | 2 +-
f5e30c
 src/copy.c     | 4 ++--
f5e30c
 src/mv.c       | 4 ++--
f5e30c
 src/shred.c    | 4 ++--
f5e30c
 4 files changed, 7 insertions(+), 7 deletions(-)
f5e30c
f5e30c
diff --git a/bootstrap.conf b/bootstrap.conf
f5e30c
index 4da4f94..fcf29dc 100644
f5e30c
--- a/bootstrap.conf
f5e30c
+++ b/bootstrap.conf
f5e30c
@@ -210,7 +210,7 @@ gnulib_modules="
f5e30c
   remove
f5e30c
   rename
f5e30c
   renameat
f5e30c
-  renameat2
f5e30c
+  renameatu
f5e30c
   rmdir
f5e30c
   root-dev-ino
f5e30c
   rpmatch
f5e30c
diff --git a/src/copy.c b/src/copy.c
f5e30c
index 58d2f6e..1a9cdd1 100644
f5e30c
--- a/src/copy.c
f5e30c
+++ b/src/copy.c
f5e30c
@@ -53,7 +53,7 @@
f5e30c
 #include "ignore-value.h"
f5e30c
 #include "ioblksize.h"
f5e30c
 #include "quote.h"
f5e30c
-#include "renameat2.h"
f5e30c
+#include "renameatu.h"
f5e30c
 #include "root-uid.h"
f5e30c
 #include "same.h"
f5e30c
 #include "savedir.h"
f5e30c
@@ -1873,7 +1873,7 @@ copy_internal (char const *src_name, char const *dst_name,
f5e30c
   if (x->move_mode)
f5e30c
     {
f5e30c
       if (rename_errno < 0)
f5e30c
-        rename_errno = (renameat2 (AT_FDCWD, src_name, AT_FDCWD, dst_name,
f5e30c
+        rename_errno = (renameatu (AT_FDCWD, src_name, AT_FDCWD, dst_name,
f5e30c
                                    RENAME_NOREPLACE)
f5e30c
                         ? errno : 0);
f5e30c
       new_dst = rename_errno == 0;
f5e30c
diff --git a/src/mv.c b/src/mv.c
f5e30c
index b6dd72d..36fd1af 100644
f5e30c
--- a/src/mv.c
f5e30c
+++ b/src/mv.c
f5e30c
@@ -31,7 +31,7 @@
f5e30c
 #include "error.h"
f5e30c
 #include "filenamecat.h"
f5e30c
 #include "remove.h"
f5e30c
-#include "renameat2.h"
f5e30c
+#include "renameatu.h"
f5e30c
 #include "root-dev-ino.h"
f5e30c
 #include "priv-set.h"
f5e30c
 
f5e30c
@@ -456,7 +456,7 @@ main (int argc, char **argv)
f5e30c
     {
f5e30c
       assert (2 <= n_files);
f5e30c
       if (n_files == 2)
f5e30c
-        x.rename_errno = (renameat2 (AT_FDCWD, file[0], AT_FDCWD, file[1],
f5e30c
+        x.rename_errno = (renameatu (AT_FDCWD, file[0], AT_FDCWD, file[1],
f5e30c
                                      RENAME_NOREPLACE)
f5e30c
                           ? errno : 0);
f5e30c
       if (x.rename_errno != 0 && target_directory_operand (file[n_files - 1]))
f5e30c
diff --git a/src/shred.c b/src/shred.c
f5e30c
index 2ddaadd..270b1e9 100644
f5e30c
--- a/src/shred.c
f5e30c
+++ b/src/shred.c
f5e30c
@@ -93,7 +93,7 @@
f5e30c
 #include "human.h"
f5e30c
 #include "randint.h"
f5e30c
 #include "randread.h"
f5e30c
-#include "renameat2.h"
f5e30c
+#include "renameatu.h"
f5e30c
 #include "stat-size.h"
f5e30c
 
f5e30c
 /* Default number of times to overwrite.  */
f5e30c
@@ -1096,7 +1096,7 @@ wipename (char *oldname, char const *qoldname, struct Options const *flags)
f5e30c
         memset (base, nameset[0], len);
f5e30c
         base[len] = 0;
f5e30c
         bool rename_ok;
f5e30c
-        while (! (rename_ok = (renameat2 (AT_FDCWD, oldname, AT_FDCWD, newname,
f5e30c
+        while (! (rename_ok = (renameatu (AT_FDCWD, oldname, AT_FDCWD, newname,
f5e30c
                                           RENAME_NOREPLACE)
f5e30c
                                == 0))
f5e30c
                && errno == EEXIST && incname (base, len))
f5e30c
-- 
f5e30c
2.14.4
f5e30c