Nightly: su breaks

After tinkering with Haiku nightly, I discovered an odd behavior with su. Steps to reproduce:

  1. Launch a Terminal GUI.
  2. Run su vagrant or similar, to temporarily lose root privileges.
  3. Within the su vagrant context, run su user -c 'pkgman refresh'.


su refreshes the repository data.


su silently fails to escalate privileges to user-level permissions, resulting in the pkgman refresh command erroring with *** request for refreshing repository "Haiku" failed : Initialization failed

The su help message describes the command line syntax as usage: su [-pl] [-c command] [username], so I also tried su -c 'pkgman refresh' user, in case su was really expecting usernames to appear after the command, but I get the same behavior either way.

The larger goal I’m trying to accomplish is to integrate Haiku into a Vagrant virtual machine, which typically expects a vagrant user account. Funny that alpha 4 was able to use multiple accounts more easily. Ah well, I think I may just stick with the single user account for Haiku nightly, since su broke somehow.

Haiku alpha 4 used coreutils su, which has since been deprecated, so I wrote a new su. I recall at the time I could only partially test it since there was another bug breaking setgid altogether, but that has since been fixed. If you file a ticket and assign it to me, I’ll probably have time to look in the next month or so.