Blame SOURCES/coreutils-8.30-renameatu.patch

d3767b
From 57ee8db4fee8eb6772df1ff18d275594c0b034d4 Mon Sep 17 00:00:00 2001
d3767b
From: Paul Eggert <eggert@cs.ucla.edu>
d3767b
Date: Thu, 5 Jul 2018 09:22:09 -0700
d3767b
Subject: [PATCH 1/2] renameatu: rename from renameat2
d3767b
d3767b
It's looking like Glibc will add a renameat2 function
d3767b
that is incompatible with Gnulib renameat2; see:
d3767b
https://sourceware.org/ml/libc-alpha/2018-07/msg00064.html
d3767b
To help avoid future confusion, rename renameat2 to something else.
d3767b
Use the name 'renameatu', as the Gnulib function is close to the
d3767b
Glibc function.  Perhaps someday there will also be a renameat2
d3767b
Gnulib module, which mimicks the future glibc renameat2, but that
d3767b
can wait as nobody seems to need such a module now.
d3767b
* NEWS: Mention this.
d3767b
* lib/renameatu.c: Rename from lib/renameat2.c.
d3767b
* lib/renameatu.h: Rename from lib/renameat2.h.
d3767b
* modules/renameatu: Rename from modules/renameat2.
d3767b
* modules/renameatu-tests: Rename from modules/renameat2-tests.
d3767b
All uses of "renameat2" in identifiers or file name
d3767b
changed to "renameatu", except for two instances in
d3767b
lib/renameatu.c that deal with the Linux kernel's
d3767b
renameat2 syscall.
d3767b
d3767b
Upstream-commit: 2522322e5304e7d86c63e607e2bc83c8d8b0a889
d3767b
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
d3767b
---
d3767b
 gnulib-tests/gnulib.mk                             | 12 +++---
d3767b
 .../{test-renameat2.c => test-renameatu.c}         | 48 +++++++++++-----------
d3767b
 lib/backupfile.c                                   |  4 +-
d3767b
 lib/gnulib.mk                                      | 10 ++---
d3767b
 lib/renameat.c                                     |  4 +-
d3767b
 lib/{renameat2.c => renameatu.c}                   |  9 ++--
d3767b
 lib/{renameat2.h => renameatu.h}                   |  8 ++--
d3767b
 7 files changed, 48 insertions(+), 47 deletions(-)
d3767b
 rename gnulib-tests/{test-renameat2.c => test-renameatu.c} (80%)
d3767b
 rename lib/{renameat2.c => renameatu.c} (94%)
d3767b
 rename lib/{renameat2.h => renameatu.h} (84%)
d3767b
d3767b
diff --git a/gnulib-tests/gnulib.mk b/gnulib-tests/gnulib.mk
d3767b
index be2b99e..891425b 100644
d3767b
--- a/gnulib-tests/gnulib.mk
d3767b
+++ b/gnulib-tests/gnulib.mk
d3767b
@@ -1750,14 +1750,14 @@ EXTRA_DIST += test-rename.h test-renameat.c signature.h macros.h
d3767b
 
d3767b
 ## end   gnulib module renameat-tests
d3767b
 
d3767b
-## begin gnulib module renameat2-tests
d3767b
+## begin gnulib module renameatu-tests
d3767b
 
d3767b
-TESTS += test-renameat2
d3767b
-check_PROGRAMS += test-renameat2
d3767b
-test_renameat2_LDADD = $(LDADD) @LIBINTL@
d3767b
-EXTRA_DIST += test-rename.h test-renameat2.c signature.h macros.h
d3767b
+TESTS += test-renameatu
d3767b
+check_PROGRAMS += test-renameatu
d3767b
+test_renameatu_LDADD = $(LDADD) @LIBINTL@
d3767b
+EXTRA_DIST += test-rename.h test-renameatu.c signature.h macros.h
d3767b
 
d3767b
-## end   gnulib module renameat2-tests
d3767b
+## end   gnulib module renameatu-tests
d3767b
 
d3767b
 ## begin gnulib module rmdir-tests
d3767b
 
d3767b
diff --git a/gnulib-tests/test-renameat2.c b/gnulib-tests/test-renameatu.c
d3767b
similarity index 80%
d3767b
rename from gnulib-tests/test-renameat2.c
d3767b
rename to gnulib-tests/test-renameatu.c
d3767b
index 0104890..988428b 100644
d3767b
--- a/gnulib-tests/test-renameat2.c
d3767b
+++ b/gnulib-tests/test-renameatu.c
d3767b
@@ -1,4 +1,4 @@
d3767b
-/* Test renameat2.
d3767b
+/* Test renameatu.
d3767b
    Copyright (C) 2009-2018 Free Software Foundation, Inc.
d3767b
 
d3767b
    This program is free software: you can redistribute it and/or modify
d3767b
@@ -18,12 +18,12 @@
d3767b
 
d3767b
 #include <config.h>
d3767b
 
d3767b
-#include <renameat2.h>
d3767b
+#include <renameatu.h>
d3767b
 
d3767b
 #include <stdio.h>
d3767b
 
d3767b
 #include "signature.h"
d3767b
-SIGNATURE_CHECK (renameat2, int,
d3767b
+SIGNATURE_CHECK (renameatu, int,
d3767b
                  (int, char const *, int, char const *, unsigned int));
d3767b
 
d3767b
 #include <dirent.h>
d3767b
@@ -39,18 +39,18 @@ SIGNATURE_CHECK (renameat2, int,
d3767b
 #include "ignore-value.h"
d3767b
 #include "macros.h"
d3767b
 
d3767b
-#define BASE "test-renameat2.t"
d3767b
+#define BASE "test-renameatu.t"
d3767b
 
d3767b
 #include "test-rename.h"
d3767b
 
d3767b
 static int dfd1 = AT_FDCWD;
d3767b
 static int dfd2 = AT_FDCWD;
d3767b
 
d3767b
-/* Wrapper to test renameat2 like rename.  */
d3767b
+/* Wrapper to test renameatu like rename.  */
d3767b
 static int
d3767b
 do_rename (char const *name1, char const *name2)
d3767b
 {
d3767b
-  return renameat2 (dfd1, name1, dfd2, name2, 0);
d3767b
+  return renameatu (dfd1, name1, dfd2, name2, 0);
d3767b
 }
d3767b
 
d3767b
 int
d3767b
@@ -67,24 +67,24 @@ main (void)
d3767b
   /* Test behaviour for invalid file descriptors.  */
d3767b
   {
d3767b
     errno = 0;
d3767b
-    ASSERT (renameat2 (-1, "foo", AT_FDCWD, "bar", 0) == -1);
d3767b
+    ASSERT (renameatu (-1, "foo", AT_FDCWD, "bar", 0) == -1);
d3767b
     ASSERT (errno == EBADF);
d3767b
   }
d3767b
   {
d3767b
     close (99);
d3767b
     errno = 0;
d3767b
-    ASSERT (renameat2 (99, "foo", AT_FDCWD, "bar", 0) == -1);
d3767b
+    ASSERT (renameatu (99, "foo", AT_FDCWD, "bar", 0) == -1);
d3767b
     ASSERT (errno == EBADF);
d3767b
   }
d3767b
   ASSERT (close (creat (BASE "oo", 0600)) == 0);
d3767b
   {
d3767b
     errno = 0;
d3767b
-    ASSERT (renameat2 (AT_FDCWD, BASE "oo", -1, "bar", 0) == -1);
d3767b
+    ASSERT (renameatu (AT_FDCWD, BASE "oo", -1, "bar", 0) == -1);
d3767b
     ASSERT (errno == EBADF);
d3767b
   }
d3767b
   {
d3767b
     errno = 0;
d3767b
-    ASSERT (renameat2 (AT_FDCWD, BASE "oo", 99, "bar", 0) == -1);
d3767b
+    ASSERT (renameatu (AT_FDCWD, BASE "oo", 99, "bar", 0) == -1);
d3767b
     ASSERT (errno == EBADF);
d3767b
   }
d3767b
   ASSERT (unlink (BASE "oo") == 0);
d3767b
@@ -133,13 +133,13 @@ main (void)
d3767b
 
d3767b
       ASSERT (sprintf (strchr (file1, '\0') - 2, "%02d", i) == 2);
d3767b
       ASSERT (sprintf (strchr (file2, '\0') - 2, "%02d", i + 1) == 2);
d3767b
-      ASSERT (renameat2 (fd1, file1, fd2, file2, 0) == 0);
d3767b
+      ASSERT (renameatu (fd1, file1, fd2, file2, 0) == 0);
d3767b
       free (file1);
d3767b
       free (file2);
d3767b
     }
d3767b
   dfd2 = open ("..", O_RDONLY);
d3767b
   ASSERT (0 <= dfd2);
d3767b
-  ASSERT (renameat2 (dfd, "../" BASE "16", dfd2, BASE "17", 0) == 0);
d3767b
+  ASSERT (renameatu (dfd, "../" BASE "16", dfd2, BASE "17", 0) == 0);
d3767b
   ASSERT (close (dfd2) == 0);
d3767b
 
d3767b
   /* Now we change back to the parent directory, and set dfd to ".";
d3767b
@@ -152,47 +152,47 @@ main (void)
d3767b
 
d3767b
   ASSERT (close (creat (BASE "sub2/file", 0600)) == 0);
d3767b
   errno = 0;
d3767b
-  ASSERT (renameat2 (dfd, BASE "sub1", dfd, BASE "sub2", 0) == -1);
d3767b
+  ASSERT (renameatu (dfd, BASE "sub1", dfd, BASE "sub2", 0) == -1);
d3767b
   ASSERT (errno == EEXIST || errno == ENOTEMPTY);
d3767b
   ASSERT (unlink (BASE "sub2/file") == 0);
d3767b
   errno = 0;
d3767b
-  ASSERT (renameat2 (dfd, BASE "sub2", dfd, BASE "sub1/.", 0) == -1);
d3767b
+  ASSERT (renameatu (dfd, BASE "sub2", dfd, BASE "sub1/.", 0) == -1);
d3767b
   ASSERT (errno == EINVAL || errno == EISDIR || errno == EBUSY
d3767b
           || errno == ENOTEMPTY || errno == EEXIST
d3767b
           || errno == ENOENT /* WSL */);
d3767b
   errno = 0;
d3767b
-  ASSERT (renameat2 (dfd, BASE "sub2/.", dfd, BASE "sub1", 0) == -1);
d3767b
+  ASSERT (renameatu (dfd, BASE "sub2/.", dfd, BASE "sub1", 0) == -1);
d3767b
   ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST
d3767b
           || errno == ENOENT /* WSL */);
d3767b
   errno = 0;
d3767b
-  ASSERT (renameat2 (dfd, BASE "17", dfd, BASE "sub1", 0) == -1);
d3767b
+  ASSERT (renameatu (dfd, BASE "17", dfd, BASE "sub1", 0) == -1);
d3767b
   ASSERT (errno == EISDIR);
d3767b
   errno = 0;
d3767b
-  ASSERT (renameat2 (dfd, BASE "nosuch", dfd, BASE "18", 0) == -1);
d3767b
+  ASSERT (renameatu (dfd, BASE "nosuch", dfd, BASE "18", 0) == -1);
d3767b
   ASSERT (errno == ENOENT);
d3767b
   errno = 0;
d3767b
-  ASSERT (renameat2 (dfd, "", dfd, BASE "17", 0) == -1);
d3767b
+  ASSERT (renameatu (dfd, "", dfd, BASE "17", 0) == -1);
d3767b
   ASSERT (errno == ENOENT);
d3767b
   errno = 0;
d3767b
-  ASSERT (renameat2 (dfd, BASE "17", dfd, "", 0) == -1);
d3767b
+  ASSERT (renameatu (dfd, BASE "17", dfd, "", 0) == -1);
d3767b
   ASSERT (errno == ENOENT);
d3767b
   errno = 0;
d3767b
-  ASSERT (renameat2 (dfd, BASE "sub2", dfd, BASE "17", 0) == -1);
d3767b
+  ASSERT (renameatu (dfd, BASE "sub2", dfd, BASE "17", 0) == -1);
d3767b
   ASSERT (errno == ENOTDIR);
d3767b
   errno = 0;
d3767b
-  ASSERT (renameat2 (dfd, BASE "17/", dfd, BASE "18", 0) == -1);
d3767b
+  ASSERT (renameatu (dfd, BASE "17/", dfd, BASE "18", 0) == -1);
d3767b
   ASSERT (errno == ENOTDIR);
d3767b
   errno = 0;
d3767b
-  ASSERT (renameat2 (dfd, BASE "17", dfd, BASE "18/", 0) == -1);
d3767b
+  ASSERT (renameatu (dfd, BASE "17", dfd, BASE "18/", 0) == -1);
d3767b
   ASSERT (errno == ENOTDIR || errno == ENOENT);
d3767b
 
d3767b
   /* Finally, make sure we cannot overwrite existing files.  */
d3767b
   ASSERT (close (creat (BASE "sub2/file", 0600)) == 0);
d3767b
   errno = 0;
d3767b
-  ASSERT ((renameat2 (dfd, BASE "sub2", dfd, BASE "sub1", RENAME_NOREPLACE)
d3767b
+  ASSERT ((renameatu (dfd, BASE "sub2", dfd, BASE "sub1", RENAME_NOREPLACE)
d3767b
            == -1)
d3767b
           && errno == EEXIST);
d3767b
-  ASSERT ((renameat2 (dfd, BASE "sub2/file", dfd, BASE "17", RENAME_NOREPLACE)
d3767b
+  ASSERT ((renameatu (dfd, BASE "sub2/file", dfd, BASE "17", RENAME_NOREPLACE)
d3767b
            == -1)
d3767b
           && errno == EEXIST);
d3767b
 
d3767b
diff --git a/lib/backupfile.c b/lib/backupfile.c
d3767b
index d438455..637be6c 100644
d3767b
--- a/lib/backupfile.c
d3767b
+++ b/lib/backupfile.c
d3767b
@@ -23,7 +23,7 @@
d3767b
 #include "backup-internal.h"
d3767b
 
d3767b
 #include "dirname.h"
d3767b
-#include "renameat2.h"
d3767b
+#include "renameatu.h"
d3767b
 #include "xalloc-oversized.h"
d3767b
 
d3767b
 #include <fcntl.h>
d3767b
@@ -353,7 +353,7 @@ backupfile_internal (char const *file, enum backup_type backup_type, bool rename
d3767b
           base_offset = 0;
d3767b
         }
d3767b
       unsigned flags = backup_type == simple_backups ? 0 : RENAME_NOREPLACE;
d3767b
-      if (renameat2 (AT_FDCWD, file, sdir, s + base_offset, flags) == 0)
d3767b
+      if (renameatu (AT_FDCWD, file, sdir, s + base_offset, flags) == 0)
d3767b
         break;
d3767b
       int e = errno;
d3767b
       if (e != EEXIST)
d3767b
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
d3767b
index 04473d5..0b747e3 100644
d3767b
--- a/lib/gnulib.mk
d3767b
+++ b/lib/gnulib.mk
d3767b
@@ -21,7 +21,7 @@
d3767b
 # the same distribution terms as the rest of that program.
d3767b
 #
d3767b
 # Generated by gnulib-tool.
d3767b
-# 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
d3767b
+# 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
d3767b
 
d3767b
 
d3767b
 MOSTLYCLEANFILES += lib/core lib/*.stackdump
d3767b
@@ -3218,15 +3218,15 @@ EXTRA_lib_libcoreutils_a_SOURCES += lib/renameat.c
d3767b
 
d3767b
 ## end   gnulib module renameat
d3767b
 
d3767b
-## begin gnulib module renameat2
d3767b
+## begin gnulib module renameatu
d3767b
 
d3767b
-lib_libcoreutils_a_SOURCES += lib/renameat2.c
d3767b
+lib_libcoreutils_a_SOURCES += lib/renameatu.c
d3767b
 
d3767b
-EXTRA_DIST += lib/at-func2.c lib/renameat2.h
d3767b
+EXTRA_DIST += lib/at-func2.c lib/renameatu.h
d3767b
 
d3767b
 EXTRA_lib_libcoreutils_a_SOURCES += lib/at-func2.c
d3767b
 
d3767b
-## end   gnulib module renameat2
d3767b
+## end   gnulib module renameatu
d3767b
 
d3767b
 ## begin gnulib module rewinddir
d3767b
 
d3767b
diff --git a/lib/renameat.c b/lib/renameat.c
d3767b
index 0cb7d33..67be22b 100644
d3767b
--- a/lib/renameat.c
d3767b
+++ b/lib/renameat.c
d3767b
@@ -16,10 +16,10 @@
d3767b
 
d3767b
 #include <config.h>
d3767b
 #include <stdio.h>
d3767b
-#include "renameat2.h"
d3767b
+#include "renameatu.h"
d3767b
 
d3767b
 int
d3767b
 renameat (int fd1, char const *src, int fd2, char const *dst)
d3767b
 {
d3767b
-  return renameat2 (fd1, src, fd2, dst, 0);
d3767b
+  return renameatu (fd1, src, fd2, dst, 0);
d3767b
 }
d3767b
diff --git a/lib/renameat2.c b/lib/renameatu.c
d3767b
similarity index 94%
d3767b
rename from lib/renameat2.c
d3767b
rename to lib/renameatu.c
d3767b
index a295ec3..b013ad6 100644
d3767b
--- a/lib/renameat2.c
d3767b
+++ b/lib/renameatu.c
d3767b
@@ -18,7 +18,7 @@
d3767b
 
d3767b
 #include <config.h>
d3767b
 
d3767b
-#include "renameat2.h"
d3767b
+#include "renameatu.h"
d3767b
 
d3767b
 #include <errno.h>
d3767b
 #include <stdio.h>
d3767b
@@ -68,10 +68,13 @@ rename_noreplace (char const *src, char const *dst)
d3767b
    the restore_cwd fails, then give a diagnostic and exit nonzero.
d3767b
 
d3767b
    Obey FLAGS when doing the renaming.  If FLAGS is zero, this
d3767b
-   function is equivalent to renameat (FD1, SRC, FD2, DST).  */
d3767b
+   function is equivalent to renameat (FD1, SRC, FD2, DST).
d3767b
+   Otherwise, attempt to implement FLAGS even if the implementation is
d3767b
+   not atomic; this differs from the GNU/Linux native renameat2,
d3767b
+   which fails if it cannot guarantee atomicity.  */
d3767b
 
d3767b
 int
d3767b
-renameat2 (int fd1, char const *src, int fd2, char const *dst,
d3767b
+renameatu (int fd1, char const *src, int fd2, char const *dst,
d3767b
            unsigned int flags)
d3767b
 {
d3767b
   int ret_val = -1;
d3767b
diff --git a/lib/renameat2.h b/lib/renameatu.h
d3767b
similarity index 84%
d3767b
rename from lib/renameat2.h
d3767b
rename to lib/renameatu.h
d3767b
index aba7966..7d79775 100644
d3767b
--- a/lib/renameat2.h
d3767b
+++ b/lib/renameatu.h
d3767b
@@ -16,15 +16,13 @@
d3767b
 
d3767b
 /* written by Paul Eggert */
d3767b
 
d3767b
-/* Get RENAME_* macros from linux/fs.h if present, otherwise supply
d3767b
+/* Get RENAME_* macros from <stdio.h> if present, otherwise supply
d3767b
    the traditional Linux values.  */
d3767b
-#if HAVE_LINUX_FS_H
d3767b
-# include <linux/fs.h>
d3767b
-#endif
d3767b
+#include <stdio.h>
d3767b
 #ifndef RENAME_NOREPLACE
d3767b
 # define RENAME_NOREPLACE  (1 << 0)
d3767b
 # define RENAME_EXCHANGE   (1 << 1)
d3767b
 # define RENAME_WHITEOUT   (1 << 2)
d3767b
 #endif
d3767b
 
d3767b
-extern int renameat2 (int, char const *, int, char const *, unsigned int);
d3767b
+extern int renameatu (int, char const *, int, char const *, unsigned int);
d3767b
-- 
d3767b
2.14.4
d3767b
d3767b
d3767b
From a6b7ff5ef538bbdff4550a56fed878e9cd951d6d Mon Sep 17 00:00:00 2001
d3767b
From: Paul Eggert <eggert@cs.ucla.edu>
d3767b
Date: Thu, 5 Jul 2018 09:33:48 -0700
d3767b
Subject: [PATCH 2/2] build: update gnulib submodule to latest
d3767b
d3767b
* bootstrap.conf, src/copy.c, src/mv.c, src/shred.c:
d3767b
Adjust to renaming of renameat2 to renameatu.
d3767b
d3767b
Upstream-commit: 439741053256618eb651e6d43919df29625b8714
d3767b
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
d3767b
---
d3767b
 bootstrap.conf | 2 +-
d3767b
 src/copy.c     | 4 ++--
d3767b
 src/mv.c       | 4 ++--
d3767b
 src/shred.c    | 4 ++--
d3767b
 4 files changed, 7 insertions(+), 7 deletions(-)
d3767b
d3767b
diff --git a/bootstrap.conf b/bootstrap.conf
d3767b
index 4da4f94..fcf29dc 100644
d3767b
--- a/bootstrap.conf
d3767b
+++ b/bootstrap.conf
d3767b
@@ -210,7 +210,7 @@ gnulib_modules="
d3767b
   remove
d3767b
   rename
d3767b
   renameat
d3767b
-  renameat2
d3767b
+  renameatu
d3767b
   rmdir
d3767b
   root-dev-ino
d3767b
   rpmatch
d3767b
diff --git a/src/copy.c b/src/copy.c
d3767b
index 58d2f6e..1a9cdd1 100644
d3767b
--- a/src/copy.c
d3767b
+++ b/src/copy.c
d3767b
@@ -53,7 +53,7 @@
d3767b
 #include "ignore-value.h"
d3767b
 #include "ioblksize.h"
d3767b
 #include "quote.h"
d3767b
-#include "renameat2.h"
d3767b
+#include "renameatu.h"
d3767b
 #include "root-uid.h"
d3767b
 #include "same.h"
d3767b
 #include "savedir.h"
d3767b
@@ -1873,7 +1873,7 @@ copy_internal (char const *src_name, char const *dst_name,
d3767b
   if (x->move_mode)
d3767b
     {
d3767b
       if (rename_errno < 0)
d3767b
-        rename_errno = (renameat2 (AT_FDCWD, src_name, AT_FDCWD, dst_name,
d3767b
+        rename_errno = (renameatu (AT_FDCWD, src_name, AT_FDCWD, dst_name,
d3767b
                                    RENAME_NOREPLACE)
d3767b
                         ? errno : 0);
d3767b
       new_dst = rename_errno == 0;
d3767b
diff --git a/src/mv.c b/src/mv.c
d3767b
index b6dd72d..36fd1af 100644
d3767b
--- a/src/mv.c
d3767b
+++ b/src/mv.c
d3767b
@@ -31,7 +31,7 @@
d3767b
 #include "error.h"
d3767b
 #include "filenamecat.h"
d3767b
 #include "remove.h"
d3767b
-#include "renameat2.h"
d3767b
+#include "renameatu.h"
d3767b
 #include "root-dev-ino.h"
d3767b
 #include "priv-set.h"
d3767b
 
d3767b
@@ -456,7 +456,7 @@ main (int argc, char **argv)
d3767b
     {
d3767b
       assert (2 <= n_files);
d3767b
       if (n_files == 2)
d3767b
-        x.rename_errno = (renameat2 (AT_FDCWD, file[0], AT_FDCWD, file[1],
d3767b
+        x.rename_errno = (renameatu (AT_FDCWD, file[0], AT_FDCWD, file[1],
d3767b
                                      RENAME_NOREPLACE)
d3767b
                           ? errno : 0);
d3767b
       if (x.rename_errno != 0 && target_directory_operand (file[n_files - 1]))
d3767b
diff --git a/src/shred.c b/src/shred.c
d3767b
index 2ddaadd..270b1e9 100644
d3767b
--- a/src/shred.c
d3767b
+++ b/src/shred.c
d3767b
@@ -93,7 +93,7 @@
d3767b
 #include "human.h"
d3767b
 #include "randint.h"
d3767b
 #include "randread.h"
d3767b
-#include "renameat2.h"
d3767b
+#include "renameatu.h"
d3767b
 #include "stat-size.h"
d3767b
 
d3767b
 /* Default number of times to overwrite.  */
d3767b
@@ -1096,7 +1096,7 @@ wipename (char *oldname, char const *qoldname, struct Options const *flags)
d3767b
         memset (base, nameset[0], len);
d3767b
         base[len] = 0;
d3767b
         bool rename_ok;
d3767b
-        while (! (rename_ok = (renameat2 (AT_FDCWD, oldname, AT_FDCWD, newname,
d3767b
+        while (! (rename_ok = (renameatu (AT_FDCWD, oldname, AT_FDCWD, newname,
d3767b
                                           RENAME_NOREPLACE)
d3767b
                                == 0))
d3767b
                && errno == EEXIST && incname (base, len))
d3767b
-- 
d3767b
2.14.4
d3767b