[PATCH] su: support numeric UIDs with a -n flag

Ben Fuller ben at bvnf.space
Tue May 10 16:48:06 UTC 2022


On Tue, May 10, 2022 at 15:12:31 +0000, Laurent Bercot wrote:
>  As much as I understand and sympathize with your plight - I'm the
> first one to complain about the low quality of "traditional" low-level
> userspace on Linux - I don't think your approach is the right solution.
> "su" has - more or less - a known interface, and is - more or less -
> usable on every distribution; a script using su will generally be
> portable from one distro to another.

Across Linux, this is mostly true, but across *NIX, there is less
compatibility - the BSDs have a very different -c, for example.

>  Only use existing tool names when you provide an interface that's
> exactly compatible with the existing tool; else you will weaken the
> reach and usefulness of the tool. If you need new functionality,
> implement the functionality as a separate tool, that can take
> inspiration from the existing tool for its name and interface, but
> you should call it ben-su rather than su. Introducing a divergence
> in busybox su is harmful in the long run.
> 
> (This is why GNU coreutils is so difficult to replace: it has
> embraced and extended, and now the world is full of scripts relying
> on cp --useless-options that every potential replacement has to
> implement.)

I very much agree with your points here, you've convinced me. In any
case, it's a lazy way out. I think the better solution is to write a
non-portable utility specifically for our use-case, and as you said,
to avoid naming it similarly to existing tools.

Thanks,

Ben


More information about the busybox mailing list