aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref
diff options
context:
space:
mode:
authorPaul Eggert2019-09-21 11:27:46 -0700
committerPaul Eggert2019-09-21 11:38:36 -0700
commitd49d6ea9677eea1d30aae4244934b1c7336e35a3 (patch)
treec671f33693f458a7ba992a2a97250f620aec861d /doc/lispref
parent56213b15e65a350f3f8cd9426a97691d8ff217ee (diff)
downloademacs-d49d6ea9677eea1d30aae4244934b1c7336e35a3.tar.gz
emacs-d49d6ea9677eea1d30aae4244934b1c7336e35a3.zip
Revert too-picky file-access tests
Problem reported by Andreas Schwab (Bug#37475). * doc/lispref/files.texi (Writing to Files) (Testing Accessibility, Kinds of Files): Document that accessibility and file-type predicates return nil if there is trouble determining accessibility or type. * etc/NEWS: Adjust, and list the affected primitives. * src/callproc.c (init_callproc): Go back to Ffile_exists_p. * src/fileio.c (PICKY_EACCES, file_test_errno): Remove. All uses removed. (Ffile_name_case_insensitive_p, Ffile_exists_p, Ffile_symlink_p) (Ffile_directory_p, Ffile_regular_p): Document that these functions return nil if there is trouble. (Ffile_name_case_insensitive_p, check_file_access) (Ffile_writable_p, Ffile_symlink_p, Ffile_directory_p) (Ffile_accessible_directory_p, Ffile_regular_p) * src/lread.c (Fload): Go back to treating trouble in determining the answer as if the file were missing. * src/fileio.c (Ffile_newer_than_file_p): Use file_attribute_errno not file_test_errno, since returning nil is not appropriate when there are two files to test; e.g., in the rare cases where both file timestamps have overflowed then neither t nor nil is correct.
Diffstat (limited to 'doc/lispref')
-rw-r--r--doc/lispref/files.texi23
1 files changed, 14 insertions, 9 deletions
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index fba9622fecf..3746c6d2c95 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -607,8 +607,7 @@ This function appends the contents of the region delimited by
607@var{filename}. If that file does not exist, it is created. This 607@var{filename}. If that file does not exist, it is created. This
608function returns @code{nil}. 608function returns @code{nil}.
609 609
610An error is signaled if @var{filename} specifies a nonwritable file, 610An error is signaled if you cannot write or create @var{filename}.
611or a nonexistent file in a directory where files cannot be created.
612 611
613When called from Lisp, this function is completely equivalent to: 612When called from Lisp, this function is completely equivalent to:
614 613
@@ -851,12 +850,13 @@ permissions.
851@defun file-exists-p filename 850@defun file-exists-p filename
852This function returns @code{t} if a file named @var{filename} appears 851This function returns @code{t} if a file named @var{filename} appears
853to exist. This does not mean you can necessarily read the file, only 852to exist. This does not mean you can necessarily read the file, only
854that you can find out its attributes. (On GNU and other POSIX-like 853that you can probably find out its attributes. (On GNU and other POSIX-like
855systems, this is true if the file exists and you have execute 854systems, this is true if the file exists and you have execute
856permission on the containing directories, regardless of the 855permission on the containing directories, regardless of the
857permissions of the file itself.) 856permissions of the file itself.)
858 857
859If the file does not exist, this function returns @code{nil}. 858If the file does not exist, or if there was trouble determining
859whether the file exists, this function returns @code{nil}.
860 860
861Directories 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
862given a directory. However, because @code{file-exists-p} follows 862given a directory. However, because @code{file-exists-p} follows
@@ -881,7 +881,7 @@ inside the directory, and open those files if their modes permit.
881This function returns @code{t} if the file @var{filename} can be written 881This function returns @code{t} if the file @var{filename} can be written
882or created by you, and @code{nil} otherwise. A file is writable if the 882or created by you, and @code{nil} otherwise. A file is writable if the
883file exists and you can write it. It is creatable if it does not exist, 883file exists and you can write it. It is creatable if it does not exist,
884but the specified directory does exist and you can write in that 884but its parent directory does exist and you can write in that
885directory. 885directory.
886 886
887In the example below, @file{foo} is not writable because the parent 887In the example below, @file{foo} is not writable because the parent
@@ -899,7 +899,7 @@ directory.
899@defun file-accessible-directory-p dirname 899@defun file-accessible-directory-p dirname
900This function returns @code{t} if you have permission to open existing 900This function returns @code{t} if you have permission to open existing
901files in the directory whose name as a file is @var{dirname}; 901files in the directory whose name as a file is @var{dirname};
902otherwise (or if there is no such directory), it returns @code{nil}. 902otherwise (e.g., if there is no such directory), it returns @code{nil}.
903The value of @var{dirname} may be either a directory name (such as 903The value of @var{dirname} may be either a directory name (such as
904@file{/foo/}) or the file name of a file which is a directory 904@file{/foo/}) or the file name of a file which is a directory
905(such as @file{/foo}, without the final slash). 905(such as @file{/foo}, without the final slash).
@@ -914,8 +914,8 @@ file in @file{/foo/} will give an error:
914@end defun 914@end defun
915 915
916@defun access-file filename string 916@defun access-file filename string
917This function opens file @var{filename} for reading, then closes it and 917If you can read @var{filename} this function returns @code{nil};
918returns @code{nil}. However, if the open fails, it signals an error 918otherwise it signals an error
919using @var{string} as the error message text. 919using @var{string} as the error message text.
920@end defun 920@end defun
921 921
@@ -1011,6 +1011,7 @@ absolute file name of the target; determining the full file name that
1011the link points to is nontrivial, see below.) 1011the link points to is nontrivial, see below.)
1012 1012
1013If the file @var{filename} is not a symbolic link, or does not exist, 1013If the file @var{filename} is not a symbolic link, or does not exist,
1014or if there is trouble determining whether it is a symbolic link,
1014@code{file-symlink-p} returns @code{nil}. 1015@code{file-symlink-p} returns @code{nil}.
1015 1016
1016Here are a few examples of using this function: 1017Here are a few examples of using this function:
@@ -1071,7 +1072,9 @@ link. If you actually need the file name of the link target, use
1071 1072
1072@defun file-directory-p filename 1073@defun file-directory-p filename
1073This function returns @code{t} if @var{filename} is the name of an 1074This function returns @code{t} if @var{filename} is the name of an
1074existing directory, @code{nil} otherwise. 1075existing directory. It returns @code{nil} if @var{filename} does
1076not name a directory, or if there is trouble determining whether
1077it is a directory.
1075This function follows symbolic links. 1078This function follows symbolic links.
1076 1079
1077@example 1080@example
@@ -1103,6 +1106,8 @@ This function follows symbolic links.
1103This function returns @code{t} if the file @var{filename} exists and is 1106This function returns @code{t} if the file @var{filename} exists and is
1104a regular file (not a directory, named pipe, terminal, or 1107a regular file (not a directory, named pipe, terminal, or
1105other I/O device). 1108other I/O device).
1109It returns @code{nil} if @var{filename} does not exist or is not a regular
1110file, or if there is trouble determining whether it is a regular file.
1106This function follows symbolic links. 1111This function follows symbolic links.
1107@end defun 1112@end defun
1108 1113