Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 779187 - [PATCH] dev-util/re2c-2.1.1: configure error when /bin/sh != bash
Summary: [PATCH] dev-util/re2c-2.1.1: configure error when /bin/sh != bash
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Robin Johnson
URL: https://github.com/skvadrik/re2c/pull...
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: nonbash
  Show dependency tree
 
Reported: 2021-03-30 01:49 UTC by Matt Whitlock
Modified: 2021-05-10 17:05 UTC (History)
5 users (show)

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


Attachments
re2c-2.1.1-configure-bashisms.patch (re2c-2.1.1-configure-bashisms.patch,835 bytes, patch)
2021-03-30 01:49 UTC, Matt Whitlock
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Whitlock 2021-03-30 01:49:10 UTC
Created attachment 696138 [details, diff]
re2c-2.1.1-configure-bashisms.patch

re2c's configure.ac contains Bashisms (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.

AM_CONDITIONAL([WITH_BENCHMARKS], [test "x$enable_benchmarks" == "xyes"])

    [test "x$enable_benchmarks_regenerate" == "xyes"])

./configure: 5339: test: x: unexpected operator
./configure: 5386: test: x: unexpected operator

The attached patch removes the Bashisms and allows dev-util/re2c-2.1.1 to configure without error when /bin/sh is Dash, after the following changes are made to the ebuild:

inherit autotools

src_prepare() {
	default
	eautoreconf
}
Comment 1 Sergei Trofimovich gentoo-dev 2021-03-30 07:29:20 UTC
Looks good. Can you send it upstream as well?
Comment 2 Larry the Git Cow gentoo-dev 2021-03-30 07:37:03 UTC
The bug has been referenced in the following commit(s):

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

commit f046a2ab06555b7cdfd47f03cf12337b18effa5e
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2021-03-30 07:36:38 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2021-03-30 07:37:01 +0000

    dev-util/re2c: tweak ./configure for dash
    
    Matt noticed errors when running ./configure on dash:
        ./configure: 5339: test: x: unexpected operator
        ./configure: 5386: test: x: unexpected operator
    
    The change is to use POSIX '=' comparison instead of bash-specific ==.
    
    Patch-by: Matt Whitlock
    Bug: https://bugs.gentoo.org/779187
    Package-Manager: Portage-3.0.18, Repoman-3.0.3
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 dev-util/re2c/files/re2c-2.1.1-sh.patch | 48 +++++++++++++++++++++++++++++++++
 dev-util/re2c/re2c-2.1.1-r1.ebuild      | 29 ++++++++++++++++++++
 2 files changed, 77 insertions(+)
Comment 3 Sergei Trofimovich gentoo-dev 2021-03-31 18:52:29 UTC
Proposed upstream as https://github.com/skvadrik/re2c/pull/348
Comment 4 Étienne Buira 2021-05-10 15:17:31 UTC
This fix breaks compilation, as configure.ac timestamp is updated, autotools invokes itself to re-generate configure (and there is no dependency on autotools).

Please reopen or add "inherit autotools"/eautoreconf.

Seen error:

>>> Compiling source in /var/tmp/portage/dev-util/re2c-2.1.1-r1/work/re2c-2.1.1 ...
make -j2 
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /var/tmp/portage/dev-util/re2c-2.1.1-r1/work/re2c-2.1.1/build-aux/missing aclocal-1.16 
/var/tmp/portage/dev-util/re2c-2.1.1-r1/work/re2c-2.1.1/build-aux/missing: line 81: aclocal-1.16: command not found
WARNING: 'aclocal-1.16' is missing on your system.
         You should only need it if you modified 'acinclude.m4' or
         'configure.ac' or m4 files included by 'configure.ac'.
         The 'aclocal' program is part of the GNU Automake package:
         <https://www.gnu.org/software/automake>
         It also requires GNU Autoconf, GNU m4 and Perl in order to run:
         <https://www.gnu.org/software/autoconf>
         <https://www.gnu.org/software/m4/>
         <https://www.perl.org/>
make: *** [Makefile:1758: aclocal.m4] Error 127
Comment 5 Sam James archtester gentoo-dev Security 2021-05-10 15:20:35 UTC
(In reply to Étienne Buira from comment #4)
> This fix breaks compilation, as configure.ac timestamp is updated, autotools
> invokes itself to re-generate configure (and there is no dependency on
> autotools).
> 
> Please reopen or add "inherit autotools"/eautoreconf.
> 
> Seen error:
> 

In future, please file a new bug. I can fix this quickly now but this is easy to miss.

> >>> Compiling source in /var/tmp/portage/dev-util/re2c-2.1.1-r1/work/re2c-2.1.1 ...
> make -j2 
> CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh
> /var/tmp/portage/dev-util/re2c-2.1.1-r1/work/re2c-2.1.1/build-aux/missing
> aclocal-1.16 
> /var/tmp/portage/dev-util/re2c-2.1.1-r1/work/re2c-2.1.1/build-aux/missing:
> line 81: aclocal-1.16: command not found
> WARNING: 'aclocal-1.16' is missing on your system.
>          You should only need it if you modified 'acinclude.m4' or
>          'configure.ac' or m4 files included by 'configure.ac'.
>          The 'aclocal' program is part of the GNU Automake package:
>          <https://www.gnu.org/software/automake>
>          It also requires GNU Autoconf, GNU m4 and Perl in order to run:
>          <https://www.gnu.org/software/autoconf>
>          <https://www.gnu.org/software/m4/>
>          <https://www.perl.org/>
> make: *** [Makefile:1758: aclocal.m4] Error 127
Comment 6 Sam James archtester gentoo-dev Security 2021-05-10 15:24:52 UTC
(In reply to Sam James from comment #5)
> (In reply to Étienne Buira from comment #4)
> > This fix breaks compilation, as configure.ac timestamp is updated, autotools
> > invokes itself to re-generate configure (and there is no dependency on
> > autotools).
> > 
> > Please reopen or add "inherit autotools"/eautoreconf.
> > 
> > Seen error:
> > 
> 
> In future, please file a new bug. I can fix this quickly now but this is
> easy to miss.
> 

(and when you do, include a full build.log and emerge --info).
Comment 7 Larry the Git Cow gentoo-dev 2021-05-10 15:25:51 UTC
The bug has been closed via the following commit(s):

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

commit be44b523eb78e10f9a594f4f900af44eaeb36b61
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-05-10 15:24:40 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-05-10 15:25:43 +0000

    dev-util/re2c: regenerate autotools for nonbash patch
    
    While the used patch does modify configure directly,
    this is fragile and sometimes causes maintainer mode
    to be triggered regardless. Let's regenerate autotools
    to be safe given a user managed to hit this.
    
    Closes: https://bugs.gentoo.org/779187
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-util/re2c/re2c-2.1.1-r1.ebuild | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Comment 8 Sergei Trofimovich gentoo-dev 2021-05-10 17:05:58 UTC
(In reply to Larry the Git Cow from comment #7)
> The bug has been closed via the following commit(s):
> 
> https://gitweb.gentoo.org/repo/gentoo.git/commit/
> ?id=be44b523eb78e10f9a594f4f900af44eaeb36b61
> 
> commit be44b523eb78e10f9a594f4f900af44eaeb36b61
> Author:     Sam James <sam@gentoo.org>
> AuthorDate: 2021-05-10 15:24:40 +0000
> Commit:     Sam James <sam@gentoo.org>
> CommitDate: 2021-05-10 15:25:43 +0000
> 
>     dev-util/re2c: regenerate autotools for nonbash patch
>     
>     While the used patch does modify configure directly,
>     this is fragile and sometimes causes maintainer mode
>     to be triggered regardless. Let's regenerate autotools
>     to be safe given a user managed to hit this.
>     
>     Closes: https://bugs.gentoo.org/779187
>     Signed-off-by: Sam James <sam@gentoo.org>
> 
>  dev-util/re2c/re2c-2.1.1-r1.ebuild | 12 ++++++++++++
>  1 file changed, 12 insertions(+)

The patch does include configure changes and is applied after .ac change. There should be no need for eautoreconf. If it does it might be a sign of broken clock on the machine.