Re: [BUG] inconsistent user context handling w/ tramp

Subject: Re: [BUG] inconsistent user context handling w/ tramp

Date: Sat, 02 Mar 2013 14:50:19 -0400

To: Simon Campese, notmuch@notmuchmail.org

Cc:

From: David Bremner


Simon Campese <notmuchmail_org@campese.de> writes:

> Hello,
>
> after using tramp to open a file using the 'su' or 'sudo' protocol as
> user X, the next time I run 'compose-mail' to compose a message it
> apparently looks in the home directory of user X for its config file,
> mail directory etc. In the compose window, I get the error message
>
> 'Error reading configuration file $X_homedir/.notmuch-config: No such
> file or directory'
>
> in all header fields (From, Fcc etc.) that should be filled by notmuch
> ($X_homedir  is the home directory of user X from above).
>

I don't think this is specific to notmuch. Notmuch uses the HOME
environment variable to locate it's configuration file, and tramp is
modifying this environment variable. 

To verify this:

Start emacs with "emacs -Q"
open a file use /su:user_@localhost:filename
run M-! (or M-x shell-command) echo $HOME

you will see that the variable is changed to the home directory of
user_x.

If you think this behaviour of tramp is wrong (I didn't think through
all the implications), then you could file an emacs bug.

Do you see this behaviour when running compose-mail from a buffer that
is not a tramp buffer?

All that said, the patches of 

     mid:2f89028f7986f67792478f1728ca1f1fdd382d3c.1359495450.git.jani@nikula.org

could be used to work around this "feature" of tramp.  In fact since
they were stalled a bit waiting for a convincing use case, maybe your
report will help get them into notmuch more quickly.

Someone would still have to modify the emacs client side code, but at
least conceptually I don't think that would be difficult.

d

PS: all my tests where with Emacs 24.2.1



Thread: