[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Recent change to file-chase-links has a bug
From: |
Kenichi Handa |
Subject: |
Recent change to file-chase-links has a bug |
Date: |
Wed, 9 Apr 2003 16:10:47 +0900 (JST) |
User-agent: |
SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.2.92 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) |
This change has a bug.
2003-04-08 Richard M. Stallman <address@hidden>
[...]
* files.el (file-chase-links): New arg LIMIT.
After that many iterations, just return what we've got.
Now the code is as below:
(defun file-chase-links (filename &optional limit)
"Chase links in FILENAME until a name that is not a link.
Unlike `file-truename', this does not check whether a parent
directory name is a symbolic link.
If the optional argument LIMIT is a number,
it means chase no more than that many links and then stop."
(let (tem (newname filename)
(count 0)
(max (max limit 100)))
(while (and (or (null limit) (< count limit))
(setq tem (file-symlink-p newname)))
(save-match-data
(if (= count max)
(error "Apparent cycle of symbolic links for %s" filename))
At least, (max limit 100) must be:
(max (if (numberp limit) limit 0) 100)
Otherwise, for instance, C-x 4 a signals an error.
And, if the docstring is correct, actually the code must be
something like this:
(defun file-chase-links (filename &optional limit)
[...]
(let (tem (newname filename)
(count 0)
(max 100)
(while (and (or (not (numberp limit)) (< count limit))
(setq tem (file-symlink-p newname)))
(save-match-data
(if (= count max)
(error "Apparent cycle of symbolic links for %s" filename))
But, I have not yet installed that fix because it seems that
the original line "(max (max limit 100))" suggests some
other intention, e.g., "don't allow a limit less than 100".
---
Ken'ichi HANDA
address@hidden
- Recent change to file-chase-links has a bug,
Kenichi Handa <=