aboutsummaryrefslogtreecommitdiffstats
path: root/src/lread.c
diff options
context:
space:
mode:
authorPaul Eggert2019-09-21 11:27:46 -0700
committerPaul Eggert2019-09-21 11:38:36 -0700
commitd49d6ea9677eea1d30aae4244934b1c7336e35a3 (patch)
treec671f33693f458a7ba992a2a97250f620aec861d /src/lread.c
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 'src/lread.c')
-rw-r--r--src/lread.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/lread.c b/src/lread.c
index 4f3446b09db..151731a81d9 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1343,26 +1343,18 @@ Return t if the file exists and loads successfully. */)
1343 /* openp already checked for newness, no point doing it again. 1343 /* openp already checked for newness, no point doing it again.
1344 FIXME would be nice to get a message when openp 1344 FIXME would be nice to get a message when openp
1345 ignores suffix order due to load_prefer_newer. */ 1345 ignores suffix order due to load_prefer_newer. */
1346 Lisp_Object notfound = found;
1347 if (!load_prefer_newer && is_elc) 1346 if (!load_prefer_newer && is_elc)
1348 { 1347 {
1349 result = stat (SSDATA (efound), &s1); 1348 result = stat (SSDATA (efound), &s1);
1350 int err = errno;
1351 if (result == 0) 1349 if (result == 0)
1352 { 1350 {
1353 SSET (efound, SBYTES (efound) - 1, 0); 1351 SSET (efound, SBYTES (efound) - 1, 0);
1354 result = stat (SSDATA (efound), &s2); 1352 result = stat (SSDATA (efound), &s2);
1355 err = errno;
1356 SSET (efound, SBYTES (efound) - 1, 'c'); 1353 SSET (efound, SBYTES (efound) - 1, 'c');
1357 if (result != 0)
1358 notfound = Fsubstring (found, make_fixnum (0),
1359 make_fixnum (-1));
1360 } 1354 }
1361 if (result != 0) 1355
1362 file_test_errno (notfound, err); 1356 if (result == 0
1363 else if (timespec_cmp (get_stat_mtime (&s1), 1357 && timespec_cmp (get_stat_mtime (&s1), get_stat_mtime (&s2)) < 0)
1364 get_stat_mtime (&s2))
1365 < 0)
1366 { 1358 {
1367 /* Make the progress messages mention that source is newer. */ 1359 /* Make the progress messages mention that source is newer. */
1368 newer = 1; 1360 newer = 1;