[Toybox] [Aboriginal] aboriginal linux

Isaac Dunham ibid.ag at gmail.com
Sun Sep 28 14:05:02 PDT 2014


On Sun, Sep 28, 2014 at 11:36:11AM -0500, Rob Landley wrote:
> Redirected to the toybox list, where I have a pending message to reply
> to on this topic already...
> 
> > Long ago I developed a strong dislike for the library emulating features when GNU's glibc emulated aio by helpfully making my program multi-threaded and hijacking signals.
> 
> You think that's bad, dalias decided that implementing AT_EACCESS
> required spawning a new process for every system call. (setfsuid()
> exists, thanks to the samba guys, but apparently doesn't apply here. No
> idea why.)

man 2 setfsuid says that 

       The system call setfsuid() changes the value of the caller's filesystem
       user ID--the user ID that the  Linux  kernel  uses  to  check  for  all
       accesses to the filesystem.  Normally, the value of the filesystem user
       ID will shadow the value of the effective user ID.  In  fact,  whenever
       the  effective  user ID is changed, the filesystem user ID will also be
       changed to the new value of the effective user ID.

       Explicit calls to setfsuid() and setfsgid(2) are usually used  only  by
       programs such as the Linux NFS server that need to change what user and
       group ID is used for file access without a corresponding change in  the
       real and effective user and group IDs.

Reading the last sentence of the first paragraph, it would seem to be
implied that AT_EACCESS is actually the default behavior...
which I somehow find surprising.

But calling setfsuid would have some side-effects if the filesystem uid
is not what is expected.

> > I found your workaround of multiple -e clauses simpler and easier to read, than the alternation "\|" but back in 1986 when I was learning about grep maybe it was more primitive, but even now I like the simple answer better.
> 
> I didn't follow that bit. Toybox grep implements multiple -e clauses by
> gluing them together with \| (which means that unbalanced parentheses
> can have unexpected results, but doing that is an error _anyway_, so...)

Perhaps the first part is in response to the sed workaround in single.sh?
 

Anyhow, an alternate proposal for how to handle rm -rf:
Try deleting files, and handle errors by the chmod path if errno == EPERM.

Is there a reason not to do this?

Thanks,
Isaac Dunham

 1411938302.0


More information about the Toybox mailing list