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

Bug 687002

Summary: app-shells/dash: re-enable LINENO support
Product: Gentoo Linux Reporter: Michael Orlitzky <mjo>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: alexander
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=527644
https://bugs.gentoo.org/show_bug.cgi?id=714092
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: dash-0.5.10.2-r1.ebuild

Description Michael Orlitzky gentoo-dev 2019-05-30 11:53:19 UTC
Our existing dash ebuilds pass "--disable-lineno" to the configure script to disable its support for the LINENO variable within scripts. However, LINENO is part of POSIX,

  https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html

and some scripts expect it to work.

It was disabled in bug #527644 to work around upstream bashisms in some configure scripts. And while I'm sure a few of those problems persist, I make the following arguments:

  * As a user, I choose dash for speed. On a Gentoo system, ./configure
    scripts are likely the most common place to experience those speedups.
    Forcing ./configure to re-exec itself with /bin/bash because it can't
    use LINENO is counterproductive to me.

  * As a developer, I use dash precisely because I want to find and fix
    these upstream bugs. Sweeping them under the rug hurts the upstreams
    that care about portability.

  * Things are a lot better than they were in 2014 for users of a non-bash
    /bin/sh. By now, a lot of the bashisms should have been caught, and
    upstreams are at least familiar with the issue (so they won't reject
    our bug reports).
Comment 1 Michael Orlitzky gentoo-dev 2020-03-13 18:25:03 UTC
There is finally someone working on a new release of autoconf, and this is causing problems:

  https://lists.gnu.org/archive/html/autoconf/2020-03/msg00022.html

The LINENO variable is POSIX:

  https://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html

Please, unbreak dash (or let me do it).
Comment 2 Mike Gilbert gentoo-dev 2020-03-13 18:35:31 UTC
I say we give it a try in ~arch. Please go ahead if nobody else protests in the next few day.
Comment 3 Michael Orlitzky gentoo-dev 2020-03-15 14:34:50 UTC
Created attachment 619818 [details]
dash-0.5.10.2-r1.ebuild

Here's an EAPI=7 ebuild.

Please review: this ebuild also drops the gentoo-only "dumb echo" patch that was enabled by default. You can see in bug 337329 that vapier went on a rant against dash and hacked the shell to work around the fact that imagemagick was using an autoconf macro that was missing a call to AS_ECHO. Those are *precisely* the sort of portability problems that people use dash to detect. Dash's upstream behavior is correct according to POSIX, and this patch was never submitted, so we're doomed to have "echo" act weird on Gentoo forever unless we drop it.
Comment 4 Mike Gilbert gentoo-dev 2020-03-15 15:06:57 UTC
(In reply to Michael Orlitzky from comment #3)

Yeah, I tried disabling the dumb-echo patch by default.

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

vapier changed the USE flag from "dumb-echo", to "vanilla", which effectively re-enabled the patch by default.

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

I have no objection to dropping the patch entirely.

The new ebuild looks good to me.
Comment 5 Larry the Git Cow gentoo-dev 2020-03-15 15:58:31 UTC
The bug has been closed via the following commit(s):

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

commit 808dded4f103becf7929562b1ed58046aa63f3f6
Author:     Michael Orlitzky <mjo@gentoo.org>
AuthorDate: 2020-03-15 15:34:34 +0000
Commit:     Michael Orlitzky <mjo@gentoo.org>
CommitDate: 2020-03-15 15:56:02 +0000

    app-shells/dash: new revision that more-closely matches upstream.
    
    Our dash ebuilds differed from upstream in two ways in the past: we
    disabled LINENO support with --disable-lineno, and we patched the
    "echo" command to ignore certain arguments and escape sequences.
    
    Disabling LINENO tricks configure scripts into re-executing themselves
    with bash, which can hide errors for users (good?), but also hides
    them from developers (bad). The LINENO variable is covered by POSIX,
    and it's counterintuitive to silently force bash on users who have
    explicitly set /bin/sh to dash. This new revision therefore re-enables
    LINENO. This same change (in the context of Debian) was discussed on
    the autoconf mailing list.
    
    The "dumb echo" patch reflects a similar situation. Dash's upstream
    "echo" implementation differs from the bash implementation, but is
    correct according to POSIX. This can shed light upon some portability
    bugs, particularly in autoconf scripts, and the "dumb echo" patch
    hides some of those bugs from end users. But again, it hides them from
    the authors as well and thereby perpetuates the portability issues.
    Since this patch is Gentoo-specific, and hides problems that are
    better addressed elsewhere, this new revision eliminates it.
    
    Closes: https://bugs.gentoo.org/687002
    Package-Manager: Portage-2.3.84, Repoman-2.3.20
    Signed-off-by: Michael Orlitzky <mjo@gentoo.org>

 app-shells/dash/dash-0.5.10.2-r1.ebuild | 53 +++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)