[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fchmodat with AT_SYMLINK_NOFOLLOW

From: Bruno Haible
Subject: Re: fchmodat with AT_SYMLINK_NOFOLLOW
Date: Sat, 08 Feb 2020 20:49:00 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-171-generic; KDE/5.18.0; x86_64; ; )

Hi Paul,

> I installed the attached patch to Gnulib in preparation for the upcoming 
> glibc fix. The patch causes fchmodat with AT_SYMLINK_NOFOLLOW to work on 
> non-symlinks, and similarly for lchmod on non-symlinks. The idea is to 
> avoid this sort of problem in the future, and to let Coreutils etc. work 
> on older platforms as if glibc 2.32 (or whatever) is already in place.

Some improvements:

1) Improve the cross-compilation guesses. The result of the
"fchmodat+AT_SYMLINK_NOFOLLOW works on non-symlinks" test is:
  - yes on kFreeBSD/glibc, Hurd/glibc, FreeBSD 12, AIX 7.2, Solaris 11, Haiku,
  - no on Linux/glibc, Cygwin 2.9.

2) On Cygwin, the functions fchmodat and lchown crash. The cause is an endless
recursion, because some of the #includes in fchmodat.c includes the full
<sys/stat.h>, including the '#define fchmodat rpl_fchmodat'.

3) Strengthen the unit test, and make sure that it does not write files that
other unit tests could possibly write as well.
This test is a bit tricky, because on native Windows, we cannot do arbitrary
  - chmod of 700 is equivalent to 600 (since it does not have an execute bit
    on the file system),
  - chmod of 600 sets the mode to 666 - since there is no distinction between
    users, group, and world with this API.
  - After a chmod of 400 (= read-only), unlink() fails.

2020-02-08  Bruno Haible  <address@hidden>

        fchmodat: Strengthen tests.
        * tests/test-fchmodat.c (BASE): New macro.
        (main): Use it, to avoid conflicts with other unit tests. Verify that
        fchmodat changed the file permission bits.

2020-02-08  Bruno Haible  <address@hidden>

        fchmodat: Fix endless recursion on Cygwin (regression from 2020-02-07).
        * lib/fchmodat.c (orig_fchmodat): Move definition to immediately after
        '#undef __need_system_sys_stat_h'.

2020-02-08  Bruno Haible  <address@hidden>

        fchmodat: Improve cross-compilation guesses.
        * m4/fchmodat.m4 (gl_FUNC_FCHMODAT): Require AC_CANONICAL_HOST. When
        cross-compiling, guess depending on the platform.
        * doc/posix-functions/fchmodat.texi: Clarify.

Attachment: 0001-fchmodat-Improve-cross-compilation-guesses.patch
Description: Text Data

Attachment: 0002-fchmodat-Fix-endless-recursion-on-Cygwin-regression-.patch
Description: Text Data

Attachment: 0003-fchmodat-Strengthen-tests.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]