Subject: bug#19857: BUG with head "-n-0"

From: matshyeq <[email-masked]>
Date: Fri, 21 Aug 2015 17:34:38 +0100

I can confirm BUG exists on

CentOS Linux release 7.1.1503 (Core)
# head --version
head (GNU coreutils) 8.22
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie and Jim Meyering.

# printf 'abc\ndef\nghi\n'>head_test_ok.txt
# head -n-0 head_test_ok.txt
abc
def
ghi
# printf 'abc\ndef\nghi'>head_test_nok.txt
# head -n-0 head_test_nok.txt

Thank you,
Kind Regards
~Maciek

On Fri, Feb 13, 2015 at 5:25 PM, Paul Eggert <[email-masked]> wrote:

> matshyeq wrote:
>
>> I think I've found an issue when head is called with -n-0 parameter
>> It should return whole file but only seem to work for files with newline
>> character at the end.
>>
>
> I'm not observing this problem on Ubuntu 14.10 x86-64; see below.  Which
> platform and version of 'head' are you running?  Can you send a recipe to
> reproduce the bug?
>
> $ printf 'abc\ndef\nghi' >t
> $ head -n-0 t
> abc
> def
> ghi$ head --version | head -n1
> head (GNU coreutils) 8.23
>
>