tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch: use GNU readlink --canonicalize for file-truename when availa


From: Michael Albinus
Subject: Re: Patch: use GNU readlink --canonicalize for file-truename when available
Date: Fri, 14 Aug 2009 17:10:29 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Julian Scheid <address@hidden> writes:

> Patch take two attached.

Looks OK to me. I've committed it.

> Related question:
>
> file-truename appears to always return a value ending in a slash when
> its argument ends in a slash, and vice versa.
>
> The cache used in tramp-handle-file-truename, however, seems to not
> distinguish between the two and so if truename for foo/ is requested
> and later truename for foo, the result for the latter will end in a
> slash. Did this come up before? Do you think this could be a problem
> and if so, any thoughts on how to best fix it?

The file cache enters file names via (directory-file-name file).
Therefore, both file names are equivalent. This is due to performance
reasons, because most cached values are equal in both cases.

I don't know whether it matters, how Tramp returns the file
name. Usually, applications shall care about, and call either
directory-file-name or file-name-as-directory, depending what they need.

Maybe one could embed the code of tramp-handle-file-truename like this
(untested):

  (funcall
    (if (match-string "/$" filename)
               'file-name-as-directory
             'directory-file-name)
    (with-parsed-tramp-file-name (expand-file-name filename) nil
      (with-file-property v localname "file-truename"
        ...
   
But I'm not sure, whether file-name-as-directory does something
unexpected, when the local machine runs W32 or VMS or whatever.

Best regards, Michael.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]