aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorPaul Eggert2019-09-17 19:18:14 -0700
committerPaul Eggert2019-09-17 19:24:38 -0700
commit9dc306b1db08196684d05a474148e16305adbad0 (patch)
tree78a401e0156a34ef1d2ae99acad31fb3ad9cb806 /doc
parentae3edf0ac3f1e893338917497b55859d6aca7d42 (diff)
downloademacs-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.texi13
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
856permission on the containing directories, regardless of the 856permission on the containing directories, regardless of the
857permissions of the file itself.) 857permissions of the file itself.)
858 858
859If the file does not exist, or if access control policies prevent you 859If the file does not exist, this function returns @code{nil}.
860from finding its attributes, this function returns @code{nil}.
861 860
862Directories are files, so @code{file-exists-p} can return @code{t} when 861Directories are files, so @code{file-exists-p} can return @code{t} when
863given a directory. However, because @code{file-exists-p} follows 862given 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}
1264This function returns a list of attributes of file @var{filename}. If 1263This function returns a list of attributes of file @var{filename}. If
1265the specified file's attributes cannot be accessed, it returns @code{nil}. 1264the specified file does not exist, it returns @code{nil}.
1266This function does not follow symbolic links. 1265This function does not follow symbolic links.
1267The optional parameter @var{id-format} specifies the preferred format 1266The optional parameter @var{id-format} specifies the preferred format
1268of attributes @acronym{UID} and @acronym{GID} (see below)---the 1267of attributes @acronym{UID} and @acronym{GID} (see below)---the
@@ -1464,9 +1463,8 @@ The underlying ACL implementation is platform-specific; on GNU/Linux
1464and BSD, Emacs uses the POSIX ACL interface, while on MS-Windows Emacs 1463and BSD, Emacs uses the POSIX ACL interface, while on MS-Windows Emacs
1465emulates the POSIX ACL interface with native file security APIs. 1464emulates the POSIX ACL interface with native file security APIs.
1466 1465
1467If Emacs was not compiled with ACL support, or the file does not exist 1466If ACLs are not supported or the file does not exist,
1468or is inaccessible, or Emacs was unable to determine the ACL entries 1467then the return value is @code{nil}.
1469for 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
1478same form as what @code{set-file-selinux-context} takes for its 1476same 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
1481If Emacs was not compiled with SELinux support, or the file does not 1479If SELinux is not supported or the file does not exist,
1482exist or is inaccessible, or if the system does not support SELinux,
1483then the return value is @code{(nil nil nil nil)}. 1480then the return value is @code{(nil nil nil nil)}.
1484@end defun 1481@end defun
1485 1482