5 POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html}
9 Portability problems fixed by Gnulib:
12 This function does not allow trailing slashes when creating a
13 destination directory, as in @code{rename("dir","new/")}:
16 This function does not reject trailing slashes on the destination for
17 non-directories on some platforms, as in @code{rename("file","new/")}:
18 AIX 7.1, Solaris 11.3, Cygwin 1.5.x, mingw, MSVC 14.
20 This function does not reject trailing slashes on symlinks to
21 non-directories on some platforms, as in
22 @code{rename("link-to-file/","f")}:
25 This function ignores trailing slashes on symlinks on some platforms,
26 such that @code{rename("link/","new")} corrupts @file{link}:
29 This function incorrectly reduces the link count when comparing two
30 spellings of a hard link on some platforms:
31 NetBSD 1.6, Cygwin 1.5.x.
33 This function will not always replace an existing destination on some
35 Cygwin 1.5.x, mingw, MSVC 14.
36 However, the replacement is not atomic for directories, and may end up
37 losing the empty destination if the source could not be renamed.
39 This function mistakenly allows names ending in @samp{.} or @samp{..}
41 Cygwin 1.5.x, mingw, MSVC 14.
43 This function does not reject attempts to rename existing directories
44 and non-directories onto one another on some platforms:
45 Cygwin 1.5.x, mingw, MSVC 14.
48 Portability problems not fixed by Gnulib:
51 POSIX requires that @code{rename("symlink-to-dir/","dir2")} rename
52 @file{dir} and leave @file{symlink-to-dir} dangling; likewise, it
53 requires that @code{rename("dir","dangling/")} rename @file{dir} so
54 that @file{dangling} is no longer a dangling symlink. This behavior
55 is counter-intuitive, so on some systems, @code{rename} fails with
56 @code{ENOTDIR} if either argument is a symlink with a trailing slash:
57 glibc, OpenBSD, Cygwin 1.7.
59 POSIX requires that @code{rename} do nothing and return 0 if the
60 source and destination are hard links to the same file. This behavior
61 is counterintuitive, and on some systems @code{renameat} is a no-op in
62 this way only if the source and destination identify the same
63 directory entry. On these systems, for example, although renaming
64 @file{./f} to @file{f} is a no-op, renaming @file{f} to @file{g}
65 deletes @file{f} when @file{f} and @file{g} are hard links to the same
69 After renaming a non-empty directory over an existing empty directory,
70 the old directory name is still visible through the @code{stat} function
71 for 30 seconds after the rename, on NFS file systems, on some platforms:
74 This function will not rename a source that is currently opened