GNU bug report logs - #11631
Head command does not position file pointer correctly for negative line count

Previous Next

Package: coreutils;

Reported by: Anoop Sharma <sendtoanoop <at> gmail.com>

Date: Tue, 5 Jun 2012 09:41:01 UTC

Severity: normal

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: "Voelker, Bernhard" <bernhard.voelker <at> siemens-enterprise.com>
To: Anoop Sharma <sendtoanoop <at> gmail.com>, "11631 <at> debbugs.gnu.org" <11631 <at> debbugs.gnu.org>
Subject: bug#11631: Head command does not position file pointer correctly for	negative line count
Date: Tue, 5 Jun 2012 10:03:33 +0000
Anoop Sharma wrote:

> Head command does not position file pointer correctly for negative line
> count. Here is a demonstration of the problem.

The problem doesn't seem to be limited to negative
line counts. I replaced the 10 ABC lines by a number
sequence to demonstrate this issue clearer.

  $ seq 10 | ( head -n -2 ; echo xxx ; cat )
  1
  2
  3
  4
  5
  6
  7
  8
  xxx
  $ seq 10 | ( head -n 2 ; echo xxx ; cat )
  1
  2
  xxx

So head eats all of the input. The info page is silent
about this.

Have a nice day,
Berny




This bug report was last modified 13 years and 46 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.