summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Nagaev <bnagaev@gmail.com>2015-10-18 23:11:28 +0300
committerBoris Nagaev <bnagaev@gmail.com>2015-10-22 19:13:08 +0000
commit45fe3f1cde1e516d1ddccddb5e33ea4316497c36 (patch)
tree41d4c857f30937b0a550bc7ff9c5f69412efd094
parent456f721917d07b3dd4259c324ff216f90bd32139 (diff)
configure: fix log corruption with option -v
This bug occurs if ./configure is called with -v on systems on which fd proc entries point to the files/devices they are open on instead of being magic nodes which would basically dup() the actual fds (e.g., Linux). In this case, the command "tee $tty" appends to /dev/stderr, which may be already opened by the parent process. This breaks the log file. Normally, the log file starts with This is the Qt Open Source Edition. ... but with `-v` flag it would start with output of awkprog and maybe some zero bytes. Zero bytes are observed on Debian Wheezy. DEFAULT_INCDIRS=... ... ^@^@^@^@^@^@^@^@^@^@^@^@... Done running configuration tests. ... To fix this problem, the output of `...` is saved to a variable, and then eval'd and echo'd (if -v). This solution was found by Tony Theodore. https://github.com/mxe/mxe/issues/938#issuecomment-149770348 Change-Id: Id0c28598890e813774cc92f38ee46a0697b34e77 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rwxr-xr-xconfigure7
1 files changed, 3 insertions, 4 deletions
diff --git a/configure b/configure
index 3fbf97143d..367cb22455 100755
--- a/configure
+++ b/configure
@@ -3613,10 +3613,9 @@ END {
print "DEFAULT_LIBDIRS=\"/lib\n/usr/lib\"\n";
}'
-unset tty
-[ "$OPT_VERBOSE" = "yes" ] && tty=/dev/stderr
-eval "`LC_ALL=C $TEST_COMPILER $SYSROOT_FLAG $TEST_COMPILER_CXXFLAGS -xc++ -E -v - < /dev/null 2>&1 > /dev/null | $AWK "$awkprog" | tee $tty`"
-unset tty
+awkprog_result=`LC_ALL=C $TEST_COMPILER $SYSROOT_FLAG $TEST_COMPILER_CXXFLAGS -xc++ -E -v - < /dev/null 2>&1 > /dev/null | $AWK "$awkprog"`
+eval "$awkprog_result"
+[ "$OPT_VERBOSE" = "yes" ] && echo "$awkprog_result"
echo "Done running configuration tests."