plural.c: improve reproducibility

There is a subtle non-determinism when building glibc.
This depends on whether the glibc is built using the distibuted
file intl/plural.c or built using the generated file intl/plural.c.
These two files (intl/plural.c generated vs. distributed) are slightly
different, hence we may end up with slightly different libraries.

Originally, having "bison" installed was optional. So if "bison" was
not present, we always built libraries with the distributed plural.c.
If bison was installed, we *** may have *** replaced the distributed
file plural.c with a new plural.c generated from plural.y. if the
timestamps triggered this rule:

plural.c plural.y
	$(BISON) $(BISONFLAGS) $@ $^

Given that timestamps are not preserved in GIT repositories, the above
rule is not reliable without explicitly touching plural.c or plural.y.
In other words, the rule may or may not have fired.

In summary: there are two distinct sources of non-determinism:

1. Having "bison" installed or not
2. Having "bison" installed but timestamps poorly defined.

This patch fixes this by requiring "bison" being installed
and by always generating intl/plural.c from intl/plural.y.
(This is achieved by simply removing checked-in intl/plural.c)

	[BZ #22432]
	* configure.ac (BISON): Require to be present.
	* configure: Regenerated.
	* intl/Makefile (generated): Add plural.c.
	[$(BISON) != no]: Make code unconditional.
	(plural.c): Change rule to $(objpfx)plural.c.
	($(objpfx)plural.o): Depend on $(objpfx)plural.c.
	* intl/plural.c: Remove.
	* manual/install.texi (Tools for Compilation): Document bison as
	required.
	* INSTALL: Regenerated.
This commit is contained in:
Juro Bystricky 2017-11-30 21:21:15 +00:00 committed by Joseph Myers
parent bd6ea9edd1
commit 1faaf7035c
8 changed files with 98 additions and 2098 deletions

View File

@ -1,3 +1,17 @@
2017-11-30 Juro Bystricky <juro.bystricky@linux.intel.com>
[BZ #22432]
* configure.ac (BISON): Require to be present.
* configure: Regenerated.
* intl/Makefile (generated): Add plural.c.
[$(BISON) != no]: Make code unconditional.
(plural.c): Change rule to $(objpfx)plural.c.
($(objpfx)plural.o): Depend on $(objpfx)plural.c.
* intl/plural.c: Remove.
* manual/install.texi (Tools for Compilation): Document bison as
required.
* INSTALL: Regenerated.
2017-11-30 Joseph Myers <joseph@codesourcery.com>
* sysdeps/m68k/m680x0/fpu/s_llrint.c: Include

10
INSTALL
View File

@ -462,6 +462,11 @@ build the GNU C Library:
version 4.1.3 is the newest verified to work to build the GNU C
Library.
* GNU 'bison' 2.7 or later
'bison' is used to generate the 'yacc' parser code in the 'intl'
subdirectory.
* Perl 5
Perl is not required, but it is used if present to test the
@ -481,11 +486,6 @@ and if you change any of the message translation files you will need
* GNU 'gettext' 0.10.36 or later
If you wish to regenerate the 'yacc' parser code in the 'intl'
subdirectory you will need
* GNU 'bison' 2.7 or later
You may also need these packages if you upgrade your source tree using
patches, although we try to avoid this.

3
NEWS
View File

@ -79,7 +79,8 @@ Deprecated and removed features, and other changes affecting compatibility:
Changes to build and runtime requirements:
[Add changes to build and runtime requirements here]
* bison version 2.7 or later is required to generate code in the 'intl'
subdirectory.
Security related changes:

128
configure vendored
View File

@ -632,7 +632,6 @@ ASFLAGS_config
libc_cv_cc_with_libunwind
libc_cv_insert
libc_cv_protected_data
BISON
INSTALL_INFO
PERL
BASH_SHELL
@ -645,6 +644,7 @@ PYTHON
PYTHON_PROG
AUTOCONF
NM
BISON
AWK
SED
MAKEINFO
@ -4940,6 +4940,69 @@ if test $ac_verc_fail = yes; then
critic_missing="$critic_missing gawk"
fi
for ac_prog in bison
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_BISON+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$BISON"; then
ac_cv_prog_BISON="$BISON" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_BISON="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
BISON=$ac_cv_prog_BISON
if test -n "$BISON"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $BISON" >&5
$as_echo "$BISON" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$BISON" && break
done
if test -z "$BISON"; then
ac_verc_fail=yes
else
# Found it, now check the version.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $BISON" >&5
$as_echo_n "checking version of $BISON... " >&6; }
ac_prog_version=`$BISON --version 2>&1 | sed -n 's/^.*bison (GNU Bison) \([0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
2.7*|[3-9].*|[1-9][0-9]*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_prog_version" >&5
$as_echo "$ac_prog_version" >&6; }
fi
if test $ac_verc_fail = yes; then
critic_missing="$critic_missing bison"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC is sufficient to build libc" >&5
$as_echo_n "checking if $CC is sufficient to build libc... " >&6; }
@ -5399,69 +5462,6 @@ $as_echo "no" >&6; }
fi
for ac_prog in bison
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_BISON+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$BISON"; then
ac_cv_prog_BISON="$BISON" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_BISON="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
BISON=$ac_cv_prog_BISON
if test -n "$BISON"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $BISON" >&5
$as_echo "$BISON" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$BISON" && break
done
if test -z "$BISON"; then
ac_verc_fail=yes
else
# Found it, now check the version.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $BISON" >&5
$as_echo_n "checking version of $BISON... " >&6; }
ac_prog_version=`$BISON --version 2>&1 | sed -n 's/^.*bison (GNU Bison) \([0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
2.7*|[3-9].*|[1-9][0-9]*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_prog_version" >&5
$as_echo "$ac_prog_version" >&6; }
fi
if test $ac_verc_fail = yes; then
BISON=no
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for .set assembler directive" >&5
$as_echo_n "checking for .set assembler directive... " >&6; }

View File

@ -939,6 +939,9 @@ AC_CHECK_PROG_VER(SED, sed, --version,
AC_CHECK_PROG_VER(AWK, gawk, --version,
[GNU Awk[^0-9]*\([0-9][0-9.]*\)],
[3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
AC_CHECK_PROG_VER(BISON, bison, --version,
[bison (GNU Bison) \([0-9]*\.[0-9.]*\)],
[2.7*|[3-9].*|[1-9][0-9]*], critic_missing="$critic_missing bison")
AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
AC_TRY_COMPILE([], [
@ -1070,10 +1073,6 @@ if test "$PERL" != no &&
fi
AC_PATH_PROG(INSTALL_INFO, install-info, no,
$PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
AC_CHECK_PROG_VER(BISON, bison, --version,
[bison (GNU Bison) \([0-9]*\.[0-9.]*\)],
[2.7*|[3-9].*|[1-9][0-9]*],
BISON=no)
AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
cat > conftest.s <<EOF

View File

@ -38,14 +38,13 @@ before-compile += $(objpfx)msgs.h
install-others = $(inst_localedir)/locale.alias
generated += msgs.h mtrace-tst-gettext.out tst-gettext.mtrace
generated += msgs.h mtrace-tst-gettext.out tst-gettext.mtrace plural.c
generated-dirs += domaindir localedir
ifneq (no,$(BISON))
plural.c: plural.y
$(objpfx)plural.c: plural.y
$(BISON) $(BISONFLAGS) $@ $^
endif
$(objpfx)plural.o: plural.c
$(objpfx)plural.o: $(objpfx)plural.c
ifeq ($(run-built-tests),yes)
ifeq (yes,$(build-shared))

File diff suppressed because it is too large Load Diff

View File

@ -509,6 +509,12 @@ function, which was introduced in version 3.1.2 of @code{gawk}.
As of release time, @code{gawk} version 4.1.3 is the newest verified
to work to build @theglibc{}.
@item
GNU @code{bison} 2.7 or later
@code{bison} is used to generate the @code{yacc} parser code in the @file{intl}
subdirectory.
@item
Perl 5
@ -540,14 +546,6 @@ and if you change any of the message translation files you will need
GNU @code{gettext} 0.10.36 or later
@end itemize
@noindent
If you wish to regenerate the @code{yacc} parser code in the @file{intl}
subdirectory you will need
@itemize @bullet
@item
GNU @code{bison} 2.7 or later
@end itemize
@noindent
You may also need these packages if you upgrade your source tree using