Re: [PATCH] tools: make virt-pki-validate work with acls and xattrs

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

 



On 05/31/2012 05:57 AM, Philipp Hahn wrote:
> Hello,
> 
> I find parsing the output of "ls -l" very suspect and fragile,

As do I.

> since its 
> output heaviely depends on the environment: SELinux, ACLs,

That only affects the 11th character, which we are stripping.

> locale.

That affects the date string and other elements later on in the line,
but not the mode string.

This _particular_ use of 'ls -l' is portable, as POSIX guarantees a
consistent interpretation of the first 11 bytes of each line (it's not
until later in the line that you indeed run into fragile parsing
aspects, even under POSIX rules).

> Perhaps using /usr/bin/stat would be better, but I don't know how 
> available /usr/bin/stat" is on non-Linux-platforms (on my Debian system it's 
> in coreutils).

I agree that stat(1) would be safer, but it is less portable, and we
want this validation script to run everywhere.

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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]