GNU bug report logs - #25041
Bugs in TAC and TAIL for closed stdin

Previous Next

Package: coreutils;

Reported by: Marcel Böhme <boehme.marcel <at> gmail.com>

Date: Sun, 27 Nov 2016 09:16:01 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #19 received at 25041 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Jim Meyering <jim <at> meyering.net>
Cc: 25041 <at> debbugs.gnu.org,
 Marcel Böhme <boehme.marcel <at> gmail.com>
Subject: Re: bug#25041: Bugs in TAC and TAIL for closed stdin
Date: Sun, 27 Nov 2016 21:22:48 +0000
On 27/11/16 15:51, Jim Meyering wrote:
> On Sun, Nov 27, 2016 at 7:40 AM, Pádraig Brady <P <at> draigbrady.com> wrote:
>> I'll push the attached later
> 
> Thanks to both of you.
> 
> That patch looks fine, modulo a formatting nit: the second line is
> indented one space too far:
> 
> +              f->ignore = ! (reopen_inaccessible_files
> +                              && follow_mode == Follow_name);
> 

Done.
Also we should probably clear any errors such as ENOSPC
from the stream before reuse for the next input:

diff --git a/src/tac.c b/src/tac.c
index 2e820fa..c1b6003 100644
--- a/src/tac.c
+++ b/src/tac.c
@@ -477,6 +477,7 @@ temp_stream (FILE **fp, char **file_name)
     }
   else
     {
+      clearerr (tmp_fp);
       if (fseeko (tmp_fp, 0, SEEK_SET) < 0
           || ftruncate (fileno (tmp_fp), 0) < 0)
         {

cheers,
Pádraig




This bug report was last modified 8 years and 176 days ago.

Previous Next


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