rename
======

POSIX specification:
 http://www.opengroup.org/onlinepubs/9699919799/functions/rename.html

Gnulib module: rename

Portability problems fixed by Gnulib:

  * This function does not allow trailing slashes when creating a destination directory, as in rename("dir","new/"): NetBSD 1.6.

  * This function does not reject trailing slashes on the destination for non-directories on some platforms, as in rename("file","new/"): AIX 7.1, Solaris 11 2010-11, Cygwin 1.5.x, mingw.

  * This function does not reject trailing slashes on symlinks to non-directories on some platforms, as in rename("link-to-file/","f"): FreeBSD 7.2.

  * This function ignores trailing slashes on symlinks on some platforms, such that rename("link/","new") corrupts link: Solaris 9.

  * This function incorrectly reduces the link count when comparing two spellings of a hard link on some platforms: NetBSD 1.6, Cygwin 1.5.x.

  * This function will not always replace an existing destination on some platforms: Cygwin 1.5.x, mingw. However, the replacement is not atomic for directories, and may end up losing the empty destination if the source could not be renamed.

  * This function mistakenly allows names ending in . or .. on some platforms: Cygwin 1.5.x, mingw.

  * This function does not reject attempts to rename existing directories and non-directories onto one another on some platforms: Cygwin 1.5.x, mingw.

  * This function does not allow trailing slashes on source directories on older platforms, as in rename("dir/","new"): SunOS 4.1.

Portability problems not fixed by Gnulib:

  * POSIX requires that rename("symlink-to-dir/","dir2") rename dir and leave symlink-to-dir dangling; likewise, it requires that rename("dir","dangling/") rename dir so that dangling is no longer a dangling symlink.  This behavior is counter-intuitive, so on some systems, rename fails with ENOTDIR if either argument is a symlink with a trailing slash: glibc, OpenBSD, Cygwin 1.7.

  * After renaming a non-empty directory over an existing empty directory, the old directory name is still visible through the stat function for 30 seconds after the rename, on NFS file systems, on some platforms: Linux 2.6.18.

  * This function will not rename a source that is currently opened by any process: mingw.