coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octal file permissions in ls


From: Eric Blake
Subject: Re: Octal file permissions in ls
Date: Mon, 18 Mar 2013 12:57:50 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4

On 03/18/2013 10:43 AM, Sakse Dalum wrote:
> Hi there,
> 
> I recently found myself wanting ls to show file permissions in octal format, 
> so
> I decided to implement the feature. Being somewhat unfamiliar with C coding 
> and
> C coding standards in particular, I've hunched my way through the 
> implementation
> method, but seeing that it's only a few lines of code, it shouldn't break
> anything as far as I can see.
> 
> Anywho, I've attached a diff to this mail, which may or may not be applicable 
> to
> the most recent version (I just did an apt-get source in Trisquel 6.0 to get 
> the
> source for coreutils).

Thanks for the attempt.  We prefer patches against libvirt.git; for more
information, read the HACKING file in the sources that you downloaded.

> --- 846,852 ----
>     {"block-size", required_argument, NULL, BLOCK_SIZE_OPTION},
>     {"context", no_argument, 0, 'Z'},
>     {"author", no_argument, NULL, AUTHOR_OPTION},
> +   {"octal", no_argument, NULL, 'O'},

We are reluctant to burn short option letters in 'ls' without REALLY
GOOD JUSTIFICATION.  Good justification includes another existing
implementation, such as BSD or Solaris, that has already burned -O for
the same usage.

A new long option might be okay, although this is one particular case
where post-processing 'ls -l' output might be just as easy to do, and is
more portable because it can be done with existing tools instead of
waiting for your new option to hit distros for all the machines you like
to use.  I'm probably 80-20 against including even a new --octal
operation in ls, since it seems like a bit of a corner case usage, and
since the existing stat(1) utility in coreutils already provides this
information.

$ stat -c %a HACKING
664
$ ls -l HACKING
-rw-rw-r--. 1 eblake eblake 24005 Jan 26 04:08 HACKING

If we do decide to take your addition, it would be a new feature, so it
would be incomplete without a testsuite addition to prove that it works
right, and with a coreutils.texi and NEWS addition mentioning the
improvement.  All told, by the time you add all these, your contribution
would be non-trivial, and would require FSF copyright assignment.  Is
this still something you are interested in pursuing?

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]