On 01/09/2012 11:58 AM, Peter Rosin wrote: > Hi! > Hi Peter. > MSYS will not allow redirecting on top of an existing r/o file, > even if the dir is r/w, like this: > > $ mkdir foo > $ ls -do foo > drwxr-xr-x 2 peda 0 Jan 9 11:02 foo > $ cd foo > $ touch bar > $ chmod a-w bar > $ ls > bar > bash: bar: Permission denied > $ cat bar > $ > Which is good and POSIX-ish, no?
> I think the above causes a testsuite failure for tap-driver-stderr.test. > Unlikely: the test is expected to see a failure in the `tap-driver' script, since that script is trying to write to a read-only file (an action which should rightfully trigger an error); what we are actually checking is that this failure is accompanied by a meaningful error message *which does not get redirected to the test logs*. Let's see what's happening ... > Cheers, > Peter > > For reference, tap-driver-stderr.log: > > Running from installcheck: no > Using TAP: no > PATH = /home/peda/automake/tests:/c/Program Files (x86)/Microsoft > F#/v4.0/:/c/Program Files (x86)/Microsoft Visual Studio > 10.0/VSTSDB/Deploy:/c/Program Files (x86)/Microsoft Visual Studio > 10.0/Common7/IDE/:/c/Program Files (x86)/Microsoft Visual Studio > 10.0/VC/BIN:/c/Program Files (x86)/Microsoft Visual Studio > 10.0/Common7/Tools/:/c/Windows/Microsoft.NET/Framework/v4.0.30319:/c/Windows/Microsoft.NET/Framework/v3.5:/c/Program > Files (x86)/Microsoft Visual Studio 10.0/VC/VCPackages:/c/Program Files > (x86)/HTML Help Workshop:/c/Program Files (x86)/Microsoft Visual Studio > 10.0/Team Tools/Performance Tools:/c/Program Files (x86)/Microsoft > SDKs/Windows/v7.0A/bin/NETFX 4.0 > Tools:.:/usr/local/bin:/mingw/bin:/bin:/c/Program Files/Common > Files/Microsoft Shared/Windows Live:/c/Program Files (x86)/Common > Files/Microsoft Shared/Windows > Live:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/ > ./defs: line 805: priv-check.11388: Permission denied > ++ pwd > /home/peda/automake/tests/tap-driver-stderr.dir > + fetch_tap_driver > + case $am_tap_implementation in > + sed '1s|#!.*|#! /bin/sh|' /home/peda/automake/lib/tap-driver.sh > + chmod a+x tap-driver > + sed 10q tap-driver > #! /bin/sh > # Copyright (C) 2011 Free Software Foundation, Inc. > # > # This program is free software; you can redistribute it and/or modify > # it under the terms of the GNU General Public License as published by > # the Free Software Foundation; either version 2, or (at your option) > # any later version. > # > # This program is distributed in the hope that it will be useful, > # but WITHOUT ANY WARRANTY; without even the implied warranty of > + tst=zardoz > + for suf in trs log > + rm -f zardoz.log zardoz.trs > + touch zardoz.trs > + chmod a-w zardoz.trs > + st=0 > + ./tap-driver --test-name zardoz --log-file zardoz.log --trs-file zardoz.trs > -- sh -c 'echo 1..1; echo ok 1; echo "Hello, World!"' > + cat stdout > PASS: zardoz 1 > + cat stderr > awk: cmd. line:324: (FILENAME=- FNR=4) fatal: can't redirect to `zardoz.trs' > (Permission denied) > tap-driver.sh: fatal: I/O or internal error > So far so good: the error goes to stderr ... > + cat zardoz.log > 1..1 > ok 1 > PASS: zardoz 1 > Hello, World! > + cat zardoz.trs > + test 0 -eq 0 > + /bin/grep -F 'Hello, World!' stderr stdout > + /bin/grep -F zardoz.trs stderr > awk: cmd. line:324: (FILENAME=- FNR=4) fatal: can't redirect to `zardoz.trs' > (Permission denied) > + for suf in trs log > + rm -f zardoz.log zardoz.trs > + touch zardoz.log > + chmod a-w zardoz.log > + st=0 > + ./tap-driver --test-name zardoz --log-file zardoz.log --trs-file zardoz.trs > -- sh -c 'echo 1..1; echo ok 1; echo "Hello, World!"' > + st=1 > Hmmm... looks like the shell is not returning a non-zero exit status in face of a I/O redirection failure. Could you try what happens doing the following? $ > foo; chmod a-w foo; sh -c ': > foo; echo one: $?'; echo two: $? > + cat stdout > + cat stderr > ./tap-driver: line 637: zardoz.log: Permission denied > (This is good as well BTW, this error goes to stderr too). Thanks, Stefano