nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nmh 1.8RC2, xlbiff, and $HOME


From: Robert Elz
Subject: Re: nmh 1.8RC2, xlbiff, and $HOME
Date: Tue, 31 Jan 2023 06:51:52 +0700

    Date:        Mon, 30 Jan 2023 16:11:26 -0500
    From:        Ken Hornstein <kenh@pobox.com>
    Message-ID:  <20230130211131.8E81D1DF5BA@pb-smtp20.pobox.com>

  | Alexander does point out that HOME is supposed to be
  | valid according to POSIX,

That's actually not correct, all the text quoted requires is that
HOME be set at login time - nothing at all about what can be done
with it after that.

Further POSIX reading will also find, in the description of ~ expansion in
the shell (XCU 2.6.1 in Issue 7 TC2 - the current version from 2018):

        If the login name is null (that is, the tilde-prefix contains only
        the tilde), the tilde-prefix is replaced by the value of the variable
        HOME. If HOME is unset, the results are unspecified.

which clearly allows the possibility that HOME not be set (which in this
case makes the result of the ~ expansion unspecified, because some shells
look up the password file, and use the home directory field from there,
others give an error, perhaps others just use "" - but that is irrelevant
to the question of whether HOME is required to be unset.)   Setting HOME=''
isn't even mentioned: in that case ~/foo expands to /foo (which is actually
what you want, HOME=/ might (should, by a strict reading of the standard)
result in //foo which is an unspecified path).

Similarly, in XCU 4 in the description of the cd utility:

     1. If no directory operand is given and the HOME environment variable
        is empty or undefined, the default behavior is implementation-defined
        and no further steps shall be taken.

Again, HOME being unset is allowed there, this time with implementation-defined
results (which just means the implementation must say what happens in the
doc).

Running with HOME unset is not even all that unusual, "env -i command"
results in that - I do almost all builds that way, to ensure that nothing
in my local environment, or home directory, affects the results, so they
will be repeatable.

But I agree that a relative Path in MH should be relative to HOME (and
I'd even retain: relative to / if HOME is not set, which it can be when
there as been no login - like when you're in single user mode).

I'd also suggest never issuing errors because the user's environment isn't
like we think it ought to be, unless that actually prevents something
functioning as intended.

kre





reply via email to

[Prev in Thread] Current Thread [Next in Thread]