On Wed, Jan 8, 2020 at 3:32 PM Rob Landley <[email protected]> wrote: > > Hello from Tokyo. > > I'm shoveling my way through shell variable expansion, and I've implemented 3 > of > the 8 types so far (tilde expansion, bracket expansion, and quote removal), > and > I'm adding tests/sh.test entries for each, and I've come to this one: > > echo {~,~root}/pwd > > And I'm going... ok, I can get away with just saying ~ and comparing it with > $HOME (which I did in the previous two tests), but if I want an actual > username, > the only one guaranteed-ish to be on the system is "root". But though root's > home directory has been "/root" on every Linux distro I've used for the past > decade, it's not actually _required_ by anything?
yeah, and it's just / for all users on Android, and /data for all uids that correspond to apps (which is: all uids >= 10000). > No, posix doesn't require a root user to exist, because Microsoft and IBM > sabotaged it. Back during the cold war, the US federal government required > Unix, > C, and Posix compatibility for all its systems in Federal Information and > Processing Standard 151 (http://www.opengroup.org/testing/fips/) meaning even > Apple came out with Unix for the Mac (https://youtu.be/nwrTTXOg-KI) and thus > having certified posix compatibility was _required_ to get big lucrative > government contracts... so Microsoft and IBM got seats on the Posix committe > and > sabotaged it as much as possible to so they could declare NT and S/360 posix > compatibile via half-assed "compatibility layers" > (https://en.wikipedia.org/wiki/Microsoft_POSIX_subsystem) even though NT > didn't > have the concept of more than one user (which is why your word processor was > allowed to format the hard drive). > > Anyway, Android _also_ doesn't have user accounts, because they used the UID > mechanism to separate apps (each app running as a different UID) back before > thhey started spraying the system down with SELinux everywhere. (Because > Android > shipped in 2007 and container infrastructure didn't start seriously going into > the kernel until around 2010, and was properly _usable_ about 5 years after > that.) > > Anyway, tl;dr: ~root isn't guaranteed to expand to /root but nothing _else_ is > likely to consistently expand to anything, and I wanna write tilde expansion > tests. Suggestions? slap in another of our "wait, is this Android?" checks and skip this test there? `[ $(id -u shell) -eq 2000 ]` would be an appropriately uid-themed check. > Rob > _______________________________________________ > Toybox mailing list > [email protected] > http://lists.landley.net/listinfo.cgi/toybox-landley.net _______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
