JD Smith <jdtsm...@gmail.com> writes: Hi,
> OK I believe I’ve cracked it. Great! > And, at long last, HERE we see the problem, in > `tramp-compat-temporary-file-directory': > > (eval (car (get 'temporary-file-directory 'standard-value)) t)) > > Why is this an issue? That standard value of > `temporary-file-directory' contains, for 'darwin systems: > > (shell-command-to-string \"getconf DARWIN_USER_TEMP_DIR\")))) When I wrote tramp-compat-temporary-file-directory, I didn't expect an external process is spawned. But I don't use macOS ... > One thing I don’t understand is why tramp needs to re-evaluate the > standard value of the variable `temporary-file-directory’ at all. > That variable doesn’t appear to change on remote hosts, or ever > really. What does change is the returned result of the > identically-name function `temporary-file-directory’. Tramp needs a trustworthy value on the local host. There were bug reports, that this variable got another value, somewhere else (even remote!), which has broken Tramp. That's why I have introduced this defsubst. > A quick fix for me was simply to (see FIXED timing, below): > > (defsubst tramp-compat-temporary-file-directory () > "Return name of directory for temporary files. > It is the default value of `temporary-file-directory'." > temporary-file-directory) I have fixed this slightly different: I've changed the defsubst to a defconst. All callees need to be changed, but that's simple. Will be available with next Tramp 2.5.1.3, roughly in a week. > I note that this remains an issue in Emacs 28.1 and Tramp v2.5.1.2. Yes, there are still discrepancies in my tests (I'm running GNU/Linux), mainly in tramp-sh-handle-expand-file-name: Running on "/" read-file-name-default 1 0.866070978 0.866070978 completing-read 1 0.864735142 0.864735142 completion-file-name-table 21 0.7882453620 0.0375354934 ... Running on "/ssh::" read-file-name-default 1 6.540671391 6.540671391 tramp-sh-handle-expand-file-name 408 4.9722099110 0.0121867889 completing-read 1 1.586810819 1.586810819 completion-file-name-table 21 1.3919740299 0.0662844776 ... So there is still something to be investigated in tramp-sh-handle-expand-file-name. But since this is the test case we have started on a remote default-directory, it might be OK. At least the time for tramp-sh-handle-expand-file-name is not cumulated in completing-read. Will see. > Thanks for your help with this (and as always, for Tramp, which is > unique and incredibly useful). I have to thank for your investigation and patience. I wouldn't find it ever, because I have no macOS. > Best, > JDS Best regards, Michael.