From unknown Sun Jun 22 20:55:40 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#17471 <17471@debbugs.gnu.org> To: bug#17471 <17471@debbugs.gnu.org> Subject: Status: On Solaris 10, grep snapshot apparently hit by bleeding-edge Autoconf bug Reply-To: bug#17471 <17471@debbugs.gnu.org> Date: Mon, 23 Jun 2025 03:55:40 +0000 retitle 17471 On Solaris 10, grep snapshot apparently hit by bleeding-edge = Autoconf bug reassign 17471 grep submitter 17471 Paul Eggert severity 17471 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sun May 11 16:49:20 2014 Received: (at submit) by debbugs.gnu.org; 11 May 2014 20:49:20 +0000 Received: from localhost ([127.0.0.1]:59725 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjagR-0007AJ-KT for submit@debbugs.gnu.org; Sun, 11 May 2014 16:49:20 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49721) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjagO-00079x-Im for submit@debbugs.gnu.org; Sun, 11 May 2014 16:49:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WjagC-0000uZ-Cb for submit@debbugs.gnu.org; Sun, 11 May 2014 16:49:11 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:48322) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjagC-0000uV-9k for submit@debbugs.gnu.org; Sun, 11 May 2014 16:49:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51390) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wjag4-0008Mq-UC for bug-grep@gnu.org; Sun, 11 May 2014 16:49:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wjafy-0000sE-SM for bug-grep@gnu.org; Sun, 11 May 2014 16:48:56 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]:32879) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wjafm-0000qj-TR; Sun, 11 May 2014 16:48:39 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 94F8A39E8019; Sun, 11 May 2014 13:48:37 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Q6NJMYKsxcbf; Sun, 11 May 2014 13:48:32 -0700 (PDT) Received: from [192.168.1.9] (pool-108-0-233-62.lsanca.fios.verizon.net [108.0.233.62]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id DB8F239E8016; Sun, 11 May 2014 13:48:32 -0700 (PDT) Message-ID: <536FE220.8070600@cs.ucla.edu> Date: Sun, 11 May 2014 13:48:32 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: grep mailing list Subject: On Solaris 10, grep snapshot apparently hit by bleeding-edge Autoconf bug Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit Cc: Autoconf bugs X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Following up to the grep snapshot announcement in: http://lists.gnu.org/archive/html/platform-testers/2014-05/msg00000.html That snapshot failed to build the shell scripts egrep and fgrep properly on Solaris 10, because it set "SHELL = /bin/sh" in src/Makefile, which caused the makefile to put "#!/bin/sh" at the top of the shell scripts, which breaks because the shell scripts use a construct '${0%/*}' that Solaris 10 /bin/sh doesn't grok. The build should have used SHELL = /bin/bash, which is what grep does with my test builds. We could work around the problem by avoiding that shell construct, but I'd rather fix the build machinery because this bug could affect any package that uses POSIX shell scripts. The snapshot was built with an experimental version of Autoconf (2.69.117-1717), whereas I had tested with the latest stable version (2.69 as shipped with Fedora 20). The two versions differ in how they compute the name of a working shell, so it appears that there's a bug in the experimental version of Autoconf. A quick workaround for grep is to build the next snapshot with Autoconf 2.69. In the long run, though, we should fix the Autoconf bug. I'll CC: this to bug-autoconf to give them a heads-up. From debbugs-submit-bounces@debbugs.gnu.org Mon May 12 08:15:39 2014 Received: (at submit) by debbugs.gnu.org; 12 May 2014 12:15:39 +0000 Received: from localhost ([127.0.0.1]:60259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wjp8s-0001Aq-5F for submit@debbugs.gnu.org; Mon, 12 May 2014 08:15:38 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39579) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wjp8n-0001AZ-EL for submit@debbugs.gnu.org; Mon, 12 May 2014 08:15:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wjp8c-0004FL-0o for submit@debbugs.gnu.org; Mon, 12 May 2014 08:15:28 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:49748) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wjp8b-0004F9-Uh for submit@debbugs.gnu.org; Mon, 12 May 2014 08:15:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wjp8X-0000ji-I8 for bug-grep@gnu.org; Mon, 12 May 2014 08:15:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wjp8T-000459-34 for bug-grep@gnu.org; Mon, 12 May 2014 08:15:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61812) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wjp8S-00044o-SL; Mon, 12 May 2014 08:15:13 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4CCF3qs010846 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 May 2014 08:15:03 -0400 Received: from [10.3.113.30] (ovpn-113-30.phx2.redhat.com [10.3.113.30]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s4CCF220010033; Mon, 12 May 2014 08:15:02 -0400 Message-ID: <5370BB46.3030003@redhat.com> Date: Mon, 12 May 2014 06:15:02 -0600 From: Eric Blake Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Paul Eggert , grep mailing list Subject: Re: On Solaris 10, grep snapshot apparently hit by bleeding-edge Autoconf bug References: <536FE220.8070600@cs.ucla.edu> In-Reply-To: <536FE220.8070600@cs.ucla.edu> X-Enigmail-Version: 1.6 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="kpB4J8BJLTPt3pBNjSfSe4kMqfQCd4atL" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit Cc: Autoconf bugs X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --kpB4J8BJLTPt3pBNjSfSe4kMqfQCd4atL Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 05/11/2014 02:48 PM, Paul Eggert wrote: > Following up to the grep snapshot announcement in: >=20 > http://lists.gnu.org/archive/html/platform-testers/2014-05/msg00000.htm= l >=20 > That snapshot failed to build the shell scripts egrep and fgrep properl= y > on Solaris 10, because it set "SHELL =3D /bin/sh" in src/Makefile, whic= h > caused the makefile to put "#!/bin/sh" at the top of the shell scripts,= > which breaks because the shell scripts use a construct '${0%/*}' that > Solaris 10 /bin/sh doesn't grok. The build should have used SHELL =3D > /bin/bash, which is what grep does with my test builds. In autoconf.git, there are zero hits for: git grep -F '0%/*' However, in grep.git, there is: src/egrep.sh: if test -x "${0%/*}/@grep@"; then src/egrep.sh: PATH=3D${0%/*}:$PATH The culprit is grep itself, not autoconf. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --kpB4J8BJLTPt3pBNjSfSe4kMqfQCd4atL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTcLtGAAoJEKeha0olJ0Nqp9gH+gMhWS8fAKjm/tnxctfbseif zkTuwOp0jvKRnBzWve5+NzYGTZw6z9r/z9mxRRe8lGyzeYwaoJqj9gFl5XR+H1bC ahJHmm9uIZayJx6JgINYg0ckATmaH7xEoX/8P9HHOIJmvpv/rJsVHAF3mJHf9u+5 Jr6fJ6dSeeAL/is2sdJLXIPWm+23ibXHK3RfKmDtLqznxvGn2EC4EtI/YWARlceG 8JFKKvDKvsyC0XstmCTR/ZRJ33uLRmvkiSVezNqO5T12DUJfMI6HkaQIE+LvFcti liYs5gKGDxUpOU7DfOKIRhelzpPwSBtH4oekl/Cmd41G5gvf5hkrlbfOaBsoiXs= =ZB8P -----END PGP SIGNATURE----- --kpB4J8BJLTPt3pBNjSfSe4kMqfQCd4atL-- From debbugs-submit-bounces@debbugs.gnu.org Mon May 12 13:34:13 2014 Received: (at 17471) by debbugs.gnu.org; 12 May 2014 17:34:13 +0000 Received: from localhost ([127.0.0.1]:60967 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wju7A-0003Ig-1J for submit@debbugs.gnu.org; Mon, 12 May 2014 13:34:12 -0400 Received: from mail-yk0-f179.google.com ([209.85.160.179]:55866) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wju77-0003IR-3M for 17471@debbugs.gnu.org; Mon, 12 May 2014 13:34:09 -0400 Received: by mail-yk0-f179.google.com with SMTP id 19so6163534ykq.38 for <17471@debbugs.gnu.org>; Mon, 12 May 2014 10:34:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=W4vE18RN8IjJzOgPDXXhQgJhMPvnY4Pga6ugLEHQ4RE=; b=wZ/eI8VaafeMIzBmKhaslxNY6G4GHDLyblCe53cThCEJjTQ02pzufqGX3FDyV1dnti WWe0ZdfVw1Y9/jHoY7dU3C3hEMmM+GtwHPLOoduXpWLj2qy7vK5ifXzo/NaeiWQkeEfd YZ9g/3U82NwUgXOZs4n7C+ySVPfyZOtl7EcBQYjwn/w2hv3PGEiHrCZZngfpFl5CWw8C 1iDCvfQe0Y+syFv4pF/MGyueBHGjIwh7rBUtPNW2gWB3MglIduJT66/bQ8QXVzXuVLkN yDgLso4ljhRs72NHpeHjAg+QajR0KiCAu295/cuosAlGIRASBmZH7rQF1nKrh+RsBbP4 kqMQ== X-Received: by 10.236.151.116 with SMTP id a80mr43065962yhk.48.1399916043397; Mon, 12 May 2014 10:34:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.170.127.18 with HTTP; Mon, 12 May 2014 10:33:42 -0700 (PDT) In-Reply-To: <536FE220.8070600@cs.ucla.edu> References: <536FE220.8070600@cs.ucla.edu> From: Jim Meyering Date: Mon, 12 May 2014 10:33:42 -0700 X-Google-Sender-Auth: Dl8a8KaAG4BDzgnBzsZ1eCF3Oco Message-ID: Subject: Re: bug#17471: On Solaris 10, grep snapshot apparently hit by bleeding-edge Autoconf bug To: Paul Eggert Content-Type: multipart/mixed; boundary=20cf303a36737b863e04f9375a91 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 17471 Cc: 17471@debbugs.gnu.org, Autoconf bugs X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --20cf303a36737b863e04f9375a91 Content-Type: text/plain; charset=ISO-8859-1 On Sun, May 11, 2014 at 1:48 PM, Paul Eggert wrote: > Following up to the grep snapshot announcement in: > > http://lists.gnu.org/archive/html/platform-testers/2014-05/msg00000.html > > That snapshot failed to build the shell scripts egrep and fgrep properly on > Solaris 10, because it set "SHELL = /bin/sh" in src/Makefile, which caused > the makefile to put "#!/bin/sh" at the top of the shell scripts, which > breaks because the shell scripts use a construct '${0%/*}' that Solaris 10 > /bin/sh doesn't grok. The build should have used SHELL = /bin/bash, which > is what grep does with my test builds. > > We could work around the problem by avoiding that shell construct, but I'd > rather fix the build machinery because this bug could affect any package > that uses POSIX shell scripts. The snapshot was built with an experimental > version of Autoconf (2.69.117-1717), whereas I had tested with the latest > stable version (2.69 as shipped with Fedora 20). The two versions differ in > how they compute the name of a working shell, so it appears that there's a > bug in the experimental version of Autoconf. > > A quick workaround for grep is to build the next snapshot with Autoconf > 2.69. In the long run, though, we should fix the Autoconf bug. I'll CC: > this to bug-autoconf to give them a heads-up. Hi Paul, Thanks for reporting that. I would like our egrep and fgrep scripts to work even on systems with a non-POSIX shell and no "bash" to fall back on. Our tests/init.sh code tries hard to find a sufficiently functional shell (including a test for the ${VAR%GLOB} construct), and making it work in spite of Solaris's /bin/sh was tricky, and we had to be willing to give up and skip tests altogether, in the event that no sufficiently featureful shell is found. Here, we don't have that luxury. Ideally, these wrapper shell scripts would not have to fork an extra process to perform this trivial string manipulation, but I can live with the extra overhead, expecially for scripts like these that merely provide support for obsolescent-named programs. I think the attach patch is sufficiently portable to do what I want. Does anyone see a way to make it more efficient with a POSIX shell? --20cf303a36737b863e04f9375a91 Content-Type: application/octet-stream; name="0001-egrep-fgrep-make-wrappers-portable-to-non-POSIX-shel.patch" Content-Disposition: attachment; filename="0001-egrep-fgrep-make-wrappers-portable-to-non-POSIX-shel.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hv41ul5w0 RnJvbSBlMmEzMDViZmYyYmUzNzZmNmRkMjllNTJhMWQzMjYzNmUwYzIyNzA2IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gTWV5ZXJpbmcgPG1leWVyaW5nQGZiLmNvbT4KRGF0ZTog TW9uLCAxMiBNYXkgMjAxNCAxMDozMzowOSAtMDcwMApTdWJqZWN0OiBbUEFUQ0hdIGVncmVwLCBm Z3JlcDogbWFrZSB3cmFwcGVycyBwb3J0YWJsZSB0byBub24tUE9TSVggc2hlbGxzCgoqIHNyYy9l Z3JlcC5zaCAoZ3JlcCk6IFVzZSBzZWQgaW4gYSBzdWJzaGVsbCBpbiBwbGFjZSBvZiB0aGUKUE9T SVggc2ggY29uc3RydWN0LCAkezAlLyp9LiAgVGhlIGxhdHRlciBpcyBub3QgcG9ydGFibGUgdG8K U29sYXJpcyAxMC4gIFJlcG9ydGVkIGJ5IFBhdWwgRWdnZXJ0IGluIGh0dHA6Ly9kZWJidWdzLmdu dS5vcmcvMTc0NzEKLS0tCiBzcmMvZWdyZXAuc2ggfCA3ICsrKystLS0KIDEgZmlsZSBjaGFuZ2Vk LCA0IGluc2VydGlvbnMoKyksIDMgZGVsZXRpb25zKC0pCgpkaWZmIC0tZ2l0IGEvc3JjL2VncmVw LnNoIGIvc3JjL2VncmVwLnNoCmluZGV4IGYxYjQxNDYuLjBhMzc0YWEgMTAwNjQ0Ci0tLSBhL3Ny Yy9lZ3JlcC5zaAorKysgYi9zcmMvZWdyZXAuc2gKQEAgLTIsOSArMiwxMCBAQAogZ3JlcD1ncmVw CiBjYXNlICQwIGluCiAgICovKikKLSAgICBpZiB0ZXN0IC14ICIkezAlLyp9L0BncmVwQCI7IHRo ZW4KLSAgICAgIFBBVEg9JHswJS8qfTokUEFUSAotICAgICAgZ3JlcD1AZ3JlcEAKKyAgICBkaXJu YW1lPWBlY2hvICIkMCJ8c2VkICdzLC8vKlteL10qJCwsJ2AKKyAgICBpZiB0ZXN0IC14ICIkZGly bmFtZSIvJ0BncmVwQCc7IHRoZW4KKyAgICAgIFBBVEg9IiRkaXJuYW1lOiRQQVRIIgorICAgICAg Z3JlcD0nQGdyZXBAJwogICAgIGZpOzsKIGVzYWMKIGV4ZWMgJGdyZXAgQG9wdGlvbkAgIiRAIgot LSAKMi4wLjAucmMzCgo= --20cf303a36737b863e04f9375a91-- From debbugs-submit-bounces@debbugs.gnu.org Mon May 12 13:57:25 2014 Received: (at 17471) by debbugs.gnu.org; 12 May 2014 17:57:25 +0000 Received: from localhost ([127.0.0.1]:32774 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjuTd-000458-69 for submit@debbugs.gnu.org; Mon, 12 May 2014 13:57:25 -0400 Received: from mail-yk0-f180.google.com ([209.85.160.180]:57137) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjuTa-00044p-4A for 17471@debbugs.gnu.org; Mon, 12 May 2014 13:57:22 -0400 Received: by mail-yk0-f180.google.com with SMTP id q9so6183933ykb.39 for <17471@debbugs.gnu.org>; Mon, 12 May 2014 10:57:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=IcVq6clrM1ctd26qgkPlj6hcATOl/zhweBUdGbtXFik=; b=o/TIdO2pD9kLviQRpkx2cKbvCk+okj0op7nuMT6NGm4iz75secpSodmdT/rwAzYqp5 rdESvdWImEX4CO/LDJ4k5URyyTU4y+eaB7SV4XCzd1XyslVGkZJozDWMhpDH652Fcv9e 3yAP4V/B6PT1UgOOVMk5PgkWv2RoT0EX8+gWVIQWG68VZZfEym7uUgGscxS56bTsFcLy +8Q6sb3sdfqFRcMJp7UMSEnskliqmS4pHE9Nk3iMwPBZH7mfi/AbHUD2MfO7LXL62AQn zDFxZmwWUbBIU1OfED7PKYxgPrNvJJ9tlGVLSqpXs2JpCvRBIa/cjJkBQ7uGvJNKHt71 2vDQ== X-Received: by 10.236.151.116 with SMTP id a80mr43249384yhk.48.1399917436536; Mon, 12 May 2014 10:57:16 -0700 (PDT) MIME-Version: 1.0 Received: by 10.170.127.18 with HTTP; Mon, 12 May 2014 10:56:56 -0700 (PDT) In-Reply-To: <536FE220.8070600@cs.ucla.edu> References: <536FE220.8070600@cs.ucla.edu> From: Jim Meyering Date: Mon, 12 May 2014 10:56:56 -0700 X-Google-Sender-Auth: K5BEdvP6sr4wjXCLbz5OK8_HphE Message-ID: Subject: Re: bug#17471: On Solaris 10, grep snapshot apparently hit by bleeding-edge Autoconf bug To: Paul Eggert Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 17471 Cc: 17471@debbugs.gnu.org, Autoconf bugs X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Sun, May 11, 2014 at 1:48 PM, Paul Eggert wrote: > Following up to the grep snapshot announcement in: > > http://lists.gnu.org/archive/html/platform-testers/2014-05/msg00000.html > > That snapshot failed to build the shell scripts egrep and fgrep properly on > Solaris 10, because it set "SHELL = /bin/sh" in src/Makefile, which caused > the makefile to put "#!/bin/sh" at the top of the shell scripts, which > breaks because the shell scripts use a construct '${0%/*}' that Solaris 10 > /bin/sh doesn't grok. The build should have used SHELL = /bin/bash, which > is what grep does with my test builds. > > We could work around the problem by avoiding that shell construct, but I'd > rather fix the build machinery because this bug could affect any package > that uses POSIX shell scripts. The snapshot was built with an experimental > version of Autoconf (2.69.117-1717), whereas I had tested with the latest > stable version (2.69 as shipped with Fedora 20). The two versions differ in > how they compute the name of a working shell, so it appears that there's a > bug in the experimental version of Autoconf. > > A quick workaround for grep is to build the next snapshot with Autoconf > 2.69. In the long run, though, we should fix the Autoconf bug. I'll CC: > this to bug-autoconf to give them a heads-up. Hi Paul, Thanks for reporting that. I would like our egrep and fgrep scripts to work even on systems with an old shell and no "bash" to fall back on. Our tests/init.sh code tries hard to find a sufficiently functional shell (including a test for the ${VAR%GLOB} construct), and making it work in spite of Solaris's /bin/sh was tricky... plus, we had to be willing to give up and skip tests altogether, in the event that no sufficiently functional shell is found. Here, we don't have that luxury. Ideally, these wrapper shell scripts would not have to fork an extra process to perform this trivial string manipulation, but I can live with the extra overhead, especially for scripts like these that merely provide support for obsolescent programs. I think the attached patch is sufficiently portable to work everywhere. Does anyone see a (simple+clean) way to make it more efficient for the common case in which @SHELL@ is a more functional shell? From debbugs-submit-bounces@debbugs.gnu.org Mon May 12 14:03:16 2014 Received: (at 17471) by debbugs.gnu.org; 12 May 2014 18:03:16 +0000 Received: from localhost ([127.0.0.1]:32780 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjuZI-0004I7-8p for submit@debbugs.gnu.org; Mon, 12 May 2014 14:03:16 -0400 Received: from mx4.gridway.net ([72.1.205.246]:34942) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjuZF-0004Hq-Vl for 17471@debbugs.gnu.org; Mon, 12 May 2014 14:03:14 -0400 Received: from delivery.mygridway.net (delivery.mygridway.net [72.1.205.180]) by mx4.gridway.net (8.14.4/8.14.4/Debian-4) with ESMTP id s4CI2xlb006542; Mon, 12 May 2014 14:03:00 -0400 Received: from mail.ellipticsemi.com (24.114.47.98) by delivery.mygridway.net (172.17.12.4) with Microsoft SMTP Server (TLS) id 14.2.347.0; Mon, 12 May 2014 14:02:59 -0400 Date: Mon, 12 May 2014 14:02:59 -0400 From: Nick Bowler To: Jim Meyering Subject: Re: bug#17471: On Solaris 10, grep snapshot apparently hit by bleeding-edge Autoconf bug Message-ID: <20140512180258.GA10304@elliptictech.com> References: <536FE220.8070600@cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: Organization: Elliptic Technologies Inc. User-Agent: Mutt/1.5.22 (2013-10-16) X-Originating-IP: [24.114.47.98] X-Spam-Score: undef - 72.1.205.180 is whitelisted. X-CanIt-Geo: ip=72.1.205.180; country=CA; region=Ontario; city=Ottawa; latitude=45.4167; longitude=-75.7000; http://maps.google.com/maps?q=45.4167,-75.7000&z=6 X-CanItPRO-Stream: base:outbound (inherits from base:default) X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 72.1.205.246 X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 17471 Cc: Paul Eggert , Autoconf bugs , 17471@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) On 2014-05-12 10:33 -0700, Jim Meyering wrote: [...] > I think the attach patch is sufficiently portable to do what I want. > Does anyone see a way to make it more efficient with a POSIX shell? > > From e2a305bff2be376f6dd29e52a1d32636e0c22706 Mon Sep 17 00:00:00 2001 > From: Jim Meyering > Date: Mon, 12 May 2014 10:33:09 -0700 > Subject: [PATCH] egrep, fgrep: make wrappers portable to non-POSIX shells > > * src/egrep.sh (grep): Use sed in a subshell in place of the > POSIX sh construct, ${0%/*}. The latter is not portable to > Solaris 10. Reported by Paul Eggert in http://debbugs.gnu.org/17471 > --- > src/egrep.sh | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/src/egrep.sh b/src/egrep.sh > index f1b4146..0a374aa 100644 > --- a/src/egrep.sh > +++ b/src/egrep.sh > @@ -2,9 +2,10 @@ > grep=grep > case $0 in > */*) > - if test -x "${0%/*}/@grep@"; then > - PATH=${0%/*}:$PATH > - grep=@grep@ > + dirname=`echo "$0"|sed 's,//*[^/]*$,,'` I'd write dirname=`expr x"$0" : x'\(.*\)/'` but mainly for style reasons... > + if test -x "$dirname"/'@grep@'; then > + PATH="$dirname:$PATH" > + grep='@grep@' > fi;; > esac > exec $grep @option@ "$@" Cheers, -- Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/) From debbugs-submit-bounces@debbugs.gnu.org Mon May 12 14:45:11 2014 Received: (at 17471-done) by debbugs.gnu.org; 12 May 2014 18:45:11 +0000 Received: from localhost ([127.0.0.1]:32824 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjvDq-0005hY-CF for submit@debbugs.gnu.org; Mon, 12 May 2014 14:45:11 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]:60887) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjvDi-0005gb-TE for 17471-done@debbugs.gnu.org; Mon, 12 May 2014 14:45:08 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id E3D4439E8013; Mon, 12 May 2014 11:44:56 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id klowzhhsowR9; Mon, 12 May 2014 11:44:52 -0700 (PDT) Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id E441D39E801E; Mon, 12 May 2014 11:44:52 -0700 (PDT) Message-ID: <5371169E.4060103@cs.ucla.edu> Date: Mon, 12 May 2014 11:44:46 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Jim Meyering Subject: Re: bug#17471: On Solaris 10, grep snapshot apparently hit by bleeding-edge Autoconf bug References: <536FE220.8070600@cs.ucla.edu> In-Reply-To: Content-Type: multipart/mixed; boundary="------------040109090001030806020707" X-Spam-Score: -3.0 (---) X-Debbugs-Envelope-To: 17471-done Cc: Autoconf bugs , 17471-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.0 (---) This is a multi-part message in MIME format. --------------040109090001030806020707 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 05/12/2014 10:33 AM, Jim Meyering wrote: > Does anyone see a way to make it more efficient with a POSIX shell? Yes. Eric's earlier message convinced me that grep shouldn't rely on Autoconf guaranteeing a shell that supports substrings in parameter expansion, so I came up with the attached patch (which keeps the shell efficient with a POSIX shell) and pushed it before I got around to reading your message. I tested on Solaris 10 with the shell artificially set to /bin/sh, so I'm marking this as done. From an Autoconf point of view it might be nice to have a good way to say "I need a POSIX shell" or at least "I need a shell that does substrings", but that's merely a wishlist item. --------------040109090001030806020707 Content-Type: text/x-patch; name="0001-egrep-fgrep-port-to-Solaris-10-bin-sh.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-egrep-fgrep-port-to-Solaris-10-bin-sh.patch" >From 0ca1f6d79514189ef8db6e931f285cbaec9789ec Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 12 May 2014 11:38:28 -0700 Subject: [PATCH] egrep, fgrep: port to Solaris 10 /bin/sh This old shell doesn't grok ${0%/*}; see: http://bugs.gnu.org/17471 * src/Makefile.am (egrep fgrep): Don't assume the shell does substrings. * src/egrep.sh (dir): New var, so that the substring calculation is done only once (which is a small win even with newer shells), and so that the calculation is easier to edit on older shells. --- src/Makefile.am | 7 +++++++ src/egrep.sh | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index f8c9415..e2c82a4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -47,7 +47,14 @@ EXTRA_DIST = dosbuf.c egrep.sh egrep fgrep: egrep.sh Makefile $(AM_V_GEN)grep=`echo grep | sed -e '$(transform)'` && \ case $@ in egrep) option=-E;; fgrep) option=-F;; esac && \ + shell_does_substrings='set x/y && d=$${1%/*} && test "$$d" = x' && \ + if $(SHELL) -c "$$shell_does_substrings" 2>/dev/null; then \ + edit_substring='s,X,X,'; \ + else \ + edit_substring='s,\$${0%/\*},`expr "X$$0" : '\''X\\(.*\\)/'\''`,g'; \ + fi && \ sed -e 's|[@]SHELL@|$(SHELL)|g' \ + -e "$$edit_substring" \ -e "s|[@]grep@|$$grep|g" \ -e "s|[@]option@|$$option|g" <$(srcdir)/egrep.sh >$@-t $(AM_V_at)chmod +x $@-t diff --git a/src/egrep.sh b/src/egrep.sh index f1b4146..1a03d2a 100644 --- a/src/egrep.sh +++ b/src/egrep.sh @@ -2,8 +2,9 @@ grep=grep case $0 in */*) - if test -x "${0%/*}/@grep@"; then - PATH=${0%/*}:$PATH + dir=${0%/*} + if test -x "$dir/@grep@"; then + PATH=$dir:$PATH grep=@grep@ fi;; esac -- 1.9.0 --------------040109090001030806020707-- From debbugs-submit-bounces@debbugs.gnu.org Mon May 12 21:34:37 2014 Received: (at 17471-done) by debbugs.gnu.org; 13 May 2014 01:34:37 +0000 Received: from localhost ([127.0.0.1]:33077 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wk1c4-0002Vl-Mj for submit@debbugs.gnu.org; Mon, 12 May 2014 21:34:36 -0400 Received: from mail-yh0-f48.google.com ([209.85.213.48]:58637) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wk1c1-0002VO-Sg for 17471-done@debbugs.gnu.org; Mon, 12 May 2014 21:34:34 -0400 Received: by mail-yh0-f48.google.com with SMTP id a41so4841565yho.35 for <17471-done@debbugs.gnu.org>; Mon, 12 May 2014 18:34:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=/Qgzuk0yQmn8SgezvJtlFGBP+4y3LFlWUJKHuZ21ykE=; b=WJ7taQIFtbuL9szcq7SS8y2BvNMfPtAlVfl0hvrb+ToiBCuIL2I1W91E2I23lyoZ7f t/4iJhc9zV/5JsoNXsHnHpHzENWbpR+MDEDMoisyLdNTOViiJhED26xh7Vr9mPQCAaWr mepx7EwBBEYTglnOBy5pZfwFUarhY3XS9k8Ntd0RQ+w1I+bDthMPuMIaySboqsq36lyc hk38pwmelqBX0NDsAX13/flqKq6nHe/7jb3bXJ9cMzz9uCO5vPkoI9J1jb+1zbEGoPUu YmywTsTmqW9utCKU6sPBz3G4F7DW19ZKUxuC+Ub+L3j7UEvJ9bSmsNFxaIjSyHWy2PhH aYGg== X-Received: by 10.236.112.237 with SMTP id y73mr16881553yhg.103.1399944868081; Mon, 12 May 2014 18:34:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.170.127.18 with HTTP; Mon, 12 May 2014 18:34:07 -0700 (PDT) In-Reply-To: <5371169E.4060103@cs.ucla.edu> References: <536FE220.8070600@cs.ucla.edu> <5371169E.4060103@cs.ucla.edu> From: Jim Meyering Date: Mon, 12 May 2014 18:34:07 -0700 X-Google-Sender-Auth: oxs7p4Pv9JVOlM0fVljnYKuvRbU Message-ID: Subject: Re: bug#17471: On Solaris 10, grep snapshot apparently hit by bleeding-edge Autoconf bug To: Paul Eggert Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 17471-done Cc: Autoconf bugs , 17471-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Thanks for dealing with that. The only potential problem I see with your patch would be when one runs configure with a perverse program name transformation, e.g., --program-transform-name='s/^/$/', introducing a shell metacharacter (or leading/trailing white space!) in the resulting name. In that case, the lack of single quotes around @grep@ would be fatal. Fixing that is not high priority. Anyone who does that to grep deserves the result :-) From unknown Sun Jun 22 20:55:40 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 10 Jun 2014 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator