GNU bug report logs - #17145
head fails with implicit stdin on darwin

Previous Next

Package: coreutils;

Reported by: Denis Excoffier <gcc <at> Denis-Excoffier.org>

Date: Sun, 30 Mar 2014 21:44:02 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Denis Excoffier <gcc <at> Denis-Excoffier.org>
Subject: bug#17145: closed (Re: bug#17145: head fails with implicit stdin
 on darwin)
Date: Wed, 02 Apr 2014 14:48:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#17145: head fails with implicit stdin on darwin

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 17145 <at> debbugs.gnu.org.

-- 
17145: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17145
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 17145-done <at> debbugs.gnu.org, Denis Excoffier <gcc <at> Denis-Excoffier.org>
Subject: Re: bug#17145: head fails with implicit stdin on darwin
Date: Wed, 02 Apr 2014 07:47:11 -0700
Pádraig Brady wrote:
> s/if/else if/

Thanks.  Or better yet, return false if fstat fails.  I did that, plus 
the other changes you and Bernhard suggested, and installed the patch.

[Message part 3 (message/rfc822, inline)]
From: Denis Excoffier <gcc <at> Denis-Excoffier.org>
To: bug-coreutils <at> gnu.org
Subject: head fails with implicit stdin on darwin
Date: Sun, 30 Mar 2014 22:40:18 +0200
Hello,

head -n -1 -- -
or equivalently
head -n -1
returns immediately (ie does not wait for further stdin) and prints nothing.

I use coreutils 8.22 compiled (with gcc-4.8.2) on top of darwin 13.1.0 (Mavericks).

However the following seem to work perfectly:
head -n 1
head -c -1
cat | head -n -1
head -n -1 ---presume-input-pipe
on cygwin: head -n -1

What is weird on my system is lseek() at the beginning of elide_tail_lines_file():
lseek(fd, 0, SEEK_CUR) returns a (random?) number, something like 6735, 539 etc.
lseek(fd, 0, SEEK_END) returns 0

Hope this helps,

Regards,

Denis Excoffier.


This bug report was last modified 11 years and 103 days ago.

Previous Next


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