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 15:29:42 +0200 [thread overview]
Message-ID: <2963806.h44gZ2e3cx@omega> (raw)
In-Reply-To: <83r240haxr.fsf@gnu.org>
Eli Zaretskii wrote:
> > 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.
>
> Well, at the very least how about documenting this subtlety?
Done as follows:
2019-09-28 Bruno Haible <bruno@clisp.org>
access: Document limitations on Windows.
Suggested by Zaretskii <eliz@gnu.org>.
* doc/posix-functions/access.texi: Mention two limitations on Windows.
diff --git a/doc/posix-functions/access.texi b/doc/posix-functions/access.texi
index 49064d2..8bfa2c1 100644
--- a/doc/posix-functions/access.texi
+++ b/doc/posix-functions/access.texi
@@ -31,4 +31,17 @@ this function, especially in a set-uid or set-gid program.
This function does not have an option for not following symbolic links
(like @code{stat} versus @code{lstat}). If you need this option, use
the Gnulib module @code{faccessat} with the @code{AT_EACCESS} flag.
+@item
+On native Windows, files whose basename does not contain a @samp{.}
+cannot be executed through @code{execlp} or @code{execvp}. Nevertheless,
+this function may return true for such files.
+@item
+On Windows, different facilities for executing a program have different
+ways of finding an executable file, by trying various suffixes. For
+example, @code{execlp} and @code{execvp} search for files with the
+suffixes @code{.com}, @code{.exe}, @code{.bat}, @code{.cmd}, when the
+file with the given file name does not exist. Whereas @code{cmd.exe}
+searches according to the @code{PATHEXT} environment variable. This
+function does not perform any search; it merely looks at the file with
+the given file name.
@end itemize
next prev parent reply other threads:[~2019-09-28 13:30 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
2019-09-28 12:17 ` Eli Zaretskii
2019-09-28 13:29 ` Bruno Haible [this message]
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=2963806.h44gZ2e3cx@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).