On 1/10/20 7:45 PM, Denys Nykula wrote:
> On Thu, Jan 09, 2020 at 08:24:05PM -0600, Rob Landley wrote:
>> On 1/9/20 12:02 AM, enh wrote:
>>> it looks like debian says /nonexistent for ~nobody, and macOS says
>>> /var/empty. so that's probably good enough for non-Android? oh, but
>>> ~root works on macOS too anyway --- /var/root.
> 
> Gentoo's default ~nobody is /var/empty like on macOS, worth mentioning I 
> think.
> /nonexistent might be Debian-specific.

I need to test the "~ with no name" codepath that gives $HOME, and the "~name"
codepath that does a getpwnam(). Beyond that I don't have a strong opinion about
which users to test, I just need to be able to check it gave an expected result.

>> The problem is not knowing what to compare the string against. And yes, I'll
>> need to test for macos here too so it knows to expect /var/root, but 
>> according
>> to tests/du.test that's just "$(uname) == Darwin"... except the above test 
>> for
>> not having an /etc/passwd with :root: in it may also trigger on MacOSX 
>> (dunno),
>> so I should probably go back to the previous test.
> 
> Could you test -e /var/root in this case instead of uname? I have Linux 
> systems
> with /var/root, though this one isn't a Gentoo thing, just local.

How about just:

  for i in /root /var/root /; do [ -e $i ] && EXPECT=$i && break; done

Rob
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to