aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2012-09-30 19:07:14 -0700
committerPaul Eggert2012-09-30 19:07:14 -0700
commit86ec63ba3057ac5b3b760ebbdd547ff6d455cb65 (patch)
tree4d51b01424790cd9f2d3369f12792f4d076e80e6
parent19e54a4d41c41edea579287b3a0423d4ff361d34 (diff)
downloademacs-86ec63ba3057ac5b3b760ebbdd547ff6d455cb65.tar.gz
emacs-86ec63ba3057ac5b3b760ebbdd547ff6d455cb65.zip
Revert the FOLLOW-SYMLINKS change for file-attributes.
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/files.texi8
-rw-r--r--etc/ChangeLog5
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/files.el5
-rw-r--r--lisp/time.el2
-rw-r--r--src/ChangeLog6
-rw-r--r--src/dired.c26
-rw-r--r--src/lisp.h2
-rw-r--r--src/sysdep.c3
11 files changed, 37 insertions, 34 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 04b677b177e..db728d6fec0 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12012-10-01 Paul Eggert <eggert@cs.ucla.edu>
2
3 Revert the FOLLOW-SYMLINKS change for file-attributes.
4 * files.texi (File Attributes, Magic File Names): Undo last change.
5
12012-09-30 Paul Eggert <eggert@cs.ucla.edu> 62012-09-30 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 file-attributes has a new optional arg FOLLOW-SYMLINKS. 8 file-attributes has a new optional arg FOLLOW-SYMLINKS.
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 2b087208c60..9424a661236 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -1187,7 +1187,7 @@ link to.
1187@end example 1187@end example
1188@end defun 1188@end defun
1189 1189
1190@defun file-attributes filename &optional id-format follow-symlinks 1190@defun file-attributes filename &optional id-format
1191@anchor{Definition of file-attributes} 1191@anchor{Definition of file-attributes}
1192This function returns a list of attributes of file @var{filename}. If 1192This function returns a list of attributes of file @var{filename}. If
1193the specified file cannot be opened, it returns @code{nil}. 1193the specified file cannot be opened, it returns @code{nil}.
@@ -1197,9 +1197,6 @@ valid values are @code{'string} and @code{'integer}. The latter is
1197the default, but we plan to change that, so you should specify a 1197the default, but we plan to change that, so you should specify a
1198non-@code{nil} value for @var{id-format} if you use the returned 1198non-@code{nil} value for @var{id-format} if you use the returned
1199@acronym{UID} or @acronym{GID}. 1199@acronym{UID} or @acronym{GID}.
1200The optional parameter @var{follow-symlinks} says whether to follow
1201@var{filename} if it is a symbolic link; if @code{t}, symbolic links
1202are followed and if @code{nil} they are not.
1203 1200
1204The elements of the list, in order, are: 1201The elements of the list, in order, are:
1205 1202
@@ -2964,7 +2961,8 @@ between consecutive checks. For example:
2964 (let ((remote-file-name-inhibit-cache 2961 (let ((remote-file-name-inhibit-cache
2965 (- display-time-interval 5))) 2962 (- display-time-interval 5)))
2966 (and (file-exists-p file) 2963 (and (file-exists-p file)
2967 (< 0 (nth 7 (file-attributes file nil t)))))) 2964 (< 0 (nth 7 (file-attributes
2965 (file-chase-links file)))))))
2968@end example 2966@end example
2969@end defopt 2967@end defopt
2970 2968
diff --git a/etc/ChangeLog b/etc/ChangeLog
index 0cd21f53a41..d8cb96e0f5e 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,8 @@
12012-10-01 Paul Eggert <eggert@cs.ucla.edu>
2
3 Revert the FOLLOW-SYMLINKS change for file-attributes.
4 * NEWS: Undo last change.
5
12012-09-30 Paul Eggert <eggert@cs.ucla.edu> 62012-09-30 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 file-attributes has a new optional arg FOLLOW-SYMLINKS. 8 file-attributes has a new optional arg FOLLOW-SYMLINKS.
diff --git a/etc/NEWS b/etc/NEWS
index 9a232fd0a5b..2791a25e051 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -807,11 +807,6 @@ The PSECS slot is new, and uses picosecond resolution. It can be
807accessed via the new timer--psecs accessor. 807accessed via the new timer--psecs accessor.
808 808
809+++ 809+++
810** file-attributes has a new optional argument FOLLOW-SYMLINKS
811that says whether to follow symbolic links. The default, as before,
812is to not follow symlinks.
813
814+++
815** Floating point functions now always return special values like NaN, 810** Floating point functions now always return special values like NaN,
816instead of signaling errors, if given invalid args, e.g. (log -1.0). 811instead of signaling errors, if given invalid args, e.g. (log -1.0).
817Previously, they returned NaNs on some platforms but signaled errors 812Previously, they returned NaNs on some platforms but signaled errors
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0b6fa3f8d21..e683650856c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
12012-10-01 Paul Eggert <eggert@cs.ucla.edu> 12012-10-01 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Revert the FOLLOW-SYMLINKS change for file-attributes.
4 * files.el (remote-file-name-inhibit-cache, after-find-file):
5 * time.el (display-time-file-nonempty-p): Undo last change.
6
3 * profiler.el (profiler-sampling-interval): Change default back to 1. 7 * profiler.el (profiler-sampling-interval): Change default back to 1.
4 See Stefan Monnier in 8 See Stefan Monnier in
5 <http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00863.html>. 9 <http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00863.html>.
diff --git a/lisp/files.el b/lisp/files.el
index 8bc02d08f6f..76a13f6cefd 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1014,7 +1014,7 @@ consecutive checks. For example:
1014 (defun display-time-file-nonempty-p (file) 1014 (defun display-time-file-nonempty-p (file)
1015 (let ((remote-file-name-inhibit-cache (- display-time-interval 5))) 1015 (let ((remote-file-name-inhibit-cache (- display-time-interval 5)))
1016 (and (file-exists-p file) 1016 (and (file-exists-p file)
1017 (< 0 (nth 7 (file-attributes file nil t))))))" 1017 (< 0 (nth 7 (file-attributes (file-chase-links file)))))))"
1018 :group 'files 1018 :group 'files
1019 :version "24.1" 1019 :version "24.1"
1020 :type `(choice 1020 :type `(choice
@@ -2082,7 +2082,8 @@ unless NOMODES is non-nil."
2082 ((and error (file-attributes buffer-file-name)) 2082 ((and error (file-attributes buffer-file-name))
2083 (setq buffer-read-only t) 2083 (setq buffer-read-only t)
2084 (if (and (file-symlink-p buffer-file-name) 2084 (if (and (file-symlink-p buffer-file-name)
2085 (not (file-exists-p buffer-file-name))) 2085 (not (file-exists-p
2086 (file-chase-links buffer-file-name))))
2086 "Symbolic link that points to nonexistent file" 2087 "Symbolic link that points to nonexistent file"
2087 "File exists, but cannot be read")) 2088 "File exists, but cannot be read"))
2088 ((not buffer-read-only) 2089 ((not buffer-read-only)
diff --git a/lisp/time.el b/lisp/time.el
index 7c0deadecfd..fe3cdbb57be 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -485,7 +485,7 @@ update which can wait for the next redisplay."
485(defun display-time-file-nonempty-p (file) 485(defun display-time-file-nonempty-p (file)
486 (let ((remote-file-name-inhibit-cache (- display-time-interval 5))) 486 (let ((remote-file-name-inhibit-cache (- display-time-interval 5)))
487 (and (file-exists-p file) 487 (and (file-exists-p file)
488 (< 0 (nth 7 (file-attributes file nil t)))))) 488 (< 0 (nth 7 (file-attributes (file-chase-links file)))))))
489 489
490;;;###autoload 490;;;###autoload
491(define-minor-mode display-time-mode 491(define-minor-mode display-time-mode
diff --git a/src/ChangeLog b/src/ChangeLog
index 9704c6d4469..9ad044a570a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,11 @@
12012-10-01 Paul Eggert <eggert@cs.ucla.edu> 12012-10-01 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Revert the FOLLOW-SYMLINKS change for file-attributes.
4 Doing it right would require several changes to Tramp, and there's
5 not enough time to get that tested before the freeze today.
6 * dired.c (directory_files_internal, Ffile_attributes):
7 Undo last change.
8
3 * frame.c (x_report_frame_params): Port better to wider ints. 9 * frame.c (x_report_frame_params): Port better to wider ints.
4 Do not assume that EMACS_UINT is the same width as uprintmax_t, 10 Do not assume that EMACS_UINT is the same width as uprintmax_t,
5 or that pointers can be printed in 15 decimal digits. 11 or that pointers can be printed in 15 decimal digits.
diff --git a/src/dired.c b/src/dired.c
index 84a172deb58..4986f845101 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -110,13 +110,12 @@ directory_files_internal_unwind (Lisp_Object dh)
110/* Function shared by Fdirectory_files and Fdirectory_files_and_attributes. 110/* Function shared by Fdirectory_files and Fdirectory_files_and_attributes.
111 If not ATTRS, return a list of directory filenames; 111 If not ATTRS, return a list of directory filenames;
112 if ATTRS, return a list of directory filenames and their attributes. 112 if ATTRS, return a list of directory filenames and their attributes.
113 In the latter case, ID_FORMAT and FOLLOW_SYMLINKS are passed to 113 In the latter case, ID_FORMAT is passed to Ffile_attributes. */
114 Ffile_attributes. */
115 114
116Lisp_Object 115Lisp_Object
117directory_files_internal (Lisp_Object directory, Lisp_Object full, 116directory_files_internal (Lisp_Object directory, Lisp_Object full,
118 Lisp_Object match, Lisp_Object nosort, bool attrs, 117 Lisp_Object match, Lisp_Object nosort, bool attrs,
119 Lisp_Object id_format, Lisp_Object follow_symlinks) 118 Lisp_Object id_format)
120{ 119{
121 DIR *d; 120 DIR *d;
122 ptrdiff_t directory_nbytes; 121 ptrdiff_t directory_nbytes;
@@ -298,8 +297,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
298 297
299 /* Both Fexpand_file_name and Ffile_attributes can GC. */ 298 /* Both Fexpand_file_name and Ffile_attributes can GC. */
300 decoded_fullname = Fexpand_file_name (name, directory); 299 decoded_fullname = Fexpand_file_name (name, directory);
301 fileattrs = Ffile_attributes (decoded_fullname, id_format, 300 fileattrs = Ffile_attributes (decoded_fullname, id_format);
302 follow_symlinks);
303 301
304 list = Fcons (Fcons (finalname, fileattrs), list); 302 list = Fcons (Fcons (finalname, fileattrs), list);
305 UNGCPRO; 303 UNGCPRO;
@@ -352,8 +350,7 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
352 return call5 (handler, Qdirectory_files, directory, 350 return call5 (handler, Qdirectory_files, directory,
353 full, match, nosort); 351 full, match, nosort);
354 352
355 return directory_files_internal (directory, full, match, nosort, 0, 353 return directory_files_internal (directory, full, match, nosort, 0, Qnil);
356 Qnil, Qnil);
357} 354}
358 355
359DEFUN ("directory-files-and-attributes", Fdirectory_files_and_attributes, 356DEFUN ("directory-files-and-attributes", Fdirectory_files_and_attributes,
@@ -381,8 +378,7 @@ which see. */)
381 return call6 (handler, Qdirectory_files_and_attributes, 378 return call6 (handler, Qdirectory_files_and_attributes,
382 directory, full, match, nosort, id_format); 379 directory, full, match, nosort, id_format);
383 380
384 return directory_files_internal (directory, full, match, nosort, 1, 381 return directory_files_internal (directory, full, match, nosort, 1, id_format);
385 id_format, Qnil);
386} 382}
387 383
388 384
@@ -879,7 +875,7 @@ stat_gname (struct stat *st)
879#endif 875#endif
880} 876}
881 877
882DEFUN ("file-attributes", Ffile_attributes, Sfile_attributes, 1, 3, 0, 878DEFUN ("file-attributes", Ffile_attributes, Sfile_attributes, 1, 2, 0,
883 doc: /* Return a list of attributes of file FILENAME. 879 doc: /* Return a list of attributes of file FILENAME.
884Value is nil if specified file cannot be opened. 880Value is nil if specified file cannot be opened.
885 881
@@ -888,9 +884,6 @@ below) - valid values are 'string and 'integer. The latter is the
888default, but we plan to change that, so you should specify a non-nil value 884default, but we plan to change that, so you should specify a non-nil value
889for ID-FORMAT if you use the returned uid or gid. 885for ID-FORMAT if you use the returned uid or gid.
890 886
891Optional argument FOLLOW-SYMLINKS says whether to follow symbolic
892links. If t, they are followed; if nil, they are not.
893
894Elements of the attribute list are: 887Elements of the attribute list are:
895 0. t for directory, string (name linked to) for symbolic link, or nil. 888 0. t for directory, string (name linked to) for symbolic link, or nil.
896 1. Number of links to file. 889 1. Number of links to file.
@@ -924,7 +917,7 @@ which see.
924 917
925On some FAT-based filesystems, only the date of last access is recorded, 918On some FAT-based filesystems, only the date of last access is recorded,
926so last access time will always be midnight of that day. */) 919so last access time will always be midnight of that day. */)
927 (Lisp_Object filename, Lisp_Object id_format, Lisp_Object follow_symlinks) 920 (Lisp_Object filename, Lisp_Object id_format)
928{ 921{
929 Lisp_Object values[12]; 922 Lisp_Object values[12];
930 Lisp_Object encoded; 923 Lisp_Object encoded;
@@ -960,10 +953,7 @@ so last access time will always be midnight of that day. */)
960 encoded = ENCODE_FILE (filename); 953 encoded = ENCODE_FILE (filename);
961 UNGCPRO; 954 UNGCPRO;
962 955
963 if ((!NILP (follow_symlinks) 956 if (lstat (SSDATA (encoded), &s) < 0)
964 ? stat (SSDATA (encoded), &s)
965 : lstat (SSDATA (encoded), &s))
966 != 0)
967 return Qnil; 957 return Qnil;
968 958
969 values[0] = (S_ISLNK (s.st_mode) ? Ffile_symlink_p (filename) 959 values[0] = (S_ISLNK (s.st_mode) ? Ffile_symlink_p (filename)
diff --git a/src/lisp.h b/src/lisp.h
index e182d3bc14b..c3cabe0af29 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3474,7 +3474,7 @@ extern void syms_of_ccl (void);
3474extern void syms_of_dired (void); 3474extern void syms_of_dired (void);
3475extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object, 3475extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object,
3476 Lisp_Object, Lisp_Object, 3476 Lisp_Object, Lisp_Object,
3477 bool, Lisp_Object, Lisp_Object); 3477 bool, Lisp_Object);
3478 3478
3479/* Defined in term.c. */ 3479/* Defined in term.c. */
3480extern int *char_ins_del_vector; 3480extern int *char_ins_del_vector;
diff --git a/src/sysdep.c b/src/sysdep.c
index efebb49870c..a825145c6dd 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -2532,8 +2532,7 @@ list_system_processes (void)
2532 process. */ 2532 process. */
2533 procdir = build_string ("/proc"); 2533 procdir = build_string ("/proc");
2534 match = build_string ("[0-9]+"); 2534 match = build_string ("[0-9]+");
2535 proclist = directory_files_internal (procdir, Qnil, match, Qt, 0, 2535 proclist = directory_files_internal (procdir, Qnil, match, Qt, 0, Qnil);
2536 Qnil, Qnil);
2537 2536
2538 /* `proclist' gives process IDs as strings. Destructively convert 2537 /* `proclist' gives process IDs as strings. Destructively convert
2539 each string into a number. */ 2538 each string into a number. */