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

2013-04-21 Thread Felix Janda
On 04/21/13 at 12:09am, Rob Landley wrote:
 On 04/19/2013 05:28:27 PM, Felix Janda wrote:
  [snip]
  The functionality of get_access_str() is also implemented in the ls  
  toy
  (likely much better). Should something like it be in the library?
 
 Once code can be shared by a second command, putting it in lib makes  
 sense.
 
  Actually since stat and ls are both frontends to the stat system call
  more is duplicated.
 
 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.

 I note that I have a pending todo item in ls: ls -l /dev/null doesn't  
 show the major/minor numbers. (Oops. Needs another output mode for  
 device nodes. If I did one, it's not triggering right...)

Ok.

  I also wonder whether toybox will ever have SELinux support... My  
  local
  man page does even not document the -Z option to stat.
 
 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)?

Removing these the only thing that Needs to be implemented is %T for
file systems i.e. file system type in human readable form. So to
implement this one would need to find names for the magic numbers in
linux/magic.h.

(Interesting:

#define XENFS_SUPER_MAGIC   0xabba1974

But fortunately no deadbeef.)

Should %T be implemented?

Apart from this I think everything using only the information from
stat/statfs should be implemented (like %t %T for devices). Then there
are %w and %W, which regard file birth time, and for which one would
need an xstat system call... (

https://lwn.net/Articles/397442/

says something about file birth times and links to an article on xstat.)

Felix
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net


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

2013-04-21 Thread Rob Landley

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...



 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.

Rob
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net