Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 579342 - sys-libs/glibc: configure uses "==" with `test` in a few places
Summary: sys-libs/glibc: configure uses "==" with `test` in a few places
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-08 13:21 UTC by Mikael Magnusson
Modified: 2016-04-10 06:08 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mikael Magnusson 2016-04-08 13:21:48 UTC
00_all_0053-S390-configure-check-for-vector-instruction-support-.patch adds lines like

+if test "$libc_cv_asm_s390_vx" = yes ;

to some configure and configure.ac. This should be

+if test x"$libc_cv_asm_s390_vx" = xyes ;
Comment 1 SpanKY gentoo-dev 2016-04-08 17:59:42 UTC
err, no, that is perfectly valid POSIX code and dash handles it fine.  punting this bug unless you can post real details here (like build logs showing some failure).

$ dash -c 'test "$foo" = yes; echo $?'
1
$ dash -c 'foo=yes; test "$foo" = yes; echo $?'
0
Comment 2 Mikael Magnusson 2016-04-09 03:32:55 UTC
Ah, that is true, I just saw the error in my output and spotted that line as a likely candidate.

Anyway, here's the error output from configure:

checking for AVX512 support in assembler... yes
/var/tmp/portage/sys-libs/glibc-2.22-r4/work/glibc-2.22/configure: 121: test: yes: unexpected operator
checking for AVX512 support... no


checking for Intel MPX support... yes
/var/tmp/portage/sys-libs/glibc-2.22-r4/work/glibc-2.22/configure: 248: test: yes: unexpected operator
checking for AVX2 support... yes


The first one appears to be from
sysdeps/x86_64/configure:121:if test $libc_cv_asm_avx512 == yes; then

and the second is in both x86_64 and i386.

Just grepping for 'test \$' in both configure.ac gives me

configure.ac:48:if test $host != $build; then
configure.ac:64:AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])
configure.ac:285:  if test $? -ne 0; then
configure.ac:341:  if test $libc_cv_sdt = yes; then
configure.ac:470:  # and test $add_ons_automatic to see if they were explicitly requested.
configure.ac:662:while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
configure.ac:667:if test $o != $tail; then
configure.ac:672:if test $o != $tail; then
configure.ac:783:while test $# -gt 0; do
configure.ac:824:	  if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
configure.ac:834:	if test $found = no; then
configure.ac:915:    if test $? -eq 88; then
configure.ac:920:  if test $found = no; then
configure.ac:977:AS_IF([test $libc_cv_compiler_ok != yes],
configure.ac:994:    test $libc_cv_autoconf_works = yes || AUTOCONF=no
configure.ac:1097:if test $libc_cv_friendly_stddef = yes; then
configure.ac:1114:if test $libc_cv_need_minus_P = yes; then
configure.ac:1140:if test $libc_cv_asm_set_directive = yes; then
configure.ac:1157:if test $libc_cv_asm_unique_object = yes; then
configure.ac:1173:if test $libc_cv_asm_previous_directive = yes; then
configure.ac:1188:  if test $libc_cv_asm_popsection_directive = yes; then
configure.ac:1207:if test $libc_cv_asm_protected_directive = yes; then
configure.ac:1224:  if test $libc_cv_visibility_attribute != yes; then
configure.ac:1229:if test $libc_cv_visibility_attribute = yes; then
configure.ac:1252:if test $libc_cv_visibility_attribute = yes; then
configure.ac:1270:  if test $libc_cv_broken_visibility_attribute = yes; then
configure.ac:1294:if test $libc_cv_broken_alias_attribute = yes; then
configure.ac:1298:if test $libc_cv_visibility_attribute = yes; then
configure.ac:1309:  if test $libc_cv_have_sdata_section = yes; then
configure.ac:1327:if test $libc_cv_initfini_array != yes; then
configure.ac:1357:if test $libc_cv_ctors_header = no; then
configure.ac:1374:if test $libc_cv_cc_with_libunwind = yes; then
configure.ac:1423:if test $libc_cv_as_noexecstack = yes; then
configure.ac:1516:    while test $# -ge 2 -a "$1" = NOTE; do
configure.ac:1561:if test $libc_cv_fno_toplevel_reorder = yes; then
configure.ac:1592:if test $libc_cv_gnu89_inline = yes; then
configure.ac:1616:if test $libc_cv_have_section_quotes = yes; then
configure.ac:1636:if test $libc_cv_asm_weak_directive = no; then
configure.ac:1658:if test $libc_cv_asm_weak_directive = yes; then
configure.ac:1660:elif test $libc_cv_asm_weakext_directive = yes; then
configure.ac:1679:if test $libc_cv_ld_no_whole_archive = no; then
configure.ac:1698:if test $libc_cv_gcc_exceptions = yes; then
configure.ac:1809:if test $libc_cv_cc_loop_to_function = yes; then
configure.ac:1883:if test $libc_cv_predef_fortify_source = yes; then
configure.ac:1923:if test $libc_cv_predef_stack_protector = yes; then
configure.ac:1975:if test $libc_cv_builtin_trap = yes; then
configure.ac:2042:if test ${old_glibc_headers} = yes; then
sysdeps/aarch64/configure.ac:17:if test $libc_cv_aarch64_be = yes; then
sysdeps/arm/configure.ac:22:if test $libc_cv_arm_pcs_vfp = yes; then
sysdeps/arm/configure.ac:36:if test $libc_cv_arm_tls_desc = yes; then
sysdeps/arm/configure.ac:78:if test $libc_cv_arm_pcrel_movw = yes; then
sysdeps/arm/configure.ac:116:if test $libc_cv_arm_tpoff_addend = no; then
sysdeps/hppa/configure.ac:64:if test $libc_cv_hppa_tls = no; then
sysdeps/i386/configure.ac:41:if test $libc_cv_cc_sse4 = yes; then
sysdeps/i386/configure.ac:58:if test $libc_cv_cc_avx = yes; then
sysdeps/i386/configure.ac:69:if test $libc_cv_cc_sse2avx = yes; then
sysdeps/i386/configure.ac:78:if test $libc_cv_cc_fma4 = yes; then
sysdeps/i386/configure.ac:102:if test $libc_cv_asm_mpx == yes; then
sysdeps/i386/configure.ac:110:if test $libc_cv_cc_avx2 = yes; then
sysdeps/mach/configure.ac:44:if test $libc_cv_mach_task_creation_time = no; then
sysdeps/mach/configure.ac:75:if test $libc_cv_mach_host_page_size = yes; then
sysdeps/mach/configure.ac:89:if test $libc_cv_mach_i386_ioports = yes; then
sysdeps/mach/configure.ac:98:if test $libc_cv_mach_i386_gdt = yes; then
sysdeps/mach/configure.ac:122:if test $hurd_cv_mig_retcode = yes; then
sysdeps/nios2/configure.ac:11:if test $libc_cv_nios2_be = yes; then
sysdeps/nptl/configure.ac:28:if test $libc_cv_forced_unwind = yes; then
sysdeps/nptl/configure.ac:41:  if test $libc_cv_c_cleanup = no; then
sysdeps/powerpc/powerpc32/configure.ac:14:if test $libc_cv_ppc_secure_plt = yes; then
sysdeps/sparc/configure.ac:28:if test $libc_cv_sparc_as_vis3 = yes; then
sysdeps/sparc/configure.ac:53:if test $libc_cv_sparc_gcc_gotdata = yes; then
sysdeps/sparc/configure.ac:57:if test $libc_cv_sparc_gcc_gotdata = yes; then
sysdeps/unix/sysv/linux/configure.ac:42:  if test $user_version -lt $arch_version; then
sysdeps/unix/sysv/linux/configure.ac:79:  if test $enable_sanity = yes; then
sysdeps/unix/sysv/linux/configure.ac:98:if test $host = $build; then
sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac:13:if test $libc_cv_ppc64_elfv2_abi = yes; then
sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac:26:  if test $libc_cv_ppc64_def_call_elf = no; then
sysdeps/x86_64/configure.ac:12:if test $libc_cv_cc_sse4 = yes; then
sysdeps/x86_64/configure.ac:21:if test $libc_cv_cc_avx = yes; then
sysdeps/x86_64/configure.ac:38:if test $libc_cv_asm_avx512 == yes; then
sysdeps/x86_64/configure.ac:46:if test $libc_cv_cc_avx512 = yes; then
sysdeps/x86_64/configure.ac:57:if test $libc_cv_cc_sse2avx = yes; then
sysdeps/x86_64/configure.ac:66:if test $libc_cv_cc_fma4 = yes; then
sysdeps/x86_64/configure.ac:90:if test $libc_cv_asm_mpx == yes; then
sysdeps/x86_64/configure.ac:98:if test $libc_cv_cc_avx2 = yes; then

I guess in most of these cases, these variables are never empty. There's a couple of double equals in there too which would also break dash if they get hit:
# dash -c 'test $libc_cv_asm_mpx == yes; echo $?'
dash: 1: test: ==: unexpected operator
2
# dash -c 'test $libc_cv_asm_mpx = yes; echo $?'
dash: 1: test: =: unexpected operator
2
(because the parameter is empty, these both errored)

# dash -c 'test $0 = yes; echo $?'
1
(okay, set parameter and one equals)

# dash -c 'test $0 == yes; echo $?'
dash: 1: test: dash: unexpected operator
2
(error, double equals)


I also did a grep for 'test.*==' but none of those are quoted so they are in the results above also.
Comment 3 SpanKY gentoo-dev 2016-04-09 23:42:33 UTC
the issue isn't so much the fact that the arg is unquoted but that it's using ==.  this isn't a regression as the code in question has been there for a while.

that said, configure bootstraps itself and re-execs with bash transparently.  are you exporting CONFIG_SHELL yourself and breaking that ?
Comment 4 SpanKY gentoo-dev 2016-04-10 00:16:04 UTC
i've fixed this upstream in the 2.20+ branches and master.  it'll make its way into Gentoo, but i don't think this warrants a specific update.  lemme know if there's anything else.
Comment 5 Mikael Magnusson 2016-04-10 06:08:47 UTC
(In reply to SpanKY from comment #3)
> the issue isn't so much the fact that the arg is unquoted but that it's
> using ==.  this isn't a regression as the code in question has been there
> for a while.
> 
> that said, configure bootstraps itself and re-execs with bash transparently.
> are you exporting CONFIG_SHELL yourself and breaking that ?

No, just using eselect set sh dash.