*Synopsis*: problem with quoting in script
CR 6710205 changed on Jun 6 2008 by <User 1-5Q-1267>
=== Field ============ === New Value ============= === Old Value =============
Description New Note
====================== =========================== ===========================
*Change Request ID*: 6710205
*Synopsis*: problem with quoting in script
Product: solaris
Category: shell
Subcategory: korn93
Type: Defect
Subtype:
Status: 1-Dispatched
Substatus:
Priority: 3-Medium
Introduced In Release:
Introduced In Build:
Responsible Engineer:
Keywords: opensolaris
=== *Description* ============================================================
Category
shell
Sub-Category
bourne
Description
This extract from the Qt 4.3/4.4 configure script does not work correctly:
#!/bin/sh
# Adds a new qmake variable to the cache
# Usage: QMakeVar mode varname contents
# where mode is one of: set, add, del
QMakeVar()
{
case "$1" in
set)
eq="="
;;
add)
eq="+="
;;
del)
eq="-="
;;
*)
echo >&2 "BUG: wrong command to QMakeVar: $1"
;;
esac
echo "$2" "$eq" "$3"
}
SYSTEM_VARIABLES="CC CXX CFLAGS CXXFLAGS LDFLAGS"
for varname in $SYSTEM_VARIABLES; do
cmd=`echo \
'if [ -n "\$'${varname}'" ]; then
QMakeVar set QMAKE_'${varname}' "\$'${varname}'"
fi'`
eval "$cmd"
done
Frequency
Always
Regression
Solaris 10
Steps to Reproduce
Run the above script. If none of the 'SYSTEM_VARIABLES' are set in the
environment, nothing should be printed.
Expected Result
No output when CC etc are not set.
Actual Result
prints lines like
QMAKE_CC = $CC
In the Qt configure script, this causes malformed Makefiles to be generated,
and the build of Qt fails.
Error Message(s)
None
Test Case
Workaround
Use #!/bin/bash in the script
Submitter wants to work on bug
No
Additional configuration information
OS2008.05, running on Parallels on a Mac. I've read other reports of this
problem (don't know what hardware).
*** (#1 of 2): 2008-06-03 22:06:25 GMT+00:00 <User 1-F4SZV>
David Korn responds:
This is a ksh93 bug that has been there since the first release of ksh93.
The bug happens with the sequence \$. inside ``. Note, that `` is
obsolete and you should use $(...) instead.
The next ksh93 patch will contain a fix for this.
["The next patch" refers to the upstream ksh93 release.]
*** (#2 of 2): 2008-06-06 19:06:17 GMT+00:00 <User 1-5Q-1267>
=== *Workaround* =============================================================
=== *Additional Details* =====================================================
Targeted Release:
Commit To Fix In Build:
Fixed In Build:
Integrated In Build:
Verified In Build:
See Also:
Duplicate of:
Hooks:
Hook1:
Hook2:
Hook3:
Hook4:
Hook5:
Hook6: <email address omitted>
Program Management:
Root Cause:
Fix Affects Documentation: No
Fix Affects Localization: No
=== *History* ================================================================
Date Submitted: 2008-06-03 22:06:24 GMT+00:00
Submitted By: <User 1-F4SZV>
Status Changed Date Updated Updated By
=== *Service Request* ========================================================
Impact: Limited
Functionality: Secondary
Severity: 4
Product Name: solaris
Product Release: solaris_nevada
Product Build: snv_86
Operating System: solaris_nevada
Hardware: x86
Submitted Date: 2008-06-03 22:06:25 GMT+00:00
=== *Multiple Release (MR) Cluster* - 0 ======================================