From: Kenichi Handa <handa@m17n.org>
Subject: Recent change to file-chase-links has a bug
Date: Wed, 9 Apr 2003 16:10:47 +0900 (JST) [thread overview]
Message-ID: <200304090710.QAA15874@etlken.m17n.org> (raw)
This change has a bug.
2003-04-08 Richard M. Stallman <rms@gnu.org>
[...]
* 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
handa@m17n.org
next reply other threads:[~2003-04-09 7:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-09 7:10 Kenichi Handa [this message]
2003-04-09 13:49 ` Recent change to file-chase-links has a bug Kai Großjohann
2003-04-09 21:26 ` Kevin Rodgers
2003-04-10 6:22 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200304090710.QAA15874@etlken.m17n.org \
--to=handa@m17n.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).