[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fchownat autofoo bugs
From: |
Jim Meyering |
Subject: |
Re: fchownat autofoo bugs |
Date: |
Sun, 20 May 2007 09:35:35 +0200 |
Greg Schafer <address@hidden> wrote:
> The autoconf check for fchownat appears slightly broken:
>
> checking for fchownat... yes
> checking whether fchownat works with AT_SYMLINK_NOFOLLOW... no
>
> The check for AT_SYMLINK_NOFOLLOW was added by Jim a while back to work
> around a Glibc-2.4 bug (on x86). The bug was fixed in Glibc-2.5 and above
> but the autoconf check always returns "no". I've tested Glibc 2.5 and 2.6.
>
> Secondly, if I try to force the correct result by configuring like this:
>
> ./configure gl_cv_func_fchownat_nofollow_works=yes
>
> it doesn't work because of:
>
> checking whether fchownat works with AT_SYMLINK_NOFOLLOW... (cached) yes
> ./configure: line 33949: test: =: unary operator expected
>
> I'm using the coreutils-6.9 release and I only noticed this because
> Debian's `fakeroot' program (an older version, not the latest from
> unstable which supports all the new *at() calls) started working again
> when it previously failed.
Thanks for spotting/reporting that.
That test obviously didn't work as intended.
I've fixed it in gnulib, patch below.
For any wondering about the consequences, afaics, the only down-side
of the bug is that in an environment with the following
- working fchownat (glibc 2.6), but
- insufficient /proc support (so /proc/self/fd/N/ is unusable), and
- fchownat called from a process whose working directory denies "x" access,
fchownat would fail when it might have succeeded.
You can see why I'm not writing a test case to exercise this one :)
Fix buggy test for the fchownat-deref bug.
* m4/openat.m4 (gl_FUNC_FCHOWNAT_DEREF_BUG): Create the dangling
symlink required for the run-test. Without it, this test would
always declare that fchownat doesn't work, and client code would
unnecessarily use the replacement function with fixed libc.
(gl_FUNC_FCHOWNAT): Eliminate a variable that wasn't initialized.
Reported by Greg Schafer.
Index: m4/openat.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/openat.m4,v
retrieving revision 1.14
diff -u -p -r1.14 openat.m4
--- m4/openat.m4 12 May 2007 08:54:34 -0000 1.14
+++ m4/openat.m4 20 May 2007 07:21:46 -0000
@@ -37,6 +37,7 @@ AC_DEFUN([gl_FUNC_FCHOWNAT_DEREF_BUG],
rm -f $gl_dangle
# Arrange for deletion of the temporary file this test creates.
ac_clean_files="$ac_clean_files $gl_dangle"
+ ln -s conftest.no-such $gl_dangle
AC_RUN_IFELSE(
[AC_LANG_SOURCE(
[[
@@ -73,10 +74,7 @@ AC_DEFUN([gl_FUNC_FCHOWNAT],
AC_CHECK_FUNC([fchownat], [have_fchownat=yes], [have_fchownat=no])
if test $have_fchownat = yes; then
- gl_FUNC_FCHOWNAT_DEREF_BUG([have_fchownat_bug=yes])
- if test $have_fchownat_bug = no; then
- use_replacement_fchownat=no
- fi
+ gl_FUNC_FCHOWNAT_DEREF_BUG([], [use_replacement_fchownat=no])
fi
if test $use_replacement_fchownat = yes; then