]> git.eshelyaron.com Git - emacs.git/commitdiff
Revert the FOLLOW-SYMLINKS change for file-attributes.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 1 Oct 2012 02:07:14 +0000 (19:07 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 1 Oct 2012 02:07:14 +0000 (19:07 -0700)
doc/lispref/ChangeLog
doc/lispref/files.texi
etc/ChangeLog
etc/NEWS
lisp/ChangeLog
lisp/files.el
lisp/time.el
src/ChangeLog
src/dired.c
src/lisp.h
src/sysdep.c

index 04b677b177e5f5fa271e495d2fa2e493f34d36c5..db728d6fec0c3282a225d9987e5264003397e27d 100644 (file)
@@ -1,3 +1,8 @@
+2012-10-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Revert the FOLLOW-SYMLINKS change for file-attributes.
+       * files.texi (File Attributes, Magic File Names): Undo last change.
+
 2012-09-30  Paul Eggert  <eggert@cs.ucla.edu>
 
        file-attributes has a new optional arg FOLLOW-SYMLINKS.
index 2b087208c60406e971700200d933045bc3d9f913..9424a6612363e2f86db719a792ad7904598a29e4 100644 (file)
@@ -1187,7 +1187,7 @@ link to.
 @end example
 @end defun
 
-@defun file-attributes filename &optional id-format follow-symlinks
+@defun file-attributes filename &optional id-format
 @anchor{Definition of file-attributes}
 This function returns a list of attributes of file @var{filename}.  If
 the specified file cannot be opened, it returns @code{nil}.
@@ -1197,9 +1197,6 @@ valid values are @code{'string} and @code{'integer}.  The latter is
 the default, but we plan to change that, so you should specify a
 non-@code{nil} value for @var{id-format} if you use the returned
 @acronym{UID} or @acronym{GID}.
-The optional parameter @var{follow-symlinks} says whether to follow
-@var{filename} if it is a symbolic link; if @code{t}, symbolic links
-are followed and if @code{nil} they are not.
 
 The elements of the list, in order, are:
 
@@ -2964,7 +2961,8 @@ between consecutive checks.  For example:
   (let ((remote-file-name-inhibit-cache
          (- display-time-interval 5)))
     (and (file-exists-p file)
-         (< 0 (nth 7 (file-attributes file nil t))))))
+         (< 0 (nth 7 (file-attributes
+                       (file-chase-links file)))))))
 @end example
 @end defopt
 
index 0cd21f53a41c50396ca17d2b5446edd90fd741a8..d8cb96e0f5ee077264fce9cc14409979eaa7327b 100644 (file)
@@ -1,3 +1,8 @@
+2012-10-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Revert the FOLLOW-SYMLINKS change for file-attributes.
+       * NEWS: Undo last change.
+
 2012-09-30  Paul Eggert  <eggert@cs.ucla.edu>
 
        file-attributes has a new optional arg FOLLOW-SYMLINKS.
index 9a232fd0a5b28eed9b0eb389d9a9ae44c0f9b5ed..2791a25e0515c3eaced0278c5b73de3cbe0ca1ca 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -806,11 +806,6 @@ stamps are still accepted.
 The PSECS slot is new, and uses picosecond resolution.  It can be
 accessed via the new timer--psecs accessor.
 
-+++
-** file-attributes has a new optional argument FOLLOW-SYMLINKS
-that says whether to follow symbolic links.  The default, as before,
-is to not follow symlinks.
-
 +++
 ** Floating point functions now always return special values like NaN,
 instead of signaling errors, if given invalid args, e.g. (log -1.0).
index 0b6fa3f8d216d6f6c724d6fa10aee3fe0529a678..e683650856c78395b37626c06c2016c57b93ba83 100644 (file)
@@ -1,5 +1,9 @@
 2012-10-01  Paul Eggert  <eggert@cs.ucla.edu>
 
+       Revert the FOLLOW-SYMLINKS change for file-attributes.
+       * files.el (remote-file-name-inhibit-cache, after-find-file):
+       * time.el (display-time-file-nonempty-p): Undo last change.
+
        * profiler.el (profiler-sampling-interval): Change default back to 1.
        See Stefan Monnier in
        <http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00863.html>.
index 8bc02d08f6f487efbc83c02a3e7d4f3d72f3b8dd..76a13f6cefd3e42a189745cd5b783c3792f84082 100644 (file)
@@ -1014,7 +1014,7 @@ consecutive checks.  For example:
   (defun display-time-file-nonempty-p (file)
     (let ((remote-file-name-inhibit-cache (- display-time-interval 5)))
       (and (file-exists-p file)
-           (< 0 (nth 7 (file-attributes file nil t))))))"
+           (< 0 (nth 7 (file-attributes (file-chase-links file)))))))"
   :group 'files
   :version "24.1"
   :type `(choice
@@ -2082,7 +2082,8 @@ unless NOMODES is non-nil."
             ((and error (file-attributes buffer-file-name))
              (setq buffer-read-only t)
              (if (and (file-symlink-p buffer-file-name)
-                      (not (file-exists-p buffer-file-name)))
+                      (not (file-exists-p
+                            (file-chase-links buffer-file-name))))
                  "Symbolic link that points to nonexistent file"
                "File exists, but cannot be read"))
             ((not buffer-read-only)
index 7c0deadecfd4d6d51ff4689507817ce48ca43daf..fe3cdbb57be9ae977d43f5e122f9711a4980b1ae 100644 (file)
@@ -485,7 +485,7 @@ update which can wait for the next redisplay."
 (defun display-time-file-nonempty-p (file)
   (let ((remote-file-name-inhibit-cache (- display-time-interval 5)))
     (and (file-exists-p file)
-        (< 0 (nth 7 (file-attributes file nil t))))))
+        (< 0 (nth 7 (file-attributes (file-chase-links file)))))))
 
 ;;;###autoload
 (define-minor-mode display-time-mode
index 9704c6d44693e899958f19f8d25fbea33cd30877..9ad044a570ab45a6db93cc061ea83bca327f88ad 100644 (file)
@@ -1,5 +1,11 @@
 2012-10-01  Paul Eggert  <eggert@cs.ucla.edu>
 
+       Revert the FOLLOW-SYMLINKS change for file-attributes.
+       Doing it right would require several changes to Tramp, and there's
+       not enough time to get that tested before the freeze today.
+       * dired.c (directory_files_internal, Ffile_attributes):
+       Undo last change.
+
        * frame.c (x_report_frame_params): Port better to wider ints.
        Do not assume that EMACS_UINT is the same width as uprintmax_t,
        or that pointers can be printed in 15 decimal digits.
index 84a172deb58d6297b7dd632c2dc2dfd5c776350d..4986f845101e208c687d985148d9dac1d4ee604a 100644 (file)
@@ -110,13 +110,12 @@ directory_files_internal_unwind (Lisp_Object dh)
 /* Function shared by Fdirectory_files and Fdirectory_files_and_attributes.
    If not ATTRS, return a list of directory filenames;
    if ATTRS, return a list of directory filenames and their attributes.
-   In the latter case, ID_FORMAT and FOLLOW_SYMLINKS are passed to
-   Ffile_attributes.  */
+   In the latter case, ID_FORMAT is passed to Ffile_attributes.  */
 
 Lisp_Object
 directory_files_internal (Lisp_Object directory, Lisp_Object full,
                          Lisp_Object match, Lisp_Object nosort, bool attrs,
-                         Lisp_Object id_format, Lisp_Object follow_symlinks)
+                         Lisp_Object id_format)
 {
   DIR *d;
   ptrdiff_t directory_nbytes;
@@ -298,8 +297,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
 
                  /* Both Fexpand_file_name and Ffile_attributes can GC.  */
                  decoded_fullname = Fexpand_file_name (name, directory);
-                 fileattrs = Ffile_attributes (decoded_fullname, id_format,
-                                               follow_symlinks);
+                 fileattrs = Ffile_attributes (decoded_fullname, id_format);
 
                  list = Fcons (Fcons (finalname, fileattrs), list);
                  UNGCPRO;
@@ -352,8 +350,7 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
     return call5 (handler, Qdirectory_files, directory,
                   full, match, nosort);
 
-  return directory_files_internal (directory, full, match, nosort, 0,
-                                  Qnil, Qnil);
+  return directory_files_internal (directory, full, match, nosort, 0, Qnil);
 }
 
 DEFUN ("directory-files-and-attributes", Fdirectory_files_and_attributes,
@@ -381,8 +378,7 @@ which see.  */)
     return call6 (handler, Qdirectory_files_and_attributes,
                   directory, full, match, nosort, id_format);
 
-  return directory_files_internal (directory, full, match, nosort, 1,
-                                  id_format, Qnil);
+  return directory_files_internal (directory, full, match, nosort, 1, id_format);
 }
 
 \f
@@ -879,7 +875,7 @@ stat_gname (struct stat *st)
 #endif
 }
 
-DEFUN ("file-attributes", Ffile_attributes, Sfile_attributes, 1, 3, 0,
+DEFUN ("file-attributes", Ffile_attributes, Sfile_attributes, 1, 2, 0,
        doc: /* Return a list of attributes of file FILENAME.
 Value is nil if specified file cannot be opened.
 
@@ -888,9 +884,6 @@ below) - valid values are 'string and 'integer.  The latter is the
 default, but we plan to change that, so you should specify a non-nil value
 for ID-FORMAT if you use the returned uid or gid.
 
-Optional argument FOLLOW-SYMLINKS says whether to follow symbolic
-links.  If t, they are followed; if nil, they are not.
-
 Elements of the attribute list are:
  0. t for directory, string (name linked to) for symbolic link, or nil.
  1. Number of links to file.
@@ -924,7 +917,7 @@ which see.
 
 On some FAT-based filesystems, only the date of last access is recorded,
 so last access time will always be midnight of that day.  */)
-  (Lisp_Object filename, Lisp_Object id_format, Lisp_Object follow_symlinks)
+  (Lisp_Object filename, Lisp_Object id_format)
 {
   Lisp_Object values[12];
   Lisp_Object encoded;
@@ -960,10 +953,7 @@ so last access time will always be midnight of that day.  */)
   encoded = ENCODE_FILE (filename);
   UNGCPRO;
 
-  if ((!NILP (follow_symlinks)
-       ? stat (SSDATA (encoded), &s)
-       : lstat (SSDATA (encoded), &s))
-      != 0)
+  if (lstat (SSDATA (encoded), &s) < 0)
     return Qnil;
 
   values[0] = (S_ISLNK (s.st_mode) ? Ffile_symlink_p (filename)
index e182d3bc14bcecd9091c305abd286e5ba807e015..c3cabe0af29e46a5cc45f613e920923571ed8f7c 100644 (file)
@@ -3474,7 +3474,7 @@ extern void syms_of_ccl (void);
 extern void syms_of_dired (void);
 extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object,
                                              Lisp_Object, Lisp_Object,
-                                             bool, Lisp_Object, Lisp_Object);
+                                             bool, Lisp_Object);
 
 /* Defined in term.c.  */
 extern int *char_ins_del_vector;
index efebb49870c85c3ef0bc1f6b64290d38de1db109..a825145c6ddbc2189687c07cb84dc974288013a3 100644 (file)
@@ -2532,8 +2532,7 @@ list_system_processes (void)
      process.  */
   procdir = build_string ("/proc");
   match = build_string ("[0-9]+");
-  proclist = directory_files_internal (procdir, Qnil, match, Qt, 0,
-                                      Qnil, Qnil);
+  proclist = directory_files_internal (procdir, Qnil, match, Qt, 0, Qnil);
 
   /* `proclist' gives process IDs as strings.  Destructively convert
      each string into a number.  */