[PATCH] stat: reformat quoted file names

Denys Vlasenko vda.linux at googlemail.com
Sat Jun 12 20:02:31 UTC 2010


On Saturday 12 June 2010 17:45, Seb wrote:
> Hello,
> 
> I noticed that the stat "quoted filename with dereferenced symbolic link" format
> significantly differs with the GNU implementation (in "_install/" is the Busybox
> implementation):
> 
> $ _install/bin/stat /dev/cdrom
>   File: "/dev/cdrom -> hdb"
>   Size: 3               Blocks: 0          IO Block: 4096   symbolic link
> Device: ch/12d  Inode: 5325        Links: 1
> Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
> Access: 2010-06-12 16:21:31.000000000
> Modify: 2010-06-12 18:21:28.000000000
> Change: 2010-06-12 18:21:28.000000000
> 
> $ /bin/stat /dev/cdrom
>   File: `/dev/cdrom' -> `hdb'
>   Size: 3               Blocks: 0          IO Block: 4096   symbolic link
> Device: ch/12d  Inode: 5325        Links: 1
> Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
> Access: 2010-06-12 17:23:51.278714942 +0200
> Modify: 2010-06-12 18:21:28.187900425 +0200
> Change: 2010-06-12 18:21:28.187900425 +0200
> 
> $ _install/bin/stat -c "%N" /dev/cdrom
> /tmp -> /dev/shm
> 
> $ /bin/stat -c "%N" /dev/cdrom
> `/dev/cdrom' -> `hdb'
> 
> As most of the scripts that rely on the stat output will certainly expect a GNU
> stat fashion, maybe it would be a good idea to follow this one.
>
> 
> To help in this way, I tried to make a patch (in attachment). It seems to work,
> but my C skill does not allow me to be sure of anything, so probably there is
> better code to do if you find the suggestion acceptable. :)

Applied with some edits.

Busybox consistently uses 'string' instead of `string' quoting in messages.
In the font I use, ` and ' look entirely different (they aren't
mirror images of each other).

Thus I used this style here too.
-- 
vda


More information about the busybox mailing list