Subject: bug#10465: MSYS read-only file trouble

From: Peter Rosin <[email-masked]>
Date: Mon, 09 Jan 2012 11:58:48 +0100

Hi!

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
$

I think the above causes a testsuite failure for tap-driver-stderr.test.

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
+ 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
+ cat stdout
+ cat stderr
./tap-driver: line 637: zardoz.log: Permission denied
+ cat zardoz.log
+ cat zardoz.trs
cat: zardoz.trs: No such file or directory
+ :
+ test 1 -eq 0
+ exit_status=1
+ set +e
+ cd /home/peda/automake/tests
+ test no = yes
+ case $am_explicit_skips in
+ test 1 -eq 0
+ keep_testdirs=yes
+ am_keeping_testdirs
+ case $keep_testdirs in
+ return 0
+ set +x
tap-driver-stderr: exit 1

Cheers,
Peter