[Toybox] [landley/toybox] install -d -o USER -g GROUP DEST doesn't set uid/gid (#105)

Rob Landley rob at landley.net
Sat Nov 17 10:28:32 PST 2018


On 11/1/18 5:07 PM, Volodymyr Medvid wrote:
> "install -d" doesn't honor custom uid/gid.
> install_main returns early if (flags & FLAG_d), doing mkpathat without fchown.

Hmmm... I just pushed a patch to that, but it's not quiet right.

When calling lchown() it does xgetuid() and xgetgid() for the default values
you're not overriding (when you have -o or -g but not both). Technically that
should be the fsuid, but although there's a setfsuid() I can't find a _getfsuid()_?

Man 7 capabilities is uninformative. And I still dunno what the point of suid
is. (We added real and effective, but programs know to look for both of those
know and freak if they're different! Let's add /opt and start sticking files in
there, then we'll need /opt/usr for when people start to expect it!)

Sorry, that's another rant:

  http://lists.busybox.net/pipermail/busybox/2010-December/074114.html

(Which I got slightly wrong: the / disk was half a megabyte, the rk05 disk packs
were 2.5 megabytes each. Still adds up to 3 megabytes though. Primary sources
are https://www.bell-labs.com/usr/dmr/www/notes.html and
https://www.bell-labs.com/usr/dmr/www/hist.html)

Anyway, install -d does what you expect now, UNLESS you run it in a context
where you've changed fsuid (which was implemented for samba, so the server could
read/write files as different users without having to fork and run entirely _as_
those users). That would be ignored on the last path component, but not the ones
before it.

Let me know if anybody comes up with a proper fix. :)

Rob



More information about the Toybox mailing list