On 04/28/2015 03:59 AM, Pádraig Brady wrote: >>> The output from du shall consist of the amount of space allocated >>> to a file and the name of the file, in the following format: >>> >>> "%d %s\n", <size>, <pathname> >>> >>> Instead, GNU du uses "%d\t%s\n", i.e., a tab character as delimiter, >>> even if POSIXLY_CORRECT is set. >>> >>> Do I read POSIX right? >> >> No, the space stands for any (positive) amount of white space. >> >> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap05.html#tag_05 >> >> Andreas. >> > > Thanks for pointing that out Andreas. > So a ' ' in a format implies any amount of blank chars.
Correct. > So we could separate the du columns with spaces rather than tab, Yes, I'd prefer that we did that. It is much easier to guarantee alignment when using spaces and completely avoiding whatever tab stops people have set up. > though that would almost definitely introduce a compatibility issue, > and would be inconsistent with Solaris and FreeBSD at least. POSIX is already clear that anyone parsing for literal tabs is broken when trying to parse du output. The only safe way to parse du output is to break on all whitespace (the way awk already does). I'm 70-30 in favor of changing to spaces. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
