bug-gnulib
[Top][All Lists]
Advanced

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

Re: fchmodat.c & lchmod.c - O_PATH & AT_EMPTY_PATH on older kernels


From: Bruno Haible
Subject: Re: fchmodat.c & lchmod.c - O_PATH & AT_EMPTY_PATH on older kernels
Date: Wed, 22 Jun 2022 02:50:15 +0200

Paul Eggert wrote:
> Thanks for reporting those problems. I installed the attached, which 
> fixed things for me on GNU/Linux and AIX. I think it should also put a 
> dent into the problems you reported on MS-Windows

Thanks. I confirm it fixes the compilation warning and the test failures on AIX.
And it fixes also the 'test-lchmod' failure on native Windows.

> though I can't easily test this.

Since the remaining issue is only on Windows, I dug a bit deeper.

The claim that I made on 2022-06-12, that the test failures on Windows were
a recent regression, was wrong. They must have been failing for a while
already. Apologies.

The problem on Windows is similar to the one on AIX. chmod ("file/", mode)
does not fail on AIX, and on Windows it fails with a wrong error code (EINVAL
instead of ENOTDIR).

The fix cannot be in fchmodat.c, since on this platform fchmodat.c delegates
to at-func.c and the functions 'chmod' and 'lchmod'.

So, the right fix is to make 'chmod' work right. And then, with the appropriate
module dependency, 'fchmodat' works right as well.

I've pushed the attached 4 patches.


2022-06-22  Bruno Haible  <bruno@clisp.org>

        fchmodat: Fix test failure on native Windows.
        * modules/fchmodat (Depends-on): Add 'chmod'.

2022-06-22  Bruno Haible  <bruno@clisp.org>

        chmod: Add tests.
        * tests/test-chmod.c: New file, based on tests/test-lchmod.c.
        * modules/chmod-tests: New file.

        chmod: New module.
        * lib/sys_stat.in.h (chmod): Declare when GNULIB_CHMOD is 1.
        * lib/chmod.c: New file, based on lib/lchmod.c.
        * m4/chmod.m4: New file, based on m4/fchmodat.m4.
        * m4/sys_stat_h.m4 (gl_SYS_STAT_H): Test whether chmod is declared.
        (gl_SYS_STAT_H_REQUIRE_DEFAULTS): Initialize GNULIB_CHMOD.
        (gl_SYS_STAT_H_DEFAULTS): Initialize REPLACE_CHMOD.
        * modules/sys_stat (Makefile.am): Substitute GNULIB_CHMOD,
        REPLACE_CHMOD.
        * modules/chmod: New file, based on modules/lchmod.
        * doc/posix-functions/chmod.texi: Mention the new module and the
        problems on IRIX and Windows.

2022-06-21  Bruno Haible  <bruno@clisp.org>

        lchmod: Simplify.
        * lib/lchmod.c: Remove unnecessary include, obsolete since 2020-02-23.

Attachment: 0001-lchmod-Simplify.patch
Description: Text Data

Attachment: 0002-chmod-New-module.patch
Description: Text Data

Attachment: 0003-chmod-Add-tests.patch
Description: Text Data

Attachment: 0004-fchmodat-Fix-test-failure-on-native-Windows.patch
Description: Text Data


reply via email to

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