Skip to content

Commit 6fb1a9e

Browse files
author
Vladimir Kempik
committed
8065704: Set LC_ALL=C for all relevant commands in the build system
Reviewed-by: jiefu, phh Backport-of: 54a3efc
1 parent 994276c commit 6fb1a9e

8 files changed

+30
-18
lines changed

make/RunTestsPrebuilt.gmk

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ else ifeq ($(OPENJDK_TARGET_OS), macosx)
230230
NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu)
231231
MEMORY_SIZE := $(shell $(EXPR) `/usr/sbin/sysctl -n hw.memsize` / 1024 / 1024)
232232
else ifeq ($(OPENJDK_TARGET_OS), solaris)
233-
NUM_CORES := $(shell LC_MESSAGES=C /usr/sbin/psrinfo -v | $(GREP) -c on-line)
233+
NUM_CORES := $(shell /usr/sbin/psrinfo -v | $(GREP) -c on-line)
234234
MEMORY_SIZE := $(shell \
235235
/usr/sbin/prtconf 2> /dev/null | $(GREP) "^Memory [Ss]ize" | $(AWK) '{print $$3}' \
236236
)

make/RunTestsPrebuiltSpec.gmk

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
# Fake minimalistic spec file for RunTestsPrebuilt.gmk.
2828
################################################################################
2929

30+
# Make sure all shell commands are executed with the C locale
31+
export LC_ALL := C
32+
3033
define VerifyVariable
3134
ifeq ($$($1), )
3235
$$(info Error: Variable $1 is missing, needed by RunTestPrebuiltSpec.gmk)

make/autoconf/basics.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ AC_DEFUN_ONCE([BASIC_INIT],
405405
# Save the path variable before it gets changed
406406
ORIGINAL_PATH="$PATH"
407407
AC_SUBST(ORIGINAL_PATH)
408-
DATE_WHEN_CONFIGURED=`LANG=C date`
408+
DATE_WHEN_CONFIGURED=`date`
409409
AC_SUBST(DATE_WHEN_CONFIGURED)
410410
AC_MSG_NOTICE([Configuration created at $DATE_WHEN_CONFIGURED.])
411411
])

make/autoconf/build-performance.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ AC_DEFUN([BPERF_CHECK_CORES],
3535
FOUND_CORES=yes
3636
elif test -x /usr/sbin/psrinfo; then
3737
# Looks like a Solaris system
38-
NUM_CORES=`LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line`
38+
NUM_CORES=`/usr/sbin/psrinfo -v | grep -c on-line`
3939
FOUND_CORES=yes
4040
elif test -x /usr/sbin/sysctl; then
4141
# Looks like a MacOSX system

make/autoconf/configure

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ fi
4343
export CONFIG_SHELL=$BASH
4444
export _as_can_reexec=no
4545

46+
# Make sure all shell commands are executed with the C locale
47+
export LC_ALL=C
48+
4649
if test "x$CUSTOM_CONFIG_DIR" != x; then
4750
custom_hook=$CUSTOM_CONFIG_DIR/custom-hook.m4
4851
if test ! -e $custom_hook; then

make/autoconf/spec.gmk.in

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ COMMA:=,
4646
# What make to use for main processing, after bootstrapping top-level Makefile.
4747
MAKE := @MAKE@
4848

49+
# Make sure all shell commands are executed with the C locale
50+
export LC_ALL := C
51+
4952
# The default make arguments
5053
MAKE_ARGS = $(MAKE_LOG_FLAGS) -r -R -I $(TOPDIR)/make/common SPEC=$(SPEC) \
5154
MAKE_LOG_FLAGS="$(MAKE_LOG_FLAGS)" $(MAKE_LOG_VARS)

make/common/JavaCompilation.gmk

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ define add_file_to_clean
121121
$1_CLEAN_$$($2_TARGET) := 1
122122
$$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET) : $2
123123
$(MKDIR) -p $$(@D)
124-
export LC_ALL=C ; ( $(CAT) $$< && $(ECHO) "" ) \
124+
( $(CAT) $$< && $(ECHO) "" ) \
125125
| $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' \
126126
-e 's/\([^\\]\)!/\1\\!/g' -e 's/^[ ]*#.*/#/g' \
127127
| $(SED) -f "$(TOPDIR)/make/common/support/unicode2x.sed" \

make/scripts/compare.sh

+17-14
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ if [ -z "$TOPDIR" ]; then
3434
exit 1
3535
fi
3636

37+
# Make sure all shell commands are executed with the C locale
38+
export LC_ALL=C
39+
3740
if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
3841
FULLDUMP_CMD="$OTOOL -v -V -h -X -d"
3942
LDD_CMD="$OTOOL -L"
@@ -81,15 +84,15 @@ diff_text() {
8184

8285
if [[ "$THIS_FILE" = *"META-INF/MANIFEST.MF" ]]; then
8386
# Filter out date string, ant version and java version differences.
84-
TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
87+
TMP=$($DIFF $OTHER_FILE $THIS_FILE | \
8588
$GREP '^[<>]' | \
8689
$SED -e '/[<>] Ant-Version: Apache Ant .*/d' \
8790
-e '/[<>] Created-By: .* (Oracle [Corpatin)]*/d' \
8891
-e '/[<>] [Corpatin]*)/d' \
8992
-e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d')
9093
fi
9194
if test "x$SUFFIX" = "xjava"; then
92-
TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
95+
TMP=$($DIFF $OTHER_FILE $THIS_FILE | \
9396
$GREP '^[<>]' | \
9497
$SED -e '/[<>] \* from.*\.idl/d' \
9598
-e '/[<>] .*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
@@ -144,7 +147,7 @@ diff_text() {
144147
fi
145148
if test "x$SUFFIX" = "xproperties"; then
146149
# Filter out date string differences.
147-
TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
150+
TMP=$($DIFF $OTHER_FILE $THIS_FILE | \
148151
$GREP '^[<>]' | \
149152
$SED -e '/[<>].*[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}-[0-9]\{6\}.*/d')
150153
fi
@@ -154,7 +157,7 @@ diff_text() {
154157
-e 's/<font size=-1>/<font size=\"-1\">/g'"
155158
$CAT $THIS_FILE | eval "$HTML_FILTER" > $THIS_FILE.filtered
156159
$CAT $OTHER_FILE | eval "$HTML_FILTER" > $OTHER_FILE.filtered
157-
TMP=$(LC_ALL=C $DIFF $OTHER_FILE.filtered $THIS_FILE.filtered | \
160+
TMP=$($DIFF $OTHER_FILE.filtered $THIS_FILE.filtered | \
158161
$GREP '^[<>]' | \
159162
$SED -e '/[<>] <!-- Generated by javadoc .* on .* -->/d' \
160163
-e '/[<>] <meta name="date" content=".*">/d' )
@@ -481,11 +484,11 @@ compare_zip_file() {
481484
CONTENTS_DIFF_FILE=$WORK_DIR/$ZIP_FILE.diff
482485
# On solaris, there is no -q option.
483486
if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
484-
LC_ALL=C $DIFF -r $OTHER_UNZIPDIR $THIS_UNZIPDIR \
487+
$DIFF -r $OTHER_UNZIPDIR $THIS_UNZIPDIR \
485488
| $GREP -v -e "^<" -e "^>" -e "^Common subdirectories:" \
486489
> $CONTENTS_DIFF_FILE
487490
else
488-
LC_ALL=C $DIFF -rq $OTHER_UNZIPDIR $THIS_UNZIPDIR > $CONTENTS_DIFF_FILE
491+
$DIFF -rq $OTHER_UNZIPDIR $THIS_UNZIPDIR > $CONTENTS_DIFF_FILE
489492
fi
490493

491494
ONLY_OTHER=$($GREP "^Only in $OTHER_UNZIPDIR" $CONTENTS_DIFF_FILE)
@@ -532,11 +535,11 @@ compare_zip_file() {
532535
if [ -n "$SHOW_DIFFS" ]; then
533536
for i in $(cat $WORK_DIR/$ZIP_FILE.difflist) ; do
534537
if [ -f "${OTHER_UNZIPDIR}/$i.javap" ]; then
535-
LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.javap ${THIS_UNZIPDIR}/$i.javap
538+
$DIFF ${OTHER_UNZIPDIR}/$i.javap ${THIS_UNZIPDIR}/$i.javap
536539
elif [ -f "${OTHER_UNZIPDIR}/$i.cleaned" ]; then
537-
LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.cleaned ${THIS_UNZIPDIR}/$i
540+
$DIFF ${OTHER_UNZIPDIR}/$i.cleaned ${THIS_UNZIPDIR}/$i
538541
else
539-
LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i ${THIS_UNZIPDIR}/$i
542+
$DIFF ${OTHER_UNZIPDIR}/$i ${THIS_UNZIPDIR}/$i
540543
fi
541544
done
542545
fi
@@ -776,7 +779,7 @@ compare_bin_file() {
776779
> $WORK_FILE_BASE.symbols.this
777780
fi
778781

779-
LC_ALL=C $DIFF $WORK_FILE_BASE.symbols.other $WORK_FILE_BASE.symbols.this > $WORK_FILE_BASE.symbols.diff
782+
$DIFF $WORK_FILE_BASE.symbols.other $WORK_FILE_BASE.symbols.this > $WORK_FILE_BASE.symbols.diff
780783
if [ -s $WORK_FILE_BASE.symbols.diff ]; then
781784
SYM_MSG=" diff "
782785
if [[ "$ACCEPTED_SYM_DIFF" != *"$BIN_FILE"* ]]; then
@@ -816,9 +819,9 @@ compare_bin_file() {
816819
| $UNIQ > $WORK_FILE_BASE.deps.this.uniq)
817820
(cd $FILE_WORK_DIR && $RM -f $NAME)
818821

819-
LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this \
822+
$DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this \
820823
> $WORK_FILE_BASE.deps.diff
821-
LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq \
824+
$DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq \
822825
> $WORK_FILE_BASE.deps.diff.uniq
823826

824827
if [ -s $WORK_FILE_BASE.deps.diff ]; then
@@ -868,7 +871,7 @@ compare_bin_file() {
868871
> $WORK_FILE_BASE.fulldump.this 2>&1 &
869872
wait
870873

871-
LC_ALL=C $DIFF $WORK_FILE_BASE.fulldump.other $WORK_FILE_BASE.fulldump.this \
874+
$DIFF $WORK_FILE_BASE.fulldump.other $WORK_FILE_BASE.fulldump.this \
872875
> $WORK_FILE_BASE.fulldump.diff
873876

874877
if [ -s $WORK_FILE_BASE.fulldump.diff ]; then
@@ -915,7 +918,7 @@ compare_bin_file() {
915918
| eval "$this_DIS_DIFF_FILTER" > $WORK_FILE_BASE.dis.this 2>&1 &
916919
wait
917920

918-
LC_ALL=C $DIFF $WORK_FILE_BASE.dis.other $WORK_FILE_BASE.dis.this > $WORK_FILE_BASE.dis.diff
921+
$DIFF $WORK_FILE_BASE.dis.other $WORK_FILE_BASE.dis.this > $WORK_FILE_BASE.dis.diff
919922

920923
if [ -s $WORK_FILE_BASE.dis.diff ]; then
921924
DIS_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.dis.diff | awk '{print $5}')

0 commit comments

Comments
 (0)