[Toybox] [CLEANUP] [PATCH] stat: Some cleanup

Felix Janda felix.janda at posteo.de
Mon Apr 22 14:27:56 PDT 2013


On 04/21/13 at 11:30pm, Rob Landley wrote:
> On 04/21/2013 04:40:16 PM, Felix Janda wrote:
> > > If you can come up with a clean way to share the code, go for it.
> > 
> > Ok, actually I'd only put something like get_access_str() of stat into
> > the lib.
> 
> Cool. Although a quick glance at the one in stat implies it doesn't  
> handle the fun combinations of "suid and sgid bits without  
> corresponding executable bit when applied to a directory so it's the  
> sticky bit" that I had to make work in ls.
> 
>    stat /dev/null
>    stat /tmp
> 
> So if you actually need that behavior you'll need the blob of ls  
> starting around line 340...

The only thing get_access_str() printed apart from the permissions was
whether it's a directory or not. But I'm very certain that it should be
identical to ls. Thanks for the pointer to the relevant part of ls,
attached is a patch moving it into a library function.

> > > I'm leaning against it. If you saw my toybox talk at ELC (it's on
> > > youtube) I talked about security approaches and containers vs  
> > selinux.
> > 
> > I anticipated that (and read your outline and skimmed the video). So  
> > it
> > would be ok to remove the SELinux parts from the command (which anyway
> > only say that they are not implemented)?
> 
> Yes.
> 
> > Should "%T" be implemented?
> 
> I'd wait for somebody to complain about its absence.

I like that approach. Attached is another patch removing unimplemented
options/formats and doing a bit of cleanup (mainly of the help text,
which has some resemblance with the GNU manual page).

Felix
-------------- next part --------------
A non-text attachment was scrubbed...
Name: format-mode.patch
Type: text/x-patch
Size: 3963 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20130422/973af648/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stat-help.patch
Type: text/x-patch
Size: 9163 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20130422/973af648/attachment-0001.bin>


More information about the Toybox mailing list