GNU bug report logs -
#54001
29.0.50; abbreviate-file-name has side-effects
Previous Next
Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>
Date: Mon, 14 Feb 2022 17:22:02 UTC
Severity: normal
Found in version 29.0.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 54001 in the body.
You can then email your comments to 54001 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
mail <at> daniel-mendler.de, monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org
:
bug#54001
; Package
emacs
.
(Mon, 14 Feb 2022 17:22:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
New bug report received and forwarded. Copy sent to
mail <at> daniel-mendler.de, monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org
.
(Mon, 14 Feb 2022 17:22:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Package: Emacs
Version: 29.0.50
Since:
commit bf505a63f98ed61934a8fb81ec65c96859606b6e
Author: Jim Porter <jporterbugs <at> gmail.com>
Date: Mon Nov 15 13:33:07 2021 +0100
Support abbreviating home directory of Tramp filenames
`abbreviate-file-name` has significantly changed in its behavior:
- it's slower (because it goes through file-name-handlers)
- it can have very visible side effects like prompting the user for a password.
I haven't measured the slowdown, so I'll assume it's acceptable, but
asking for a password (or contacting a remote host) is not.
I suggest we take a step back and think of how to get that feature
without having to contact any remote host during `abbreviate-file-name`.
Maybe we can do that by making Tramp opportunistically add entries to
`directory-abbrev-alist` when it performs expansion?
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#54001
; Package
emacs
.
(Mon, 14 Feb 2022 17:53:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 54001 <at> debbugs.gnu.org (full text, mbox):
On 2/14/2022 9:19 AM, Stefan Monnier via Bug reports for GNU Emacs, the
Swiss army knife of text editors wrote:
> Package: Emacs
> Version: 29.0.50
>
>
> Since:
>
> commit bf505a63f98ed61934a8fb81ec65c96859606b6e
> Author: Jim Porter <jporterbugs <at> gmail.com>
> Date: Mon Nov 15 13:33:07 2021 +0100
>
> Support abbreviating home directory of Tramp filenames
>
> `abbreviate-file-name` has significantly changed in its behavior:
> - it's slower (because it goes through file-name-handlers)
> - it can have very visible side effects like prompting the user for a password.
>
> I haven't measured the slowdown, so I'll assume it's acceptable, but
> asking for a password (or contacting a remote host) is not.
Sorry about that. I did what I could to minimize the slowdown (including
some more general optimizations to make Tramp faster). There are some
benchmarks in the original bug here (these are with 1000 iterations;
you'll want to compare the first section with the last):
<https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-11/msg01293.html>.
> I suggest we take a step back and think of how to get that feature
> without having to contact any remote host during `abbreviate-file-name`.
> Maybe we can do that by making Tramp opportunistically add entries to
> `directory-abbrev-alist` when it performs expansion?
I think Michael Albinus suggested doing that in the original bug,
although I was concerned about modifying defcustoms invisibly like that.
Is that ok to do? Another option might be to store the abbreviations for
a given file-name-handler somewhere internally and consult that when
calling that file-name-handler's implementation of `abbreviate-file-name'.
Maybe this patch should be backed out for now; it shouldn't be
interrupting the user. (I thought I'd tested that, but maybe it was on
an earlier revision of the patch.) I'll probably have time to look into
a new solution in a few weeks, but anyone else who's interested should
feel free to fix it in the meantime.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#54001
; Package
emacs
.
(Mon, 14 Feb 2022 19:49:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 54001 <at> debbugs.gnu.org (full text, mbox):
>> I suggest we take a step back and think of how to get that feature
>> without having to contact any remote host during `abbreviate-file-name`.
>> Maybe we can do that by making Tramp opportunistically add entries to
>> `directory-abbrev-alist` when it performs expansion?
>
> I think Michael Albinus suggested doing that in the original bug, although
> I was concerned about modifying defcustoms invisibly like that. Is that ok
> to do?
No it's not, but we can add a non-defcustom'd variable holding
additional entries to circumvent this problem.
> Another option might be to store the abbreviations for a given
> file-name-handler somewhere internally and consult that when calling that
> file-name-handler's implementation of `abbreviate-file-name'.
That would work as well.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#54001
; Package
emacs
.
(Mon, 14 Feb 2022 20:53:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 54001 <at> debbugs.gnu.org (full text, mbox):
On 2/14/2022 11:48 AM, Stefan Monnier via Bug reports for GNU Emacs, the
Swiss army knife of text editors wrote:
>>> I suggest we take a step back and think of how to get that feature
>>> without having to contact any remote host during `abbreviate-file-name`.
>>> Maybe we can do that by making Tramp opportunistically add entries to
>>> `directory-abbrev-alist` when it performs expansion?
[snip]
>> Another option might be to store the abbreviations for a given
>> file-name-handler somewhere internally and consult that when calling that
>> file-name-handler's implementation of `abbreviate-file-name'.
>
> That would work as well.
Looking at my original patch again, this value is already cached as a
Tramp connection property named "home-directory". If the code were
changed to set that connection property in a more-appropriate place, and
`tramp-handle-abbreviate-file-name' simply *reads* that connection
property, then I think that should resolve this issue.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#54001
; Package
emacs
.
(Mon, 14 Feb 2022 21:01:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 54001 <at> debbugs.gnu.org (full text, mbox):
> Looking at my original patch again, this value is already cached as a Tramp
> connection property named "home-directory". If the code were changed to set
> that connection property in a more-appropriate place, and
> `tramp-handle-abbreviate-file-name' simply *reads* that connection property,
> then I think that should resolve this issue.
Sounds like it,
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#54001
; Package
emacs
.
(Mon, 14 Feb 2022 21:40:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 54001 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 2/14/2022 1:00 PM, Stefan Monnier via Bug reports for GNU Emacs, the
Swiss army knife of text editors wrote:
>> Looking at my original patch again, this value is already cached as a Tramp
>> connection property named "home-directory". If the code were changed to set
>> that connection property in a more-appropriate place, and
>> `tramp-handle-abbreviate-file-name' simply *reads* that connection property,
>> then I think that should resolve this issue.
>
> Sounds like it,
I've only lightly tested this patch, but I think it should resolve the
issue. It only sets the "home-directory" connection property when a
connection is already established. Otherwise, it just uses the cached
value (if any).
Maybe there's a cleaner way to do this though; opportunistically setting
a connection property like this seems like something there might be a
special function for in Tramp, but I didn't see one after a bit of
looking so this is what I went with.
[0001-Don-t-attempt-to-connect-to-a-remote-server-during-a.patch (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#54001
; Package
emacs
.
(Mon, 14 Feb 2022 21:52:03 GMT)
Full text and
rfc822 format available.
Message #23 received at 54001 <at> debbugs.gnu.org (full text, mbox):
Jim Porter [2022-02-14 13:38:58] wrote:
> I've only lightly tested this patch, but I think it should resolve the
> issue. It only sets the "home-directory" connection property when
> a connection is already established. Otherwise, it just uses the cached
> value (if any).
>
> Maybe there's a cleaner way to do this though; opportunistically setting
> a connection property like this seems like something there might be
> a special function for in Tramp, but I didn't see one after a bit of looking
> so this is what I went with.
Thanks Jim.
Michael, I assume you'll want to take care of this patch. Let me know
if you prefer that I install it, of course,
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#54001
; Package
emacs
.
(Tue, 15 Feb 2022 08:54:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 54001 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
Hi Jim, Stefan,
>> I've only lightly tested this patch, but I think it should resolve the
>> issue. It only sets the "home-directory" connection property when
>> a connection is already established. Otherwise, it just uses the cached
>> value (if any).
>
> Thanks Jim.
>
> Michael, I assume you'll want to take care of this patch. Let me know
> if you prefer that I install it, of course,
Yes, it is OK. Please install.
>> Maybe there's a cleaner way to do this though; opportunistically setting
>> a connection property like this seems like something there might be
>> a special function for in Tramp, but I didn't see one after a bit of looking
>> so this is what I went with.
I've recently made some changes for home directories in the other Tramp
backends. Likely, I need to revise these settings once the patch has
arrived on master.
> Stefan
Best regards, Michael.
Reply sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
You have taken responsibility.
(Tue, 15 Feb 2022 13:12:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
bug acknowledged by developer.
(Tue, 15 Feb 2022 13:12:02 GMT)
Full text and
rfc822 format available.
Message #31 received at 54001-done <at> debbugs.gnu.org (full text, mbox):
> I've only lightly tested this patch, but I think it should resolve the
> issue. It only sets the "home-directory" connection property when
> a connection is already established. Otherwise, it just uses the cached
> value (if any).
Thanks, pushed to master. And closing.
Daniel, feel to ping us back if the fix isn't good enough.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#54001
; Package
emacs
.
(Tue, 15 Feb 2022 13:27:02 GMT)
Full text and
rfc822 format available.
Message #34 received at 54001-done <at> debbugs.gnu.org (full text, mbox):
On 2/15/22 14:11, Stefan Monnier wrote:
>> I've only lightly tested this patch, but I think it should resolve the
>> issue. It only sets the "home-directory" connection property when
>> a connection is already established. Otherwise, it just uses the cached
>> value (if any).
>
> Thanks, pushed to master. And closing.
> Daniel, feel to ping us back if the fix isn't good enough.
Thanks! I will if the issue comes up again.
Daniel
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 16 Mar 2022 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 154 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.