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

Bug 723084

Summary: app-arch/zip-3.0-r3: zip-3.0-pic.patch introduces a Bashism into a /bin/sh configure script
Product: Gentoo Linux Reporter: Matt Whitlock <gentoo>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: jstein
Priority: Normal Keywords: PullRequest
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/gentoo/gentoo/pull/16855
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 526268    

Description Matt Whitlock 2020-05-14 18:44:35 UTC
app-arch/zip-3.0-r3 applies files/zip-3.0-pic.patch, which contains a Bashism (use of == operator with [ built-in). Thus, configure emits the error shown below when /bin/sh is not Bash. This doesn't cause the build to fail outright, but it may be causing misdetection of features.

Checking if compiler wants to create pic code
./unix/configure: 233: [: #define __pic__ 2
#define __PIC__ 2: unexpected operator

The patch should be corrected:

--- app-arch/zip/files/zip-3.0-pic.patch~	2015-08-09 00:38:18.000000000 +0000
+++ app-arch/zip/files/zip-3.0-pic.patch	2020-05-14 18:40:51.740215030 +0000
@@ -9,7 +9,7 @@
  OCRCU8=""
 +piclib="$(echo | $CPP -dM $CFLAGS - | grep -i __pic__)"
 +echo "Checking if compiler wants to create pic code"
-+[ "$piclib" == "" ] && \
++[ "$piclib" = "" ] && \
  if eval "$CPP match.S > _match.s 2>/dev/null"; then
    if test ! -s _match.s || grep error < _match.s > /dev/null; then
      :

After making the above correction, configure no longer emits the "unexpected operator" error when /bin/sh is not Bash.
Comment 1 Volkmar W. Pogatzki 2020-07-27 08:33:51 UTC
Cannot reproduce that "unexpected operator" behavior:

 * Package:    app-arch/zip-3.0-r4
 * Repository: gentoo
 * Maintainer: base-system@gentoo.org
 * USE:        abi_x86_64 amd64 bzip2 crypt elibc_glibc kernel_linux unicode userland_GNU
 * FEATURES:   network-sandbox preserve-libs sandbox userpriv usersandbox
 * Package:    app-arch/zip-3.0-r4
 * Repository: gentoo
 * Maintainer: base-system@gentoo.org
 * USE:        abi_x86_64 amd64 bzip2 crypt elibc_glibc kernel_linux unicode userland_GNU
 * FEATURES:   network-sandbox preserve-libs sandbox userpriv usersandbox
>>> Unpacking source...
>>> Unpacking zip30.zip to /var/tmp/portage/app-arch/zip-3.0-r4/work
>>> Source unpacked in /var/tmp/portage/app-arch/zip-3.0-r4/work
>>> Preparing source in /var/tmp/portage/app-arch/zip-3.0-r4/work/zip30 ...
 * Applying zip-3.0-no-crypt.patch ...
 [ ok ]
 * Applying zip-3.0-pic.patch ...
 [ ok ]
 * Applying zip-3.0-exec-stack.patch ...
 [ ok ]
 * Applying zip-3.0-build.patch ...
 [ ok ]
 * Applying zip-3.0-zipnote-freeze.patch ...
 [ ok ]
 * Applying zip-3.0-format-security.patch ...
 [ ok ]
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/app-arch/zip-3.0-r4/work/zip30 ...
Check C compiler type (optimization options)
  GNU C (-O3)
Check bzip2 support
Comment 2 Volkmar W. Pogatzki 2020-07-27 08:43:25 UTC
(In reply to Volkmar W. Pogatzki from comment #1)
> Cannot reproduce that "unexpected operator" behavior:

Sorry. The output I've tried posting was not complete.  So here ...

 * Package:    app-arch/zip-3.0-r4
 * Repository: gentoo
 * Maintainer: base-system@gentoo.org
 * USE:        abi_x86_64 amd64 bzip2 crypt elibc_glibc kernel_linux unicode userland_GNU
 * FEATURES:   network-sandbox preserve-libs sandbox userpriv usersandbox
 * Package:    app-arch/zip-3.0-r4
 * Repository: gentoo
 * Maintainer: base-system@gentoo.org
 * USE:        abi_x86_64 amd64 bzip2 crypt elibc_glibc kernel_linux unicode userland_GNU
 * FEATURES:   network-sandbox preserve-libs sandbox userpriv usersandbox
>>> Unpacking source...
>>> Unpacking zip30.zip to /var/tmp/portage/app-arch/zip-3.0-r4/work
>>> Source unpacked in /var/tmp/portage/app-arch/zip-3.0-r4/work
>>> Preparing source in /var/tmp/portage/app-arch/zip-3.0-r4/work/zip30 ...
 * Applying zip-3.0-no-crypt.patch ...
 [ ok ]
 * Applying zip-3.0-pic.patch ...
 [ ok ]
 * Applying zip-3.0-exec-stack.patch ...
 [ ok ]
 * Applying zip-3.0-build.patch ...
 [ ok ]
 * Applying zip-3.0-zipnote-freeze.patch ...
 [ ok ]
 * Applying zip-3.0-format-security.patch ...
 [ ok ]
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/app-arch/zip-3.0-r4/work/zip30 ...
Check C compiler type (optimization options)
  GNU C (-O3)
Check bzip2 support
  Check for bzip2 compiled library in IZ_BZIP2 (/var/tmp/portage/app-arch/zip-3.0-r4/temp)
    /var/tmp/portage/app-arch/zip-3.0-r4/temp/libbz2.a not found
-- Since IZ_BZIP2 defined, skipping OS and bzip2 checks - no bzip2
Check for the C preprocessor
Check if we can use asm code
Checking if compiler wants to create pic code
Check for ANSI options
Check for prototypes
Check the handling of const
Check for time_t
Check for size_t
Check for off_t
Check size of UIDs and GIDs
Comment 3 Matt Whitlock 2020-07-27 12:36:23 UTC
(In reply to Volkmar W. Pogatzki from comment #1)
> Cannot reproduce that "unexpected operator" behavior

To what shell is your /bin/sh linked?
Comment 4 Larry the Git Cow gentoo-dev 2020-07-27 15:19:47 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=984af8e316087ab6a6562a7ddd0bc09fb19f272a

commit 984af8e316087ab6a6562a7ddd0bc09fb19f272a
Author:     Volkmar W. Pogatzki <gentoo@pogatzki.net>
AuthorDate: 2020-07-27 15:00:14 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2020-07-27 15:19:23 +0000

    app-arch/zip: fix bashism in zip-3.0-pic.patch
    
    Closes: https://bugs.gentoo.org/723084
    Package-Manager: Portage-2.3.103, Repoman-2.3.23
    Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>
    Closes: https://github.com/gentoo/gentoo/pull/16855

 app-arch/zip/files/zip-3.0-pic.patch | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)