Subject: bug#19218: Inconsistent spacing of output of "ls --full-time [file argument]"

From: "Michael Salem" <[email-masked]>
Date: Wed, 03 Dec 2014 12:49:02 +0000

To wrap up: I reported inconsistent output format from ls as a bug; 
others have made informative comments, to the effect that the output 
format of ls is not specified in detail so there is no program error; 
it is user error. I think the essential points are, going from the 
general to the particular:

1. Don't rely on undocumented behaviour in general.
2. If you do rely on undocumented output format, you're less likely 
to have trouble using whitespace as a delimiter rather than rely on 
absolute character positions. (In my particular case whitespace would 
have been OK, although it's been pointed out that ls date format, 
which I was assuming, is not guaranteed anyway, and ls is not the 
appropriate tool.)
3. The output format of ls depends upon its content, in particular it 
adjusts the lengths of all lines according to the longest one, so it 
is not incorrect for runs of ls which would produce overlong lines to 
eliminate some space characters. Thus, the line for file cp in /etc, 
in the output of <ls --full-time cp> can legitimately be spaced 
differently than for a listing of all the files in the directory, 
some of them with long names.

I wouldn't have distributed a script like the one I was trying to use 
without more care, but had thought it would be safe when using the 
same version of ls on the same system, and always in the same 
directory!

Thanks to all, and I hope this conversation might be of use to anyone 
repeating my mistake.