diff options
| author | Paul Eggert | 2019-09-17 19:18:14 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-09-17 19:24:38 -0700 |
| commit | 9dc306b1db08196684d05a474148e16305adbad0 (patch) | |
| tree | 78a401e0156a34ef1d2ae99acad31fb3ad9cb806 /doc | |
| parent | ae3edf0ac3f1e893338917497b55859d6aca7d42 (diff) | |
| download | emacs-9dc306b1db08196684d05a474148e16305adbad0.tar.gz emacs-9dc306b1db08196684d05a474148e16305adbad0.zip | |
Improve reporting of I/O, access errors
Signal an error for file-oriented errors that are not tame
errors like ENOENT and ENOTDIR (Bug#37389).
Do this for primitives exposed to Lisp; the lower
level internal C API merely makes errno values available
to higher-level C code.
* doc/lispref/files.texi (Testing Accessibility)
(File Attributes, Extended Attributes): Do not say that the
functions return nil when the return value cannot be determined.
* etc/NEWS: Mention the change.
* src/dired.c (Ffile_attributes): Fix doc string confusion
about opening a file vs getting its attributes.
(file_attributes): Signal serious errors.
* src/fileio.c (check_existing, check_executable)
(check_writable): Remove. All callers changed to use
check_file_access or file_access_p.
(file_access_p, file_metadata_errno, file_attribute_errno)
(file_test_errno, check_file_access, check_emacs_readlinkat):
New functions.
* src/fileio.c (Ffile_executable_p, Ffile_readable_p)
(Ffile_name_case_insensitive_p, Frename_file, Ffile_exists_p):
(Ffile_symlink_p, Ffile_directory_p)
(Ffile_accessible_directory_p, Ffile_regular_p)
(Ffile_selinux_context, Ffile_acl, Ffile_modes)
(Ffile_newer_than_file_p, Fset_visited_file_modtime)
(Ffile_system_info):
* src/filelock.c (unlock_file, Ffile_locked_p):
* src/lread.c (Fload):
Signal serious errors.
* src/fileio.c (Ffile_writable_p): Remove unnecessary CHECK_STRING.
(emacs_readlinkat): Now static.
* src/filelock.c (current_lock_owner, lock_if_free): Return a
positive errno on error, and the negative of the old old value
on success. All callers changed.
* src/lread.c (openp): Propagate serious errno values to caller.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/files.texi | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 18a1f4908d6..fba9622fecf 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi | |||
| @@ -856,8 +856,7 @@ systems, this is true if the file exists and you have execute | |||
| 856 | permission on the containing directories, regardless of the | 856 | permission on the containing directories, regardless of the |
| 857 | permissions of the file itself.) | 857 | permissions of the file itself.) |
| 858 | 858 | ||
| 859 | If the file does not exist, or if access control policies prevent you | 859 | If the file does not exist, this function returns @code{nil}. |
| 860 | from finding its attributes, this function returns @code{nil}. | ||
| 861 | 860 | ||
| 862 | Directories are files, so @code{file-exists-p} can return @code{t} when | 861 | Directories are files, so @code{file-exists-p} can return @code{t} when |
| 863 | given a directory. However, because @code{file-exists-p} follows | 862 | given a directory. However, because @code{file-exists-p} follows |
| @@ -1262,7 +1261,7 @@ on the 19th, @file{aug-20} was written on the 20th, and the file | |||
| 1262 | @defun file-attributes filename &optional id-format | 1261 | @defun file-attributes filename &optional id-format |
| 1263 | @anchor{Definition of file-attributes} | 1262 | @anchor{Definition of file-attributes} |
| 1264 | This function returns a list of attributes of file @var{filename}. If | 1263 | This function returns a list of attributes of file @var{filename}. If |
| 1265 | the specified file's attributes cannot be accessed, it returns @code{nil}. | 1264 | the specified file does not exist, it returns @code{nil}. |
| 1266 | This function does not follow symbolic links. | 1265 | This function does not follow symbolic links. |
| 1267 | The optional parameter @var{id-format} specifies the preferred format | 1266 | The optional parameter @var{id-format} specifies the preferred format |
| 1268 | of attributes @acronym{UID} and @acronym{GID} (see below)---the | 1267 | of attributes @acronym{UID} and @acronym{GID} (see below)---the |
| @@ -1464,9 +1463,8 @@ The underlying ACL implementation is platform-specific; on GNU/Linux | |||
| 1464 | and BSD, Emacs uses the POSIX ACL interface, while on MS-Windows Emacs | 1463 | and BSD, Emacs uses the POSIX ACL interface, while on MS-Windows Emacs |
| 1465 | emulates the POSIX ACL interface with native file security APIs. | 1464 | emulates the POSIX ACL interface with native file security APIs. |
| 1466 | 1465 | ||
| 1467 | If Emacs was not compiled with ACL support, or the file does not exist | 1466 | If ACLs are not supported or the file does not exist, |
| 1468 | or is inaccessible, or Emacs was unable to determine the ACL entries | 1467 | then the return value is @code{nil}. |
| 1469 | for any other reason, then the return value is @code{nil}. | ||
| 1470 | @end defun | 1468 | @end defun |
| 1471 | 1469 | ||
| 1472 | @defun file-selinux-context filename | 1470 | @defun file-selinux-context filename |
| @@ -1478,8 +1476,7 @@ for details about what these actually mean. The return value has the | |||
| 1478 | same form as what @code{set-file-selinux-context} takes for its | 1476 | same form as what @code{set-file-selinux-context} takes for its |
| 1479 | @var{context} argument (@pxref{Changing Files}). | 1477 | @var{context} argument (@pxref{Changing Files}). |
| 1480 | 1478 | ||
| 1481 | If Emacs was not compiled with SELinux support, or the file does not | 1479 | If SELinux is not supported or the file does not exist, |
| 1482 | exist or is inaccessible, or if the system does not support SELinux, | ||
| 1483 | then the return value is @code{(nil nil nil nil)}. | 1480 | then the return value is @code{(nil nil nil nil)}. |
| 1484 | @end defun | 1481 | @end defun |
| 1485 | 1482 | ||