Re: [PATCH] config: Expand ~ to $HOME

Subject: Re: [PATCH] config: Expand ~ to $HOME

Date: Wed, 11 May 2016 23:16:39 +0300

To: David Edmondson, Bijan Chokoufe

Cc: notmuch@notmuchmail.org

From: Tomi Ollila


On Wed, May 11 2016, David Edmondson <dme@dme.org> wrote:

> On Wed, May 11 2016, Bijan Chokoufe wrote:
>
>> so what would be the spec for handling ~user?
>
> Look up "user" in the password file and replace "~user" with their home
> directory. See getpwnam().
>
>> As Tomi pointed out ~foo will point to different folders if set by user
>> 'foo' or by user 'bar'.
>
> ~foo means "the home directory of user foo", independent of who is using
> it, so it will be the same when used by both user foo and user bar.
>

3 things more if you're cooking new patch

1) use git send-email -- then it is easier to apply.

2) on talloc() use config instead of NULL to lessen unfreed memory
   at program exit

3) talloc_free() old config->database_path and set it to point the new
   value.

Tomi



>> To what folder should it point and where do I get this information?
>>
>> David Edmondson <dme@dme.org> schrieb am Di., 10. Mai 2016 um 10:22 Uhr:
>>
>>> On Mon, May 09 2016, Bijan Chokoufe Nejad wrote:
>>>
>>> >> ~user is ~ in case you're 'user' -- except that now that I think of it
>>> >> ~user could read home directory from /etc/passwd and not using $HOME.
>>> >> If you're 'eve', then ~alice should definitely be different than ~
>>> >
>>> > OK I see. I never used ~user instead of ~ and don't see any advantage in
>>> using
>>> > ~user but good to know it's there.
>>>
>>> A solution that supports ~ but not ~user seems incomplete.
>>>

Thread: