From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [PATCH] drop lchmod
Date: Wed, 4 Jan 2017 16:35:52 -0500 [thread overview]
Message-ID: <20170104213552.GR1555@brightrain.aerifal.cx> (raw)
In-Reply-To: <B28814C4-68C9-42E0-AE4F-3F046663C51C@gmail.com>
On Wed, Jan 04, 2017 at 10:23:55PM +0100, Julien Ramseier wrote:
> lchmod is not POSIX and not supported on Linux.
> Keeping it would probably do more harm than good: software checking
> for its presence (i.e. libarchive) will use it and always fail.
>
>
> diff --git a/include/sys/stat.h b/include/sys/stat.h
> index 9d09662..0058338 100644
> --- a/include/sys/stat.h
> +++ b/include/sys/stat.h
> @@ -92,7 +92,6 @@ int futimens(int, const struct timespec [2]);
> int utimensat(int, const char *, const struct timespec [2], int);
>
> #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
> -int lchmod(const char *, mode_t);
> #define S_IREAD S_IRUSR
> #define S_IWRITE S_IWUSR
> #define S_IEXEC S_IXUSR
> diff --git a/src/stat/lchmod.c b/src/stat/lchmod.c
> deleted file mode 100644
> index f324ba7..0000000
> --- a/src/stat/lchmod.c
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -#define _GNU_SOURCE
> -#include <sys/stat.h>
> -#include <fcntl.h>
> -
> -int lchmod(const char *path, mode_t mode)
> -{
> - return fchmodat(AT_FDCWD, path, mode, AT_SYMLINK_NOFOLLOW);
> -}
This can't be done because it's ABI. It will cause any program linked
with a reference to lchmod to failto execute with missing symbol
errors.
libarchive needs to be fixed to respect the errno value. fchmodat with
AT_FDCWD and the AT_SYMLINK_NOFOLLOW flag is semantically equivalent
to lchmod and is required by POSIX, so software should be prepared to
deal with systems where the error EOPNOTSUPP occurs.
Rich
next prev parent reply other threads:[~2017-01-04 21:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-04 21:23 Julien Ramseier
2017-01-04 21:35 ` Rich Felker [this message]
2017-01-05 0:39 ` A. Wilcox
2017-01-05 11:23 ` Julien Ramseier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170104213552.GR1555@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).