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: Bakul Shah
Subject: Re: nmh 1.8RC2, xlbiff, and $HOME
Date: Tue, 31 Jan 2023 08:49:36 -0800

On Jan 31, 2023, at 8:32 AM, Ralph Corderoy <ralph@inputplus.co.uk> wrote:
> 
> Hi Ken,
> 
>>> So an unset HOME is allowed by this function, it's an empty HOME
>>> which isn't.
>> 
>> It strikes me as strange that there is a difference between an unset
>> HOME and an empty HOME in terms of behavior.  I mean, yes, I can see
>> how the code is written, the historical precedent and how we got here,
>> but ... well, I'm trying to understand the justification for treating
>> those differently.
> 
> A non-empty HOME is clear; its content should be used.
> 
> An unset HOME is clear; it cannot be used.
> There's a ready fallback, getpwuid(3) and pw_dir so use that.
> 
> What's the intent of an empty HOME?
> Is it set by accident when it's meant to be unset?
> Is it empty by accident when it's meant to be non-empty?
> Do they want HOME=/, HOME=$PWD, or are they expecting it to error.
> Any choice could be not what the user intended so exit.

FWIW, this is how /bin/sh behaves on FreeBSD:

$ cd /tmp
$ sh -c 'cd; echo $PWD'
/home/bakul
$ unset HOME
$ sh -c 'cd; echo $PWD'
cd: HOME not set
/tmp
$ HOME=/bin sh -c 'cd; echo $PWD'
/bin
$ HOME='' sh -c 'cd; echo $PWD'
/tmp
$ HOME='foo' sh -c 'cd; echo $PWD'
cd: foo: No such file or directory
/tmp



reply via email to

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