tramp-devel
[Top][All Lists]
Advanced

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

Re: How to cleanup connection for file-exists-p


From: Dan Davison
Subject: Re: How to cleanup connection for file-exists-p
Date: Thu, 26 Aug 2010 10:21:57 -0400
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux)

Michael Albinus <address@hidden> writes:

> Dan Davison <address@hidden> writes:
>
> Hi Dan,
>
>> It seems that file-exists-p sometimes requires
>> `tramp-cleanup-connection' to be executed in order for its return value
>> to be reliable. Specifically, if I create the file in a way that tramp
>> does not know about, then tramp may report that the file does not
>> exist when it does[1].
>>
>> I am using 
>>
>>        (if (file-remote-p default-directory)
>>         (tramp-cleanup-connection default-directory))
>>
>> to accomplish this cache flushing. Is it reasonable to pass the
>> connection as string to tramp-cleanup-connection like that? Or should I
>> create the argument in some different way? Or is there a different way
>> to ensure that file-exists-p reports the correct answer?
>
> `tramp-cleanup-connection' is too heavy, because it also disconnects the
> remote host. Reestablishing the connection is expansive, compared with
> basic file operations.
>
> What you need is just flushing the file cache. Something like
>
>   (if (file-remote-p default-directory)
>       (with-parsed-tramp-file-name default-directory nil
>         (tramp-flush-directory-property v "")))
>
> With Tramp 2.1.19, released recently, this isn't needed anymore. File
> cache flushing is applied in `tramp-handle-process-file', the working
> horse for all synchronous remote process calls.


Thanks Michael. That's, as always, very helpful.

Dan

>
>> Thanks,
>>
>> Dan
>
> Best regards, Michael.



reply via email to

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