Re: [PATCH] Add support for ~/foo style relative paths

Subject: Re: [PATCH] Add support for ~/foo style relative paths

Date: Fri, 01 Nov 2024 17:13:08 +0200

To: notmuch@notmuchmail.org

Cc:

From: Tomi Ollila


On Fri, Nov 01 2024, David Bremner wrote:

> "Ralph Seichter" <ralph@ml.seichter.de> writes:
>
>> Mind you, I don't object to being able to reference other users' home
>> directories. I just don't quite see how useful that ability would be,
>> given the private nature of email. Am I missing an obvious usecase here?
>
> I don't see an obvious use case either, I'm just thinking about user
> expectations and error reporting.

$ man dash | grep -B3 -C5 'tilde expansion'

  Tilde Expansion (substituting a user's home directory)
       A  word beginning with an unquoted tilde character (~) is sub‐
       jected to tilde expansion.  All the characters up to  a  slash
       (/)  or  the end of the word are treated as a username and are
       replaced with the user's home directory.  If the  username  is
       missing (as in ~/foobar), the tilde is replaced with the value
       of the HOME variable (the current user's home directory).

IMO only deviation from this can be *not* supporting ~user. ~foo
expanding as ${HOME}foo is inconsistent and unexpected...

Tomi

PS. did you know that e.g. ssh does not expand ~ -> getenv("HOME"),
but reads the real directory from passwd database.

PPS. bash(1) also expands ~+ as $PWD and ~- as $OLDPWD (and zsh(1)),
     again I suggest *not* supporting these (either ;D):
  $ bash -c 'echo ~+'
  /home/too/vc/ext/notmuch
  $ bash -c 'echo ~+/a-dir'
  /home/too/vc/ext/notmuch/a-dir
  $ bash -c 'echo ~+snafu'
  ~+snafu
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: