bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: bug-gnulib@gnu.org, psmith@gnu.org
Subject: Re: [PATCH] findprog-in: Set errno to indicate why NULL was returned.
Date: Sat, 28 Sep 2019 13:48:01 +0200	[thread overview]
Message-ID: <224240905.7j50jP0exv@omega> (raw)
In-Reply-To: <831rwgxob0.fsf@gnu.org>

Eli Zaretskii wrote:
> The value of EACCES (not EACCESS!) on MS-Windows frequently means the
> file cannot be accessed for a reason that has nothing to do with
> execute permissions.  It could be, for example, that some intermediate
> directory in the full file name doesn't exist or is otherwise
> inaccessible.

Thanks for the scrutiny, Eli. Fixed as follows:


2019-09-15  Bruno Haible  <bruno@clisp.org>

	findprog-in: Fix comment.
	Reported by Eli Zaretskii <eliz@gnu.org>.
	* lib/findprog.h (find_in_given_path): Extend description of EACCES
	condition.
	* lib/stat.c (rpl_stat): Fix typo in comment.
	* lib/utime.c (_gl_utimens_windows): Likewise.

diff --git a/lib/findprog.h b/lib/findprog.h
index 804f02a..263c53c 100644
--- a/lib/findprog.h
+++ b/lib/findprog.h
@@ -50,8 +50,9 @@ extern const char *find_in_path (const char *progname);
    - Otherwise, it sets errno and returns NULL.
      Specific errno values include:
        - ENOENT: means that the program's file was not found.
-       - EACCESS: means that the program's file was found but lacks the
-         execute permissions.
+       - EACCES: means that the program's file cannot be accessed (due to some
+         issue with one of the ancestor directories) or lacks the execute
+         permissions.
    If OPTIMIZE_FOR_EXEC is true, the function saves some work, under the
    assumption that the resulting pathname will not be accessed directly,
    only through execl/execv or execlp/execvp.
diff --git a/lib/stat.c b/lib/stat.c
index 9228500..e3248a8 100644
--- a/lib/stat.c
+++ b/lib/stat.c
@@ -375,7 +375,7 @@ rpl_stat (char const *name, struct stat *buf)
 
       case ERROR_ACCESS_DENIED:  /* rname is such as 'C:\System Volume Information\foo'.  */
       case ERROR_SHARING_VIOLATION: /* rname is such as 'C:\pagefile.sys' (second approach only).  */
-                                    /* XXX map to EACCESS or EPERM? */
+                                    /* XXX map to EACCES or EPERM? */
         errno = EACCES;
         break;
 
@@ -398,7 +398,7 @@ rpl_stat (char const *name, struct stat *buf)
         errno = ENAMETOOLONG;
         break;
 
-      case ERROR_DELETE_PENDING: /* XXX map to EACCESS or EPERM? */
+      case ERROR_DELETE_PENDING: /* XXX map to EACCES or EPERM? */
         errno = EPERM;
         break;
 
diff --git a/lib/utime.c b/lib/utime.c
index a0466f7..a5a362b 100644
--- a/lib/utime.c
+++ b/lib/utime.c
@@ -224,7 +224,7 @@ _gl_utimens_windows (const char *name, struct timespec ts[2])
         errno = ENAMETOOLONG;
         break;
 
-      case ERROR_DELETE_PENDING: /* XXX map to EACCESS or EPERM? */
+      case ERROR_DELETE_PENDING: /* XXX map to EACCES or EPERM? */
         errno = EPERM;
         break;
 



      reply	other threads:[~2019-09-28 11:48 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
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 [this message]

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=224240905.7j50jP0exv@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).