Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
8065704: Set LC_ALL=C for all relevant commands in the build system
Browse files Browse the repository at this point in the history
Reviewed-by: naoto, erikj
  • Loading branch information
magicus committed Oct 11, 2019
1 parent 19a6085 commit 54a3efc
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 20 deletions.
2 changes: 1 addition & 1 deletion make/RunTestsPrebuilt.gmk
Expand Up @@ -230,7 +230,7 @@ else ifeq ($(OPENJDK_TARGET_OS), macosx)
NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu)
MEMORY_SIZE := $(shell $(EXPR) `/usr/sbin/sysctl -n hw.memsize` / 1024 / 1024)
else ifeq ($(OPENJDK_TARGET_OS), solaris)
NUM_CORES := $(shell LC_MESSAGES=C /usr/sbin/psrinfo -v | $(GREP) -c on-line)
NUM_CORES := $(shell /usr/sbin/psrinfo -v | $(GREP) -c on-line)
MEMORY_SIZE := $(shell \
/usr/sbin/prtconf 2> /dev/null | $(GREP) "^Memory [Ss]ize" | $(AWK) '{print $$3}' \
)
Expand Down
3 changes: 3 additions & 0 deletions make/RunTestsPrebuiltSpec.gmk
Expand Up @@ -27,6 +27,9 @@
# Fake minimalistic spec file for RunTestsPrebuilt.gmk.
################################################################################

# Make sure all shell commands are executed with the C locale
export LC_ALL := C

define VerifyVariable
ifeq ($$($1), )
$$(info Error: Variable $1 is missing, needed by RunTestPrebuiltSpec.gmk)
Expand Down
2 changes: 1 addition & 1 deletion make/autoconf/basics.m4
Expand Up @@ -427,7 +427,7 @@ AC_DEFUN_ONCE([BASIC_INIT],
# Save the path variable before it gets changed
ORIGINAL_PATH="$PATH"
AC_SUBST(ORIGINAL_PATH)
DATE_WHEN_CONFIGURED=`LANG=C date`
DATE_WHEN_CONFIGURED=`date`
AC_SUBST(DATE_WHEN_CONFIGURED)
AC_MSG_NOTICE([Configuration created at $DATE_WHEN_CONFIGURED.])
])
Expand Down
2 changes: 1 addition & 1 deletion make/autoconf/build-performance.m4
Expand Up @@ -35,7 +35,7 @@ AC_DEFUN([BPERF_CHECK_CORES],
FOUND_CORES=yes
elif test -x /usr/sbin/psrinfo; then
# Looks like a Solaris system
NUM_CORES=`LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line`
NUM_CORES=`/usr/sbin/psrinfo -v | grep -c on-line`
FOUND_CORES=yes
elif test -x /usr/sbin/sysctl; then
# Looks like a MacOSX system
Expand Down
3 changes: 3 additions & 0 deletions make/autoconf/configure
Expand Up @@ -43,6 +43,9 @@ fi
export CONFIG_SHELL=$BASH
export _as_can_reexec=no

# Make sure all shell commands are executed with the C locale
export LC_ALL=C

if test "x$CUSTOM_CONFIG_DIR" != x; then
custom_hook=$CUSTOM_CONFIG_DIR/custom-hook.m4
if test ! -e $custom_hook; then
Expand Down
3 changes: 3 additions & 0 deletions make/autoconf/spec.gmk.in
Expand Up @@ -51,6 +51,9 @@ COMMA:=,
# What make to use for main processing, after bootstrapping top-level Makefile.
MAKE := @MAKE@

# Make sure all shell commands are executed with the C locale
export LC_ALL := C

# The default make arguments
MAKE_ARGS = $(MAKE_LOG_FLAGS) -r -R -I $(TOPDIR)/make/common SPEC=$(SPEC) \
MAKE_LOG_FLAGS="$(MAKE_LOG_FLAGS)" $(MAKE_LOG_VARS)
Expand Down
2 changes: 1 addition & 1 deletion make/common/JavaCompilation.gmk
Expand Up @@ -122,7 +122,7 @@ define add_file_to_clean
$$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET) : $2
$$(call LogInfo, Cleaning $$(patsubst $(OUTPUTDIR)/%,%, $$@))
$$(call MakeTargetDir)
export LC_ALL=C ; ( $(CAT) $$< && $(ECHO) "" ) \
( $(CAT) $$< && $(ECHO) "" ) \
| $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' \
-e 's/\([^\\]\)!/\1\\!/g' -e 's/^[ ]*#.*/#/g' \
| $(SED) -f "$(TOPDIR)/make/common/support/unicode2x.sed" \
Expand Down
35 changes: 19 additions & 16 deletions make/scripts/compare.sh
Expand Up @@ -34,6 +34,9 @@ if [ -z "$TOPDIR" ]; then
exit 1
fi

# Make sure all shell commands are executed with the C locale
export LC_ALL=C

if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
FULLDUMP_CMD="$OTOOL -v -V -h -X -d"
LDD_CMD="$OTOOL -L"
Expand Down Expand Up @@ -110,7 +113,7 @@ elif [ "$OPENJDK_TARGET_OS" = "windows" ]; then
"
fi
elif [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
DIS_DIFF_FILTER="LANG=C $SED \
DIS_DIFF_FILTER="$SED \
-e 's/0x[0-9a-f]\{3,16\}/<HEXSTR>/g' -e 's/^[0-9a-f]\{12,20\}/<ADDR>/' \
-e 's/-20[0-9][0-9]-[0-1][0-9]-[0-3][0-9]-[0-2][0-9]\{5\}/<DATE>/g' \
-e 's/), built on .*/), <DATE>/' \
Expand All @@ -134,15 +137,15 @@ diff_text() {

if [[ "$THIS_FILE" = *"META-INF/MANIFEST.MF" ]]; then
# Filter out date string, ant version and java version differences.
TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
TMP=$($DIFF $OTHER_FILE $THIS_FILE | \
$GREP '^[<>]' | \
$SED -e '/[<>] Ant-Version: Apache Ant .*/d' \
-e '/[<>] Created-By: .* (Oracle [Corpatin)]*/d' \
-e '/[<>] [Corpatin]*)/d' \
-e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d')
fi
if test "x$SUFFIX" = "xjava"; then
TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
TMP=$($DIFF $OTHER_FILE $THIS_FILE | \
$GREP '^[<>]' | \
$SED -e '/[<>] \* from.*\.idl/d' \
-e '/[<>] .*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
Expand Down Expand Up @@ -197,7 +200,7 @@ diff_text() {
fi
if test "x$SUFFIX" = "xproperties"; then
# Filter out date string differences.
TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
TMP=$($DIFF $OTHER_FILE $THIS_FILE | \
$GREP '^[<>]' | \
$SED -e '/[<>].*[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}-[0-9]\{6\}.*/d')
fi
Expand All @@ -207,7 +210,7 @@ diff_text() {
-e 's/<font size=-1>/<font size=\"-1\">/g'"
$CAT $THIS_FILE | eval "$HTML_FILTER" > $THIS_FILE.filtered
$CAT $OTHER_FILE | eval "$HTML_FILTER" > $OTHER_FILE.filtered
TMP=$(LC_ALL=C $DIFF $OTHER_FILE.filtered $THIS_FILE.filtered | \
TMP=$($DIFF $OTHER_FILE.filtered $THIS_FILE.filtered | \
$GREP '^[<>]' | \
$SED -e '/[<>] <!-- Generated by javadoc .* on .* -->/d' \
-e '/[<>] <meta name="date" content=".*">/d' )
Expand Down Expand Up @@ -554,11 +557,11 @@ compare_zip_file() {
CONTENTS_DIFF_FILE=$WORK_DIR/$ZIP_FILE.diff
# On solaris, there is no -q option.
if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
LC_ALL=C $DIFF -r $OTHER_UNZIPDIR $THIS_UNZIPDIR \
$DIFF -r $OTHER_UNZIPDIR $THIS_UNZIPDIR \
| $GREP -v -e "^<" -e "^>" -e "^Common subdirectories:" \
> $CONTENTS_DIFF_FILE
else
LC_ALL=C $DIFF -rq $OTHER_UNZIPDIR $THIS_UNZIPDIR > $CONTENTS_DIFF_FILE
$DIFF -rq $OTHER_UNZIPDIR $THIS_UNZIPDIR > $CONTENTS_DIFF_FILE
fi

ONLY_OTHER=$($GREP "^Only in $OTHER_UNZIPDIR" $CONTENTS_DIFF_FILE)
Expand Down Expand Up @@ -605,11 +608,11 @@ compare_zip_file() {
if [ -n "$SHOW_DIFFS" ]; then
for i in $(cat $WORK_DIR/$ZIP_FILE.difflist) ; do
if [ -f "${OTHER_UNZIPDIR}/$i.javap" ]; then
LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.javap ${THIS_UNZIPDIR}/$i.javap
$DIFF ${OTHER_UNZIPDIR}/$i.javap ${THIS_UNZIPDIR}/$i.javap
elif [ -f "${OTHER_UNZIPDIR}/$i.cleaned" ]; then
LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.cleaned ${THIS_UNZIPDIR}/$i
$DIFF ${OTHER_UNZIPDIR}/$i.cleaned ${THIS_UNZIPDIR}/$i
else
LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i ${THIS_UNZIPDIR}/$i
$DIFF ${OTHER_UNZIPDIR}/$i ${THIS_UNZIPDIR}/$i
fi
done
fi
Expand Down Expand Up @@ -642,7 +645,7 @@ compare_jmod_file() {
$JMOD list $THIS_JMOD | sort > $THIS_JMOD_LIST
$JMOD list $OTHER_JMOD | sort > $OTHER_JMOD_LIST
JMOD_LIST_DIFF_FILE=$WORK_DIR/$JMOD_FILE.list.diff
LC_ALL=C $DIFF $THIS_JMOD_LIST $OTHER_JMOD_LIST > $JMOD_LIST_DIFF_FILE
$DIFF $THIS_JMOD_LIST $OTHER_JMOD_LIST > $JMOD_LIST_DIFF_FILE

ONLY_THIS=$($GREP "^<" $JMOD_LIST_DIFF_FILE)
ONLY_OTHER=$($GREP "^>" $JMOD_LIST_DIFF_FILE)
Expand Down Expand Up @@ -924,7 +927,7 @@ compare_bin_file() {
> $WORK_FILE_BASE.symbols.this
fi

LC_ALL=C $DIFF $WORK_FILE_BASE.symbols.other $WORK_FILE_BASE.symbols.this > $WORK_FILE_BASE.symbols.diff
$DIFF $WORK_FILE_BASE.symbols.other $WORK_FILE_BASE.symbols.this > $WORK_FILE_BASE.symbols.diff
if [ -s $WORK_FILE_BASE.symbols.diff ]; then
SYM_MSG=" diff "
if [[ "$ACCEPTED_SYM_DIFF" != *"$BIN_FILE"* ]]; then
Expand Down Expand Up @@ -964,9 +967,9 @@ compare_bin_file() {
| $UNIQ > $WORK_FILE_BASE.deps.this.uniq)
(cd $FILE_WORK_DIR && $RM -f $NAME)

LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this \
$DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this \
> $WORK_FILE_BASE.deps.diff
LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq \
$DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq \
> $WORK_FILE_BASE.deps.diff.uniq

if [ -s $WORK_FILE_BASE.deps.diff ]; then
Expand Down Expand Up @@ -1016,7 +1019,7 @@ compare_bin_file() {
> $WORK_FILE_BASE.fulldump.this 2>&1 &
wait

LC_ALL=C $DIFF $WORK_FILE_BASE.fulldump.other $WORK_FILE_BASE.fulldump.this \
$DIFF $WORK_FILE_BASE.fulldump.other $WORK_FILE_BASE.fulldump.this \
> $WORK_FILE_BASE.fulldump.diff

if [ -s $WORK_FILE_BASE.fulldump.diff ]; then
Expand Down Expand Up @@ -1063,7 +1066,7 @@ compare_bin_file() {
| eval "$this_DIS_DIFF_FILTER" > $WORK_FILE_BASE.dis.this 2>&1 &
wait

LC_ALL=C $DIFF $WORK_FILE_BASE.dis.other $WORK_FILE_BASE.dis.this > $WORK_FILE_BASE.dis.diff
$DIFF $WORK_FILE_BASE.dis.other $WORK_FILE_BASE.dis.this > $WORK_FILE_BASE.dis.diff

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

0 comments on commit 54a3efc

Please sign in to comment.