diff options
| author | Paul Eggert | 2019-09-21 11:27:46 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-09-21 11:38:36 -0700 |
| commit | d49d6ea9677eea1d30aae4244934b1c7336e35a3 (patch) | |
| tree | c671f33693f458a7ba992a2a97250f620aec861d /doc/lispref | |
| parent | 56213b15e65a350f3f8cd9426a97691d8ff217ee (diff) | |
| download | emacs-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.texi | 23 |
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 |
| 608 | function returns @code{nil}. | 608 | function returns @code{nil}. |
| 609 | 609 | ||
| 610 | An error is signaled if @var{filename} specifies a nonwritable file, | 610 | An error is signaled if you cannot write or create @var{filename}. |
| 611 | or a nonexistent file in a directory where files cannot be created. | ||
| 612 | 611 | ||
| 613 | When called from Lisp, this function is completely equivalent to: | 612 | When 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 |
| 852 | This function returns @code{t} if a file named @var{filename} appears | 851 | This function returns @code{t} if a file named @var{filename} appears |
| 853 | to exist. This does not mean you can necessarily read the file, only | 852 | to exist. This does not mean you can necessarily read the file, only |
| 854 | that you can find out its attributes. (On GNU and other POSIX-like | 853 | that you can probably find out its attributes. (On GNU and other POSIX-like |
| 855 | systems, this is true if the file exists and you have execute | 854 | systems, this is true if the file exists and you have execute |
| 856 | permission on the containing directories, regardless of the | 855 | permission on the containing directories, regardless of the |
| 857 | permissions of the file itself.) | 856 | permissions of the file itself.) |
| 858 | 857 | ||
| 859 | If the file does not exist, this function returns @code{nil}. | 858 | If the file does not exist, or if there was trouble determining |
| 859 | whether the file exists, this function returns @code{nil}. | ||
| 860 | 860 | ||
| 861 | 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 |
| 862 | given a directory. However, because @code{file-exists-p} follows | 862 | given a directory. However, because @code{file-exists-p} follows |
| @@ -881,7 +881,7 @@ inside the directory, and open those files if their modes permit. | |||
| 881 | This function returns @code{t} if the file @var{filename} can be written | 881 | This function returns @code{t} if the file @var{filename} can be written |
| 882 | or created by you, and @code{nil} otherwise. A file is writable if the | 882 | or created by you, and @code{nil} otherwise. A file is writable if the |
| 883 | file exists and you can write it. It is creatable if it does not exist, | 883 | file exists and you can write it. It is creatable if it does not exist, |
| 884 | but the specified directory does exist and you can write in that | 884 | but its parent directory does exist and you can write in that |
| 885 | directory. | 885 | directory. |
| 886 | 886 | ||
| 887 | In the example below, @file{foo} is not writable because the parent | 887 | In 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 |
| 900 | This function returns @code{t} if you have permission to open existing | 900 | This function returns @code{t} if you have permission to open existing |
| 901 | files in the directory whose name as a file is @var{dirname}; | 901 | files in the directory whose name as a file is @var{dirname}; |
| 902 | otherwise (or if there is no such directory), it returns @code{nil}. | 902 | otherwise (e.g., if there is no such directory), it returns @code{nil}. |
| 903 | The value of @var{dirname} may be either a directory name (such as | 903 | The 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 |
| 917 | This function opens file @var{filename} for reading, then closes it and | 917 | If you can read @var{filename} this function returns @code{nil}; |
| 918 | returns @code{nil}. However, if the open fails, it signals an error | 918 | otherwise it signals an error |
| 919 | using @var{string} as the error message text. | 919 | using @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 | |||
| 1011 | the link points to is nontrivial, see below.) | 1011 | the link points to is nontrivial, see below.) |
| 1012 | 1012 | ||
| 1013 | If the file @var{filename} is not a symbolic link, or does not exist, | 1013 | If the file @var{filename} is not a symbolic link, or does not exist, |
| 1014 | or 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 | ||
| 1016 | Here are a few examples of using this function: | 1017 | Here 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 |
| 1073 | This function returns @code{t} if @var{filename} is the name of an | 1074 | This function returns @code{t} if @var{filename} is the name of an |
| 1074 | existing directory, @code{nil} otherwise. | 1075 | existing directory. It returns @code{nil} if @var{filename} does |
| 1076 | not name a directory, or if there is trouble determining whether | ||
| 1077 | it is a directory. | ||
| 1075 | This function follows symbolic links. | 1078 | This function follows symbolic links. |
| 1076 | 1079 | ||
| 1077 | @example | 1080 | @example |
| @@ -1103,6 +1106,8 @@ This function follows symbolic links. | |||
| 1103 | This function returns @code{t} if the file @var{filename} exists and is | 1106 | This function returns @code{t} if the file @var{filename} exists and is |
| 1104 | a regular file (not a directory, named pipe, terminal, or | 1107 | a regular file (not a directory, named pipe, terminal, or |
| 1105 | other I/O device). | 1108 | other I/O device). |
| 1109 | It returns @code{nil} if @var{filename} does not exist or is not a regular | ||
| 1110 | file, or if there is trouble determining whether it is a regular file. | ||
| 1106 | This function follows symbolic links. | 1111 | This function follows symbolic links. |
| 1107 | @end defun | 1112 | @end defun |
| 1108 | 1113 | ||