If I run the command:
install -d -m 755 /some/directory/to/create
then I just expect a directory to be created. Whether I run it as root or as myself.
This is what GNU install does.
However, Rust install does something different, but only when run by root (or rather, when it thinks the effective uid is root)
Having created the directory it chowns it to 0:0.
This breaks code running under pseudo (such as OpenEmbedded Yocto builds).
The culprit is likely to be chown_optional_user_group(), which hasd this code:
// Determine the owner and group IDs to be used for chown.
let (owner_id, group_id) = if b.owner_id.is_some() || b.group_id.is_some() {
(b.owner_id, b.group_id)
} else if geteuid() == 0 {
// Special case for root user.
(Some(0), Some(0))
} else {
// No chown operation needed.
return Ok(());
};
That "Special case for root user" looks more like "Screw-up for root user"