* Recent change to file-chase-links has a bug
@ 2003-04-09 7:10 Kenichi Handa
2003-04-09 13:49 ` Kai Großjohann
2003-04-10 6:22 ` Richard Stallman
0 siblings, 2 replies; 4+ messages in thread
From: Kenichi Handa @ 2003-04-09 7:10 UTC (permalink / 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Recent change to file-chase-links has a bug
2003-04-09 7:10 Recent change to file-chase-links has a bug Kenichi Handa
@ 2003-04-09 13:49 ` Kai Großjohann
2003-04-09 21:26 ` Kevin Rodgers
2003-04-10 6:22 ` Richard Stallman
1 sibling, 1 reply; 4+ messages in thread
From: Kai Großjohann @ 2003-04-09 13:49 UTC (permalink / raw)
Kenichi Handa <handa@m17n.org> writes:
> 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)))
Wild guess: Richard meant (or limit 100) instead of (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))
--
A preposition is not a good thing to end a sentence with.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Recent change to file-chase-links has a bug
2003-04-09 13:49 ` Kai Großjohann
@ 2003-04-09 21:26 ` Kevin Rodgers
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2003-04-09 21:26 UTC (permalink / raw)
Kai Großjohann wrote:
> Kenichi Handa <handa@m17n.org> writes:
>>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)))
>
> Wild guess: Richard meant (or limit 100) instead of (max limit 100).
That seems like an awfully conservative default. How about bumping it up to
1024?
--
<a href="mailto:<kevin.rodgers@ihs.com>">Kevin Rodgers</a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Recent change to file-chase-links has a bug
2003-04-09 7:10 Recent change to file-chase-links has a bug Kenichi Handa
2003-04-09 13:49 ` Kai Großjohann
@ 2003-04-10 6:22 ` Richard Stallman
1 sibling, 0 replies; 4+ messages in thread
From: Richard Stallman @ 2003-04-10 6:22 UTC (permalink / raw)
Cc: emacs-devel
At least, (max limit 100) must be:
(max (if (numberp limit) limit 0) 100)
Otherwise, for instance, C-x 4 a signals an error.
Thanks. I fixed this.
And, if the docstring is correct, actually the code must be
something like this:
That change would make limits greater than 100 not work.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-04-10 6:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-09 7:10 Recent change to file-chase-links has a bug Kenichi Handa
2003-04-09 13:49 ` Kai Großjohann
2003-04-09 21:26 ` Kevin Rodgers
2003-04-10 6:22 ` Richard Stallman
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.