From: Bruno Haible <bruno@clisp.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: bug-gnulib@gnu.org, psmith@gnu.org
Subject: Re: new module 'access'
Date: Sat, 28 Sep 2019 14:06:00 +0200 [thread overview]
Message-ID: <50636743.vYNJyYVXY4@omega> (raw)
In-Reply-To: <83k1a7wis1.fsf@gnu.org>
Eli Zaretskii wrote:
> > > > +@item
> > > > +This function does not support the @code{X_OK} mode on some platforms:
> > > > +MSVC 14.
> > >
> > > This says MSVC, but the code will do the same on MinGW, right?
> >
> > Yes, I enabled this code also on mingw. With the mingw version I tested,
> > it is a no-op, because that mingw version links against an older MSVCRT
> > runtime. If/when mingw starts to link against newer Microsoft ucrt runtimes,
> > it will be affected by the same problem.
>
> I'm saying that the documentation should mention MinGW as well,
> because currently it gives an impression that only MSVC builds are
> affected in any way.
So far, only MSVC builds are affected. The gnulib documentation lists
situations/platforms that we _know_ are buggy. There is always the
implicit statement "If a situation/platform is not mentioned explicitly
it may still be buggy". For example, often FreeBSD 6.0 is mentioned to
have a certain bug, although the bug may also exist in FreeBSD 11 and 12
- simply because I don't have the time to verify each bug on each new
version of FreeBSD.
> > Should it look whether the file extension is one of the known ones?
> > Definitely not. When you rename a file prog.exe to prog.foo and invoke
> > it through execlp/execvp, it works. And '.foo' is surely not one of the
> > "known" file extensions.
>
> You describe a very unusual situation, because prog.foo will not be
> found by the Windows shell and by many other programs that use the
> shell via the likes of 'system' and 'popen'. I think it's better to
> be 90% correct than do nothing about this issue because we cannot
> easily be 100% correct. Callers don't usually expect an X_OK test to
> degenerate into F_OK, IMO.
>
> IOW, I think this implementation doesn't live up to Gnulib's promise
> to be a portability layer, because it loses too much of the baby with
> the bath water.
There are different ways to test for "executable" on Windows:
- execlp/execvp,
- CreateProcess,
- system / popen, like you say,
- cmd.exe,
- surely more (PowerShell...)
Let's assume that they work differently (cmd.exe definitely works differently
than execlp/execvp; I tested that).
The module does not attempt to handle all of these, just the first one,
because
- the function access() is located at the C library level,
- it is compatible with what the old MSVCRT (without the argument check
for the mode in _access()) does.
If you consider the gnulib access() function unfit for some purpose, you must
also consider the old MSVCRT _acccess() function unfit for the same purpose.
Bruno
next prev parent reply other threads:[~2019-09-28 12:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-14 19:35 [PATCH] findprog-in: Set errno to indicate why NULL was returned Paul Smith
2019-09-14 19:38 ` Paul Smith
2019-09-15 17:11 ` new module 'access' Bruno Haible
2019-09-16 15:22 ` Eli Zaretskii
2019-09-16 22:45 ` Bruno Haible
2019-09-17 6:15 ` Eli Zaretskii
2019-09-28 12:06 ` Bruno Haible [this message]
2019-09-28 12:17 ` Eli Zaretskii
2019-09-28 13:29 ` Bruno Haible
2019-09-28 13:54 ` Eli Zaretskii
2019-09-15 17:58 ` [PATCH] findprog-in: Set errno to indicate why NULL was returned Bruno Haible
2019-09-16 15:18 ` Eli Zaretskii
2019-09-28 11:48 ` Bruno Haible
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
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50636743.vYNJyYVXY4@omega \
--to=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
--cc=eliz@gnu.org \
--cc=psmith@gnu.org \
/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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).