[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mingw remove bug
From: |
Eric Blake |
Subject: |
Re: mingw remove bug |
Date: |
Wed, 16 Sep 2009 17:41:37 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Eric Blake <ebb9 <at> byu.net> writes:
> > I'm arguing that the second program should also report "No such
> > file or directory".
>
> Ah, so for 'foo/', the code should distinguish between ENOENT and ENOTDIR,
> based on whether 'foo' exists. I'll update the patch and test accordingly.
I'm taking a step back. Rather than my first attempt at rpl_remove, it seems
like I should be able to get away with much simpler code, provided that the
underlying syscalls aren't broken. It certainly has the benefit of avoiding an
unnecessary [l]stat:
int result = rmdir (name);
if (result == -1 && errno == ENOTDIR)
result = unlink (name);
return result;
(glibc remove() does it the other way around: attempting unlink first and only
calling rmdir if errno == EISDIR/EPERM. This works fine on Linux, but is too
dangerous on platforms where unlink can remove a directory)
So, I found two reasons that the rmdir module should no longer be obsolete -
cygwin 1.5.x mistakenly removes a directory given with a trailing "./", even
though POSIX requires this to fail with EINVAL; and mingw rmdir("file/") fails
with EINVAL instead of ENOTDIR (which would leak EINVAL out of the above
rpl_remove() logic, instead of confirming ENOTDIR failure with unlink("file/")).
Meanwhile, the rmdir-errno module, in use by coreutils until today, guessed
wrong for cross-compilation to Solaris (where rmdir fails with EEXIST, not
ENOTEMPTY, on a populated directory); now that coreutils no longer uses the
module [1], I see no reason to keep the module alive.
[1] http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/18181/focus=18182
By the way, this patch series also fixes unlinkat(-1,"/dir/./",AT_REMOVEDIR) on
cygwin 1.5.x, since the openat module already depended on rmdir. So far, I
don't know of any systems with native unlinkat but with broken rmdir, but I
suppose I should add tests for unlinkat to verify the same behavior.
Technically, GNU/Linux is not POSIX-compliant: rmdir("symlink-to-empty-dir/")
fails with ENOTDIR, instead of succeeding at turning symlink-to-empty-dir into
a dangling link. But this behavior is counter-intuitive (both rmdir("symlink-
to-file/") and rmdir("symlink-to-full-dir/") are required to fail, so why is
symlink-to-empty-dir special?), and GNU/Linux is at least consistent (rename
("symlink-to-empty-dir/","other") also has non-POSIX behavior to prevent
accidental dangling symlink creation). So I intentionally don't want to
penalize GNU/Linux with a rmdir(2) wrapper that creates dangling symlinks; if
we want rm(1) and rmdir(1) to do so under POSIXLY_CORRECT, then they can
perform the extra checks manually.
Here's what I plan on pushing later today.
From: Eric Blake <address@hidden>
Date: Wed, 16 Sep 2009 10:08:55 -0600
Subject: [PATCH 1/2] rmdir: work around cygwin 1.5.x and mingw bugs
* m4/rmdir.m4 (gl_FUNC_RMDIR): Detect the bugs.
* lib/rmdir.c (rmdir): Work around it.
* modules/rmdir (Status, Notice): No longer obsolete.
(Files): Add dos.m4.
(Depends-on): Add unistd.
(configure.ac): Set witnesses.
(License): Relax to LGPLv2+.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Set defaults.
* modules/unistd (Makefile.am): Substitute witnesses.
* lib/unistd.in.h (rmdir): Declare replacement.
* doc/posix-functions/rmdir.texi (rmdir): Document this.
* modules/rmdir-tests: New tests.
* tests/test-rmdir.c: Likewise.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 17 ++++++
doc/posix-functions/rmdir.texi | 13 ++++
lib/rmdir.c | 38 ++++++++++--
lib/unistd.in.h | 15 +++++
m4/rmdir.m4 | 34 +++++++++++-
m4/unistd_h.m4 | 4 +-
modules/rmdir | 13 ++---
modules/rmdir-tests | 11 ++++
modules/unistd | 2 +
tests/test-rmdir.c | 125 ++++++++++++++++++++++++++++++++++++++++
10 files changed, 256 insertions(+), 16 deletions(-)
create mode 100644 modules/rmdir-tests
create mode 100644 tests/test-rmdir.c
diff --git a/ChangeLog b/ChangeLog
index e58b782..c6b3e25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2009-09-16 Eric Blake <address@hidden>
+
+ rmdir: work around cygwin 1.5.x and mingw bugs
+ * m4/rmdir.m4 (gl_FUNC_RMDIR): Detect the bugs.
+ * lib/rmdir.c (rmdir): Work around it.
+ * modules/rmdir (Status, Notice): No longer obsolete.
+ (Files): Add dos.m4.
+ (Depends-on): Add unistd.
+ (configure.ac): Set witnesses.
+ (License): Relax to LGPLv2+.
+ * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Set defaults.
+ * modules/unistd (Makefile.am): Substitute witnesses.
+ * lib/unistd.in.h (rmdir): Declare replacement.
+ * doc/posix-functions/rmdir.texi (rmdir): Document this.
+ * modules/rmdir-tests: New tests.
+ * tests/test-rmdir.c: Likewise.
+
2009-09-15 Eric Blake <address@hidden>
fchdir: improve use of replacement functions
diff --git a/doc/posix-functions/rmdir.texi b/doc/posix-functions/rmdir.texi
index b259d5a..aca8b8b 100644
--- a/doc/posix-functions/rmdir.texi
+++ b/doc/posix-functions/rmdir.texi
@@ -9,6 +9,14 @@ rmdir
Portability problems fixed by Gnulib:
@itemize
@item
+This function mistakenly removes a directory with
address@hidden("dir/./")} on some platforms:
+Cygwin 1.5.x.
address@hidden
+This function fails with @code{EINVAL} instead of the expected
address@hidden for @code{rmdir("file/")} on some platforms:
+mingw.
address@hidden
This function is missing on some old platforms.
@end itemize
@@ -17,4 +25,9 @@ rmdir
@item
When @code{rmdir} fails because the specified directory is not empty, the
@code{errno} value is system dependent.
address@hidden
+POSIX requires that @code{rmdir("link-to-empty/")} remove @file{empty}
+and leave @file{link-to-empty} as a dangling symlink. This is
+counter-intuitive, so some systems fail with @code{ENOTDIR} instead:
+glibc
@end itemize
diff --git a/lib/rmdir.c b/lib/rmdir.c
index 113d13c..1a06986 100644
--- a/lib/rmdir.c
+++ b/lib/rmdir.c
@@ -1,6 +1,6 @@
-/* BSD compatible remove directory function for System V
+/* Work around rmdir bugs.
- Copyright (C) 1988, 1990, 1999, 2003, 2004, 2005, 2006 Free
+ Copyright (C) 1988, 1990, 1999, 2003, 2004, 2005, 2006, 2009 Free
Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -18,18 +18,43 @@
#include <config.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+#include <unistd.h>
+
#include <errno.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
-/* rmdir adapted from GNU tar. */
+#undef rmdir
/* Remove directory DIR.
Return 0 if successful, -1 if not. */
int
-rmdir (char const *dir)
+rpl_rmdir (char const *dir)
{
+#if HAVE_RMDIR
+ /* Work around cygwin 1.5.x bug where rmdir("dir/./") succeeds. */
+ size_t len = strlen (dir);
+ int result;
+ while (len && ISSLASH (dir[len - 1]))
+ len--;
+ if (len && dir[len - 1] == '.' && (1 == len || ISSLASH (dir[len - 2])))
+ {
+ errno = EINVAL;
+ return -1;
+ }
+ result = rmdir (dir);
+ /* Work around mingw bug, where rmdir("file/") fails with EINVAL
+ instead of ENOTDIR. We've already filtered out trailing ., the
+ only reason allowed by POSIX for EINVAL. */
+ if (result == -1 && errno == EINVAL)
+ errno = ENOTDIR;
+ return result;
+
+#else /* !HAVE_RMDIR */
+ /* rmdir adapted from GNU tar. FIXME: Delete this implementation in
+ 2010 if no one reports a system with missing rmdir. */
pid_t cpid;
int status;
struct stat statbuf;
@@ -70,4 +95,5 @@ rmdir (char const *dir)
}
return 0;
}
+#endif /* !HAVE_RMDIR */
}
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 553fb06..68c3155 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -672,6 +672,21 @@ extern int readlink (const char *file, char *buf, size_t
bufsize);
#endif
+#if @GNULIB_RMDIR@
+# if @REPLACE_RMDIR@
+# define rmdir rpl_rmdir
+/* Remove the directory DIR. */
+extern int rmdir (char const *name);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef rmdir
+# define rmdir(n) \
+ (GL_LINK_WARNING ("rmdir is unportable - " \
+ "use gnulib module rmdir for portability"), \
+ rmdir (n))
+#endif
+
+
#if @GNULIB_SLEEP@
/* Pause the execution of the current thread for N seconds.
Returns the number of seconds left to sleep.
diff --git a/m4/rmdir.m4 b/m4/rmdir.m4
index bbe8bbd..db590d2 100644
--- a/m4/rmdir.m4
+++ b/m4/rmdir.m4
@@ -1,4 +1,4 @@
-# rmdir.m4 serial 4
+# rmdir.m4 serial 5
dnl Copyright (C) 2002, 2005, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,5 +6,37 @@ dnl with or without modifications, as long as this notice is
preserved.
AC_DEFUN([gl_FUNC_RMDIR],
[
+ AC_REQUIRE([gl_AC_DOS])
+ dnl FIXME: simplify this module in 2010 if no one reports a missing rmdir
AC_REPLACE_FUNCS([rmdir])
+ if test $ac_cv_func_rmdir = no; then
+ REPLACE_RMDIR=1
+ # If someone lacks rmdir, make configure fail, and request
+ # a bug report to inform us about it.
+ if test x"$SKIP_RMDIR_CHECK" != xyes; then
+ AC_MSG_FAILURE([Your system lacks the rmdir function.
+ Please report this, along with the output of "uname -a", to the
+ address@hidden mailing list. To continue past this point,
+ rerun configure with SKIP_RMDIR_CHECK=yes.
+ E.g., ./configure SKIP_RMDIR_CHECK=yes])
+ fi
+ else
+ dnl Detect cygwin 1.5.x bug.
+ AC_CACHE_CHECK([whether rmdir works], [gl_cv_func_rmdir_works],
+ [mkdir conftest.dir
+ touch conftest.file
+ AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stdio.h>
+ #include <errno.h>
+]], [[return !rmdir ("conftest.file/") || errno != ENOTDIR
+ || !rmdir ("conftest.dir/./");]])],
+ [gl_cv_func_rmdir_works=yes], [gl_cv_func_rmdir_works=no],
+ [gl_cv_func_rmdir_works="guessing no"])
+ rm -rf conftest.dir conftest.file])
+ if test x"$gl_cv_func_rmdir_works" != xyes; then
+ REPLACE_RMDIR=1
+ AC_LIBOBJ([rmdir])
+ fi
+ fi
])
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
index e83dad3..2d5edc7 100644
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 26
+# unistd_h.m4 serial 27
dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -56,6 +56,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2])
GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK])
GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT])
+ GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR])
GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP])
GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT])
GNULIB_UNISTD_H_GETOPT=0; AC_SUBST([GNULIB_UNISTD_H_GETOPT])
@@ -97,6 +98,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN])
REPLACE_LINK=0; AC_SUBST([REPLACE_LINK])
REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK])
+ REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR])
REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE])
UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H])
UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
diff --git a/modules/rmdir b/modules/rmdir
index ead58f2..d047e4c 100644
--- a/modules/rmdir
+++ b/modules/rmdir
@@ -1,21 +1,18 @@
Description:
rmdir() function: delete a directory.
-Status:
-obsolete
-
-Notice:
-This module is obsolete.
-
Files:
lib/rmdir.c
+m4/dos.m4
m4/rmdir.m4
Depends-on:
sys_stat
+unistd
configure.ac:
gl_FUNC_RMDIR
+gl_UNISTD_MODULE_INDICATOR([rmdir])
Makefile.am:
@@ -23,7 +20,7 @@ Include:
<unistd.h>
License:
-GPL
+LGPLv2+
Maintainer:
-Jim Meyering
+Jim Meyering, Eric Blake
diff --git a/modules/rmdir-tests b/modules/rmdir-tests
new file mode 100644
index 0000000..f5b69f8
--- /dev/null
+++ b/modules/rmdir-tests
@@ -0,0 +1,11 @@
+Files:
+tests/test-rmdir.c
+
+Depends-on:
+
+configure.ac:
+AC_CHECK_FUNCS_ONCE([symlink])
+
+Makefile.am:
+TESTS += test-rmdir
+check_PROGRAMS += test-rmdir
diff --git a/modules/unistd b/modules/unistd
index 6bf5338..4736e4c 100644
--- a/modules/unistd
+++ b/modules/unistd
@@ -49,6 +49,7 @@ unistd.h: unistd.in.h
-e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \
-e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
-e 's|@''GNULIB_READLINKAT''@|$(GNULIB_READLINKAT)|g' \
+ -e 's|@''GNULIB_RMDIR''@|$(GNULIB_RMDIR)|g' \
-e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \
-e 's|@''GNULIB_SYMLINKAT''@|$(GNULIB_SYMLINKAT)|g' \
-e 's|@''GNULIB_UNISTD_H_GETOPT''@|$(GNULIB_UNISTD_H_GETOPT)|g' \
@@ -89,6 +90,7 @@ unistd.h: unistd.in.h
-e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
-e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \
-e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
+ -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \
-e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
-e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)
|g' \
-
e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_A
ND_USE_SOCKETS)|g' \
diff --git a/tests/test-rmdir.c b/tests/test-rmdir.c
new file mode 100644
index 0000000..17fb0ff
--- /dev/null
+++ b/tests/test-rmdir.c
@@ -0,0 +1,125 @@
+/* Tests of rmdir.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Eric Blake <address@hidden>, 2009. */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+
+#if !HAVE_SYMLINK
+# define symlink(a,b) (-1)
+#endif
+
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ fflush (stderr); \
+ abort (); \
+ } \
+ } \
+ while (0)
+
+#define BASE "test-rmdir.t"
+
+int
+main ()
+{
+ /* Remove any leftovers from a previous partial run. */
+ ASSERT (system ("rm -rf " BASE "*") == 0);
+
+ /* Setup. */
+ ASSERT (mkdir (BASE "dir", 0700) == 0);
+ ASSERT (close (creat (BASE "dir/file", 0600)) == 0);
+
+ /* Basic error conditions. */
+ errno = 0;
+ ASSERT (rmdir ("") == -1);
+ ASSERT (errno == ENOENT);
+ errno = 0;
+ ASSERT (rmdir (BASE "nosuch") == -1);
+ ASSERT (errno == ENOENT);
+ errno = 0;
+ ASSERT (rmdir (BASE "nosuch/") == -1);
+ ASSERT (errno == ENOENT);
+ errno = 0;
+ ASSERT (rmdir (".") == -1);
+ ASSERT (errno == EINVAL || errno == EBUSY);
+ /* Resulting errno after ".." or "/" is too varied to test; it is
+ reasonable to see any of EINVAL, EBUSY, EEXIST, ENOTEMPTY,
+ EACCES, EPERM. */
+ ASSERT (rmdir ("..") == -1);
+ ASSERT (rmdir ("/") == -1);
+ ASSERT (rmdir ("///") == -1);
+ errno = 0;
+ ASSERT (rmdir (BASE "dir/file/") == -1);
+ ASSERT (errno == ENOTDIR);
+
+ /* Non-empty directory. */
+ errno = 0;
+ ASSERT (rmdir (BASE "dir") == -1);
+ ASSERT (errno == EEXIST || errno == ENOTEMPTY);
+
+ /* Non-directory. */
+ errno = 0;
+ ASSERT (rmdir (BASE "dir/file") == -1);
+ ASSERT (errno == ENOTDIR);
+
+ /* Empty directory. */
+ ASSERT (unlink (BASE "dir/file") == 0);
+ errno = 0;
+ ASSERT (rmdir (BASE "dir/./") == -1);
+ ASSERT (errno == EINVAL);
+ ASSERT (rmdir (BASE "dir") == 0);
+
+ /* Test symlink behavior. Specifying trailing slash should remove
+ referent directory (POSIX), or cause ENOTDIR failure (Linux), but
+ not touch symlink. We prefer the Linux behavior for its
+ intuitiveness (especially compared to rmdir("symlink-to-file/")),
+ but not enough to penalize POSIX systems with an rpl_rmdir. */
+ if (symlink (BASE "dir", BASE "link") != 0)
+ {
+ fputs ("skipping test: symlinks not supported on this filesystem\n",
+ stderr);
+ return 77;
+ }
+ ASSERT (mkdir (BASE "dir", 0700) == 0);
+ errno = 0;
+ if (rmdir (BASE "link/") == 0)
+ {
+ struct stat st;
+ errno = 0;
+ ASSERT (stat (BASE "link", &st) == -1);
+ ASSERT (errno == ENOENT);
+ }
+ else
+ {
+ ASSERT (errno == ENOTDIR);
+ ASSERT (rmdir (BASE "dir") == 0);
+ }
+ ASSERT (unlink (BASE "link") == 0);
+
+ return 0;
+}
--
1.6.4.2
>From 83f9ffe4821ac6690e9d1cf644229c66a0abee0b Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Wed, 16 Sep 2009 10:14:57 -0600
Subject: [PATCH 2/2] rmdir-errno: delete module, it was unsafe for cross-
compilation
* modules/rmdir-errno: Delete.
* m4/rmdir-errno.m4: Likewise.
* MODULES.html.sh (compatibility checks for POSIX:2008): Remove
the module.
* NEWS: Mention this.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 7 +++++++
MODULES.html.sh | 1 -
NEWS | 3 +++
m4/rmdir-errno.m4 | 49 -------------------------------------------------
modules/rmdir-errno | 20 --------------------
5 files changed, 10 insertions(+), 70 deletions(-)
delete mode 100644 m4/rmdir-errno.m4
delete mode 100644 modules/rmdir-errno
diff --git a/ChangeLog b/ChangeLog
index c6b3e25..8861754 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2009-09-16 Eric Blake <address@hidden>
+ rmdir-errno: delete module, it was unsafe for cross-compilation
+ * modules/rmdir-errno: Delete.
+ * m4/rmdir-errno.m4: Likewise.
+ * MODULES.html.sh (compatibility checks for POSIX:2008): Remove
+ the module.
+ * NEWS: Mention this.
+
rmdir: work around cygwin 1.5.x and mingw bugs
* m4/rmdir.m4 (gl_FUNC_RMDIR): Detect the bugs.
* lib/rmdir.c (rmdir): Work around it.
diff --git a/MODULES.html.sh b/MODULES.html.sh
index 76741b3..9ba3a3b 100755
--- a/MODULES.html.sh
+++ b/MODULES.html.sh
@@ -2381,7 +2381,6 @@ func_all_modules ()
func_module d-type
func_module link-follow
func_module rename-dest-slash
- func_module rmdir-errno
func_module unlink-busy
func_module winsz-ioctl
func_module winsz-termios
diff --git a/NEWS b/NEWS
index f506cba..1aa0ba4 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,9 @@ User visible incompatible changes
Date Modules Changes
+2009-09-16 rmdir-errno This module is removed. Compare errno to EEXIST
+ and ENOTDIR instead of ERRNO_RMDIR_NON_EMPTY.
+
2009-09-04 link-follow The macro LINK_FOLLOWS_SYMLINK is now tri-state,
rather than only defined to 1.
diff --git a/m4/rmdir-errno.m4 b/m4/rmdir-errno.m4
deleted file mode 100644
index b7398bc..0000000
--- a/m4/rmdir-errno.m4
+++ /dev/null
@@ -1,49 +0,0 @@
-# serial 10
-
-# Copyright (C) 2000, 2001, 2005, 2006, 2009 Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# When rmdir fails because the specified directory is not empty, it sets
-# errno to some value, usually ENOTEMPTY. However, on some AIX systems,
-# ENOTEMPTY is mistakenly defined to be EEXIST. To work around this, and
-# in general, to avoid depending on the use of any particular symbol, this
-# test runs a test to determine the actual numeric value.
-AC_DEFUN([gl_FUNC_RMDIR_NOTEMPTY],
-[dnl
- AC_CHECK_HEADERS_ONCE([unistd.h])
- AC_CACHE_CHECK([for rmdir-not-empty errno value],
- gl_cv_func_rmdir_errno_not_empty,
- [
- # Arrange for deletion of the temporary directory this test creates.
- ac_clean_files="$ac_clean_files confdir2"
- mkdir confdir2; : > confdir2/file
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <stdio.h>
-#include <errno.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
- int main ()
- {
- FILE *s;
- int val;
- rmdir ("confdir2");
- val = errno;
- s = fopen ("confdir2/errno", "w");
- fprintf (s, "%d\n", val);
- return 0;
- }
- ]])],
- [gl_cv_func_rmdir_errno_not_empty=`cat confdir2/errno`],
- [gl_cv_func_rmdir_errno_not_empty='configure error in rmdir-errno.m4'],
- [gl_cv_func_rmdir_errno_not_empty=ENOTEMPTY]
- )
- ]
- )
-
- AC_DEFINE_UNQUOTED([RMDIR_ERRNO_NOT_EMPTY],
- $gl_cv_func_rmdir_errno_not_empty,
- [the value to which errno is set when rmdir fails on a nonempty directory])
-])
diff --git a/modules/rmdir-errno b/modules/rmdir-errno
deleted file mode 100644
index d0b81b6..0000000
--- a/modules/rmdir-errno
+++ /dev/null
@@ -1,20 +0,0 @@
-Description:
-rmdir errno for nonempty directories
-
-Files:
-m4/rmdir-errno.m4
-
-Depends-on:
-
-configure.ac:
-gl_FUNC_RMDIR_NOTEMPTY
-
-Makefile.am:
-
-Include:
-
-License:
-GPL
-
-Maintainer:
-Jim Meyering
--
1.6.4.2
- mingw remove bug, Eric Blake, 2009/09/14
- Re: mingw remove bug, Ben Pfaff, 2009/09/14
- Re: mingw remove bug, Eric Blake, 2009/09/14
- Re: mingw remove bug, Ben Pfaff, 2009/09/14
- Re: mingw remove bug, Eric Blake, 2009/09/14
- Re: mingw remove bug,
Eric Blake <=
- Re: mingw remove bug, Jim Meyering, 2009/09/16
- Re: mingw remove bug, Eric Blake, 2009/09/16
- Re: mingw remove bug, Jim Meyering, 2009/09/17