[libvirt] [PATCH] tools: make virt-pki-validate work with acls and xattrs
Eric Blake
eblake at redhat.com
Thu May 31 14:51:25 UTC 2012
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 at redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120531/c7858e40/attachment-0001.sig>
More information about the libvir-list
mailing list