[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unlink test failure on MacOS X
From: |
Jim Meyering |
Subject: |
Re: unlink test failure on MacOS X |
Date: |
Sat, 20 Mar 2010 17:15:12 +0100 |
Bruno Haible wrote:
> The workaround below impacts only MacOS platforms. I'm applying it.
> It also fixes the 'unlinkat' test failure.
>
> 2010-03-20 Bruno Haible <address@hidden>
>
> Work around unlink() bug on MacOS X 10.5.6.
> * lib/unlink.c (rpl_unlink): If UNLINK_PARENT_BUG is defined, fail when
> attempting to unlink a parent directory.
> * m4/unlink.m4 (gl_FUNC_UNLINK): Require AC_CANONICAL_HOST. Test for
> MacOS X 10.5 bug. If the bug is present, define UNLINK_PARENT_BUG and
> activate for the replacement function.
> * doc/posix-functions/unlink.texi: Mention the MacOS X 10.5 bug.
>
...
> --- m4/unlink.m4.orig Sat Mar 20 15:16:31 2010
...
> + (umask 077 && mkdir "$tmp")
> + }; then
> + mkdir "$tmp/subdir"
> + export tmp
> + AC_RUN_IFELSE(
> + [AC_LANG_SOURCE([[
> + #include <stdlib.h>
> + #include <unistd.h>
> + int main ()
> + {
> + if (chdir (getenv ("tmp")) != 0)
> + return 1;
> + return unlink ("..") == 0;
> + }
This all looks fine.
The only question I had was why bother to create "$tmp/subdir".
At first I though it was to ensure $tmp is not empty,
but that should not matter, since the unlink is being applied to $tmp/..
which, by definition, is not empty.