[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-patch] patch 2.7.3: read-only-files test fails with POSIX shell
From: |
Christian Weisgerber |
Subject: |
[bug-patch] patch 2.7.3: read-only-files test fails with POSIX shell |
Date: |
Sun, 1 Feb 2015 21:44:22 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
In patch 2.7.3, tests/read-only-files fails with a POSIX-conformant
shell. The problematic section is this:
: > read-only
chmod a-w read-only
if : 2> /dev/null > read-only; then
echo "Files with read-only permissions are writable" \
"(probably running as superuser)" >&2
exit 77
fi
rm -f read-only
A redirection failure for a special built-in causes the shell to
exit, and the colon command is a special built-in.
In practice, the test errors out unexpectedly with FreeBSD sh,
OpenBSD sh (pdksh), and bash --posix.
Suggested fix: Perform the redirection in a subshell.
- if : 2> /dev/null > read-only; then
+ if ( : 2> /dev/null > read-only ); then
--
Christian "naddy" Weisgerber address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug-patch] patch 2.7.3: read-only-files test fails with POSIX shell,
Christian Weisgerber <=