GNU bug report logs - #4819
file-truename's undocumented behavior

Previous Next

Package: emacs;

Reported by: MON KEY <monkey <at> sandpframing.com>

Date: Wed, 28 Oct 2009 00:35:04 UTC

Severity: normal

Tags: wontfix

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #50 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: MON KEY <monkey <at> sandpframing.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 4819 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
Subject: Re: bug#4819: file-truename's undocumented behavior
Date: Fri, 6 Nov 2009 19:01:28 -0500
Stefan,
I'm very sorry for the delayed response things have been hectic of late.

On Wed, Oct 28, 2009 at 7:37 PM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>> I assumed nil.
>
> That would be very unexpected, since file-truename otherwise always
> returns a string when passed a string.

Yes, understood; most likely my assumptions are predicated by these seemingly
contradictory behaviors:

(file-name-absolute-p "") ;=> nil
(file-symlink-p "")       ;=> nil

>
> It's the other way around: the few functions that preserve the
> match-data should be documented as such (better yet: the byte-compiler
> should be taught about them, so it can detect when we use the
> match-data after it got clobbered).

No argument there :)

>>> Which part of the documentation do you think this behavior contradicts?
>
>> This part:
>>  (file-name-absolute-p "") ;=> nil
>>  (file-symlink-p "")       ;=> nil
>
> That's not a part of the documentation.

You're right. None the less, this behaviour does contradict behaviour indicated
by said docs.

> Elisp should generally not be w32-specific, so ratehr than use
> w32-long-file-name we should maybe change
> file-truename correspondingly.  That doesn't mean I think it's the right
> thing to do: I know next to nothing about this issue.

Best I can gather the existing w32 conditional branch has been around for a long
time.  i.e. the email address in the comments carry a {...}@harlequin.co.uk
domain.

>
>> !         ((and (string= (substring filename 0 1) "~")
>> !               (string-match-p "~[^/]*/?" filename))
>> !          (string-match "~[^/]*/?" filename)
>> !          (let ((first-part
>> !                 (substring filename 0 (match-end 0)))
>> !                (rest (substring filename (match-end 0))))
>
> What's the point?

To avoid setting the match-data b/c it _is not_ necessarily going to be used per
the conditional.

> If you're going to use string-match in the end, you might as well do it right
> away.

This is wrong.
Though, it may explain how/why the existing situation persists :)

>        Stefan
>
s_P




This bug report was last modified 13 years and 322 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.