Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 929193

Summary: app-arch/libarchive-3.7.3: configure error when /bin/sh != bash
Product: Gentoo Linux Reporter: Matt Whitlock <gentoo>
Component: Current packagesAssignee: Michał Górny <mgorny>
Status: UNCONFIRMED ---    
Severity: normal CC: gentoo
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/libarchive/libarchive/pull/2117
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 526268    
Attachments: 3.7.3-configure-fix-bashism.patch

Description Matt Whitlock 2024-04-11 20:58:00 UTC
Created attachment 890470 [details, diff]
3.7.3-configure-fix-bashism.patch

Libarchive's configure.ac contains a Bashism (use of == operator with test built-in). Thus, configure emits an error when /bin/sh is not Bash. This doesn't cause the build to fail outright, but it may be causing misdetection of features.

checking whether C compiler accepts -Wall... (cached) yes
checking whether C compiler accepts -Wformat... (cached) yes
checking whether C compiler accepts -Wformat-security... (cached) yes
checking whether ld supports --gc-sections... yes
checking whether C compiler accepts -ffunction-sections... (cached) yes
checking whether C compiler accepts -fdata-sections... (cached) yes
/var/tmp/portage/app-arch/libarchive-3.7.3/work/libarchive-3.7.3/configure: 17818: test: -Wl,--gc-sections: unexpected operator

The error is due to this Bashism in configure.ac:

if test "$DEAD_CODE_REMOVAL" == ""; then

The attached patch corrects the Bashism and allows app-arch/libarchive-3.7.3 to configure without error.

Note: The patch has to touch the aclocal.m4 file to set its mtime after configure.ac's, or else the build fails due to auto-regenerating only some of the generated build system, leading to a libtool version mismatch.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-04-11 21:01:48 UTC
I should've done -z, but I fixed it upstream already with =.