GNU bug report logs - #35762
When `test-driver` script + `check` testing framework are writing to same logfile = corrupted output

Previous Next

Package: automake;

Reported by: howaboutsynergy <at> protonmail.com

Date: Thu, 16 May 2019 14:32:01 UTC

Severity: normal

Done: Karl Berry <karl <at> freefriends.org>

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: howaboutsynergy <at> protonmail.com
Subject: bug#35762: closed (Re: bug#35762: (No Subject))
Date: Tue, 24 Nov 2020 02:07:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#35762: When `test-driver` script + `check` testing framework are writing to same logfile = corrupted output

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

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

-- 
35762: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=35762
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Karl Berry <karl <at> freefriends.org>
To: 35762 <at> debbugs.gnu.org
Subject: Re: bug#35762: (No Subject)
Date: Mon, 23 Nov 2020 19:06:51 -0700
   : >"$log_file"
   "$@" >>"$log_file" 2>&1

I committed this change to test-driver, so it'll (finally) be in the
next release. (Sorry for the long-delayed response.)

(I was tempted to make the script exit unsuccessfully if either of the
commands failed (e.g., add  || exit 1  or some such), but I was too scared.)

Thanks for the report,
Karl

[Message part 3 (message/rfc822, inline)]
From: howaboutsynergy <at> protonmail.com
To: "bug-automake <at> gnu.org" <bug-automake <at> gnu.org>
Subject: When `test-driver` script + `check` testing framework are writing to
 same logfile = corrupted output
Date: Thu, 16 May 2019 08:07:36 +0000
[Message part 4 (text/plain, inline)]
Hi. This isn't a bug, but just to inform you that `test-driver` redirecting stdout(and stderr) to the log file, coupled with  the test itself also writing to the same log file(for whatever reason), will result in them both using the same outfile (with different descriptors) thus corrupted output is the result.

For an example of what happens, see this comment: https://github.com/libcheck/check/issues/188#issuecomment-492794060 which I'll reproduce below for easy reading.

For exact reproduction steps with using `check` (the unit test framework for C) see the previous comment aka https://github.com/libcheck/check/issues/188#issuecomment-492782675

#include <stdio.h>
  

int main() {
  FILE *f=NULL;
  f = fopen("/tmp/a_out_.log", "w");
  if (NULL == f) {
    fprintf(stderr,"oopsie\n");
  } else {
    fprintf(stdout, "Something");
    fprintf(f," messy ");
    fprintf(f," jessy\n");
    fprintf(stdout, " or another\n");
    fprintf(f,"More stuff\n");
    fclose(f);                                                                                                                  

  }
}

$ gcc a.c && { ./a.out >/tmp/a_out_.log ; cat /tmp/a_out_.log ; }
Something or another
uff

That's basically what happens.

I'm on Arch Linux, and have the following versions:

local/autoconf 2.69-5 (base-devel)
    A GNU tool for automatically configuring source code
local/autoconf2.13 2.13-5
    A GNU tool for automatically configuring source code (Legacy 2.1x version)
local/automake 1.16.1-1 (base-devel)
    A GNU tool for automatically creating Makefiles

$ automake --version
automake (GNU automake) 1.16.1

$ autoconf --version
autoconf (GNU Autoconf) 2.69

$ make --version
GNU Make 4.2.1
Built for x86_64-pc-linux-gnu

  # test-driver - basic testsuite driver script.
  

  scriptversion=2018-03-07.03; # UTC

Thanks.
[publickey - howaboutsynergy@protonmail.com - 0x947B9B34.asc (application/pgp-keys, attachment)]
[signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 4 years and 259 days ago.

Previous Next


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