[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tramp-cache and destructive operations
From: |
Michael Albinus |
Subject: |
Re: tramp-cache and destructive operations |
Date: |
Wed, 12 Aug 2015 21:09:00 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Jürgen Hötzel <address@hidden> writes:
> Hi,
Hi Juergen,
> As a workaround I use `copy-sequence' in
> `tramp-adb-handle-directory-files-and-attributes'.
> But this is not a generic solution. Should tramp-cache be modified to
> always return a copy of lists?
tramp-cache does not care about the object you cache. Often, it is not a
list but a simple value, like a string.
If you cache a list, the hash keeps just the entry to that list. If you
use that list, and it is modified somewhere else, it is not the duty of
tramp-cache to prevent this.
So yes, using `copy-sequence' in
`tramp-adb-handle-directory-files-and-attributes' seems to be TRT.
Another approach could be to change the implementation and to cache
another list, which is used then to assemble the result of
`tramp-adb-handle-directory-files-and-attributes'. See the cache entries
when evalling `tramp-handle-directory-files-and-attributes', which uses
the cache entry for "file-name-all-completions", IIRC.
> Thanks,
>
> Jürgen
Best regards, Michael.