bug#23190: wc - Different output

2016-04-02 Thread Assaf Gordon

tags 23190 notabug
close 23190
thanks

Hello Seva,

On 04/01/2016 06:02 PM, Seva Adari wrote:

I am not sure if this a bug or expected behavior! Here is different output
from each run variation of wc invocation:
 wc -l test.txt Output: 20
 awk '{print $0}' /tmp/test.txt | wc -l   Output: 21
 cut /tmp/test.txt -f1 | wc -lOutput: 21

[...]


File, test.txt (attached here with) could be missing last "new line".


This is not a bug in 'wc', but the way it works (perhaps not intuitively):

'wc' does not count conceptual lines but the number of newline characters in 
the file.
Since the last file does not have a newline character (ASCII 0x10) - it is not 
counted.

The following will demonstrate:

   $ printf "hello" | wc -l
   0
   $ printf "hello\n" | wc -l
   1
   $ printf "a\nb\nc" | wc -l
   2

And 'awk' indeed automatically adds a newline when using 'print', like so:

   $ printf "a\nb\nc" | awk '{print $0}' | wc -l
   3


I'm therefore closing the bug, but discussion can continue by replying to this 
thread.

regards,
 - assaf






bug#23191: ls alignment bug

2016-04-02 Thread Seth Kushniryk
I forgot to mention that this is coreutils 8.21 in Slackware

On 01-Apr-16 19:53, Seth Kushniryk wrote:
> Hi, I've been having a minor issue with ls. It seems that sometimes the
> character 'é' (e accent aigu) causes the rest of the listing to be
> misaligned. My options are "-F -T 0".
> 
> Here is an example of me using it in my music library:
> 
> First Aid Kit/  Pink Floyd/The Who/
> Fleetwood Mac/  Queen/ Ton Koopman/
> Foreigner/  Rage Against The Machine/  Trooper/
> Frank Sinatra/  Red Rider/ U2/
> Félix Leclerc/ Rodriguez/ Van Morrison/
> George Harrison/Roy Orbison/   Whitesnake/
> Green Day/  Run-DMC/   Woody Guthrie/
> Iron Butterfly/ Rush/
> James/  Simon and Garfunkel/
> 
> Renaming the directory to "Felix Leclerc" fixes the issue. I think the
> problem is in "ls.c" in the function "quote_name", and what it sets for
> "size_t *width".
> 





bug#23190: wc - Different output

2016-04-02 Thread Seva Adari
Hello,

I am not sure if this a bug or expected behavior! Here is different output
from each run variation of wc invocation:
wc -l test.txt Output: 20
awk '{print $0}' /tmp/test.txt | wc -l   Output: 21
cut /tmp/test.txt -f1 | wc -lOutput: 21

Similarly, when I read file from a python program I get 21 line count.

File, test.txt (attached here with) could be missing last "new line".

Thanks
Seva


test.txt.gz
Description: GNU Zip compressed data


bug#23191: ls alignment bug

2016-04-02 Thread Seth Kushniryk
Hi, I've been having a minor issue with ls. It seems that sometimes the
character 'é' (e accent aigu) causes the rest of the listing to be
misaligned. My options are "-F -T 0".

Here is an example of me using it in my music library:

First Aid Kit/  Pink Floyd/The Who/
Fleetwood Mac/  Queen/ Ton Koopman/
Foreigner/  Rage Against The Machine/  Trooper/
Frank Sinatra/  Red Rider/ U2/
Félix Leclerc/ Rodriguez/ Van Morrison/
George Harrison/Roy Orbison/   Whitesnake/
Green Day/  Run-DMC/   Woody Guthrie/
Iron Butterfly/ Rush/
James/  Simon and Garfunkel/

Renaming the directory to "Felix Leclerc" fixes the issue. I think the
problem is in "ls.c" in the function "quote_name", and what it sets for
"size_t *width".