From MAILER-DAEMON Wed Aug 02 11:27:58 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dcvZ0-0007Ea-CA
	for mharc-bug-bash@gnu.org; Wed, 02 Aug 2017 11:27:58 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:43136)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <clemens@froglogic.com>) id 1dcvBC-0005xZ-0E
	for bug-bash@gnu.org; Wed, 02 Aug 2017 11:03:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <clemens@froglogic.com>) id 1dcvB7-0008Mp-9f
	for bug-bash@gnu.org; Wed, 02 Aug 2017 11:03:22 -0400
Received: from mail.froglogic.com ([212.60.253.106]:49222)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <clemens@froglogic.com>)
	id 1dcvB7-0008Fw-3y
	for bug-bash@gnu.org; Wed, 02 Aug 2017 11:03:17 -0400
Received: from roundcube.froglogic.com ([10.24.0.148]:36658)
	by thasos.froglogic.com with esmtp (Exim 4.80)
	(envelope-from <clemens@froglogic.com>)
	id 1dcvAx-00033D-NT; Wed, 02 Aug 2017 17:03:09 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII;
 format=flowed
Content-Transfer-Encoding: 7bit
Date: Wed, 02 Aug 2017 17:03:07 +0200
From: Clemens Anhuth <clemens@froglogic.com>
To: bug-bash@gnu.org, bash@packages.debian.org
Subject: Documented history-substr-search-*, but only
	history-substring-search-* works
Organization: froglogic GmbH
Message-ID: <e6690225bbe369cdf3f9b0c2be0c8d88@froglogic.com>
X-Sender: clemens@froglogic.com
User-Agent: Roundcube Webmail/1.2.3
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From: 212.60.253.106
X-Mailman-Approved-At: Wed, 02 Aug 2017 11:27:56 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 02 Aug 2017 15:03:23 -0000

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I../. -I.././include -I.././lib  -Wdate-time 
-D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/bash-TPGSJ6/bash-4.4=. 
-fstack-protector-strong -Wformat -Werror=format-security -Wall -no-pie 
-Wno-parentheses -Wno-format-security
uname output: Linux schenefeld 4.10.0-28-generic #32-Ubuntu SMP Fri Jun 30 
05:32:18 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.4
Patch Level: 7
Release Status: release

Description:
	https://www.gnu.org/software/bash/manual/html_node/Commands-For-History.html
	mentions...

	 history-substr-search-backward
	 history-substr-search-forward

	...but only...

          history-substring-search-backward
          history-substring-search-forward

	...seem to work.

Repeat-By:
	Add to .inputrc:

	"\e[A": history-substr-search-backward
	"\e[B": history-substr-search-forward

	Start new console/shell.

	Type a substring of a previously executed command.
	Press Up arrow key.

Fix:
	Change documentation to use...

	 history-substring-search-backward
	 history-substring-search-forward


From MAILER-DAEMON Wed Aug 02 11:30:48 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dcvbj-00015m-Vd
	for mharc-bug-bash@gnu.org; Wed, 02 Aug 2017 11:30:48 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:53711)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dcvbh-00013N-7q
	for bug-bash@gnu.org; Wed, 02 Aug 2017 11:30:46 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dcvbd-0006U4-OE
	for bug-bash@gnu.org; Wed, 02 Aug 2017 11:30:45 -0400
Received: from mpv1-2015.cwru.edu ([129.22.103.226]:14745
	helo=mpv1-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1dcvbd-0006TO-In
	for bug-bash@gnu.org; Wed, 02 Aug 2017 11:30:41 -0400
Received: from mpv6-2015.CWRU.Edu (EHLO mpv6-2015.case.edu) ([129.22.103.202])
	by mpv1-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AOB43685; Wed, 02 Aug 2017 11:30:33 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id BHQ35708 (AUTH cpr);
	Wed, 02 Aug 2017 11:30:33 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: Documented history-substr-search-*, but only
	history-substring-search-* works
To: Clemens Anhuth <clemens@froglogic.com>, bug-bash@gnu.org,
	bash@packages.debian.org
References: <e6690225bbe369cdf3f9b0c2be0c8d88@froglogic.com>
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <127e373b-730e-a89d-cce4-390ea0fffdf1@case.edu>
Date: Wed, 2 Aug 2017 11:30:32 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <e6690225bbe369cdf3f9b0c2be0c8d88@froglogic.com>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Junkmail-Status: score=7/60, host=mpv1-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.2.151517:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__SUBJ_ALPHA_END, __TO_MALFORMED_2, __TO_NAME,
	__TO_NAME_DIFF_FROM_ACC, __REFERENCES, __HAS_FROM,
	FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA,
	__USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION,
	__IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE,
	__REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC,
	__FROM_DOMAIN_IN_ANY_CC1, __FROM_DOMAIN_IN_ANY_CC2,
	__REPLYTO_SAMEAS_FROM_DOMAIN, __ANY_URI, __URI_WITH_PATH,
	__URI_NO_WWW, __CP_URI_IN_BODY, __SUBJ_ALPHA_NEGATE,
	__URI_IN_BODY, __URI_NOT_IMG, __FORWARDED_MSG,
	__NO_HTML_TAG_RAW, BODYTEXTP_SIZE_3000_LESS,
	BODY_SIZE_400_499, __MIME_TEXT_P1, __MIME_TEXT_ONLY,
	__URI_NS, HTML_00_01, HTML_00_10, BODY_SIZE_5000_LESS,
	IN_REP_TO, MSG_THREAD, __FROM_DOMAIN_IN_RCPT,
	__TO_REAL_NAMES, MULTIPLE_REAL_RCPTS, LEGITIMATE_SIGNS,
	[TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.226
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 02 Aug 2017 15:30:46 -0000

On 8/2/17 11:03 AM, Clemens Anhuth wrote:

> Fix:
>     Change documentation to use...
> 
>      history-substring-search-backward
>      history-substring-search-forward

Thanks for the report.  This was fixed in the devel branch last November.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Thu Aug 03 06:56:35 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ddDnv-0007CS-5b
	for mharc-bug-bash@gnu.org; Thu, 03 Aug 2017 06:56:35 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:54666)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <emlyn.jose@wipro.com>) id 1ddDns-0007Av-G6
	for bug-bash@gnu.org; Thu, 03 Aug 2017 06:56:33 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <emlyn.jose@wipro.com>) id 1ddDno-0003Ej-HL
	for bug-bash@gnu.org; Thu, 03 Aug 2017 06:56:32 -0400
Received: from mail-hk2apc01on0082.outbound.protection.outlook.com
	([104.47.124.82]:40832
	helo=APC01-HK2-obe.outbound.protection.outlook.com)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <emlyn.jose@wipro.com>)
	id 1ddDnn-00039q-SG
	for bug-bash@gnu.org; Thu, 03 Aug 2017 06:56:28 -0400
Received: from SG2PR03MB2185.apcprd03.prod.outlook.com (10.141.124.141) by
	SG2PR03MB2172.apcprd03.prod.outlook.com (10.141.124.140) with Microsoft
	SMTP Server (version=TLS1_2,
	cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id
	15.1.1304.10; Thu, 3 Aug 2017 10:56:21 +0000
Received: from SG2PR03MB2185.apcprd03.prod.outlook.com
	([fe80::a1c4:d30a:4e19:1204]) by
	SG2PR03MB2185.apcprd03.prod.outlook.com
	([fe80::a1c4:d30a:4e19:1204%15]) with mapi id 15.01.1304.025;
	Thu, 3 Aug 2017 10:56:21 +0000
From: "emlyn.jose@wipro.com" <emlyn.jose@wipro.com>
To: "chet.ramey@case.edu" <chet.ramey@case.edu>, Greg Wooledge
	<wooledg@eeg.ccf.org>
CC: "bug-bash@gnu.org" <bug-bash@gnu.org>
Subject: RE: bash 4.4 null byte warning!!
Thread-Topic: bash 4.4 null byte warning!!
Thread-Index: AdKuqgsprHS+cCb0SAaOroTOd0ADogAOmEkAALNz0IAAJvRTABZ+KDGg
Date: Thu, 3 Aug 2017 10:56:21 +0000
Message-ID: <SG2PR03MB21855FB6B5834E9F335BEDE688B10@SG2PR03MB2185.apcprd03.prod.outlook.com>
References: <HKNPR03MB230809726ED57A0E4D87015C880D0@HKNPR03MB2308.apcprd03.prod.outlook.com>
	<20170406144523.GO17132@eeg.ccf.org>
	<HKNPR03MB230852B61B38C92CE8E50BFE88010@HKNPR03MB2308.apcprd03.prod.outlook.com>
	<a8dbc09a-a588-42c5-faab-c2b0d1fa5c91@case.edu>
In-Reply-To: <a8dbc09a-a588-42c5-faab-c2b0d1fa5c91@case.edu>
Accept-Language: en-GB, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
authentication-results: spf=none (sender IP is )
	smtp.mailfrom=emlyn.jose@wipro.com; 
x-originating-ip: [115.110.158.33]
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; SG2PR03MB2172;
	6:PDE4jUhacrg10V4Pt6X2FnXR/GReuU9oFv1xAEsdPDdRrmjrTBKSS3CMBrq8dM88FWik3I2FEZ5szFrieeJswIKgXbmNJnDI0Kr6YRnbNH3dIuKBt5mOzysyZpqEqlHyYzp9yj73+CsxZBBAbOnfwPetboxmus4nyJwO372ujXpXJnalWqDlGpk4Y9OculTUyyBOtfWdaTeQcie5irk51TJi9GwOllZ9Ume9ZR90rYityp/8yntNfcJ1KfWa1/z72r4fL9qzhN3HYA82J0MP063l1ev2lvxapmkeIXeP/m+rK34ohfUb2ptpUWYjpR4z4mlg6GzBpIHlmIh2yvzF1Q==;
	5:4isQPMllxWLNJiiMG0NaBobL4EvrHro2W+EZc3XRicNXG9VG1xVdimD32XsEpNMdRv7/cKcYWYHN9C/nIsh8Bd8rAvetepIfEOLE0RIf1Escqdvop0ww0YIp6evNZhFsNdbrxwJKs68O5RRwo4v4Fw==;
	24:ANenm1Re2oiugoanyQhc3MBAfVP0LDUaHQ6w/KfVMmt2w7V1zrh8RIM8GxLGI7hajsHJWwnFElo2Fjm87gnjt/EofzwmqIi6GtyoiVYTGIA=;
	7:geYPzIA1pDySxcF+GVVPDSo/YHffJtjRqLGr/RGbeWa+Pz3t3J/Vfkb9pxFFwBpclZBxGHsQzTG5J+/9nl+R/c8sPk7ORLWrm5xlOkTqiJ8ukOKX4bFuOfjZfqyqls8ZEmBrcZpu348j1EkECfbOwRC8t9ZXp/jbspT2c5thJX3mAPm804NKjZqzO61Sik+EQHDO6dsftsUKZuFlzEJKNESLm/f/DwddAajtTUpy65I=
x-ms-office365-filtering-correlation-id: 0ba69598-eadf-4fb7-3f1a-08d4da5e46bf
x-ms-office365-filtering-ht: Tenant
x-microsoft-antispam: UriScan:; BCL:0; PCL:0;
	RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603031)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);
	SRVR:SG2PR03MB2172; 
x-ms-traffictypediagnostic: SG2PR03MB2172:
x-exchange-antispam-report-test: UriScan:(267259832677123)(22074186197030)(62627912741753); 
x-microsoft-antispam-prvs: <SG2PR03MB2172D0BE596EB719D792151788B10@SG2PR03MB2172.apcprd03.prod.outlook.com>
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0;
	RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(61425038)(6040450)(601004)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(10201501046)(93006095)(93001095)(3002001)(6055026)(61426038)(61427038)(6041248)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123564025)(20161123558100)(20161123555025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);
	SRVR:SG2PR03MB2172; BCL:0; PCL:0;
	RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);
	SRVR:SG2PR03MB2172; 
x-forefront-prvs: 03883BD916
x-forefront-antispam-report: SFV:NSPM;
	SFS:(10009020)(6900300001)(6009001)(39860400002)(39400400002)(39410400002)(39450400003)(39850400002)(39840400002)(189002)(377454003)(199003)(13464003)(24454002)(5250100002)(68736007)(97736004)(81166006)(7736002)(81156014)(5890100001)(25786009)(14454004)(93886004)(8676002)(74316002)(15974865002)(229853002)(2501003)(305945005)(4326008)(55016002)(99286003)(5660300001)(6306002)(9686003)(53546010)(53936002)(38730400002)(6436002)(2171002)(2900100001)(6246003)(478600001)(101416001)(3280700002)(33656002)(54356999)(226693001)(76176999)(50986999)(966005)(106356001)(105586002)(66066001)(6506006)(7696004)(86362001)(102836003)(2950100002)(3846002)(6116002)(2906002)(8936002)(189998001)(3660700001)(225543005)(18886075002);
	DIR:OUT; SFP:1101; SCL:1; SRVR:SG2PR03MB2172;
	H:SG2PR03MB2185.apcprd03.prod.outlook.com; FPR:; SPF:None;
	PTR:InfoNoRecords; MX:1; A:1; LANG:en; 
received-spf: None (protection.outlook.com: wipro.com does not designate
	permitted sender hosts)
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-OriginatorOrg: wipro.com
X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Aug 2017 10:56:21.3239 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 258ac4e4-146a-411e-9dc8-79a9e12fd6da
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR03MB2172
X-MS-Exchange-CrossPremises-AuthAs: Internal
X-MS-Exchange-CrossPremises-AuthMechanism: 04
X-MS-Exchange-CrossPremises-AuthSource: SG2PR03MB2185.apcprd03.prod.outlook.com
X-MS-Exchange-CrossPremises-TransportTrafficType: Email
X-MS-Exchange-CrossPremises-TransportTrafficSubType: 
X-MS-Exchange-CrossPremises-SCL: 1
X-MS-Exchange-CrossPremises-messagesource: StoreDriver
X-MS-Exchange-CrossPremises-BCC: 
X-MS-Exchange-CrossPremises-originalclientipaddress: 115.110.158.33
X-MS-Exchange-CrossPremises-transporttraffictype: Email
X-MS-Exchange-CrossPremises-transporttrafficsubtype: 
X-MS-Exchange-CrossPremises-disclaimer-hash: ef6ed6a830673538406bd527e716551fd2daba1e446b50e7f1f30c79ce70f874
X-MS-Exchange-CrossPremises-antispam-scancontext: DIR:Originating; SFV:NSPM;
	SKIP:0; 
X-MS-Exchange-CrossPremises-processed-by-journaling: Journal Agent
X-OrganizationHeadersPreserved: SG2PR03MB2172.apcprd03.prod.outlook.com
X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy]
X-Received-From: 104.47.124.82
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 03 Aug 2017 10:56:33 -0000

SGkgZ3V5cyENCg0KTXkgb3JnYW5pemF0aW9uIGlzIHJlY2VpdmluZyByZXBlYXRlZCBhbGVydHMg
Zm9yIHVzaW5nIG15IG1haWwgaWQgaGVyZSA6IGh0dHBzOi8vbWFpbC1hcmNoaXZlLmNvbS9idWct
YmFzaEBnbnUub3JnL21zZzE5NTYxLmh0bWwNCg0KQ291bGQgeW91IHBsZWFzZSByZW1vdmUgbXkg
bWFpZCBpZD8NCg0KVGhhbmsgeW91IQ0KDQpSZWdhcmRzLA0KRW1seW4gSm9zZS4NCg0KLS0tLS1P
cmlnaW5hbCBNZXNzYWdlLS0tLS0NCkZyb206IENoZXQgUmFtZXkgW21haWx0bzpjaGV0LnJhbWV5
QGNhc2UuZWR1XQ0KU2VudDogVHVlc2RheSwgQXByaWwgMTEsIDIwMTcgNDoyOSBBTQ0KVG86IEVt
bHluIEpvc2UgKEdJUykgPGVtbHluLmpvc2VAd2lwcm8uY29tPjsgR3JlZyBXb29sZWRnZSA8d29v
bGVkZ0BlZWcuY2NmLm9yZz4NCkNjOiBjaGV0LnJhbWV5QGNhc2UuZWR1OyBidWctYmFzaEBnbnUu
b3JnDQpTdWJqZWN0OiBSZTogYmFzaCA0LjQgbnVsbCBieXRlIHdhcm5pbmchIQ0KDQoqKiBUaGlz
IG1haWwgaGFzIGJlZW4gc2VudCBmcm9tIGFuIGV4dGVybmFsIHNvdXJjZSAqKg0KDQpPbiA0LzEw
LzE3IDE6MDggQU0sIGVtbHluLmpvc2VAd2lwcm8uY29tIHdyb3RlOg0KDQo+Pj5JZiB5b3Ugd2Fu
dCB0byBzdXBwcmVzcyB0aGUgd2FybmluZywgeW91J2xsIGhhdmUgdG8gZWRpdCB0aGUgc291cmNl
DQo+Pj5hbmQNCj4gcmVidWlsZC4NCj4gRG8geW91IGhhdmUgYSBndWlkZSBvbiBob3cgdG8gZG8g
dGhpcz8NCg0KQ2hhbmdlIHRoZSAjaWYgMSBvbiBsaW5lIDU5NjYgb2Ygc3Vic3QuYyB0byAjaWYg
MC4gIFRoZW4gZm9sbG93IHRoZSBkaXJlY3Rpb25zIGluIElOU1RBTEwsIHdoaWNoIGJhc2ljYWxs
eSBjb25zaXN0IG9mIHRoZSB1c3VhbCBgY29uZmlndXJlIDsgbWFrZSA7IG1ha2UgaW5zdGFsbCcg
aWRpb20gY29tbW9uIHRvIEdOVSBzb2Z0d2FyZS4NCg0KLS0NCmBgVGhlIGx5ZiBzbyBzaG9ydCwg
dGhlIGNyYWZ0IHNvIGxvbmcgdG8gbGVybmUuJycgLSBDaGF1Y2VyDQogICAgICAgICAgICAgICAg
IGBgQXJzIGxvbmdhLCB2aXRhIGJyZXZpcycnIC0gSGlwcG9jcmF0ZXMNCkNoZXQgUmFtZXksIFVU
ZWNoLCBDV1JVICAgIGNoZXRAY2FzZS5lZHUgICAgaHR0cDovL2Nuc3d3dy5jbnMuY3dydS5lZHUv
fmNoZXQvDQpUaGUgaW5mb3JtYXRpb24gY29udGFpbmVkIGluIHRoaXMgZWxlY3Ryb25pYyBtZXNz
YWdlIGFuZCBhbnkgYXR0YWNobWVudHMgdG8gdGhpcyBtZXNzYWdlIGFyZSBpbnRlbmRlZCBmb3Ig
dGhlIGV4Y2x1c2l2ZSB1c2Ugb2YgdGhlIGFkZHJlc3NlZShzKSBhbmQgbWF5IGNvbnRhaW4gcHJv
cHJpZXRhcnksIGNvbmZpZGVudGlhbCBvciBwcml2aWxlZ2VkIGluZm9ybWF0aW9uLiBJZiB5b3Ug
YXJlIG5vdCB0aGUgaW50ZW5kZWQgcmVjaXBpZW50LCB5b3Ugc2hvdWxkIG5vdCBkaXNzZW1pbmF0
ZSwgZGlzdHJpYnV0ZSBvciBjb3B5IHRoaXMgZS1tYWlsLiBQbGVhc2Ugbm90aWZ5IHRoZSBzZW5k
ZXIgaW1tZWRpYXRlbHkgYW5kIGRlc3Ryb3kgYWxsIGNvcGllcyBvZiB0aGlzIG1lc3NhZ2UgYW5k
IGFueSBhdHRhY2htZW50cy4gV0FSTklORzogQ29tcHV0ZXIgdmlydXNlcyBjYW4gYmUgdHJhbnNt
aXR0ZWQgdmlhIGVtYWlsLiBUaGUgcmVjaXBpZW50IHNob3VsZCBjaGVjayB0aGlzIGVtYWlsIGFu
ZCBhbnkgYXR0YWNobWVudHMgZm9yIHRoZSBwcmVzZW5jZSBvZiB2aXJ1c2VzLiBUaGUgY29tcGFu
eSBhY2NlcHRzIG5vIGxpYWJpbGl0eSBmb3IgYW55IGRhbWFnZSBjYXVzZWQgYnkgYW55IHZpcnVz
IHRyYW5zbWl0dGVkIGJ5IHRoaXMgZW1haWwuIHd3dy53aXByby5jb20NCg==


From MAILER-DAEMON Thu Aug 03 11:20:29 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ddHvJ-0006Uc-G6
	for mharc-bug-bash@gnu.org; Thu, 03 Aug 2017 11:20:29 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56561)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1ddHvH-0006St-5B
	for bug-bash@gnu.org; Thu, 03 Aug 2017 11:20:28 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1ddHvG-0003X0-3A
	for bug-bash@gnu.org; Thu, 03 Aug 2017 11:20:27 -0400
Received: from mail-qk0-x229.google.com ([2607:f8b0:400d:c09::229]:36198)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <pierre.gaston@gmail.com>)
	id 1ddHvF-0003VX-UD
	for bug-bash@gnu.org; Thu, 03 Aug 2017 11:20:26 -0400
Received: by mail-qk0-x229.google.com with SMTP id d136so9462345qkg.3
	for <bug-bash@gnu.org>; Thu, 03 Aug 2017 08:20:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc; bh=dkqqn7tHpCahkQ91HHEPuzqH27ZTVl89mXTsh+rjYkg=;
	b=R05ZR+DF30fqnpbfVlFHx2Z0T8N067KpdQXx/jOBYT76L+ugmTnqwHA08x8Hw5M/Fl
	pxJXKYDtch88KRzZRHfc9jmVzd6fcmS9gUIpPhUWYtQMMfPf8wmBklUr5sBofcufaT+X
	PFJKHhxvN3t6690ouSs3vZUyh6O2d+I4eC/kmNip3CQ1CmGcTL50s15Ij/VBUcVe7KOt
	81bqSszvNvtk1O2smiWFPY5VCMAB4hZRSmHVWLE1HvA5KbYQqOAAup1PweK+NPchNXOW
	fUXy8g8x5PcTbdoKwW5qbnvoIbY+JBL/I8506ONLSCcTPrUL7pMTEuN92iCUtJQJA6p+
	Ok+w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to:cc;
	bh=dkqqn7tHpCahkQ91HHEPuzqH27ZTVl89mXTsh+rjYkg=;
	b=PK8II7XDqQFAe1NH6wov9h5VwOavLGDvBKDA81kCalqkgmZ9HEmWTsOAJox0wdV6hA
	zigBQctWvzB+FfD2rvlbtVtlBwev27qgkSxOQxRz94M4I4eJ/q2Ocz7uX0oNUAg+TQEI
	g6/VtrOFIwsn36dIBCu89Xry3cRtw9TTT8K34yc0QeyXgZ07M38hQ4BByU5InSDK+P7+
	ALG74zU87XsZlfkiM6AvlLtmXec+SUf97pZkao8hFBDgx9JqPtWJlIYwIuM1Q2f7cM5I
	tBzce4VYeo5amh/ustpHcmUn3JdgfMT6rll1ttODQukwo+tneq77GtlZZraBxlEKlkAA
	eQxw==
X-Gm-Message-State: AHYfb5jk+hQVRMdqZ+uPxATKVNox9lkQ9+bLB+wqEMHgq+bRhRhZxj2t
	fk8yVtewoYFYfcwYZLDXSbBLqFv4FA==
X-Received: by 10.55.16.161 with SMTP id 33mr2942948qkq.312.1501773623907;
	Thu, 03 Aug 2017 08:20:23 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.12.171.70 with HTTP; Thu, 3 Aug 2017 08:20:03 -0700 (PDT)
In-Reply-To: <SG2PR03MB21855FB6B5834E9F335BEDE688B10@SG2PR03MB2185.apcprd03.prod.outlook.com>
References: <HKNPR03MB230809726ED57A0E4D87015C880D0@HKNPR03MB2308.apcprd03.prod.outlook.com>
	<20170406144523.GO17132@eeg.ccf.org>
	<HKNPR03MB230852B61B38C92CE8E50BFE88010@HKNPR03MB2308.apcprd03.prod.outlook.com>
	<a8dbc09a-a588-42c5-faab-c2b0d1fa5c91@case.edu>
	<SG2PR03MB21855FB6B5834E9F335BEDE688B10@SG2PR03MB2185.apcprd03.prod.outlook.com>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Thu, 3 Aug 2017 18:20:03 +0300
Message-ID: <CAPSX3sRFacCGFatSA=Mg35_n75C4c0-qJ4WkvUQxjTDnBO+G-g@mail.gmail.com>
Subject: Re: bash 4.4 null byte warning!!
To: "emlyn.jose@wipro.com" <emlyn.jose@wipro.com>
Cc: "bug-bash@gnu.org" <bug-bash@gnu.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:400d:c09::229
Content-Type: text/plain; charset="UTF-8"
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 03 Aug 2017 15:20:28 -0000

On Thu, Aug 3, 2017 at 1:56 PM, emlyn.jose@wipro.com <emlyn.jose@wipro.com>
wrote:

> Hi guys!
>
> My organization is receiving repeated alerts for using my mail id here :
> https://mail-archive.com/bug-bash@gnu.org/msg19561.html
>
> Could you please remove my maid id?
>
> Thank you!
>
> Regards,
> Emlyn Jose.
>
>
This is a public mailing list, moreover mirrored on usenet so there are
many, many copies of these emails that are publicly available about about
which the administrators of this list can do little about.

I'm afraid the site you point to is just one of these, it's a third party
site that makes the mailing list available to everybody.
You should try to contact them see: https://www.mail-archive.com/
faq.html#delete

From MAILER-DAEMON Fri Aug 04 19:52:16 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ddmO8-00011s-AC
	for mharc-bug-bash@gnu.org; Fri, 04 Aug 2017 19:52:16 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:46977)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <corax26@gmail.com>) id 1ddmO6-00010Q-I5
	for bug-bash@gnu.org; Fri, 04 Aug 2017 19:52:15 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <corax26@gmail.com>) id 1ddmO1-0004l2-Nf
	for bug-bash@gnu.org; Fri, 04 Aug 2017 19:52:14 -0400
Received: from mail-wr0-x22d.google.com ([2a00:1450:400c:c0c::22d]:35996)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <corax26@gmail.com>) id 1ddmO1-0004h1-Ft
	for bug-bash@gnu.org; Fri, 04 Aug 2017 19:52:09 -0400
Received: by mail-wr0-x22d.google.com with SMTP id y43so21598826wrd.3
	for <bug-bash@gnu.org>; Fri, 04 Aug 2017 16:52:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=from:subject:to:message-id:date:user-agent:mime-version
	:content-language:content-transfer-encoding;
	bh=QgN/RdgwUkUqvKO98v74u+rcrimdFi/eADNNmq7Dp3I=;
	b=txfkrWJRCbc+hxfhvvpA99OuQIS5lTDUXPmWxXeZT04xiKCPJdm2gD34Q5F70n14pb
	GAhMoEuFNs39VQVQ4eU0V5fmFYvWdelGIVNfkFGub+WrZyCymkdAYvRMzkM9ZEGy54UB
	e+PBwyfOj9osEMKFeRuwGITXXJHk/WFfzh0PJhagOLcrW5KZnMVfggGLQPunMR3c9Joh
	rKZY3Elbr28YaxGIqULP4tAa/zPBGoKTFD9tGDSv7HsnovwOExp6kgaheO7XqdCTNS+F
	s4IjX52xVX+/efIbDnAND2Q+cwEZFzHAi9VHB4zRqlajdyDvXbJ7XmFW512Xd7oOZB4Q
	Ee8Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:from:subject:to:message-id:date:user-agent
	:mime-version:content-language:content-transfer-encoding;
	bh=QgN/RdgwUkUqvKO98v74u+rcrimdFi/eADNNmq7Dp3I=;
	b=jJLYVtXOIxjDlAbGhGjh2upgZR+4A+DX/JfOnXTNhTgxqWTdMbQ7atBs+b775WvBIQ
	ZNnJ/0REwcnAUcg3ZSVg4wpmuP1tJfWwbOgYg75ExAAfGlbwWX6pA2zaZyVHBuNMBWp7
	ylNK7/6xmmVSukYPB3UTRag+pXXzrUkNwFQPYawgVbDJQn+vdXZQubbnZT/dXsIV/rxp
	YuuRfx+4Pds8kX5err2BE9Rl/u9jdNCoupn6KvaorE4I0YD5mr5eVfbUg5kfuNOPK7sN
	BVUrTmRYiZGyWIWZkluIJmmf4IcVR2srLKcVvrnCum+jPnsb2fpSPxl2UH7fQC65zKuS
	pZlw==
X-Gm-Message-State: AIVw111udsR/BdumOPkmxtmBrlRGryrm5OGmzFRFiy4ZGJRNANP8q7Pu
	Ntd8EKclCXJ4KPnZ
X-Received: by 10.223.133.97 with SMTP id 88mr2681386wrh.30.1501890726279;
	Fri, 04 Aug 2017 16:52:06 -0700 (PDT)
Received: from [192.168.0.10] (2.217.198.146.dyn.plus.net. [146.198.217.2])
	by smtp.googlemail.com with ESMTPSA id
	15sm5298977wmo.7.2017.08.04.16.52.05 for <bug-bash@gnu.org>
	(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Fri, 04 Aug 2017 16:52:05 -0700 (PDT)
From: Kevin Brodsky <corax26@gmail.com>
Subject: Execution continuing after SIGINT received
To: bug-bash@gnu.org
Message-ID: <b21334bb-9fab-3027-6bb4-7c3e8184b579@gmail.com>
Date: Sat, 5 Aug 2017 00:52:04 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
	Thunderbird/52.2.1
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Language: en-GB
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2a00:1450:400c:c0c::22d
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 04 Aug 2017 23:52:15 -0000

Hi,

I have run into a rather weird behaviour related to SIGINT, which
doesn't seem to be intended, as it's not consistent with other shells
(and is so unexpected that it took me a while to figure out what was
going wrong in my script!).

When Bash receives SIGINT while executing a command, it normally waits
for the command to complete, and then aborts execution. However, it
looks like somehow, this is not the case if the command handles SIGINT,
and execution continues after the command completes. For instance:

$ bash -c '(trap "echo INT; exit 1" INT; sleep 60s); echo after'
^CINT
after
$

Whereas:

$ bash -c '(sleep 60s); echo after'
^C
$

The command doesn't need to be a subshell; for instance, since Python
handles SIGINT by default, execution continues as well:

$ bash -c 'python -c "import time; time.sleep(60)"; echo after'
^CTraceback (most recent call last):
  File "<string>", line 1, in <module>
KeyboardInterrupt
after
$

dash, mksh, zsh don't exhibit this behaviour: in all cases, execution is
aborted. Bash seems to have always behaved like that, at least since 4.0.

Kevin


From MAILER-DAEMON Fri Aug 04 22:22:32 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ddojY-0001IM-Rv
	for mharc-bug-bash@gnu.org; Fri, 04 Aug 2017 22:22:32 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:42423)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1ddojX-0001I2-Bb
	for bug-bash@gnu.org; Fri, 04 Aug 2017 22:22:31 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1ddojU-0004gm-5w
	for bug-bash@gnu.org; Fri, 04 Aug 2017 22:22:31 -0400
Received: from havoc.proulx.com ([96.88.95.61]:35551)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1ddojU-0004gZ-0E
	for bug-bash@gnu.org; Fri, 04 Aug 2017 22:22:28 -0400
Received: from joseki.proulx.com (localhost [127.0.0.1])
	by havoc.proulx.com (Postfix) with ESMTP id 7342B6A2;
	Fri,  4 Aug 2017 20:22:27 -0600 (MDT)
Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119])
	by joseki.proulx.com (Postfix) with ESMTP id 3B8E121230;
	Fri,  4 Aug 2017 20:22:27 -0600 (MDT)
Received: by hysteria.proulx.com (Postfix, from userid 1000)
	id 24BEC2DC5B; Fri,  4 Aug 2017 20:22:26 -0600 (MDT)
Date: Fri, 4 Aug 2017 20:22:26 -0600
From: Bob Proulx <bob@proulx.com>
To: Kevin Brodsky <corax26@gmail.com>
Cc: bug-bash@gnu.org
Subject: Re: Execution continuing after SIGINT received
Message-ID: <20170804200353460209812@bob.proulx.com>
Mail-Followup-To: Kevin Brodsky <corax26@gmail.com>, bug-bash@gnu.org
References: <b21334bb-9fab-3027-6bb4-7c3e8184b579@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <b21334bb-9fab-3027-6bb4-7c3e8184b579@gmail.com>
User-Agent: NeoMutt/20170609 (1.8.3)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 96.88.95.61
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 05 Aug 2017 02:22:32 -0000

Kevin Brodsky wrote:
> $ bash -c '(trap "echo INT; exit 1" INT; sleep 60s); echo after'
> ^CINT
> after
> $

This is a good example of a bad example case.  You shouldn't "exit 1"
or you will replace the information that the process is exiting due to
a signal with an error code.  The trap handler should kill itself
instead.  Use this test case instead.

> $ bash -c '(trap "echo INT; trap - INT; kill -s INT $$" INT; sleep 60); echo after'

Of course that doesn't change the end result here.  But at least the
program exit WIFSIGNALED information is now correct.

Signal handlers should always raise the signal on themselves after
handling whatever they need to handle first.

In any case I can't recreate your problem when using real processes in
separate shells not all on one line.

Bob


From MAILER-DAEMON Sat Aug 05 10:53:48 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1de0Sa-0001KG-3R
	for mharc-bug-bash@gnu.org; Sat, 05 Aug 2017 10:53:48 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:59409)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1de0SX-0001Jz-Il
	for bug-bash@gnu.org; Sat, 05 Aug 2017 10:53:46 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1de0SU-0001hd-Hv
	for bug-bash@gnu.org; Sat, 05 Aug 2017 10:53:45 -0400
Received: from mpv2-2015.cwru.edu ([129.22.103.227]:19495
	helo=mpv1-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1de0SU-0001fB-C6
	for bug-bash@gnu.org; Sat, 05 Aug 2017 10:53:42 -0400
Received: from mpv7-2015.CWRU.Edu (EHLO mpv7-2015.case.edu) ([129.22.103.242])
	by mpv2-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AOH58193; Sat, 05 Aug 2017 10:53:39 -0400 (EDT)
Received: from h152.210.21.98.dynamic.ip.windstream.net (EHLO
	_192.168.254.10_) ([98.21.210.152])
	by mpv7-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id IFX71715 (AUTH cpr);
	Sat, 05 Aug 2017 10:53:39 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: Execution continuing after SIGINT received
To: Kevin Brodsky <corax26@gmail.com>, bug-bash@gnu.org
References: <b21334bb-9fab-3027-6bb4-7c3e8184b579@gmail.com>
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
Message-ID: <85dbcc3c-aa69-118b-cd06-fc9b58eea609@case.edu>
Date: Sat, 5 Aug 2017 10:53:41 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <b21334bb-9fab-3027-6bb4-7c3e8184b579@gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Junkmail-Status: score=7/60, host=mpv2-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.5.140616:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__SUBJ_ALPHA_END, __TO_MALFORMED_2, __TO_NAME,
	__TO_NAME_DIFF_FROM_ACC, __REFERENCES, __HAS_FROM,
	FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA,
	__USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION,
	__IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE,
	__REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC,
	__FROM_DOMAIN_IN_ANY_CC1, __FROM_DOMAIN_IN_ANY_CC2,
	__REPLYTO_SAMEAS_FROM_DOMAIN, __ANY_URI, __HTTPS_URI,
	__URI_WITH_PATH, URI_ENDS_IN_HTML, __CP_URI_IN_BODY,
	__SUBJ_ALPHA_NEGATE, __MULTIPLE_URI_TEXT, __URI_IN_BODY,
	__URI_NOT_IMG, __FORWARDED_MSG, __NO_HTML_TAG_RAW,
	BODY_SIZE_1300_1399, BODYTEXTP_SIZE_3000_LESS,
	__MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01,
	HTML_00_10, BODY_SIZE_5000_LESS, IN_REP_TO, MSG_THREAD,
	__FROM_DOMAIN_IN_RCPT, __TO_REAL_NAMES, [TRUNCATED],
	so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.227
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 05 Aug 2017 14:53:46 -0000

On 8/4/17 7:52 PM, Kevin Brodsky wrote:

> When Bash receives SIGINT while executing a command, it normally waits
> for the command to complete, and then aborts execution. However, it
> looks like somehow, this is not the case if the command handles SIGINT,
> and execution continues after the command completes. For instance:

The question of what happens when bash receives SIGINT while waiting for a
foreground job to complete has come up many times in the past.

See this for a good discussion of the issue:

https://www.cons.org/cracauer/sigint.html

The basic idea is that the user intends a keyboard-generated SIGINT to go
to the foreground process; that process gets to decide how to handle it;
and bash reacts accordingly.  If the process dies to due SIGINT, bash acts
as if it received the SIGINT; if it does not, bash assumes the process
handled it and effectively ignores it.

Consider a process (emacs is the usual example) that uses SIGINT for its
own purposes as a normal part of operation. If you run that program in a
script, you don't want the shell aborting the script unexpectedly as a
result.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Sat Aug 05 13:41:49 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1de35B-0001v9-6S
	for mharc-bug-bash@gnu.org; Sat, 05 Aug 2017 13:41:49 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:47343)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <corax26@gmail.com>) id 1de358-0001ul-Bx
	for bug-bash@gnu.org; Sat, 05 Aug 2017 13:41:47 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <corax26@gmail.com>) id 1de355-0006OC-7G
	for bug-bash@gnu.org; Sat, 05 Aug 2017 13:41:46 -0400
Received: from mail-wr0-x230.google.com ([2a00:1450:400c:c0c::230]:38770)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <corax26@gmail.com>) id 1de354-0006NA-Vs
	for bug-bash@gnu.org; Sat, 05 Aug 2017 13:41:43 -0400
Received: by mail-wr0-x230.google.com with SMTP id f21so26309065wrf.5
	for <bug-bash@gnu.org>; Sat, 05 Aug 2017 10:41:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=subject:to:references:from:message-id:date:user-agent:mime-version
	:in-reply-to:content-transfer-encoding:content-language;
	bh=KW1SKKbxL5KRCeE0CHLq577BOUOLuPDPET2LqLnWDEg=;
	b=hJCMpMB0Q6YtzNGTWIO19U1N7XeV79jtR6/TnjGtoe5SFjt3tlmXdEp7yVf5N/RaaP
	+8RsC59IqEIlAiZxhUKyZG3hDM3E5zk4tS1GS/e07OpcKAyXa1QAo4fiP7eseDsQoSFq
	NkAhYxZihkqqCedxDadovUt1Q7jyBODr9UGUQbqTHp/rOiqTANeY++csZeAbqC2xQwIi
	NxaObU1CccfoQgldIXKCvUO+vnEq+f7o+mXRA+zClmC8JeLW79LEdr3L3OdEfOOUKGTZ
	JYyTfAlvkLhcur3v6HS2HoVUTeDAGERYRh+ebYrxjsu/aTIT7yhkdMuD5GK/c0kddeZH
	l6+w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:subject:to:references:from:message-id:date
	:user-agent:mime-version:in-reply-to:content-transfer-encoding
	:content-language;
	bh=KW1SKKbxL5KRCeE0CHLq577BOUOLuPDPET2LqLnWDEg=;
	b=V1oelVM/d4MgIsgGSjyrVa66gdAK/rNxEsThQCKtHUBq+3aY9rfKPoz+yk5VzxLDbc
	KNyd18tNvxIHl9UtPbYnaR1vP6HZdUsqVemjI0uGeTinidpExKOSTyvhG229yacKWNka
	S8YM4lrmhOKgNeG1jwQhF6OEFM+vQAOcLtpGzQ/cHo4mg8UP8YEo2v+Xuuqo1v4ASYAT
	oV1O8d2O2Nch9qLGMkqGhteA4MiDtyMOk25CbfdB/8AnsXks7ur9ewdCBXuJgmjkawFZ
	9PtyEygQvjOQADuRoK4ZB4m0hYVOjJiOt0RaR5SaSD5usiLbBqXVCzxP/o8NJAMGpqIX
	81wA==
X-Gm-Message-State: AIVw113ZlHLpVioMm0RYjguIhWUFN1OEjoF8OegoTYxBaHTbsPVtdP6S
	31JoNbuG6A5eUvjv
X-Received: by 10.223.179.211 with SMTP id x19mr4324718wrd.7.1501954901437;
	Sat, 05 Aug 2017 10:41:41 -0700 (PDT)
Received: from [192.168.0.10] (2.217.198.146.dyn.plus.net. [146.198.217.2])
	by smtp.googlemail.com with ESMTPSA id
	f80sm1209785wmh.4.2017.08.05.10.41.40
	(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Sat, 05 Aug 2017 10:41:40 -0700 (PDT)
Subject: Re: Execution continuing after SIGINT received
To: chet.ramey@case.edu, bug-bash@gnu.org
References: <b21334bb-9fab-3027-6bb4-7c3e8184b579@gmail.com>
	<85dbcc3c-aa69-118b-cd06-fc9b58eea609@case.edu>
From: Kevin Brodsky <corax26@gmail.com>
Message-ID: <0c7bf471-4bc4-b38d-130f-666130d4af78@gmail.com>
Date: Sat, 5 Aug 2017 18:41:39 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
	Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <85dbcc3c-aa69-118b-cd06-fc9b58eea609@case.edu>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Content-Language: en-GB
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2a00:1450:400c:c0c::230
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 05 Aug 2017 17:41:47 -0000

On 05/08/2017 15:53, Chet Ramey wrote:
> On 8/4/17 7:52 PM, Kevin Brodsky wrote:
>
>> When Bash receives SIGINT while executing a command, it normally waits
>> for the command to complete, and then aborts execution. However, it
>> looks like somehow, this is not the case if the command handles SIGINT,
>> and execution continues after the command completes. For instance:
> The question of what happens when bash receives SIGINT while waiting for a
> foreground job to complete has come up many times in the past.
>
> See this for a good discussion of the issue:
>
> https://www.cons.org/cracauer/sigint.html
>
> The basic idea is that the user intends a keyboard-generated SIGINT to go
> to the foreground process; that process gets to decide how to handle it;
> and bash reacts accordingly.  If the process dies to due SIGINT, bash acts
> as if it received the SIGINT; if it does not, bash assumes the process
> handled it and effectively ignores it.
>
> Consider a process (emacs is the usual example) that uses SIGINT for its
> own purposes as a normal part of operation. If you run that program in a
> script, you don't want the shell aborting the script unexpectedly as a
> result.
>
> Chet

Thank you for your answer Chet. The article you linked is extremely
informative, I wasn't aware of the various possible strategies shells
can use to handle SIGINT!

So in summary, there is no bug on the Bash side, it simply implements
the WCE strategy, which does what the user wants... as long as the
invoked commands are well-behaved! And I just got very unlucky, as I did
stumble upon a misbehaved program, and all the other shells I tried
don't implement WCE... Some more experimentations showed that all three
(dash, mksh and zsh) implement WUE (I would have expected zsh to follow
Bash?).

Knowing this, it's now clear that the bug is on the Python side, as it
uses exit(1) when receiving SIGINT instead of doing the signal()/kill()
dance mentioned in the article. Other interpreters like Perl or Ruby
behave correctly, which confirms that there's a problem with Python. To
be fair, killing oneself when receiving SIGINT is quite
counter-intuitive, POSIX is not helping here.

Thanks,
Kevin


From MAILER-DAEMON Sat Aug 05 13:46:43 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1de39v-0002p5-NC
	for mharc-bug-bash@gnu.org; Sat, 05 Aug 2017 13:46:43 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:48133)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <corax26@gmail.com>) id 1de39t-0002ob-85
	for bug-bash@gnu.org; Sat, 05 Aug 2017 13:46:42 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <corax26@gmail.com>) id 1de39q-0000Zz-35
	for bug-bash@gnu.org; Sat, 05 Aug 2017 13:46:41 -0400
Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]:38762)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <corax26@gmail.com>) id 1de39p-0000ZR-St
	for bug-bash@gnu.org; Sat, 05 Aug 2017 13:46:38 -0400
Received: by mail-wm0-x234.google.com with SMTP id m85so40882992wma.1
	for <bug-bash@gnu.org>; Sat, 05 Aug 2017 10:46:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=subject:to:references:from:message-id:date:user-agent:mime-version
	:in-reply-to:content-transfer-encoding:content-language;
	bh=gzPGWtMDtKwSBdGPmWFiGCvPpL5B3bkUBhLjRyohhbo=;
	b=jfmdgz2Fd8ppEKBLj9v65WuozdDpOnZuhK0NY6yT2neglhljZ1QVJ6WamBiw8F5Lh6
	TTJ1hI3yRh6DRU1NgXYTkHmWX2SOk0XZ71ue6Y08CSaApXcrJntuQQD2+LARqGUtd5RO
	UArvg0Mb/icyCH4tqW9XB45BRvFl9BUpP8Miy0FU+EEdZDVrX7qG2Q+PY9iO3Cv59MRa
	a3DhrbzgcLVOwm0qRS3WtNnv9UpiP0Uh/wPnJ6dGZw9w7h/CBxxC/zICDzt6WUp5zHBW
	j6qwpx6TKoi0Acswztv+bCW5UaEUiMU0NIaMp8pvupvFgiMm3sKbhcHduHS5f6nJYq1Y
	wf7Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:subject:to:references:from:message-id:date
	:user-agent:mime-version:in-reply-to:content-transfer-encoding
	:content-language;
	bh=gzPGWtMDtKwSBdGPmWFiGCvPpL5B3bkUBhLjRyohhbo=;
	b=KhPqtmxUv/BY09iiUEqN4zlRV5RLpro1xQ/alDHkLQyq3k96svgCyAnN6rFuAsquCb
	urFGVqwruelAHh55oksn6syWpeUIc2zpn5jqs0+KQrB0w9VM7T+B+nksjhmqspdyId5E
	IvmPWvHwwhq2taouifSV/vbHhv0odYa9lVYrpDhxSPMk9PWjxswolegO+K0cvAGFzqh3
	/DQYzyUpgZE3vwih5Vk3vJW25V10z1hMC8xYhTDgzp9ICJInyrttPXg8Im0OHrV6OZRy
	Irf7+omDErJ+lp5d7l+xGdIffNCDd+4uXEh/TdhqkPbvmnUCAEpxvdcxHQX7F+UXys7t
	TzFg==
X-Gm-Message-State: AHYfb5gWTDiTslYqRwJyrdX2eVtbmxoGDDvEIGkCtItZrSugPIVC0H1M
	N2+qbxwpWWU3lNYX
X-Received: by 10.28.195.86 with SMTP id t83mr3267379wmf.176.1501955196512;
	Sat, 05 Aug 2017 10:46:36 -0700 (PDT)
Received: from [192.168.0.10] (2.217.198.146.dyn.plus.net. [146.198.217.2])
	by smtp.googlemail.com with ESMTPSA id
	g72sm7668692wmc.31.2017.08.05.10.46.35 for <bug-bash@gnu.org>
	(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Sat, 05 Aug 2017 10:46:35 -0700 (PDT)
Subject: Re: Execution continuing after SIGINT received
To: bug-bash@gnu.org
References: <b21334bb-9fab-3027-6bb4-7c3e8184b579@gmail.com>
	<20170804200353460209812@bob.proulx.com>
From: Kevin Brodsky <corax26@gmail.com>
Message-ID: <c560db11-e3a2-1ff0-9bf5-da2f5c06cca1@gmail.com>
Date: Sat, 5 Aug 2017 18:46:35 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
	Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <20170804200353460209812@bob.proulx.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Content-Language: en-GB
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2a00:1450:400c:c09::234
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 05 Aug 2017 17:46:42 -0000

On 05/08/2017 03:22, Bob Proulx wrote:
> Kevin Brodsky wrote:
>> $ bash -c '(trap "echo INT; exit 1" INT; sleep 60s); echo after'
>> ^CINT
>> after
>> $
> This is a good example of a bad example case.  You shouldn't "exit 1"
> or you will replace the information that the process is exiting due to
> a signal with an error code.  The trap handler should kill itself
> instead.  Use this test case instead.
>
>> $ bash -c '(trap "echo INT; trap - INT; kill -s INT $$" INT; sleep 60); echo after'
> Of course that doesn't change the end result here.  But at least the
> program exit WIFSIGNALED information is now correct.
>
> Signal handlers should always raise the signal on themselves after
> handling whatever they need to handle first.
>
> In any case I can't recreate your problem when using real processes in
> separate shells not all on one line.
>
> Bob

You're right Bob, I didn't think about the difference between exit()ing
and being kill()ed, notably in terms of WIFSIGNALED. Chet's reply
explains well the rationale, and it's now clear that the problem is on
Python's side (reproduced in my dummy example!).

Thanks,
Kevin


From MAILER-DAEMON Sat Aug 05 15:35:07 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1de4qo-0001oW-Rf
	for mharc-bug-bash@gnu.org; Sat, 05 Aug 2017 15:35:06 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41771)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1de4qn-0001nd-1v
	for bug-bash@gnu.org; Sat, 05 Aug 2017 15:35:06 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1de4qj-0004ay-T2
	for bug-bash@gnu.org; Sat, 05 Aug 2017 15:35:05 -0400
Received: from havoc.proulx.com ([96.88.95.61]:44165)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1de4qj-0004Z7-NU
	for bug-bash@gnu.org; Sat, 05 Aug 2017 15:35:01 -0400
Received: from joseki.proulx.com (localhost [127.0.0.1])
	by havoc.proulx.com (Postfix) with ESMTP id C0DD21170;
	Sat,  5 Aug 2017 13:35:00 -0600 (MDT)
Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119])
	by joseki.proulx.com (Postfix) with ESMTP id 8B649217DF;
	Sat,  5 Aug 2017 13:35:00 -0600 (MDT)
Received: by hysteria.proulx.com (Postfix, from userid 1000)
	id 75E3C2DC5B; Sat,  5 Aug 2017 13:35:00 -0600 (MDT)
Date: Sat, 5 Aug 2017 13:35:00 -0600
From: Bob Proulx <bob@proulx.com>
To: Kevin Brodsky <corax26@gmail.com>
Cc: bug-bash@gnu.org
Subject: Re: Execution continuing after SIGINT received
Message-ID: <20170805132200272630280@bob.proulx.com>
Mail-Followup-To: Kevin Brodsky <corax26@gmail.com>, bug-bash@gnu.org
References: <b21334bb-9fab-3027-6bb4-7c3e8184b579@gmail.com>
	<85dbcc3c-aa69-118b-cd06-fc9b58eea609@case.edu>
	<0c7bf471-4bc4-b38d-130f-666130d4af78@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <0c7bf471-4bc4-b38d-130f-666130d4af78@gmail.com>
User-Agent: NeoMutt/20170609 (1.8.3)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 96.88.95.61
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 05 Aug 2017 19:35:06 -0000

Kevin Brodsky wrote:
> To be fair, killing oneself when receiving SIGINT is quite
> counter-intuitive, POSIX is not helping here.

Really?  It seems intuitive to me that at any trap handling level one
should handle what needs to be handled and then raise the signal
higher to the next level of the program.  Software is all about layers
and abstraction.  Sending the signal to one self to raise the signal
again feels good to me.

POSIX even added a raise(3) call to make this easier.  (Although I
still do things the old way.)

  man 3 raise

Bob


From MAILER-DAEMON Sat Aug 05 17:45:41 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1de6tB-00013m-38
	for mharc-bug-bash@gnu.org; Sat, 05 Aug 2017 17:45:41 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:48148)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <corax26@gmail.com>) id 1de6t9-00013a-55
	for bug-bash@gnu.org; Sat, 05 Aug 2017 17:45:40 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <corax26@gmail.com>) id 1de6t6-0008HC-13
	for bug-bash@gnu.org; Sat, 05 Aug 2017 17:45:39 -0400
Received: from mail-wr0-x22f.google.com ([2a00:1450:400c:c0c::22f]:34377)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <corax26@gmail.com>) id 1de6t5-0008Fj-PS
	for bug-bash@gnu.org; Sat, 05 Aug 2017 17:45:35 -0400
Received: by mail-wr0-x22f.google.com with SMTP id 12so27374000wrb.1
	for <bug-bash@gnu.org>; Sat, 05 Aug 2017 14:45:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=subject:to:references:from:message-id:date:user-agent:mime-version
	:in-reply-to:content-transfer-encoding:content-language;
	bh=k7FXt7xanBbrZLf4rFylxZ5/mmD/c1HLpguXJGqG7T0=;
	b=UuEub3rgQCU5HjN0RZkfQbhS5e23/wHeDkMETj5EjI3nSQNmCn19MvmkwXOOBTdaum
	CkBjIplC+lWbv86L7l7/SgR2L50pxNci8bd1PLqxkH60CFkxilBbEZhQDl9k1leTZpWe
	whM8+p6NWtm9y1t0Uyt0cqPYIJwfA/kaKomIRKpM6Vtwic2OI/VcsFUsAPCq8h5FJLdj
	GGoLeZVVacUqP/xbXrRVq6LIzLfQYr3NoUEwK+vMHerIOpGEdmADJ9q4HSyuiADLFA85
	48SWmdvMC7GDjKsUtpHid6kVeHQ77rUHKLZez0WFGWDKjLLoEbnq0g4gfgsM66xk05RZ
	2WwQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:subject:to:references:from:message-id:date
	:user-agent:mime-version:in-reply-to:content-transfer-encoding
	:content-language;
	bh=k7FXt7xanBbrZLf4rFylxZ5/mmD/c1HLpguXJGqG7T0=;
	b=IwyW00dALoSZdysQQ+k8IVEJPNy3elalwZyOWb5G7mdVRvwkEUTK/RVlDc/xkscvEK
	aZ7BdortFYl7AHvjCxv+RJhcqUHvg8Tuf7SpDpOumCpUPFku3eRNDhSzkiz9zq2lJeDr
	hCufjU9vDKj2osmgsow4BzxVI3NoFFRkBgAZnCH/CVpKdgzRDLI/PGnXVC5/XfWC7+Tl
	neCRTrARYefjv56kNwSzk+Wm5iuLNGk4or0Hcvc8t6TvPHCwQC+irLxi4X1XeFGy4de+
	gwByVYRCEzm5yEec2K4lnDHmdthC3BI2AQCuV0q6bFMAI+52b9MkvnO+EHU+93JR66a4
	cwzA==
X-Gm-Message-State: AIVw113qo9hZvftdNNGTe3f/lL/Cmso/DQ8AcWHbuDXd0O0syP26RFm/
	jsqsa1HGKR8Gbbx8
X-Received: by 10.223.182.168 with SMTP id j40mr5394802wre.122.1501969534375; 
	Sat, 05 Aug 2017 14:45:34 -0700 (PDT)
Received: from [192.168.0.10] (2.217.198.146.dyn.plus.net. [146.198.217.2])
	by smtp.googlemail.com with ESMTPSA id
	d8sm8053440wmh.48.2017.08.05.14.45.32
	(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Sat, 05 Aug 2017 14:45:33 -0700 (PDT)
Subject: Re: Execution continuing after SIGINT received
To: bug-bash@gnu.org, bob@proulx.com
References: <b21334bb-9fab-3027-6bb4-7c3e8184b579@gmail.com>
	<85dbcc3c-aa69-118b-cd06-fc9b58eea609@case.edu>
	<0c7bf471-4bc4-b38d-130f-666130d4af78@gmail.com>
	<20170805132200272630280@bob.proulx.com>
From: Kevin Brodsky <corax26@gmail.com>
Message-ID: <a218ba57-3294-e9d6-fe7d-38382b1595ab@gmail.com>
Date: Sat, 5 Aug 2017 22:45:32 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
	Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <20170805132200272630280@bob.proulx.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Content-Language: en-GB
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2a00:1450:400c:c0c::22f
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 05 Aug 2017 21:45:40 -0000

On 05/08/2017 20:35, Bob Proulx wrote:
>
> Really?  It seems intuitive to me that at any trap handling level one
> should handle what needs to be handled and then raise the signal
> higher to the next level of the program.  Software is all about layers
> and abstraction.  Sending the signal to one self to raise the signal
> again feels good to me.

The thing is, "the next level of the program" really is another program,
i.e. the one that invoked it, and you are communicating via the exit
status, so it's certainly not as explicit as re-throwing an exception in
C++, for instance. But sure, once you are aware of this mechanism, it's
not difficult to understand the rationale.

Actually, IMHO, what makes it look very counter-intuitive is the fact
that you need to first reset the signal handler for SIGINT. Of course
this is necessary to avoid invoking the handler recursively, but it
feels very much like a workaround. WIFSIGNALED is true if "the child
process [...] terminated due to the receipt of a signal that was not
caught". That's not really what we want to know here; we want to know if
the child process received a signal that caused it to terminate. Whether
it handled SIGINT to clean up resources is irrelevant; what's relevant
is that it eventually terminated as a consequence of SIGINT. Ideally,
exit()ing from a signal handler should set a bit in the exit status
expressing exactly this.

I'll stop digressing, POSIX is what it is and we won't change it anyway
;-) For now, there's no other way to communicate with the shell, so
that's fair enough.

> POSIX even added a raise(3) call to make this easier.  (Although I
> still do things the old way.)
>
>   man 3 raise

That's a good point, it's arguably more self-explanatory than
kill(getpid(), ...).

Kevin


From MAILER-DAEMON Sat Aug 05 18:30:17 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1de7aL-0001de-DO
	for mharc-bug-bash@gnu.org; Sat, 05 Aug 2017 18:30:17 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:54684)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1de7aI-0001c7-S3
	for bug-bash@gnu.org; Sat, 05 Aug 2017 18:30:16 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1de7aF-0007Gs-OV
	for bug-bash@gnu.org; Sat, 05 Aug 2017 18:30:14 -0400
Received: from havoc.proulx.com ([96.88.95.61]:45673)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1de7aF-0007Fl-If
	for bug-bash@gnu.org; Sat, 05 Aug 2017 18:30:11 -0400
Received: from joseki.proulx.com (localhost [127.0.0.1])
	by havoc.proulx.com (Postfix) with ESMTP id A9D661292;
	Sat,  5 Aug 2017 16:30:10 -0600 (MDT)
Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119])
	by joseki.proulx.com (Postfix) with ESMTP id 67B52218FC;
	Sat,  5 Aug 2017 16:30:10 -0600 (MDT)
Received: by hysteria.proulx.com (Postfix, from userid 1000)
	id 5E24A2DC5B; Sat,  5 Aug 2017 16:30:10 -0600 (MDT)
Date: Sat, 5 Aug 2017 16:30:10 -0600
From: Bob Proulx <bob@proulx.com>
To: Kevin Brodsky <corax26@gmail.com>
Cc: bug-bash@gnu.org
Subject: Re: Execution continuing after SIGINT received
Message-ID: <20170805160920859538657@bob.proulx.com>
Mail-Followup-To: Kevin Brodsky <corax26@gmail.com>, bug-bash@gnu.org
References: <b21334bb-9fab-3027-6bb4-7c3e8184b579@gmail.com>
	<85dbcc3c-aa69-118b-cd06-fc9b58eea609@case.edu>
	<0c7bf471-4bc4-b38d-130f-666130d4af78@gmail.com>
	<20170805132200272630280@bob.proulx.com>
	<a218ba57-3294-e9d6-fe7d-38382b1595ab@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <a218ba57-3294-e9d6-fe7d-38382b1595ab@gmail.com>
User-Agent: NeoMutt/20170609 (1.8.3)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 96.88.95.61
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 05 Aug 2017 22:30:16 -0000

Kevin Brodsky wrote:
> The thing is, "the next level of the program" really is another program,
> i.e. the one that invoked it, and you are communicating via the exit
> status, so it's certainly not as explicit as re-throwing an exception in
> C++, for instance. But sure, once you are aware of this mechanism, it's
> not difficult to understand the rationale.

One shouldn't confuse exception handling with signal handling.  They
are really quite different things. :-)

> Actually, IMHO, what makes it look very counter-intuitive is the fact
> that you need to first reset the signal handler for SIGINT. Of course
> this is necessary to avoid invoking the handler recursively, but it
> feels very much like a workaround.

You probably remember that signal(2) is unsafe because it does exactly
that and resets the signal handler to the default.  This creates a
race condition.  There is a window of time in the signal handler when
a second signal can catch the program with the default state set
before it can reset the signal handler.  That is the main reason why
sigaction(2) should be used instead.

> WIFSIGNALED is true if "the child process [...] terminated due to
> the receipt of a signal that was not caught". That's not really what
> we want to know here; we want to know if the child process received
> a signal that caused it to terminate. Whether it handled SIGINT to
> clean up resources is irrelevant; what's relevant is that it
> eventually terminated as a consequence of SIGINT. Ideally, exit()ing
> from a signal handler should set a bit in the exit status expressing
> exactly this.

Well...  Maybe.  But how are you going to know if the program
"eventually terminated as a consequence of SIGINT" or not?  And of
course then you would need a way to provide a program to do the
opposite when required.

But it has been 40 years already with the current way things are done
and it is a little late to change things now.

> I'll stop digressing, POSIX is what it is and we won't change it anyway
> ;-) For now, there's no other way to communicate with the shell, so
> that's fair enough.

I don't see how POSIX is even involved in this.  Other than stopping
the proliferation of differences on different systems.  Before POSIX
came along every system did this slightly differently.  It was awful.
POSIX.1 simply picked BSD as the behavior to standardize upon.  And
then we could stop putting #ifdef's in our code for every different
system quirk.

What you are seeing here is just the basic behavior of the old Unix
and BSD kernels and now every kernel that has followed since.  Since
that is the common behavior among all systems the standards bodies
will mostly say, freeze on that behavior, do it the same way, don't do
it differently.  Surely that is a good thing, right?

The subtleties of https://www.cons.org/cracauer/sigint.html about how
programs should behave were learned not all at once but over the
course of time.

Bob


From MAILER-DAEMON Mon Aug 07 11:39:28 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dek7s-0004PK-Nh
	for mharc-bug-bash@gnu.org; Mon, 07 Aug 2017 11:39:28 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:42050)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <g.d0b3rm4n@gmail.com>) id 1dej53-0000Ze-Kq
	for bug-bash@gnu.org; Mon, 07 Aug 2017 10:32:35 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <g.d0b3rm4n@gmail.com>) id 1dej4y-0003CP-Ko
	for bug-bash@gnu.org; Mon, 07 Aug 2017 10:32:29 -0400
Received: from mail-lf0-x22f.google.com ([2a00:1450:4010:c07::22f]:36633)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <g.d0b3rm4n@gmail.com>)
	id 1dej4y-0003Bs-CT
	for bug-bash@gnu.org; Mon, 07 Aug 2017 10:32:24 -0400
Received: by mail-lf0-x22f.google.com with SMTP id o85so2699969lff.3
	for <bug-bash@gnu.org>; Mon, 07 Aug 2017 07:32:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=to:from:subject:organization:message-id:date:user-agent
	:mime-version:content-language:content-transfer-encoding;
	bh=txSmGeMYpZk2tB30UJEkD2pW0dSHxcpDinJTOGxNvBA=;
	b=eeFmjrmNU09x/qaT0plu4Y8wicjsWy6pa79nzRNOt4zBlORjLsmxhnX13Qj4FkIxLX
	EebPUTJQP4vTh+p2smcPduviqfOa6KLx1PslbHLdZ73ts2D7VPTSh4BzhbGS6Nrji47B
	PBQC3zFCVHCIYllUOaWmnrlVos9/U58eld2xEZjNsKcOC4GScDa2DqqS0pkBiisRubKF
	yDjGuVxE87H5FnA0GG6Xc5XIUcYS1nxkMdCKUZwy3k7baNVALt1JyqeFAvx9nbt6ax6l
	htrVZNXRoka+SXvaAAAYXITFPemw7Qd8y5VXLvFIU3Fp5oTM5iYTDYF0FY/HwSw3aPn1
	xBYg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:to:from:subject:organization:message-id:date
	:user-agent:mime-version:content-language:content-transfer-encoding;
	bh=txSmGeMYpZk2tB30UJEkD2pW0dSHxcpDinJTOGxNvBA=;
	b=VHGpb2IhSUD4r0ZfNvb3KoEBq92t4NDRuDC/J1FHLMPVm0vShCocI6XXs/cPqJg48p
	TLkB4cqKDOOxzktsvnF8u/AVyDpXGFOcM4gvxzH2fvfQkZtDCoHqZosfDXoEwA2nS4yx
	6KIAj0UiYyE5tqwYj4Ny3D2ud5I66zGXY0KuPJM79F3v/VIylu/PvU374NMaa4qbDGjR
	dd5c7edNfhmwpczi5h73EJ6HHmtg6TuHFEFyDY2zj5B2mTxCbHlO45/aqi/eOm1sn+7s
	5ZdyA26RInpVV7mX/VAe7bs7Yx8Q90Yl0FfWzefWwpzlNAVyRnCIgkeCgTRQCjnhP0z2
	yhVQ==
X-Gm-Message-State: AHYfb5jIusvtb2Ru893SgISWzrTUw1gBWwCoNC+kFgJEIuTShQhcuwEF
	oomAElwYCx8ftZETQfdC1w==
X-Received: by 10.46.2.85 with SMTP id 82mr254226ljc.101.1502116342721;
	Mon, 07 Aug 2017 07:32:22 -0700 (PDT)
Received: from [192.168.1.245] (a88-114-39-154.elisa-laajakaista.fi.
	[88.114.39.154])
	by smtp.gmail.com with ESMTPSA id 96sm1664033ljb.60.2017.08.07.07.32.21
	for <bug-bash@gnu.org>
	(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Mon, 07 Aug 2017 07:32:21 -0700 (PDT)
To: bug-bash@gnu.org
From: Reto <g.d0b3rm4n@gmail.com>
Subject: bash 4.4 changed behavior wrt to builtin 'command'
Organization: g.d0b3rm4n@gmail.com
Message-ID: <f72b1674-35c9-3871-d3a3-66bb1f3789b6@gmail.com>
Date: Mon, 7 Aug 2017 17:32:21 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
	Thunderbird/52.2.1
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2a00:1450:4010:c07::22f
X-Mailman-Approved-At: Mon, 07 Aug 2017 11:39:27 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 07 Aug 2017 14:32:35 -0000

Hi,

Not sure if it's a bug or intended behavior, but in bash 4.4 the 
behavior changed with respect to builtin command 'command', called with 
/bin/sh.

While in bash 4.3 the following works:

     # /bin/sh --version
     GNU bash, version 4.3.43(1)-release (x86_64-redhat-linux-gnu)
     Copyright (C) 2013 Free Software Foundation, Inc.
     License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>

     This is free software; you are free to change and redistribute it.
     There is NO WARRANTY, to the extent permitted by law.
     # /bin/sh -c 'command(){ echo FOO;}; command'
     FOO
     #


It does not work anymore in bash 4.4:

     # /bin/sh --version
     GNU bash, version 4.4.12(1)-release (x86_64-redhat-linux-gnu)
     Copyright (C) 2016 Free Software Foundation, Inc.
     License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>

     This is free software; you are free to change and redistribute it.
     There is NO WARRANTY, to the extent permitted by law.
     # /bin/sh -c 'command(){ echo FOO;}; command'
     /bin/sh: `command': is a special builtin
     #

AFIK 'command' is no built in command in bourne shell,
so I think it could be expected that if bash is called with /bin/sh 
'command' can be used as function name?

trying with other builtin commands in 4.3 and 4.4:

- 'shift' and 'exec' are bourne shell builtins (so it's expected they 
fail in /bin/sh case, not sure why it works in bash case?)

- 'bg' and 'command' are just bash builtins (so expected it works in 
/bin/sh case (it does for 'bg' but not for 'command'?), not sure why it 
works in bash case?)

     bash4.3.43# /bin/sh -c 'shift(){ echo FOO;}; shift'
     /bin/sh: `shift': is a special builtin
     bash4.3.43# /bin/bash -c 'shift(){ echo FOO;}; shift'
     FOO
     bash4.3.43# /bin/sh -c 'bg(){ echo FOO;}; bg'
     FOO
     bash4.3.43# /bin/bash -c 'bg(){ echo FOO;}; bg'
     FOO
     bash4.3.43# /bin/sh -c 'exec(){ echo FOO;}; exec'
     /bin/sh: `exec': is a special builtin
     bash4.3.43# /bin/bash -c 'exec(){ echo FOO;}; exec'
     FOO
     bash4.3.43#  /bin/sh -c 'command(){ echo FOO;}; command'
     FOO
     bash4.3.43#  /bin/bash -c 'command(){ echo FOO;}; command'
     FOO
     bash4.3.43#


     bash4.4.12# /bin/sh -c 'shift(){ echo FOO;}; shift'
     /bin/sh: `shift': is a special builtin
     bash4.4.12# /bin/bash -c 'shift(){ echo FOO;}; shift'
     FOO
     bash4.4.12# /bin/sh -c 'bg(){ echo FOO;}; bg'
     FOO
     bash4.4.12# /bin/bash -c 'bg(){ echo FOO;}; bg'
     FOO
     bash4.4.12# /bin/sh -c 'exec(){ echo FOO;}; exec'
     /bin/sh: `exec': is a special builtin
     bash4.4.12# /bin/bash -c 'exec(){ echo FOO;}; exec'
     FOO
     bash4.4.12# /bin/sh -c 'command(){ echo FOO;}; command'
     /bin/sh: `command': is a special builtin
     bash4.4.12# /bin/bash -c 'command(){ echo FOO;}; command'
     FOO
     bash4.4.12#


regards
Reto


From MAILER-DAEMON Mon Aug 07 11:48:39 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dekGl-000585-7k
	for mharc-bug-bash@gnu.org; Mon, 07 Aug 2017 11:48:39 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:55632)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1dekGe-00053R-4G
	for bug-bash@gnu.org; Mon, 07 Aug 2017 11:48:37 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1dekGZ-0003Xm-5C
	for bug-bash@gnu.org; Mon, 07 Aug 2017 11:48:32 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:41382 helo=svr4.eeg.ccf.org)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1dekGY-0003Lm-UX
	for bug-bash@gnu.org; Mon, 07 Aug 2017 11:48:27 -0400
Received: (qmail 3207 invoked from network); 7 Aug 2017 15:47:58 -0000
Received: from wooledg.eeg.ccf.org (10.76.172.97)
	by gateway.eeg.ccf.org with SMTP; Mon, 07 Aug 2017 11:47:58 -0400
Received: (qmail 3364 invoked by uid 563); 7 Aug 2017 15:47:58 -0000
Date: Mon, 7 Aug 2017 11:47:58 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: bug-bash@gnu.org
Subject: Re: bash 4.4 changed behavior wrt to builtin 'command'
Message-ID: <20170807154758.dtnpuwatrc7jsy6d@eeg.ccf.org>
References: <f72b1674-35c9-3871-d3a3-66bb1f3789b6@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <f72b1674-35c9-3871-d3a3-66bb1f3789b6@gmail.com>
User-Agent: NeoMutt/20170113 (1.7.2)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 139.137.100.1
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 07 Aug 2017 15:48:37 -0000

On Mon, Aug 07, 2017 at 05:32:21PM +0300, Reto wrote:
> It does not work anymore in bash 4.4:
> 
>     # /bin/sh --version
>     GNU bash, version 4.4.12(1)-release (x86_64-redhat-linux-gnu)
>     Copyright (C) 2016 Free Software Foundation, Inc.
>     License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> 
>     This is free software; you are free to change and redistribute it.
>     There is NO WARRANTY, to the extent permitted by law.
>     # /bin/sh -c 'command(){ echo FOO;}; command'
>     /bin/sh: `command': is a special builtin
>     #
> 
> AFIK 'command' is no built in command in bourne shell,
> so I think it could be expected that if bash is called with /bin/sh
> 'command' can be used as function name?

I can't reproduce this on Debian 9:

wooledg:~$ (exec -a /bin/sh bash)
sh-4.4$ command() { echo hi; }
sh-4.4$ command
hi
sh-4.4$ echo "$BASH_VERSION"
4.4.12(1)-release


From MAILER-DAEMON Mon Aug 07 14:38:25 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1demv3-0001Sy-Tc
	for mharc-bug-bash@gnu.org; Mon, 07 Aug 2017 14:38:25 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:49661)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1demuy-0001SR-9x
	for bug-bash@gnu.org; Mon, 07 Aug 2017 14:38:25 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1demut-0005hX-52
	for bug-bash@gnu.org; Mon, 07 Aug 2017 14:38:20 -0400
Received: from mpv2-2015.cwru.edu ([129.22.103.227]:10287
	helo=mpv1-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1demus-0005gV-V7
	for bug-bash@gnu.org; Mon, 07 Aug 2017 14:38:15 -0400
Received: from mpv6-2015.CWRU.Edu (EHLO mpv6-2015.case.edu) ([129.22.103.202])
	by mpv2-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AOI15689; Mon, 07 Aug 2017 14:38:12 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id BHV60106 (AUTH cpr);
	Mon, 07 Aug 2017 14:38:12 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: bash 4.4 changed behavior wrt to builtin 'command'
To: Reto <g.d0b3rm4n@gmail.com>, bug-bash@gnu.org
References: <f72b1674-35c9-3871-d3a3-66bb1f3789b6@gmail.com>
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <a6a143ac-43bb-a373-4a45-38ebc0be51af@case.edu>
Date: Mon, 7 Aug 2017 14:38:11 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <f72b1674-35c9-3871-d3a3-66bb1f3789b6@gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Junkmail-Status: score=7/60, host=mpv2-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.7.180617:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC,
	__REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID,
	__SANE_MSGID, DATE_TZ_NA, __USER_AGENT,
	__MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT,
	__CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY,
	__REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1,
	__FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN,
	__ANY_URI, __URI_WITH_PATH, __URI_NO_WWW,
	__CP_URI_IN_BODY, __SUBJ_ALPHA_NEGATE, __URI_IN_BODY,
	__URI_NOT_IMG, __FORWARDED_MSG, __NO_HTML_TAG_RAW,
	BODY_SIZE_600_699, BODYTEXTP_SIZE_3000_LESS,
	__MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01,
	HTML_00_10, BODY_SIZE_5000_LESS, IN_REP_TO, MSG_THREAD,
	__FROM_DOMAIN_IN_RCPT, __TO_REAL_NAMES,
	MULTIPLE_REAL_RCPTS, LEGITIMATE_SIGNS, __SINGLE_URI_TEXT,
	[TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.227
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 07 Aug 2017 18:38:25 -0000

On 8/7/17 10:32 AM, Reto wrote:
> Hi,
> 
> Not sure if it's a bug or intended behavior, but in bash 4.4 the behavior
> changed with respect to builtin command 'command', called with /bin/sh.

When in Posix mode, bash doesn't allow functions to be defined with the
same name as a special builtin. It seems like RedHat added `command' to
the list of special builtins in their custom build of bash-4.4. Open a
ticket if they're your vendor.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Wed Aug 09 03:05:32 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dfL3c-0007Pm-Nq
	for mharc-bug-bash@gnu.org; Wed, 09 Aug 2017 03:05:32 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:47099)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <g.d0b3rm4n@gmail.com>) id 1dfL3Y-0007Nk-BL
	for bug-bash@gnu.org; Wed, 09 Aug 2017 03:05:31 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <g.d0b3rm4n@gmail.com>) id 1dfL3V-0004d2-7Q
	for bug-bash@gnu.org; Wed, 09 Aug 2017 03:05:28 -0400
Received: from mail-lf0-x232.google.com ([2a00:1450:4010:c07::232]:36820)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <g.d0b3rm4n@gmail.com>)
	id 1dfL3V-0004bU-0N
	for bug-bash@gnu.org; Wed, 09 Aug 2017 03:05:25 -0400
Received: by mail-lf0-x232.google.com with SMTP id o85so24053278lff.3
	for <bug-bash@gnu.org>; Wed, 09 Aug 2017 00:05:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=subject:to:references:from:organization:message-id:date:user-agent
	:mime-version:in-reply-to:content-language:content-transfer-encoding;
	bh=3f5DURC9KoC3w9Yzk8cSUxkaMNcop3C13XR1P6MHaW4=;
	b=AJB0RJBRIPHJQpkX297ZpQXywXZRGfu19uQIAqYvYdRRPS2qWwK7VUl7tIFRf5nzdY
	nu6bV6m+5ldJoYIq6SV+eKdwzo8nBrPdriEc7SPXu8shgpAtSo5MigFSuKOKJmqA15ld
	UyRj79cJoJhOCWOne7oTNxMHyYvOvbp/aI87AySD3uKWtR33QDS0tL36vsfYSi0kRT07
	9zvAmi98ar9uAGUE2hhKShJiOhq2WTXmNPyLcdZkzEWevWvB6mWcBACHowmYsZXgV8vk
	UTKIS5op88yRFqdoPolV2K/wjddKbTJ+gNtTffyv/0oNCQ6UFPsCk17FHJO8KXdxMzaQ
	5fkg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:subject:to:references:from:organization
	:message-id:date:user-agent:mime-version:in-reply-to
	:content-language:content-transfer-encoding;
	bh=3f5DURC9KoC3w9Yzk8cSUxkaMNcop3C13XR1P6MHaW4=;
	b=V5je4p0HB0Fj1v6um8Uq92b7/GNHMWPYZD1yu/wNOfsyyy6ha0Etszv3FpgIBh3AeU
	Gv4qV0TjMZG2J+x0uNY81Edo3cSQyat7IWRycDl4G4Dx/7zyCdbeOjPjMbSkWwpCAiqe
	guu2E/jkolFMNVUMRb08M7ln2EnI1SKcWXRNr/F+eg/LwXcti4sruPKZhscMKgOlpLeO
	RJRany45lxawS4O1GKojTLwSIzTKFPLGYPpfH0NbjafMY4KccAyF/gVMpCveUECqEBKi
	qDsxBG17CAI+w0PAVkRtJQPQVOi8Cdl5c+3zXTVu+qBNv2leEbhukXe6GsTUyDha/ehj
	Pivg==
X-Gm-Message-State: AHYfb5jArQvesR9CGZspw5lfRh+Uzwq0oo8k/eR2FjioZMnncwZhxeMC
	OtNbF1zHb6Zl05Pz7lM=
X-Received: by 10.46.77.83 with SMTP id a80mr2385241ljb.110.1502262320667;
	Wed, 09 Aug 2017 00:05:20 -0700 (PDT)
Received: from [192.168.1.245] (a88-114-39-154.elisa-laajakaista.fi.
	[88.114.39.154])
	by smtp.gmail.com with ESMTPSA id r88sm527999lje.14.2017.08.09.00.05.19
	for <bug-bash@gnu.org>
	(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Wed, 09 Aug 2017 00:05:19 -0700 (PDT)
Subject: Re: bash 4.4 changed behavior wrt to builtin 'command'
To: bug-bash@gnu.org
References: <f72b1674-35c9-3871-d3a3-66bb1f3789b6@gmail.com>
	<a6a143ac-43bb-a373-4a45-38ebc0be51af@case.edu>
From: Reto <g.d0b3rm4n@gmail.com>
Organization: g.d0b3rm4n@gmail.com
Message-ID: <3f87d1ec-3e6e-3d6e-6682-d871ce285026@gmail.com>
Date: Wed, 9 Aug 2017 10:05:19 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
	Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <a6a143ac-43bb-a373-4a45-38ebc0be51af@case.edu>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2a00:1450:4010:c07::232
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 09 Aug 2017 07:05:31 -0000

Hi,

On 07.08.2017 21:38, Chet Ramey wrote:
> On 8/7/17 10:32 AM, Reto wrote:
>> Hi,
>>
>> Not sure if it's a bug or intended behavior, but in bash 4.4 the behavior
>> changed with respect to builtin command 'command', called with /bin/sh.
> 
> When in Posix mode, bash doesn't allow functions to be defined with the
> same name as a special builtin. It seems like RedHat added `command' to
> the list of special builtins in their custom build of bash-4.4. Open a
> ticket if they're your vendor.
> 

OK, thanks for the explanation.

For reference I opened the following bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1479220

best regards
Reto


From MAILER-DAEMON Thu Aug 10 08:20:57 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dfmSP-00077E-Od
	for mharc-bug-bash@gnu.org; Thu, 10 Aug 2017 08:20:57 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:47399)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <info@leonklingele.de>) id 1dfdHU-0008I6-5M
	for bug-bash@gnu.org; Wed, 09 Aug 2017 22:33:05 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <info@leonklingele.de>) id 1dfdHP-00005u-Ae
	for bug-bash@gnu.org; Wed, 09 Aug 2017 22:33:04 -0400
Received: from sky.leonklingele.de ([212.53.140.36]:35960)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <info@leonklingele.de>)
	id 1dfdHP-000059-3c
	for bug-bash@gnu.org; Wed, 09 Aug 2017 22:32:59 -0400
Received: from localhost (localhost [127.0.0.1])
	by sky.leonklingele.de (Postfix) with ESMTP id 245772A5CB8
	for <bug-bash@gnu.org>; Thu, 10 Aug 2017 04:32:28 +0200 (CEST)
Received: from sky.leonklingele.de ([127.0.0.1])
	by localhost (sky.leonklingele.de [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 6xWRJjagHzLv for <bug-bash@gnu.org>;
	Thu, 10 Aug 2017 04:32:26 +0200 (CEST)
From: Leon Klingele <info@leonklingele.de>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=leonklingele.de;
	s=20160101; t=1502332346;
	bh=BwqN3vl7Oe9osf9aAnRs+ZkVYuh+VCPoJ9GjLgxJICI=;
	h=From:Subject:Date:References:To:In-Reply-To:From;
	b=BNiir7tFUlGnTCKOkI95/sAO70TR11akU8zSI6e2nEgGm167zV79b1kxocA3pc4rU
	wROjHzhITEfhkPlRGGV2D8jmmJGJlKAvrvsLQ9xwNsQnPtE7kBtMCBDh6LPaMxUAcd
	A7TqNROinRTxaIMS2/AblRcgfMPv6/hqw7PkU59Dg6WIQgV2KwcSCMAmAjvs8nObvh
	s+ljX3yl/r5qO2jY2druBaPyy4sCllsn7wFxXfh25l4OSTTtO2d3gupBP916WT/cvD
	NBwIn3NyUrb+7uHHteNspqjmXDdhiYuQBmEaJloDrLg4M3QhaG1ceF+olPywu9ND/1
	RrS89Hs1wXKJQ==
Content-Type: multipart/signed;
	boundary="Apple-Mail=_39736C04-6923-413F-B91F-B6A551B0CB4B";
	protocol="application/pgp-signature"; micalg=pgp-sha512
Message-Id: <BE36358B-02FF-4E0F-9B6A-8CB41B8A5091@leonklingele.de>
Subject: Re: Line wrapping issues
Date: Thu, 10 Aug 2017 04:32:25 +0200
References: <929ABEA3-78BE-4264-8E3F-7692CF2C541C@leonklingele.de>
To: bug-bash@gnu.org
In-Reply-To: <929ABEA3-78BE-4264-8E3F-7692CF2C541C@leonklingele.de>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From: 212.53.140.36
X-Mailman-Approved-At: Thu, 10 Aug 2017 08:20:56 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 10 Aug 2017 02:33:05 -0000


--Apple-Mail=_39736C04-6923-413F-B91F-B6A551B0CB4B
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii

Oh, I forgot to include my bash version (installed with Homebrew):
$ echo $BASH_VERSION
4.4.12(1)-release

--Apple-Mail=_39736C04-6923-413F-B91F-B6A551B0CB4B
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJZi8W5AAoJEIOuwP66pdSDPeUP/iBpcyJGDUuZreU9KQzidQTR
UTp84QDN68/pFcOh0x6yFSQt6qY4JyeGBAz5bVKWXhFpCTTHxx0jwEcnkhQw81wC
DFbaE4ymSF52QTw3wUZzJM6nZWnjfJMGTVk9BAhMV3O90/VuqHF+Kxx4wMO9Zdx9
FyWxubwBPwZOyjYbl6ZfLpsohGQc7UibNPWg/to+Qg1R48z6gHTCZ/GnWRCS1+a5
5mllDtFcq32FvzKvPFP56o69lLsECss4hT8o8YFhDb7luGTdAh2RDGMpNJUpDFsp
GIAcbychYwmVZPRgc2GNnMENkZdbx3GWCoJqdIqpd7jDska+oz5TDTMNHVgoKN4G
rkzqhfQHrRq+Q/lWCoQ2aQoJkBwW38Y8DeN+oK/0vKT0x81NFnv8DqgEONp1G56y
1P1wBhMAtDVNmnrm251oEjqCsc90xOZhsk/T45Nl6xdBu6FRprsC8ABlURnhCWDk
AwtA2A/PSvSDjpeNorDF/F4julb8NrqKcueI5Mpa4oTocOVlTOFdKws7vdBiaFAA
mXRRgiEmfcY3YlXFpKm8Hg7o+ptMWbVPpOZEVI8rl1gTCLf7/NP16GdDANVeD79f
zRUIrW6lT5cGxAASHwm3nUXtYZPXbUQvFgaUSebE3oYeGYeKP4fMExFWKmZUMICP
1Lc4FX3CLBY0DRanJmVX
=FdNX
-----END PGP SIGNATURE-----

--Apple-Mail=_39736C04-6923-413F-B91F-B6A551B0CB4B--


From MAILER-DAEMON Thu Aug 10 08:20:57 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dfmSP-00077U-T8
	for mharc-bug-bash@gnu.org; Thu, 10 Aug 2017 08:20:57 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:47071)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <info@leonklingele.de>) id 1dfdFa-0008EJ-62
	for bug-bash@gnu.org; Wed, 09 Aug 2017 22:31:07 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <info@leonklingele.de>) id 1dfdFW-0007iB-9P
	for bug-bash@gnu.org; Wed, 09 Aug 2017 22:31:06 -0400
Received: from sky.leonklingele.de ([212.53.140.36]:59672)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <info@leonklingele.de>)
	id 1dfdFW-0007gJ-0S
	for bug-bash@gnu.org; Wed, 09 Aug 2017 22:31:02 -0400
Received: from localhost (localhost [127.0.0.1])
	by sky.leonklingele.de (Postfix) with ESMTP id D18112A5CB6
	for <bug-bash@gnu.org>; Thu, 10 Aug 2017 04:30:57 +0200 (CEST)
Received: from sky.leonklingele.de ([127.0.0.1])
	by localhost (sky.leonklingele.de [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id JEl3u1t3TkrA for <bug-bash@gnu.org>;
	Thu, 10 Aug 2017 04:30:55 +0200 (CEST)
From: Leon Klingele <info@leonklingele.de>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=leonklingele.de;
	s=20160101; t=1502332255;
	bh=+3aJbx1olw4zldzEjvMqABpAFLe8Ws38Cp/H6yVHW/Y=;
	h=From:Subject:Date:To:From;
	b=pkfzmkCaGFx7LVYOpj7qySCufqXdbuS5TTefN933Xb5pX2OsRP92AKM+sP6m2Fopv
	DvP3cIuHbr7xHHNM0Mv4kxoLrzr7tqxr331Gj0NjaVk/pPuobSQMwq1rmYQO8EcDUr
	pX8rDAFwMlj059HIsgjBpLK1XLge1oKHtWxcHkvL2LgbcBDAoLnRd7w4dMHXnrbNCJ
	wPXnb4m1o0nz9amm2anDyBGTTFCc+bAFCW6vfWuwY59GAKjkNbw77XhF6t7O115fDa
	A0MOnw9Ec9YfkJK13XeULKOKgP/y3g6Ty8qRFwQMQJArj9I9Nuuj5/gttQ+6ly26EJ
	eQe2dl6O3EGSA==
Content-Type: multipart/signed;
	boundary="Apple-Mail=_22D6D63F-1C31-4E29-A35B-96CDDE8837F0";
	protocol="application/pgp-signature"; micalg=pgp-sha512
Subject: Line wrapping issues
Message-Id: <929ABEA3-78BE-4264-8E3F-7692CF2C541C@leonklingele.de>
Date: Thu, 10 Aug 2017 04:30:54 +0200
To: bug-bash@gnu.org
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From: 212.53.140.36
X-Mailman-Approved-At: Thu, 10 Aug 2017 08:20:56 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 10 Aug 2017 02:31:07 -0000


--Apple-Mail=_22D6D63F-1C31-4E29-A35B-96CDDE8837F0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii

I'm experiencing line wrapping issues when using bash with fzf[1].
The issue is described in [2] and it looks like it is not caused by fzf
but instead by bash itself.

For the sake of completeness, here are the steps to reproduce:

1. Use bash with fzf, this requires you to install fzf. See [3].
2. Do an echo "abc abc abc abc abc abc abc abc abc abc abc abc abc abc
abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc" (so
you have that command in your bash history)
3. export PS1="abc abc abc abc abc abc abc abc abc abc abc abc abc abc
abc"
4. Activate fzf's reverse-i-search (Ctrl + r) (you need to have
sourc'ed fzf's $HOME/.fzf.bash file)
5. Select the echo "abc .." line, press enter
6. Bash prompt is wrapped incorrectly. After pressing enter in the last
step, the cursor is placed at the very end of the line (right after the
closing "), however there is more text on the right side of the cursor
(after EOL). See this screencast[4].

Is this problem caused by bash?

[1]: https://github.com/junegunn/fzf
[2]: https://github.com/junegunn/fzf/issues/994
[3]: https://github.com/junegunn/fzf#installation
[4]: https://git.io/v7MCY


--Apple-Mail=_22D6D63F-1C31-4E29-A35B-96CDDE8837F0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJZi8VeAAoJEIOuwP66pdSDs6YP/0el360ZiqA827MbSmxeuJgi
8sZtJdLuhTUjPWNfJxaNrirhJI5FA5+xJh/bnRkz0Zkka7+l7+85nFxQ7YjucAUj
vj3w8okVAuYXoV7M0BtAvrmnu0J3y6o0YbDX+5Okif/s65RD3/eOUTKOSk+djYh6
VajP99MM8+b0EM7hzgwLKdcRvRuHcdiXRgpi2iyYI1zGj6XkX/1QewxTw22E9Nqz
aHVS9P4i+lecSC8WP87hmm/Mxzkk9O5V/RRzYlTcRiu/FnTy1ZL7qWGwOmmiVW0N
v04UZqUe3Sg7Evk5oy8c9d5BNHlA7y6r3ofnLZcWQlqX3lkd5lVssFQW5k7CAMuy
8utgsdZJNT5mlf0umlTTFMAOtlp2r65eLdmPEu0ruwni/wiNQQPrfd/vqGZThIfL
mo0X6bN1Y1M78gDHfRtNZ2cQiEj+s0y7dFhW9HyIbABsk0iQsCqRvnC+674Ggo2j
5/++rDYOvc9qgWHEekGb06Gf9lq1GNV2L81tckYHwoMQ5KMvXhL4tV1dJ0GyRAOj
J5SpsNxEYmrrpLwCDHJb7r8xqAlmZTtB6Vdz3FAjIh8CIUoQA/ePJok4WBxfau6S
GM7PxswA9nBGF4MHDBBa2RkSZ3fEpcGqjZK3TVM2cgNv2vIY7Hytm+jYqUyBy3Gz
GLmc58ihafGP30GHzohG
=p+pA
-----END PGP SIGNATURE-----

--Apple-Mail=_22D6D63F-1C31-4E29-A35B-96CDDE8837F0--


From MAILER-DAEMON Fri Aug 11 18:55:49 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dgIqL-0005dA-FY
	for mharc-bug-bash@gnu.org; Fri, 11 Aug 2017 18:55:49 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:45335)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <matthew.persico@gmail.com>) id 1dgIqI-0005cT-5g
	for bug-bash@gnu.org; Fri, 11 Aug 2017 18:55:48 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <matthew.persico@gmail.com>) id 1dgIqG-0002iu-2p
	for bug-bash@gnu.org; Fri, 11 Aug 2017 18:55:46 -0400
Received: from mail-lf0-x22c.google.com ([2a00:1450:4010:c07::22c]:36804)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <matthew.persico@gmail.com>)
	id 1dgIqF-0002gg-Dg
	for bug-bash@gnu.org; Fri, 11 Aug 2017 18:55:43 -0400
Received: by mail-lf0-x22c.google.com with SMTP id o85so21553533lff.3
	for <bug-bash@gnu.org>; Fri, 11 Aug 2017 15:55:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc; bh=7mlB61+V+rdC8buzGN3O8pZO+v09iaeGO4DFFfjMMiI=;
	b=rYh4l0Y2UQuqymyjMOjNjvE4LJhF8qFrCcY5xcdUprIoXhBpzDa+uJqwNTovECpokj
	ggONgYxuN9EvhLxqOzMHBHkjQy6yWS3EfYUHxc1HdpMKzKO7XA7qNg1Nk/EzWTmE7xiE
	rt9DA0w8cXPcRIS6X1gKwGCEgKDjYFY5m7HCTHM55RAuiw8PfJDt5GXKEQd0IqZsDytW
	OIhFaYewfqI9uqhTyTut6utDvH8Vsb7na8WmhLH8YME0TApdc7OVKzVCVeYinpwMT0be
	dcEitnVVvxPtMceANVADgVsy9NYMzbDKiirWOUPYZQ4R4tkUxpvtZRS7rvGkJn045y0M
	/J1A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to:cc;
	bh=7mlB61+V+rdC8buzGN3O8pZO+v09iaeGO4DFFfjMMiI=;
	b=gtwW+IzSq9qjFCKeT6xFUVEBTShrF4CRtKbcIpT0TFfxQYQZ0JmD52h25TJktWCFlS
	jOl1F/cVOqslhs2D3buhWv3ZVyznStybmwH2Da4wdmcsHMyocyMPzfJMKyjVIuJ+6TEP
	LeAmje2HsrcvzTtiV6DhK6NOYg/3aP9hsvir1vGzv0+C77xctTuxcCeOfN0GBDG1vPTf
	y6MAG/nOYYxIrC9AH8s0iozuLU4UNZElaqQ4If8qCuJuxPLt5E259Nmrj04/Yac87wvO
	1Ww60HrW06uVe3UtqxyuVqmlfcM9gTGk3A0370AfGKQM8ajutQdEBie7MlP69aVTknQK
	CI7A==
X-Gm-Message-State: AHYfb5gNHIdrW9Xjs/dNucY30U0xplThrHMURlcq7w2cQyx0pZtDa/L7
	A87IQlBjsHoIBUM70afH80Y/CryJdA==
X-Received: by 10.25.29.83 with SMTP id d80mr6269270lfd.50.1502492140112; Fri,
	11 Aug 2017 15:55:40 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.25.99.139 with HTTP; Fri, 11 Aug 2017 15:55:19 -0700 (PDT)
In-Reply-To: <5da6c99c-c530-952c-5921-77ca89d7cf12@case.edu>
References: <CAL20dLBsQEAPCidjL+vv2=nDJaKP2X5zgrKpi0qe-a86+hC6+g@mail.gmail.com>
	<CAOSMAuvzKTU8JK9vS5TmXf4ArbK_BNSy4JRdFRbwG3-seZD7_g@mail.gmail.com>
	<CAL20dLAC+1XyRfNTHb5EKdK-ebA+M=q-djZDkG+C_8+ag4-wWg@mail.gmail.com>
	<5da6c99c-c530-952c-5921-77ca89d7cf12@case.edu>
From: Matthew Persico <matthew.persico@gmail.com>
Date: Fri, 11 Aug 2017 18:55:19 -0400
Message-ID: <CAL20dLDANnMoZoZumRihcKbWNMXvxUW_9Os=EAuKSV-oXz_rsg@mail.gmail.com>
Subject: Re: Patch for autoload.v3 to allow export of function
To: Chester Ramey <chet.ramey@case.edu>
Cc: "bug-bash@gnu.org" <bug-bash@gnu.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2a00:1450:4010:c07::22c
Content-Type: text/plain; charset="UTF-8"
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 11 Aug 2017 22:55:48 -0000

You'll notice from the dates on this chain that it has been a while that I
have been working on this. There are a number of reasons (like having to
work at my $job), but one of those reasons is a design one.

If you look at the code, there seven functions. Of those, only three are
used to implement autoloading. The other four are for bookkeeping purposes
only, to support the -p (dump) and -u (to remove a function from being
tracked in autoload) options.

The tracking is done with a bash array _AUTOLOADS. All insertions and
removals are processing a linear array - loop and search until you find the
item, copying the other items to a new array. It's all very inefficient,
but since we're dealing with shell, there's not much to do about speed
anyway. At one point, I converted _AUTOLOADS to a bash associative array,
but efficiency isn't the real problem here.

The real problem is that that arrays (associative or otherwise) cannot be
exported to subshells (such as starting up a new xterm), BUT the functions
can. So if you end up with -p and -u unsupportable in subshells, unless you
not only run the autoload commands in the bash profile for logins, but also
in the bashrc for subshells so that you can rebuild _AUTOLOADS, which takes
a lot of extra code, I might add, in the load phase, to make sure we don't
reload the second time around and make sure we get the array right.

Well, as you can see, I've been down the rathole and back and was about to
abandon the work until I came up with a way to avoid all this issues; an
easy way to tell if a function was an autoloaded function no matter how
many shells deep it's been exported. I can even tell whether it is still in
the shim stage or has been executed. But I fear no sane person will agree
with my solution:

Code injection.

It goes like this:

The current set of steps is

1 - Create the shim at autoload time.
2 - First time it's called, the shim finds the file with the function text
and sources it in.
3 - The shim then runs the function with whatever arguments were passed in.

What I propose to do between steps 2 and 3 is

2.1 - After sourcing the function in, type the function to get its text
2.2 - type appears to pretty print function code. No matter how sloppy or
compact your function is on disk, type presents it to you in a particular
format. To wit, for a function 'foo'

foo is a function
foo ()
{
    first line of code
    ....
}

That's regular. Therefore it can be parsed.

2.3 - With the output of the type command, I strip out line 1 and after
line 3, I add the text

local AUTOLOADED='foo'

2.4 - evaling the modified code updates the function to include that line

2.5 - Determining if a function is autoloaded is as simple as executing
(something like)

$ type foo | grep 'local AUTOLOADED='foo'.

which is REALLY REALLY fast, even under Cygwin on Windows 10. Yeah, that's
one of the environments I'm using for testing.

No more unexportable arrays and hashes. Self documenting. And 'AUTOLOADED'
can be changed to something less likely to clash with existing code. And we
document that any function you are going to autoload must avoid using the
variable AUTOLOADED, or whatever it is eventually.

So, before I post code here, what say you all? Is the idea of doing this
code injection so hideous that it would never be accepted, or is it worth
submitting the code for perusal?

Thank you for your time,

On Sun, Jul 2, 2017 at 12:50 PM, Chet Ramey <chet.ramey@case.edu> wrote:

> On 7/1/17 5:50 PM, Matthew Persico wrote:
> > Greetings!
> >
> > I have finally gotten around to working on autoload again to ensure that
> > there are no issues. But I have a question about the _AUTOLOADS array,
> > which is used to track what has been autoloaded and is the source of
> > information for the -p command.
> >
> > The code executes a linear scan of the array _AUTOLOADS each time it has
> to
> > find and element for removal or to make sure it is not about to add a
> > duplicate entry. This is hardly very efficient. Would it be OK to convert
> > that to an associative array (hash to us Perlers) indexed on function
> name?
> >
> > I ask before submitting the patch because I am worried about backward
> > compatibility; I do not know when hashes were added to bash nor do I know
> > what the policy is about how far back compatibility has to be maintained.
>
> Go ahead and submit the patch; if backwards compatibility is an issue, just
> name it `autoload.v4'.  Associative arrays have been in bash since
> bash-4.0, which was released in 2009, so including an updated version with
> future bash distributions should not limit its usefulness.
>
> Chet
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~
> chet/
>



-- 
Matthew O. Persico

From MAILER-DAEMON Mon Aug 14 09:06:57 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dhF57-00049N-KK
	for mharc-bug-bash@gnu.org; Mon, 14 Aug 2017 09:06:57 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:52362)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <angel@16bits.net>) id 1dhF55-000475-8l
	for bug-bash@gnu.org; Mon, 14 Aug 2017 09:06:56 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <angel@16bits.net>) id 1dhF52-0006J9-3o
	for bug-bash@gnu.org; Mon, 14 Aug 2017 09:06:55 -0400
Received: from mailer.hiddenmail.net ([199.195.249.9]:56914)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <angel@16bits.net>) id 1dhF51-0006Gx-W9
	for bug-bash@gnu.org; Mon, 14 Aug 2017 09:06:52 -0400
Received: from mailer by mailer.hiddenmail.net with local (Exim 4.80)
	(envelope-from <angel@16bits.net>) id 1dhF4z-0000R6-V7
	for bug-bash@gnu.org; Mon, 14 Aug 2017 15:06:50 +0200
Message-ID: <1502716006.1047.4.camel@16bits.net>
Subject: Re: Line wrapping issues
From: =?ISO-8859-1?Q?=C1ngel?= <angel@16bits.net>
To: bug-bash@gnu.org
Date: Mon, 14 Aug 2017 15:06:46 +0200
In-Reply-To: <BE36358B-02FF-4E0F-9B6A-8CB41B8A5091@leonklingele.de>
References: <929ABEA3-78BE-4264-8E3F-7692CF2C541C@leonklingele.de>
	<BE36358B-02FF-4E0F-9B6A-8CB41B8A5091@leonklingele.de>
Content-Type: text/plain; charset="ISO-8859-15"
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From: 199.195.249.9
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 14 Aug 2017 13:06:56 -0000

On 2017-08-10 Leon Klingele wrote:
> Is this problem caused by bash?
>=20
Most likely, something done by fzf is not "completely right" as in fzf
sets up things in a way that bash is then unable to determine the right
width of the line it was asked to print.

I guess the sourced file corresponds to this script?
https://github.com/junegunn/fzf/blob/master/shell/completion.bash

Regards



From MAILER-DAEMON Mon Aug 14 09:09:28 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dhF7Y-00068M-Ck
	for mharc-bug-bash@gnu.org; Mon, 14 Aug 2017 09:09:28 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:34170)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gy741.kim@gmail.com>) id 1dh9DF-00027L-Vt
	for bug-bash@gnu.org; Mon, 14 Aug 2017 02:50:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gy741.kim@gmail.com>) id 1dh9DE-0000RB-Nn
	for bug-bash@gnu.org; Mon, 14 Aug 2017 02:50:58 -0400
Received: from mail-oi0-x234.google.com ([2607:f8b0:4003:c06::234]:35945)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <gy741.kim@gmail.com>) id 1dh9DE-0000Mk-GH
	for bug-bash@gnu.org; Mon, 14 Aug 2017 02:50:56 -0400
Received: by mail-oi0-x234.google.com with SMTP id g131so76477006oic.3
	for <bug-bash@gnu.org>; Sun, 13 Aug 2017 23:50:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:from:date:message-id:subject:to;
	bh=PNl/x8jA3+4XB2zMB8Mu/+v6qrOxKx2OjsCdaDJL0Pw=;
	b=XnRBM1TcDCo3I5cAq0oRcxLm02221M4reA+u4praKrkHdII9lvDLuJUUvyMvjMtoYt
	THwU+v0sj/Ig+mL1PAqeHs51fp3GaYAfWY7AwehQO6Bg/zBR+dRvqc+qEdZGLQdK+3gF
	o7yOPzCmofi1gm/MM6N2fSpnsq5nr4nNUwFd6nfF6lpCLltMZcWnNUV05mr2GTqe4fIU
	zXQ07Xb5sBWqdLGYHkORl313Q7F3rZLFYLmKt2asEjtMUC673Uk9Ingj2ouiQ/n90Ax+
	FpF6i4ext0VqswKI8OX4SXDz7i2zwCYa3is55g++hSIqieNPqzTBkIW6XnQbH8EpHWiQ
	8msQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
	bh=PNl/x8jA3+4XB2zMB8Mu/+v6qrOxKx2OjsCdaDJL0Pw=;
	b=adeRfOXsprmjBoPMb7IzeeayJ1k3IRkuOmXwOm4mTS0o/uw4RUa3JkOOhasHXLtzl3
	u7eTyIEYqOK7Sr9NXanvvSJk6NYyUGpAlMPqu51qwi/VaqWyp6ss8TyeCSVcYNg0fxV0
	3WJB7QnkpQHDJSn0/9SxB+Wy6HPaFre86zswFwNRkoFOPMAXlYRdgW+WMtzWG5mT5U8w
	bDStetLHadVuHuSbYSWSxJv5zKTlfzajzCrZAAQyNjSVKuej8a591BnoGfR4z17WDNXM
	nwh4aHZbrMX8KibfJNZ/cIgCRf4bqLHRy9glVEId5TZ6MPjmWoZidcxEclj0uJZCFYXX
	eJ0g==
X-Gm-Message-State: AHYfb5igPFvwxoJHvNbGuJXvBck2wvR1XPJt+lsYisUkWm609uphCQAP
	z+MPgEXBYU4uwDyNDp90rJr4B8k0AW+7
X-Received: by 10.202.180.4 with SMTP id d4mr24798321oif.143.1502693453883;
	Sun, 13 Aug 2017 23:50:53 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.182.50.131 with HTTP; Sun, 13 Aug 2017 23:50:53 -0700 (PDT)
From: GwanYeong Kim <gy741.kim@gmail.com>
Date: Mon, 14 Aug 2017 15:50:53 +0900
Message-ID: <CAMrcspYPGJEzm9A0VNCdsKqZXqn7A=0_U6L0s=1jL_1owWS4UA@mail.gmail.com>
Subject: Null Pointer Dereference in wextglob_skipname
To: bug-bash@gnu.org
Content-Type: multipart/mixed; boundary="001a113d4232869b4c0556b115c4"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:4003:c06::234
X-Mailman-Approved-At: Mon, 14 Aug 2017 09:09:27 -0400
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 14 Aug 2017 06:50:59 -0000

--001a113d4232869b4c0556b115c4
Content-Type: text/plain; charset="UTF-8"

Hello,

I found a Null Pointer Dereference bug in bash.

Please confirm.

Thanks.

Version: bash 4.4.12(1)-maint(cb8c37dc664c2c0c12772111d3cc3a560d50cb04)
OS: Ubuntu 16.04.2 64bit
Steps to reproduce:
 1.Download the PoC files.
 2.Execute the following command
   : ./bash $PoC

```
ASAN:SIGSEGV
=================================================================
==13050==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000
(pc 0x000000576d66 bp 0x7ffeb47e0210 sp 0x7ffeb47e01c0 T0)
    #0 0x576d65 in wextglob_skipname /root/karas/bash/lib/glob/glob.c:345
    #1 0x576f54 in mbskipname /root/karas/bash/lib/glob/glob.c:380
    #2 0x576282 in extglob_skipname /root/karas/bash/lib/glob/glob.c:226
    #3 0x5763b8 in skipname /root/karas/bash/lib/glob/glob.c:257
    #4 0x576f9b in mbskipname /root/karas/bash/lib/glob/glob.c:382
    #5 0x578329 in glob_vector /root/karas/bash/lib/glob/glob.c:760
    #6 0x57b255 in glob_filename /root/karas/bash/lib/glob/glob.c:1363
    #7 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #8 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #9 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #10 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #11 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #12 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #13 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #14 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #15 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #16 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #17 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #18 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #19 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #20 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #21 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #22 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #23 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #24 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #25 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #26 0x57a34d in glob_filename /root/karas/bash/lib/glob/glob.c:1162
    #27 0x4eb908 in shell_glob_filename /root/karas/bash/pathexp.c:427
    #28 0x4d979b in glob_expand_word_list /root/karas/bash/subst.c:10673
    #29 0x4dc001 in expand_word_list_internal /root/karas/bash/subst.c:11109
    #30 0x4d9602 in expand_words /root/karas/bash/subst.c:10622
    #31 0x468565 in execute_simple_command
/root/karas/bash/execute_cmd.c:4220
    #32 0x457492 in execute_command_internal
/root/karas/bash/execute_cmd.c:811
    #33 0x455c31 in execute_command /root/karas/bash/execute_cmd.c:393
    #34 0x4262a6 in reader_loop /root/karas/bash/eval.c:172
    #35 0x421818 in main /root/karas/bash/shell.c:794
    #36 0x7f362f9f982f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #37 0x4204b8 in _start (/root/karas/bash/bash+0x4204b8)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /root/karas/bash/lib/glob/glob.c:345
wextglob_skipname
==13050==ABORTING
```

--001a113d4232869b4c0556b115c4
Content-Type: application/octet-stream; name=0000_null_PoC
Content-Disposition: attachment; filename=0000_null_PoC
Content-Transfer-Encoding: base64
X-Attachment-Id: f_j6bsvhnj0

QXske18vKi8vLy8bVB8vOBkKLy8vLy9AKD8ovA8v//9/L0wveyQBXy8vLy8vLzdUHy8vvA8vLy8v
L0Ao//9/L0wvLy8VF7sJfS8vLxewCX0=
--001a113d4232869b4c0556b115c4--


From MAILER-DAEMON Mon Aug 14 10:17:39 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dhGBX-0008Mc-0Y
	for mharc-bug-bash@gnu.org; Mon, 14 Aug 2017 10:17:39 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:44633)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1dhGBU-0008LK-6n
	for bug-bash@gnu.org; Mon, 14 Aug 2017 10:17:37 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1dhGBT-0005RD-4d
	for bug-bash@gnu.org; Mon, 14 Aug 2017 10:17:36 -0400
Received: from mail-oi0-x22b.google.com ([2607:f8b0:4003:c06::22b]:34866)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <pyroinajar@gmail.com>)
	id 1dhGBS-0005Pe-VA
	for bug-bash@gnu.org; Mon, 14 Aug 2017 10:17:35 -0400
Received: by mail-oi0-x22b.google.com with SMTP id e124so85266409oig.2
	for <bug-bash@gnu.org>; Mon, 14 Aug 2017 07:17:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:sender:in-reply-to:references:from:date:message-id
	:subject:to:cc;
	bh=saP4b/GsgU07hu9QwYGZN8P6J5eHm8F1NdQwhsrf2F4=;
	b=hBR/b2Qvmvdlafr/2uUbLfFDgy/f0HJxoOx/hJUgk27CDeOeSz4WjssXGRcC0taUO7
	BcFwPclkPXZCL9O8qVnLjvhCmJ612GjSmG/X6zikKrfHCZqaPWppTPoEwH/dNfoZr/r6
	LJil8o3wNnhvpyHgmiLPda8+Mz9oRREiC03gAofKunGUhSujwj2MmcCZJLDALUOBOS7i
	/TFwNTqW3crbETX2sWeiKlBdpxy1m9bSPrRrDsaNvJljMqQsXlMiFk3zcpZoRzm6avuM
	8IG9GUVeIpzWThxD3h0weQ+hUnwPAL+VdOm4Pgrv73M2xdrzc/g/ymLRV7lW4lwTkKua
	MC8g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
	:date:message-id:subject:to:cc;
	bh=saP4b/GsgU07hu9QwYGZN8P6J5eHm8F1NdQwhsrf2F4=;
	b=azPd8Kt0IMPWBGpzULJD6NLBANab8xEizkb5l8SR/G5TeiT+SVa9t3MEWxoUUBsRWr
	sBaHNyFfb43xaKSXkkOZqCf20URp6NfOVW6fh0qre+Rc7eyQzlog1skizXEOGlXmiD3J
	lskwgWeyl9AIYjqWczdTma9H4y5s9ZE/h+15HLQ+g/u4Duv57KpJb0fNRIxgDIKlA5Kg
	CeBWdLTjwfKbgCnS2YEHIIH+2NiqXcF0C1F0JD/TC52joYt35PNsmSf0yb4rneBpWxLu
	3u1C8Lg+dd5YBZ8e/GeU61IVDkPFFvnVkTDyCO7sWXx1obnV/UxBEou/manCWANIRhfe
	vDLg==
X-Gm-Message-State: AHYfb5hXG3b1IbaOXAcsoM98rgNbqW1lP3tZBMdbL2NWzXpOvUmg2kxq
	m380d6XDEwvqCPAaLP44u23kC05vSQ==
X-Received: by 10.202.75.9 with SMTP id y9mr28579162oia.152.1502720252483;
	Mon, 14 Aug 2017 07:17:32 -0700 (PDT)
MIME-Version: 1.0
Sender: pyroinajar@gmail.com
Received: by 10.74.127.73 with HTTP; Mon, 14 Aug 2017 07:17:31 -0700 (PDT)
In-Reply-To: <1502716006.1047.4.camel@16bits.net>
References: <929ABEA3-78BE-4264-8E3F-7692CF2C541C@leonklingele.de>
	<BE36358B-02FF-4E0F-9B6A-8CB41B8A5091@leonklingele.de>
	<1502716006.1047.4.camel@16bits.net>
From: DJ Mills <danielmills1@gmail.com>
Date: Mon, 14 Aug 2017 10:17:31 -0400
X-Google-Sender-Auth: d7lBv8H-koSGm7__sJ1j5TJ14dY
Message-ID: <CAPg6Z09xNapiAE+_RDp5zzk7=qkK6FGa2FiFWTeRZiKx-BET_Q@mail.gmail.com>
Subject: Re: Line wrapping issues
To: =?UTF-8?B?w4FuZ2Vs?= <angel@16bits.net>
Cc: bug-bash <bug-bash@gnu.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:4003:c06::22b
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 14 Aug 2017 14:17:37 -0000

Holy crap there is some nasty stuff in that script.

You can try shopt -s checkwinsize to see if that helps

On Mon, Aug 14, 2017 at 9:06 AM, =C3=81ngel <angel@16bits.net> wrote:

> On 2017-08-10 Leon Klingele wrote:
> > Is this problem caused by bash?
> >
> Most likely, something done by fzf is not "completely right" as in fzf
> sets up things in a way that bash is then unable to determine the right
> width of the line it was asked to print.
>
> I guess the sourced file corresponds to this script?
> https://github.com/junegunn/fzf/blob/master/shell/completion.bash
>
> Regards
>
>
>

From MAILER-DAEMON Mon Aug 14 10:30:59 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dhGOR-0000Kb-6F
	for mharc-bug-bash@gnu.org; Mon, 14 Aug 2017 10:30:59 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:48115)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dhGOO-0000HX-Ij
	for bug-bash@gnu.org; Mon, 14 Aug 2017 10:30:57 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dhGOK-0007c1-96
	for bug-bash@gnu.org; Mon, 14 Aug 2017 10:30:56 -0400
Received: from mpv2-2015.cwru.edu ([129.22.103.227]:58772
	helo=mpv1-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1dhGOK-0007YW-2Z
	for bug-bash@gnu.org; Mon, 14 Aug 2017 10:30:52 -0400
Received: from mpv6-2015.CWRU.Edu (EHLO mpv6-2015.case.edu) ([129.22.103.202])
	by mpv2-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AOK47029; Mon, 14 Aug 2017 10:30:50 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id BIC78981 (AUTH cpr);
	Mon, 14 Aug 2017 10:30:49 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu, "bug-bash@gnu.org" <bug-bash@gnu.org>
Subject: Re: Patch for autoload.v3 to allow export of function
To: Matthew Persico <matthew.persico@gmail.com>
References: <CAL20dLBsQEAPCidjL+vv2=nDJaKP2X5zgrKpi0qe-a86+hC6+g@mail.gmail.com>
	<CAOSMAuvzKTU8JK9vS5TmXf4ArbK_BNSy4JRdFRbwG3-seZD7_g@mail.gmail.com>
	<CAL20dLAC+1XyRfNTHb5EKdK-ebA+M=q-djZDkG+C_8+ag4-wWg@mail.gmail.com>
	<5da6c99c-c530-952c-5921-77ca89d7cf12@case.edu>
	<CAL20dLDANnMoZoZumRihcKbWNMXvxUW_9Os=EAuKSV-oXz_rsg@mail.gmail.com>
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <68576480-e27d-292f-1c45-1b2470663e87@case.edu>
Date: Mon, 14 Aug 2017 10:30:49 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <CAL20dLDANnMoZoZumRihcKbWNMXvxUW_9Os=EAuKSV-oXz_rsg@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Junkmail-Status: score=8/60, host=mpv2-2015.case.edu
X-Junkmail-PrAS-Raw: score=8/60, refid=2.7.2:2017.8.14.141216:17:8.317, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR, __MULTIPLE_RCPTS_CC_X2,
	__CC_NAME, __BOUNCE_CHALLENGE_SUBJ,
	__BOUNCE_NDR_SUBJ_EXEMPT, __SUBJ_ALPHA_END,
	__TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC,
	__REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID,
	__SANE_MSGID, DATE_TZ_NA, __USER_AGENT,
	__MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT,
	__CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY,
	__REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC2,
	__REPLYTO_SAMEAS_FROM_DOMAIN, __ANY_URI, __URI_WITH_PATH,
	__URI_NO_WWW, __CP_URI_IN_BODY,
	__FRAUD_MONEY_CURRENCY_DOLLAR, __SUBJ_ALPHA_NEGATE,
	__URI_IN_BODY, __URI_NOT_IMG, __FORWARDED_MSG,
	__NO_HTML_TAG_RAW, BODYTEXTP_SIZE_3000_LESS,
	BODY_SIZE_1800_1899, __MIME_TEXT_P1, __MIME_TEXT_ONLY,
	__URI_NS, HTML_00_01, HTML_00_10, __FRAUD_MONEY_CURRENCY,
	BODY_SIZE_5000_LESS, IN_REP_TO, MSG_THREAD,
	__FROM_DOMAIN_IN_RCPT, [TRUNCATED],
	so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.227
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 14 Aug 2017 14:30:57 -0000

On 8/11/17 6:55 PM, Matthew Persico wrote:

> What I propose to do between steps 2 and 3 is
> 
> 2.1 - After sourcing the function in, type the function to get its text
> 2.2 - type appears to pretty print function code. No matter how sloppy or
> compact your function is on disk, type presents it to you in a particular
> format. To wit, for a function 'foo'
> 
> foo is a function
> foo ()
> {
>     first line of code
>     ....
> }
> 
> That's regular. Therefore it can be parsed.
> 
> 2.3 - With the output of the type command, I strip out line 1 and after
> line 3, I add the text
> 
> local AUTOLOADED='foo'
> 
> 2.4 - evaling the modified code updates the function to include that line
> 
> 2.5 - Determining if a function is autoloaded is as simple as executing
> (something like)
> 
> $ type foo | grep 'local AUTOLOADED='foo'.
> 
> which is REALLY REALLY fast, even under Cygwin on Windows 10. Yeah, that's
> one of the environments I'm using for testing.
> 
> No more unexportable arrays and hashes. Self documenting. And 'AUTOLOADED'
> can be changed to something less likely to clash with existing code. And we
> document that any function you are going to autoload must avoid using the
> variable AUTOLOADED, or whatever it is eventually.
> 
> So, before I post code here, what say you all? Is the idea of doing this
> code injection so hideous that it would never be accepted, or is it worth
> submitting the code for perusal?

Of course it's worth submitting the code for folks to look at. It might be
possible to add a couple more checks to insulate it against possible future
changes to the `type' output.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Mon Aug 14 11:13:59 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dhH43-0005Li-46
	for mharc-bug-bash@gnu.org; Mon, 14 Aug 2017 11:13:59 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:60008)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dhH40-0005Kx-S9
	for bug-bash@gnu.org; Mon, 14 Aug 2017 11:13:57 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dhH3w-0001vY-D3
	for bug-bash@gnu.org; Mon, 14 Aug 2017 11:13:56 -0400
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:47152
	helo=mpv3-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1dhH3w-0001uT-7X
	for bug-bash@gnu.org; Mon, 14 Aug 2017 11:13:52 -0400
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id ANF53383; Mon, 14 Aug 2017 11:13:50 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id BIJ67651 (AUTH cpr);
	Mon, 14 Aug 2017 11:13:45 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: Null Pointer Dereference in wextglob_skipname
To: GwanYeong Kim <gy741.kim@gmail.com>, bug-bash@gnu.org
References: <CAMrcspYPGJEzm9A0VNCdsKqZXqn7A=0_U6L0s=1jL_1owWS4UA@mail.gmail.com>
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <821d6ddf-4d41-9eec-5300-ed38a6b08358@case.edu>
Date: Mon, 14 Aug 2017 11:13:45 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <CAMrcspYPGJEzm9A0VNCdsKqZXqn7A=0_U6L0s=1jL_1owWS4UA@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Junkmail-Status: score=7/60, host=mpv3-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.14.145116:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC,
	__REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID,
	__SANE_MSGID, DATE_TZ_NA, __USER_AGENT,
	__MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT,
	__CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY,
	__REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1,
	__FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN,
	__ANY_URI, __URI_WITH_PATH, __URI_NO_WWW,
	__CP_URI_IN_BODY, __SUBJ_ALPHA_NEGATE, __URI_IN_BODY,
	__URI_NOT_IMG, __FORWARDED_MSG, __NO_HTML_TAG_RAW,
	BODYTEXTP_SIZE_400_LESS, BODYTEXTP_SIZE_3000_LESS,
	BODY_SIZE_300_399, __MIME_TEXT_P1, __MIME_TEXT_ONLY,
	__URI_NS, HTML_00_01, HTML_00_10, BODY_SIZE_5000_LESS,
	IN_REP_TO, MSG_THREAD, __FROM_DOMAIN_IN_RCPT,
	__TO_REAL_NAMES, MULTIPLE_REAL_RCPTS, LEGITIMATE_SIGNS,
	[TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 14 Aug 2017 15:13:57 -0000

On 8/14/17 2:50 AM, GwanYeong Kim wrote:
> Hello,
> 
> I found a Null Pointer Dereference bug in bash.
> 
> Please confirm.

I can't reproduce it with the current development version.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Wed Aug 16 01:57:00 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dhrK8-0008U3-Fa
	for mharc-bug-bash@gnu.org; Wed, 16 Aug 2017 01:57:00 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:58029)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <matthew.persico@gmail.com>) id 1dhrK4-0008Rr-Uj
	for bug-bash@gnu.org; Wed, 16 Aug 2017 01:56:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <matthew.persico@gmail.com>) id 1dhrK3-000370-LF
	for bug-bash@gnu.org; Wed, 16 Aug 2017 01:56:57 -0400
Received: from mail-lf0-x22a.google.com ([2a00:1450:4010:c07::22a]:33897)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <matthew.persico@gmail.com>)
	id 1dhrK3-00034a-0p
	for bug-bash@gnu.org; Wed, 16 Aug 2017 01:56:55 -0400
Received: by mail-lf0-x22a.google.com with SMTP id g25so12001212lfh.1
	for <bug-bash@gnu.org>; Tue, 15 Aug 2017 22:56:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc; bh=KAxru3t40sOWJslCzisu+gxp+efYGaVtukSNaV8DZM8=;
	b=jIBL438x+dIXX6g8z4D995gWNJCbCAMUmD5do8UtYfoFlz7MQvDHuq+0CUAArFr/cH
	U9SFxtquSolC9QjafF+aLuwtGwe1ESSwiw5XcggKCKmZPphK8uzrcDeQs++VD2NEfEKd
	54SpvpUE3x/8AYMHESHxiVZMNFJs7YrPMGwUxAz4O9KliFyZ+I2C4vabRP9Q11oKTViM
	zIRbpeF7SV69rPJXQC7ZJM2nbDVsIWm3a+bi3paKlijsHK9uRZs4TV0VCjLtC3B8rm8d
	3lG+crGD4YPwIJQJ/FiDgatvVhuyiLNmVaR7OUPQfuokccSKdYZAzTMocsWYRsBbaH9v
	bBuw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to:cc;
	bh=KAxru3t40sOWJslCzisu+gxp+efYGaVtukSNaV8DZM8=;
	b=rWHqFDZgQueaDFSSFztCH9PpO2YLrl0yq6WCXN0yrfmSPP6nocYRhMiOrBl15OrDJz
	IRAfpI8nI26SiwTskTbHISMlRRpZJhLfQ3MCYwE3mUhNwSBtVxv3pSQkw0ve/cDxhTUh
	zfeOGMdsw1z9N0WtfKMjZ7Tb9cCJIuyEqHnzqCTUzCasWoCANg5zp/F3A7zXu/y4rjDc
	Rl3xKQrbTyKT9nlwoQ1oc8q/H6jPDJMF/jmjeLB3omdtNic3NVzSOhPSx1OYTV+6CyLq
	ErciiuChazPqCSkequ/sAY7Ti4lDpMWw9yEL22pjp5fxd1ju1m1Iw7I86PZEyVPHRYbc
	NFyw==
X-Gm-Message-State: AHYfb5iIhVxKvfCHFporFVAg6xC1biTxcH+ltBsVMct/LfD5SajVfnKD
	b9CeXzJ53dZQVQULes7CzbxA6yWfhA==
X-Received: by 10.25.99.90 with SMTP id x87mr215086lfb.116.1502863012110; Tue,
	15 Aug 2017 22:56:52 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.25.99.139 with HTTP; Tue, 15 Aug 2017 22:56:31 -0700 (PDT)
In-Reply-To: <68576480-e27d-292f-1c45-1b2470663e87@case.edu>
References: <CAL20dLBsQEAPCidjL+vv2=nDJaKP2X5zgrKpi0qe-a86+hC6+g@mail.gmail.com>
	<CAOSMAuvzKTU8JK9vS5TmXf4ArbK_BNSy4JRdFRbwG3-seZD7_g@mail.gmail.com>
	<CAL20dLAC+1XyRfNTHb5EKdK-ebA+M=q-djZDkG+C_8+ag4-wWg@mail.gmail.com>
	<5da6c99c-c530-952c-5921-77ca89d7cf12@case.edu>
	<CAL20dLDANnMoZoZumRihcKbWNMXvxUW_9Os=EAuKSV-oXz_rsg@mail.gmail.com>
	<68576480-e27d-292f-1c45-1b2470663e87@case.edu>
From: Matthew Persico <matthew.persico@gmail.com>
Date: Wed, 16 Aug 2017 01:56:31 -0400
Message-ID: <CAL20dLAU7q0gOOtkDbRokrjkcf8XTFOZ-wcJZDsA1cadesjF3A@mail.gmail.com>
Subject: Re: Patch for autoload.v3 to allow export of function
To: Chester Ramey <chet.ramey@case.edu>
Cc: "bug-bash@gnu.org" <bug-bash@gnu.org>
Content-Type: multipart/mixed; boundary="94eb2c0d9296fbb9200556d88f2a"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2a00:1450:4010:c07::22a
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 16 Aug 2017 05:56:59 -0000

--94eb2c0d9296fbb9200556d88f2a
Content-Type: text/plain; charset="UTF-8"

Please see the attached 'autoload.v4' and 'autoload.v4.t'.

On Mon, Aug 14, 2017 at 10:30 AM, Chet Ramey <chet.ramey@case.edu> wrote:

> On 8/11/17 6:55 PM, Matthew Persico wrote:
>
> > What I propose to do between steps 2 and 3 is
> >
> > 2.1 - After sourcing the function in, type the function to get its text
> > 2.2 - type appears to pretty print function code. No matter how sloppy or
> > compact your function is on disk, type presents it to you in a particular
> > format. To wit, for a function 'foo'
> >
> > foo is a function
> > foo ()
> > {
> >     first line of code
> >     ....
> > }
> >
> > That's regular. Therefore it can be parsed.
> >
> > 2.3 - With the output of the type command, I strip out line 1 and after
> > line 3, I add the text
> >
> > local AUTOLOADED='foo'
> >
> > 2.4 - evaling the modified code updates the function to include that line
> >
> > 2.5 - Determining if a function is autoloaded is as simple as executing
> > (something like)
> >
> > $ type foo | grep 'local AUTOLOADED='foo'.
> >
> > which is REALLY REALLY fast, even under Cygwin on Windows 10. Yeah,
> that's
> > one of the environments I'm using for testing.
> >
> > No more unexportable arrays and hashes. Self documenting. And
> 'AUTOLOADED'
> > can be changed to something less likely to clash with existing code. And
> we
> > document that any function you are going to autoload must avoid using the
> > variable AUTOLOADED, or whatever it is eventually.
> >
> > So, before I post code here, what say you all? Is the idea of doing this
> > code injection so hideous that it would never be accepted, or is it worth
> > submitting the code for perusal?
>
> Of course it's worth submitting the code for folks to look at. It might be
> possible to add a couple more checks to insulate it against possible future
> changes to the `type' output.
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~
> chet/
>



-- 
Matthew O. Persico

--94eb2c0d9296fbb9200556d88f2a
Content-Type: application/octet-stream; name="autoload.v4"
Content-Disposition: attachment; filename="autoload.v4"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_j6elsv450

IyMgLSotIHNoIC0qLQoKIyBUaGUgcHN1ZWRvLWtzaCBhdXRvbG9hZGVyLgoKIyBIb3cgdG8gdXNl
OgojIG8gT25lIGZ1bmN0aW9uIHBlciBmaWxlLgojIG8gRmlsZSBhbmQgZnVuY3Rpb24gbmFtZSBt
YXRjaCBleGFjdGx5LgojIG8gRmlsZSBpcyBsb2NhdGVkIGluIGEgZGlyZWN0b3J5IHRoYXQgaXMg
aW4gRlBBVEguCiMgbyBUaGlzIHNjcmlwdCAoYXV0b2xvYWQpIG11c3QgYmUgc291cmNlZCBpbiBh
cyBlYXJseSBhcyBwb3NzaWJsZS4gVGhpcwojICAgaW1wbGllcyB0aGF0IGFueSBjb2RlIGluIHRo
aXMgc2NyaXB0IHNob3VsZCBOT1QgcmVseSBvbiBhbnkgbGlicmFyeSBvZiBsb2NhbAojICAgb3Ig
c2VsZi1kZWZpbmVkIGZ1bmN0aW9ucyBoYXZpbmcgYWxyZWFkeSBiZWVuIGxvYWRlZC4KIyBvIGF1
dG9sb2FkIG11c3QgYmUgY2FsbGVkIGZvciBlYWNoIGZ1bmN0aW9uIGJlZm9yZSB0aGUgZnVuY3Rp
b24gY2FuIGJlIHVzZWQuIElmCiMgICBhdXRvbG9hZHMgYXJlIGluIGRpcmVjdG9yaWVzIHdoZXJl
IHRoZXJlIGFyZSBub3RoaW5nIGJ1dCBhdXRvbG9hZHMsIHRoZW4KIyAgICdhdXRvbG9hZCAvcGF0
aC90by9maWxlcy8qJyBzdWZmaWNlcyAoYnV0IHNlZSBvcHRpb25zIC1hIGFuZCAtZikuCiMgbyBU
aGUgY2FsbCBtdXN0IGJlIG1hZGUgaW4gdGhlIGN1cnJlbnQgZW52aXJvbm1lbnQsIG5vdCBhIHN1
YnNoZWxsLgojIG8gVGhlIGNvbW1hbmQgbGluZSBzdWZmaWNlcyBhcyAiY3VycmVudCBlbnZpcm9u
bWVudCIuIElmIHlvdSBoYXZlIGF1dG9sb2FkCiMgICBjYWxscyBpbiBhIHNjcmlwdCwgdGhhdCBz
Y3JpcHQgbXVzdCBiZSBkb3R0ZWQgaW50byB0aGUgcHJvY2Vzcy4KCiMgVGhlIGZpcnN0IGN1dCBv
ZiB0aGlzIHdhcyBieSBCaWxsIFRyb3N0LCB0cm9zdEByZWVkLmJpdG5ldC4KIyBUaGUgc2Vjb25k
IGN1dCBjYW1lIGZyb20gQ2hldCBSYW1leSwgY2hldEBpbnMuQ1dSVS5FZHUKIyBUaGUgdGhpcmQg
Y3V0IGNhbWUgZnJvbSBNYXJrIEtlbm5lZHksIG10a0BueS51YnMuY29tLiAgMTk5OC8wOC8yNQoj
IFRoZSBmb3VydGggY3V0IGNhbWUgZnJvbSBNYXR0aGV3IFBlcnNpY28sIG1hdHRoZXcucGVyc2lj
b0BnbWFpbC5jb20gMjAxNy9BdWd1c3QKCmF1dG9sb2FkX2NhbGNfc2hpbXNpemUgKCkKewogICAg
ZWNobyAkKChBVVRPTE9BRF9TSElNX09WRVJIRUFEICsgMyAqICR7IzF9KSkKfQoKX2F1dG9sb2Fk
X3NwbGl0X2ZwYXRoICgpCnsKICAgIChJRlM9JzonOyBzZXQgLS0gJHtGUEFUSH07IGVjaG8gIiRA
IikKfQoKX2Fsb2FkKCkKewogICAgbG9jYWwgb3B0IE9QVElORAogICAgbG9jYWwgZG9leHBvcnQ9
MAogICAgbG9jYWwgZG9yZWxvYWQ9MAogICAgbG9jYWwgZG92ZXJib3NlPTAKICAgIGxvY2FsIGRv
ZXZhbHNoaW09MAogICAgbG9jYWwgbG9hZHRoZXNlCiAgICBsb2NhbCBvcHRpbWl6ZT0wCiAgICBs
b2NhbCBsb2FkZWQ9MAogICAgbG9jYWwgZXhwb3J0ZWQ9MAogICAgbG9jYWwgb3B0aW1pemVkPTAK
ICAgIGxvY2FsIHN1bW1hcnk9MAogICAgbG9jYWwgZG9mcGF0aD0wCiAgICB3aGlsZSBnZXRvcHRz
IHhydmxhOm95ZiBvcHQ7IGRvCiAgICAgICAgY2FzZSAkb3B0IGluCiAgICAgICAgICAgIHgpIGRv
ZXhwb3J0PTE7OwogICAgICAgICAgICByKSBkb3JlbG9hZD0xOzsKICAgICAgICAgICAgdikgZG92
ZXJib3NlPTE7OwogICAgICAgICAgICBsKSBkb2V2YWxzaGltPTE7OwogICAgICAgICAgICBhKSBs
b2FkdGhlc2U9JChmaW5kICRPUFRBUkcgLW1heGRlcHRoIDEgLXR5cGUgZiAtcHJpbnRmICclZiAn
KTs7CiAgICAgICAgICAgIG8pIG9wdGltaXplPTE7OwogICAgICAgICAgICB5KSBzdW1tYXJ5PTE7
OwogICAgICAgICAgICBmKSBsb2FkdGhlc2U9JChmaW5kICQoX2F1dG9sb2FkX3NwbGl0X2ZwYXRo
KSAtbWF4ZGVwdGggMSAtdHlwZSBmIC1wcmludGYgJyVmICcpOzsKICAgICAgICAgICAgKikgZWNo
byAiX2Fsb2FkOiB1c2FnZTogX2Fsb2FkIFsteHJ2bHlmXSBbLWEgZGlyXSBbZnVuY3Rpb24gLi4u
XSIgPiYyOyByZXR1cm47OwogICAgICAgIGVzYWMKICAgIGRvbmUKCiAgICBzaGlmdCAkKCgkT1BU
SU5ELTEpKQoKICAgIFsgLXogIiRsb2FkdGhlc2UiIF0gJiYgbG9hZHRoZXNlPSIkQCIKCiAgICBs
b2NhbCBmdW5jCiAgICBmb3IgZnVuYyBpbiAkbG9hZHRoZXNlOyBkbwogICAgICAgIGxvY2FsIGV4
aXN0c19mbgogICAgICAgIGV4aXN0c19mbj0kKGRlY2xhcmUgLUYgJGZ1bmMpCiAgICAgICAgaWYg
WyAtbiAiJGV4aXN0c19mbiIgXSAmJiAoKGRvcmVsb2FkPT0wKSkgJiYgKChkb2V2YWxzaGltPT0w
KSkKICAgICAgICB0aGVuCiAgICAgICAgICAgIGlmICgoZG92ZXJib3NlKSkKICAgICAgICAgICAg
dGhlbgogICAgICAgICAgICAgICAgZWNobyAiYXV0b2xvYWQ6IGZ1bmN0aW9uICckZnVuYycgYWxy
ZWFkeSBleGlzdHMiCiAgICAgICAgICAgIGZpCiAgICAgICAgZWxzZQogICAgICAgICAgICBsb2Nh
bCBhbmRldmFsZWQ9JycKICAgICAgICAgICAgbG9jYWwgYW5kZXhwb3J0ZWQ9JycKICAgICAgICAg
ICAgbG9jYWwgZXZhbHN0YXQ9MAogICAgICAgICAgICBsb2NhbCBkb3NoaW09MQogICAgICAgICAg
ICBsb2NhbCBmdW5jZmlsZQogICAgICAgICAgICBmdW5jZmlsZT0kKF9hdXRvbG9hZF9yZXNvbHZl
ICRmdW5jKQogICAgICAgICAgICBpZiBbWyAkZnVuY2ZpbGUgXV0gOyB0aGVuCiAgICAgICAgICAg
ICAgICAjIyBUaGUgZmlsZSB3YXMgZm91bmQgZm9yICRmdW5jLiBQcm9jZXNzIGl0LgoKICAgICAg
ICAgICAgICAgIGlmICgob3B0aW1pemUpKTsgdGhlbgogICAgICAgICAgICAgICAgICAgICMjIEZv
ciB0aGUgZmlyc3QgZnVuY3Rpb24gbG9hZGVkLCB3ZSB3aWxsIG5vdCBrbm93CiAgICAgICAgICAg
ICAgICAgICAgIyMgQVVUT0xPQURfU0hJTV9PVkVSSEVBRC4gV2UgY2FuIG9ubHkgY2FsY3VsYXRl
IGl0IGFmdGVyCiAgICAgICAgICAgICAgICAgICAgIyMgd2UgaGF2ZSBsb2FkZWQgb25lIGZ1bmN0
aW9uLgogICAgICAgICAgICAgICAgICAgIGlmIFtbICRBVVRPTE9BRF9TSElNX09WRVJIRUFEIF1d
OyB0aGVuCiAgICAgICAgICAgICAgICAgICAgICAgIGxvY2FsIHNpemU9JCh3YyAtYyAkZnVuY2Zp
bGV8IHNlZCAncy8gLiovLycpCiAgICAgICAgICAgICAgICAgICAgICAgIGxvY2FsIHNoaW1zaXpl
PSQoYXV0b2xvYWRfY2FsY19zaGltc2l6ZSAkZnVuYykKICAgICAgICAgICAgICAgICAgICAgICAg
aWYgKCggc2l6ZSA8PSBzaGltc2l6ZSkpOyB0aGVuCiAgICAgICAgICAgICAgICAgICAgICAgICAg
ICBkb3NoaW09MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYW5kZXZhbGVkPScsIG9wdGlt
aXplZCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICgob3B0aW1pemVkKz0xKSkKICAgICAg
ICAgICAgICAgICAgICAgICAgZmkKICAgICAgICAgICAgICAgICAgICBmaQogICAgICAgICAgICAg
ICAgZmkKCiAgICAgICAgICAgICAgICBpZiAoKGRvZXZhbHNoaW0pKTsgdGhlbgogICAgICAgICAg
ICAgICAgICAgIGRvc2hpbT0wCiAgICAgICAgICAgICAgICAgICAgYW5kZXZhbGVkPScsIGV2YWxl
ZCcKICAgICAgICAgICAgICAgIGZpCgogICAgICAgICAgICAgICAgIyMgJ2JyYW5kJyBhcyBpbiBi
cmFuZGluZyBhIGNvdyB3aXRoIGEgbWFyay4gV2UgYWRkIGEgbG9jYWwKICAgICAgICAgICAgICAg
ICMjIHZhcmlhYmxlIHRvIGVhY2ggZnVuY3Rpb24gd2UgYXV0b2xvYWQgc28gdGhhdCB3ZSBjYW4g
dGVsbAogICAgICAgICAgICAgICAgIyMgbGF0ZXIgb24gaXQgaXMgYW4gYXV0b2xvYWRlZCBmdW5j
dGlvbiB3aXRob3V0IGhhdmluZyB0bwogICAgICAgICAgICAgICAgIyMgbWFpbnRhaW4gc29tZSBi
YXNoIGFycmF5IG9yIGhhc2ggdGhhdCBjYW5ub3QgYmUgcGFzc2VkIHRvCiAgICAgICAgICAgICAg
ICAjIyBhbmQgdXNlZCBieSBzdWJzaGVsbHMuCiAgICAgICAgICAgICAgICBsb2NhbCBicmFuZHRl
eHQKICAgICAgICAgICAgICAgIGJyYW5kdGV4dD0iZXZhbCBcIlwkKHR5cGUgJGZ1bmMgfCBzZWQg
LWUgMWQgLWUgNGlsb2NhbFxcIEFVVE9MT0FERUQ9XCckZnVuY1wnKVwiIgogICAgICAgICAgICAg
ICAgaWYgKChkb3NoaW0pKTsgdGhlbgogICAgICAgICAgICAgICAgICAgICMjIERvbid0IGJvdGhl
ciB0cnlpbmcgdG8gc2F2ZSBzcGFjZSBieSBzaG92aW5nIGFsbCB0aGUKICAgICAgICAgICAgICAg
ICAgICAjIyBldmFsIHRleHQgYmVsb3cgb250byBvbmUgdW5yZWFkYWJsZSBsaW5lOyBuZXcgbGlu
ZXMgd2lsbAogICAgICAgICAgICAgICAgICAgICMjIGJlIGFkZGVkIGF0IHlvdXIgc2VtaWNvbG9u
cyBhbmQgYW55IGluZGVudGF0aW9uIGJlbG93CiAgICAgICAgICAgICAgICAgICAgIyMgc2VlbXMg
dG8gYmUgaWdub3JlZCBhbnl3YXkgaWYgeW91IGV4cG9ydCB0aGUgZnVuY3Rpb247CiAgICAgICAg
ICAgICAgICAgICAgIyMgbG9vayBhdCBpdHMgQkFTSF9GVU5DVElPTiByZXByZXNlbnRhdGlvbi4K
ICAgICAgICAgICAgICAgICAgICBldmFsICRmdW5jICcoKQogICAgICAgICAgICAgICAgICAgIHsK
ICAgICAgICAgICAgICAgICAgICBsb2NhbCBJU19TSElNPSIkZnVuYyIKICAgICAgICAgICAgICAg
ICAgICBsb2NhbCBmaWxlPSQoX2F1dG9sb2FkX3Jlc29sdmUgJyRmdW5jJykKICAgICAgICAgICAg
ICAgICAgICBpZiBbWyAkZmlsZSBdXQogICAgICAgICAgICAgICAgICAgIHRoZW4KICAgICAgICAg
ICAgICAgICAgICAgICAgLiAkZmlsZQogICAgICAgICAgICAgICAgICAgICAgICAnJGJyYW5kdGV4
dCcKICAgICAgICAgICAgICAgICAgICAgICAgJyRmdW5jJyAiJEAiCiAgICAgICAgICAgICAgICAg
ICAgICAgIHJldHVybiAkPwogICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAg
ICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgICAgICAgICAgICAgZmkKICAgICAgICAgICAgICAg
ICAgICB9JwogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgIC4gJGZ1bmNm
aWxlCiAgICAgICAgICAgICAgICAgICAgZXZhbCAiJGJyYW5kdGV4dCIKICAgICAgICAgICAgICAg
IGZpCiAgICAgICAgICAgICAgICBldmFsc3RhdD0kPwogICAgICAgICAgICAgICAgaWYoKGV2YWxz
dGF0PT0wKSkKICAgICAgICAgICAgICAgIHRoZW4KICAgICAgICAgICAgICAgICAgICAoKGxvYWRl
ZCs9MSkpCiAgICAgICAgICAgICAgICAgICAgKChkb2V4cG9ydCkpICYmIGV4cG9ydCAtZiAkZnVu
YyAmJiBhbmRleHBvcnRlZD0nLCBleHBvcnRlZCcgJiYgKChleHBvcnRlZCs9MSkpCiAgICAgICAg
ICAgICAgICAgICAgKChkb3ZlcmJvc2UpKSAmJiBlY2hvICIkZnVuYyBhdXRvbG9hZGVkJHthbmRl
eHBvcnRlZH0ke2FuZGV2YWxlZH0iCiAgICAgICAgICAgICAgICAgICAgaWYgW1sgISAkQVVUT0xP
QURfU0hJTV9PVkVSSEVBRCBdXSAmJiAoKGRvc2hpbSkpOyB0aGVuCiAgICAgICAgICAgICAgICAg
ICAgICAgICMjIC4uLndlIGhhdmUganVzdCBsb2FkZWQgdGhlIGZpcnN0IGZ1bmN0aW9uIHNoaW0g
aW50bwogICAgICAgICAgICAgICAgICAgICAgICAjIyBtZW1vcnkuIExldCdzIGNhbGMgdGhlIEFV
VE9MT0FEX1NISU1fT1ZFUkhFQUQgc2l6ZQogICAgICAgICAgICAgICAgICAgICAgICAjIyB0byB1
c2UgZ29pbmcgZm9yd2FyZC4gSW4gdGhlb3J5LCB3ZSBjb3VsZCBjaGVjawogICAgICAgICAgICAg
ICAgICAgICAgICAjIyBhZ2FpbiBoZXJlIHRvIHNlZSBpZiB3ZSBzaG91bGQgb3B0aW1pemUgYW5k
IHNvdXJjZQogICAgICAgICAgICAgICAgICAgICAgICAjIyBpbiB0aGlzIGZ1bmN0aW9uLCBub3cg
dGhhdCB3ZSBub3cgdGhlCiAgICAgICAgICAgICAgICAgICAgICAgICMjIEFVVE9MT0FEX1NISU1f
T1ZFUkhFQUQuIEluIHByYWN0aWNlLCBpdCdzIG5vdCB3b3J0aAogICAgICAgICAgICAgICAgICAg
ICAgICAjIyBkdXBpbmcgdGhhdCBjb2RlIG9yIGNyZWF0aW5nIGEgZnVuY3Rpb24gdG8gZG8gc28g
Zm9yCiAgICAgICAgICAgICAgICAgICAgICAgICMjIG9uZSBmdW5jdGlvbi4KICAgICAgICAgICAg
ICAgICAgICAgICAgQVVUT0xPQURfU0hJTV9PVkVSSEVBRD0kKHR5cGUgJGZ1bmMgfCBncmVwIC12
IC1FICJeJDEgaXMgYSBmdW5jdGlvbiIgfCBzZWQgInMvJGZ1bmMvL2cifCB3YyAtYykKICAgICAg
ICAgICAgICAgICAgICAgICAgZXhwb3J0IEFVVE9MT0FEX1NISU1fT1ZFUkhFQUQKICAgICAgICAg
ICAgICAgICAgICBmaQogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgIGVj
aG8gIiRmdW5jIGZhaWxlZCB0byBsb2FkIiA+JjIKICAgICAgICAgICAgICAgIGZpCiAgICAgICAg
ICAgIGZpCiAgICAgICAgZmkKICAgIGRvbmUKICAgICgoc3VtbWFyeSkpICYmIGVjaG8gImF1dG9s
b2FkOiBsb2FkZWQ6JGxvYWRlZCBleHBvcnRlZDokZXhwb3J0ZWQgb3B0aW1pemVkOiRvcHRpbWl6
ZWQgb3ZlcmhlYWQ6JEFVVE9MT0FEX1NISU1fT1ZFUkhFQUQgYnl0ZXMiCn0KCl9hdXRvbG9hZF9k
dW1wKCkKewogICAgbG9jYWwgb3B0IE9QVElORAogICAgbG9jYWwgb3B0X3A9JycKICAgIGxvY2Fs
IG9wdF9zPScnCiAgICB3aGlsZSBnZXRvcHRzIHBzIG9wdAogICAgZG8KICAgICAgICBjYXNlICRv
cHQgaW4KICAgICAgICAgICAgcCApIG9wdF9wPTE7OwogICAgICAgICAgICBzICkgb3B0X3M9MTs7
CiAgICAgICAgZXNhYwogICAgZG9uZQoKICAgIHNoaWZ0ICQoKCRPUFRJTkQtMSkpCgogICAgbG9j
YWwgZXhwb3J0ZWQ9JycKICAgIGxvY2FsIGV4ZWN1dGVkPScnCiAgICBsb2NhbCBmdW5jCiAgICBm
b3IgZnVuYyBpbiAkKGRlY2xhcmUgfCBncmVwIC1FICdsb2NhbFxcezAsMX0gQVVUT0xPQURFRCcg
fCBzZWQgLWUgInMvLipBVVRPTE9BREVEPS8vIiAtZSAncy9cXC8vZycgLWUgJ3MvWyIpO10vL2cn
IC1lICJzLycvL2ciKQogICAgZG8KICAgICAgICBpZiBbIC1uICIkb3B0X3AiIF07IHRoZW4gZWNo
byAtbiAiYXV0b2xvYWQgIjsgZmkKICAgICAgICBpZiBbIC1uICIkb3B0X3MiIF0KICAgICAgICB0
aGVuCiAgICAgICAgICAgIGV4cG9ydGVkPSQoZGVjbGFyZSAtRiB8IGdyZXAgLUUgIiR7ZnVuY30k
IiB8IHNlZCAncy9kZWNsYXJlIC1mXCh4XHswLDFcfVwpLiovXDEvJykKICAgICAgICAgICAgWyAi
JGV4cG9ydGVkIiA9ICd4JyBdICYmIGV4cG9ydGVkPScgZXhwb3J0ZWQnIHx8IGV4cG9ydGVkPScg
bm90IGV4cG9ydGVkJwogICAgICAgICAgICBleGVjdXRlZD0kKHR5cGUgJGZ1bmMgfCBncmVwICds
b2NhbCBJU19TSElNJykKICAgICAgICAgICAgWyAteiAiJGV4ZWN1dGVkIiBdICYmIGV4ZWN1dGVk
PScgZXhlY3V0ZWQnIHx8IGV4ZWN1dGVkPScgbm90IGV4ZWN1dGVkJwogICAgICAgIGZpCiAgICAg
ICAgZWNobyAiJHtmdW5jfSR7ZXhwb3J0ZWR9JHtleGVjdXRlZH0iCiAgICBkb25lCn0KCl9hdXRv
bG9hZF9yZXNvbHZlKCkKewogICAgaWYgW1sgISAiJEZQQVRIIiBdXTsgdGhlbgogICAgICAgIGVj
aG8gImF1dG9sb2FkOiBGUEFUSCBub3Qgc2V0IG9yIG51bGwiID4mMgogICAgICAgIHJldHVybgog
ICAgZmkKCiAgICBsb2NhbCBwICMgZm9yICdwYXRoJy4gVGhlICQoKSBjb21tYW5kcyBpbiB0aGUg
Zm9yIGxvb3Agc3BsaXQgdGhlIEZQQVRICiAgICAgICAgICAgICMgc3RyaW5nIGludG8gaXRzIGNv
bnN0aXR1ZW50cyBzbyB0aGF0IGVhY2ggb25lIG1heSBiZSBwcm9jZXNzZWQuCgogICAgZm9yIHAg
aW4gJCggX2F1dG9sb2FkX3NwbGl0X2ZwYXRoICk7IGRvCiAgICAgICAgcD0ke3A6LS59CiAgICAg
ICAgaWYgWyAtZiAkcC8kMSBdOyB0aGVuIGVjaG8gJHAvJDE7IHJldHVybjsgZmkKICAgIGRvbmUK
CiAgICBlY2hvICJhdXRvbG9hZDogJDE6IGZ1bmN0aW9uIHNvdXJjZSBmaWxlIG5vdCBmb3VuZCIg
PiYyCn0KCl9hdXRvbG9hZF9lZGl0KCkKewogICAgWyAteiAiJEVESVRPUiIgXSAmJiBlY2hvICJF
cnJvcjogbm8gRURJVE9SIGRlZmluZWQiICYmIHJldHVybiAxCiAgICBsb2NhbCB0b2VkaXQKICAg
IGxvY2FsIGZ1bmMKICAgIGZvciBmdW5jIGluICIkQCIKICAgIGRvCiAgICAgICAgbG9jYWwgZmls
ZT0kKF9hdXRvbG9hZF9yZXNvbHZlICRmdW5jKQogICAgICAgIGlmIFtbICRmaWxlIF1dCiAgICAg
ICAgdGhlbgogICAgICAgICAgICB0b2VkaXQ9IiR0b2VkaXQgJGZpbGUiCiAgICAgICAgZWxzZQog
ICAgICAgICAgICBlY2hvICIkZnVuY25hbWUgbm90IGZvdW5kIGluIEZQQVRIIGZ1bmNmaWxlLiBT
a2lwcGluZy4iCiAgICAgICAgZmkKICAgIGRvbmUKCiAgICBbIC16ICIkdG9lZGl0IiBdICYmIHJl
dHVybiAxCgogICAgbG9jYWwgdGltZW1hcmtlcj0kKG1rdGVtcCkKCiAgICAkRURJVE9SICR0b2Vk
aXQKCiAgICBsb2NhbCBpCiAgICBmb3IgaSBpbiAkdG9lZGl0CiAgICBkbwogICAgICAgIGlmIFsg
JGkgLW50ICR0aW1lbWFya2VyIF0KICAgICAgICB0aGVuCiAgICAgICAgICAgIGxvY2FsIGY9JChi
YXNlbmFtZSAkaSkKICAgICAgICAgICAgZWNobyBSZWxvYWRpbmcgJGYKICAgICAgICAgICAgYXV0
b2xvYWQgLXIgJGYKICAgICAgICBmaQogICAgZG9uZQp9CgpfYXV0b2xvYWRfcGFnZSgpCnsKICAg
IFsgLXogIiRQQUdFUiIgXSAmJiBlY2hvICJFcnJvcjogbm8gUEFHRVIgZGVmaW5lZCIgJiYgcmV0
dXJuIDEKICAgIGxvY2FsIHRvcGFnZQogICAgbG9jYWwgZnVuYwogICAgZm9yIGZ1bmMgaW4gIiRA
IgogICAgZG8KICAgICAgICBsb2NhbCBmaWxlPSQoX2F1dG9sb2FkX3Jlc29sdmUgJGZ1bmMpCiAg
ICAgICAgaWYgW1sgJGZpbGUgXV0KICAgICAgICB0aGVuCiAgICAgICAgICAgIHRvcGFnZT0iJHRv
cGFnZSAkZmlsZSIKICAgICAgICBlbHNlCiAgICAgICAgICAgIGVjaG8gIiRmdW5jbmFtZSBub3Qg
Zm91bmQgaW4gRlBBVEggZnVuY2ZpbGUuIFNraXBwaW5nLiIKICAgICAgICBmaQogICAgZG9uZQoK
ICAgIFsgLXogIiR0b3BhZ2UiIF0gJiYgcmV0dXJuIDEKCiAgICAkUEFHRVIgJHRvcGFnZQp9Cgpf
YXV0b2xvYWRfcmVtb3ZlKCkKewogICAgdW5zZXQgLWYgIiRAIgp9CgpfYXV0b2xvYWRfaGVscCgp
CnsKICAgIGNhdCA8PEVPSApOQU1FCiAgICAgICAgYXV0b2xvYWQKClNZTk9QU0lTCiAgICAgICAg
YXV0b2xvYWQgWy1wc10KICAgICAgICBhdXRvbG9hZCBbLXh1cmVtbG95dl0gW2Z1bmN0aW9uIC4u
Ll0KICAgICAgICBhdXRvbG9hZCAtYSBkaXJlY3RvcnkgWy1veXZdCiAgICAgICAgYXV0b2xvYWQg
LWYgWy1veXZdCiAgICAgICAgYXV0b2xvYWQgWy1oXQoKICAgICAgICBhdXRvcmVsb2FkIFtmdW5j
dGlvbiAuLi5dCgpERVNDUklQVElPTgoKICAgICAgICBBbiBpbXBsZW1lbnRhdGlvbiBvZiB0aGUg
J2F1dG9sb2FkJyBmdW5jdGlvbmFsaXR5IGJ1aWx0IGludG8gb3RoZXIKICAgICAgICBzaGVsbHMs
IG9mIHdoaWNoICdrc2gnIGlzIHRoZSBtb3N0IHByb21pbmVudC4gIEl0IGFsbG93cyBmb3IgYSBr
ZWVwaW5nCiAgICAgICAgdGhlIHByb2Nlc3MgZW52aXJvbm1lbnQgc21hbGwgYnkgbG9hZGluZyBz
bWFsbCAnc2hpbScgZnVuY3Rpb25zIGludG8KICAgICAgICBtZW1vcnkgdGhhdCB3aWxsLCBvbiBm
aXJzdCBjYWxsLCBsb2FkIHRoZSBmdWxsIHRleHQgb2YgdGhlIGdpdmVuCiAgICAgICAgZnVuY3Rp
b24gYW5kIHJ1biBpdC4gU3Vic2VxdWVudCBjYWxscyB0byB0aGUgZnVuY3Rpb24ganVzdCBydW4g
dGhlCiAgICAgICAgZnVuY3Rpb24uCgogICAgICAgICdhdXRvcmVsb2FkJyBpcyBhIHN5bm9ueW0g
Zm9yICdhdXRvbG9hZCAtcicuIFNlZSBiZWxvdy4KClVTQUdFCgogICAgICAgIG8gRWFjaCBmdW5j
dGlvbiB0byBiZSBhdXRvbG9hZGVkIHNob3VsZCBiZSBkZWZpbmVkIGluIGEgc2luZ2xlIGZpbGUs
CiAgICAgICAgICBuYW1lZCBleGFjdGx5IHRoZSBzYW1lIGFzIHRoZSBmdW5jdGlvbi4KCiAgICAg
ICAgbyBJbiBvcmRlciB0byBhdm9pZCBzaWRlIGVmZmVjdHMsIGRvIE5PVCBwdXQgY29kZSBvdGhl
ciB0aGFuIHRoZQogICAgICAgICAgZnVuY3Rpb24gZGVmaW5pdGlvbiBpbiB0aGUgZmlsZS4gVW5s
ZXNzIG9mIGNvdXJzZSB5b3Ugd2FudCB0byBkbyBzb21lCiAgICAgICAgICBvbmUtdGltZSBpbml0
aWFsaXphdGlvbi4gQnV0IGJld2FyZSB0aGF0IGlmIHlvdSByZWxvYWQgdGhlIGZ1bmN0aW9uCiAg
ICAgICAgICBmb3IgYW55IHJlYXNvbiwgeW91IHdpbGwgcmVydW4gdGhlIGluaXRpYWxpemF0aW9u
IGNvZGUuIE1ha2Ugc3VyZQogICAgICAgICAgeW91ciBpbml0aWFsaXphdGlvbiBpcyByZS1lbnRy
YW50LiBPciwgYmV0dGVyIHlldCwKCiAgICAgICAgICAqKiogZG8gTk9UIHB1dCBjb2RlIG90aGVy
IHRoYW4gdGhlIGZ1bmN0aW9uIGRlZmluaXRpb24gaW4gdGhlIGZpbGUgKioqCgogICAgICAgIG8g
VGhlc2UgZnVuY3Rpb24gZGVmaW5pdGlvbiBmaWxlcyBzaG91bGQgYmUgcGxhY2VkIGluIGEgZGly
ZWN0b3J5IHRoYXQKICAgICAgICAgIGlzIGluIHRoZSBGUEFUSCBlbnZpcm9ubWVudCB2YXJpYWJs
ZS4gU3ViZGlyZWN0b3JpZXMgYXJlIE5PVCBzY2FubmVkLgoKICAgICAgICBvIFRoZSBhdXRvbG9h
ZCBzY3JpcHQgc2hvdWxkIGJlIHNvdXJjZWQgaW50byB0aGUgY3VycmVudCBwcm9jZXNzIGFzCiAg
ICAgICAgICBlYXJseSBhcyBwb3NzaWJsZSBpbiBwcm9jZXNzIHN0YXJ0IHVwLiBTZWUgTk9URVMg
YmVsb3cgZm9yCiAgICAgICAgICBzdWdnZXN0aW9ucy4KCiAgICAgICAgbyBUaGUgY2FsbHMgdG8g
dGhlIGF1dG9sb2FkIGZ1bmN0aW9uIG11c3QgYmUgbWFkZSBpbiB0aGUgY3VycmVudAogICAgICAg
ICAgcHJvY2Vzcy4gSWYgeW91ciBjYWxscyBhcmUgaW4gdGhlaXIgb3duIHNjcmlwdCwgdGhhdCBz
Y3JpcHQgbXVzdCBiZQogICAgICAgICAgc291cmNlZCBpbi4gQ29tbWFuZCBsaW5lIGludm9jYXRp
b25zIGFyZSBhbHNvIHN1ZmZpY2llbnQuIChCdXQgc2VlCiAgICAgICAgICAnLWwnIGJlbG93LikK
CiAgICAgICAgbyBUaGUgZmlyc3QgdGltZSB0aGUgZnVuY3Rpb24gaXMgY2FsbGVkLCB0aGUgc2hp
bSBmdW5jdGlvbiB0aGF0IHdhcwogICAgICAgICAgY3JlYXRlZCBieSB0aGUgJ2F1dG9sb2FkJyBj
YWxsIGlzIHdoYXQgaXMgZXhlY3V0ZWQuIFRoaXMgZnVuY3Rpb24KICAgICAgICAgIHRoZW4gZ29l
cyBhbmQgZmluZHMgdGhlIGFwcHJvcHJpYXRlIGZpbGUgaW4gRlBBVEgsIHNvdXJjZXMgaXQgaW4g
YW5kCiAgICAgICAgICB0aGVuIGNhbGxzIHRoZSBhY3R1YWwgZnVuY3Rpb24gd2l0aCBhbnkgYXJn
dW1lbnRzIHlvdSBqdXN0IHBhc3NlZCBpbgogICAgICAgICAgdG8gdGhlIHNoaW0gZnVuY3Rpb24u
IFN1YnNlcXVlbnQgY2FsbHMganVzdCBydW4gdGhlIGZ1bmN0aW9uLgoKT1BUSU9OUwoKICAgICAg
ICAtYSBBdXRvbG9hZCAoYSlsbCB0aGUgZnVuY3Rpb25zIGZvdW5kIGluIHRoZSBnaXZlbiBkaXJl
Y3RvcnkuCgogICAgICAgIC1mIEF1dG9sb2FkIGFsbCB0aGUgZnVuY3Rpb25zIGZvdW5kIGluIGFs
bCB0aGUgZGlyZWN0b3JpZXMgb24gdGhlCiAgICAgICAgICAgRlBBVEguCgogICAgICAgIC1wIFBy
aW50IGFsbCB0aGUgYXV0b2xvYWRlZCBmdW5jdGlvbnMuCgogICAgICAgIC1zIFByaW50IGFsbCB0
aGUgYXV0b2xvYWRlZCBmdW5jdGlvbnMgYW5kIGFkZCB0aGVpciBleHBvcnQgc3RhdHVzLgoKICAg
ICAgICAteCBFeHBvcnQgdGhlIHNwZWNpZmllZCBmdW5jdGlvbnMgdG8gdGhlIGVudmlyb25tZW50
IGZvciB1c2UgaW4KICAgICAgICAgICBzdWJzaGVsbHMuCgogICAgICAgIC11IFVuc2V0IHRoZSBm
dW5jdGlvbiwgc28gaXQgY2FuIGJlIHJlbG9hZGVkLgoKICAgICAgICAtciBSZWxvYWQgdGhlIHNo
aW1zIG9mIHRoZSBzcGVjaWZpZWQgZnVuY3Rpb25zLCBldmVuIGlmIHRoZSBmdW5jdGlvbnMKICAg
ICAgICAgICBoYXZlIGJlZW4gYWxyZWFkeSBiZWVuIGV4ZWN1dGVkLiAgVGhpcyB3aWxsIGFsbG93
IHlvdSB0byBtb2RpZnkgdGhlCiAgICAgICAgICAgZnVuY3Rpb25zJyBzb3VyY2UgYW5kIGhhdmUg
dGhlIG5ldyB2ZXJzaW9uIGV4ZWN1dGVkIG5leHQgdGltZSB0aGUKICAgICAgICAgICBmdW5jdGlv
biBpcyBjYWxsZWQuCgogICAgICAgICAgIEl0IHdvdWxkIGJlIHZlcnkgZWFzeSB0byBtb2RpZnkg
YSBmdW5jdGlvbidzIHNjcmlwdCwgcnVuIHRoZQogICAgICAgICAgIGZ1bmN0aW9uIGFuZCBzY3Jh
dGNoIHlvdXIgaGVhZCBmb3IgYSBsb25nIHRpbWUgdHJ5aW5nIHRvIGZpZ3VyZSBvdXQKICAgICAg
ICAgICB3aHkgeW91ciBjaGFuZ2VzIGFyZSBub3QgYmVpbmcgZXhlY3V0ZWQuIFRoYXQncyB3aHkg
d2UgcHJvdmlkZSB0aGUKICAgICAgICAgICAnLWUnIGZsYWcgZGVzY3JpYmVkIGJlbG93IGZvciBt
b2RpZmljYXRpb25zLgoKICAgICAgICAgICBSZWxvYWRzLCBvZiBjb3Vyc2UsIG9ubHkgYXBwbHkg
aW4gdGhlIGNvbnRleHQgb2YgdGhlIGN1cnJlbnQgc2Vzc2lvbgogICAgICAgICAgIGFuZCBhbnkg
ZnV0dXJlIHN1YnNoZWxsIHlvdSBzdGFydCBmcm9tIHRoZSBjdXJyZW50IHNlc3Npb24uIEV4aXN0
aW5nCiAgICAgICAgICAgc2Vzc2lvbnMgd2lsbCBuZWVkIHRvIGhhdmUgdGhlIHNhbWUgJ2F1dG9s
b2FkIC1yJyBjb21tYW5kIHJ1biBpbgogICAgICAgICAgIHRoZW0uCgogICAgICAgIC1lIEZpbmQg
dGhlIHNjcmlwdHMgaW4gd2hpY2ggdGhlIHNwZWNpZmllZCBmdW5jdGlvbnMgYXJlIGRlZmluZWQg
YW5kCiAgICAgICAgICAgc3RhcnQgdXAgXCRFRElUT1Igb24gdGhvc2Ugc2NyaXB0cy4gUmVsb2Fk
IHRoZSBvbmVzIHRoYXQgd2VyZQogICAgICAgICAgIG1vZGlmaWVkIHdoZW4geW91IGV4aXQgXCRF
RElUT1IuIChOb3RlOiBJZiB5b3UgdXNlICdhdXRvbG9hZCAtZSBmb28nCiAgICAgICAgICAgdG8g
ZWRpdCBmdW5jdGlvbiAnZm9vJywgYW5kIHRoZW4gaW4geW91ciBlZGl0b3IgeW91IHNlcGFyYXRl
bHkgbG9hZAogICAgICAgICAgIHVwIGZ1bmN0aW9uICdiYXInLCAnYXV0b2xvYWQnIGhhcyBubyB3
YXkgb2Yga25vd2luZyB0aGF0IHlvdSBlZGl0ZWQKICAgICAgICAgICAnYmFyJyBhbmQgd2lsbCBO
T1QgcmVsb2FkICdiYXInIGZvciB5b3UuKQoKICAgICAgICAgICBSZWxvYWRzLCBvZiBjb3Vyc2Us
IG9ubHkgYXBwbHkgaW4gdGhlIGNvbnRleHQgb2YgdGhlIGN1cnJlbnQgc2Vzc2lvbgogICAgICAg
ICAgIGFuZCBhbnkgZnV0dXJlIHN1YnNoZWxsIHlvdSBzdGFydCBmcm9tIHRoZSBjdXJyZW50IHNl
c3Npb24uIEV4aXN0aW5nCiAgICAgICAgICAgc2Vzc2lvbnMgd2lsbCBuZWVkIHRvIGhhdmUgdGhl
IHNhbWUgJ2F1dG9sb2FkIC1yJyBjb21tYW5kIHJ1biBpbgogICAgICAgICAgIHRoZW0uCgogICAg
ICAgIC1tIEZpbmQgdGhlIHNjcmlwdHMgaW4gd2hpY2ggdGhlIHNwZWNpZmllZCBmdW5jdGlvbnMg
YXJlIGRlZmluZWQgYW5kCiAgICAgICAgICAgcnVuIFwkUEFHRVIgb24gdGhlbSAoJ20nIGlzIGZv
ciAnbW9yZScsIGJlY2F1c2UgJ3AnIChwYWdlKSBhbmQgJ2wnCiAgICAgICAgICAgKGxvYWQpIGFy
ZSBhbHJlYWR5IHVzZWQgYXMgb3B0aW9ucyBpbiAnYXV0b2xvYWQnKS4KCiAgICAgICAgLWwgV2hl
biBhdXRvbG9hZGluZyBhIGZ1bmN0aW9uLCBldmFsIHRoZSBzaGltIGltbWVkaWF0ZWx5IGluIG9y
ZGVyIHRvCiAgICAgICAgICAgbG9hZCB0aGUgdHJ1ZSBmdW5jdGlvbiBjb2RlLiBTZWUgIlVzaW5n
ICctbCciIGluIHRoZSBOT1RFUyBiZWxvdyBmb3IKICAgICAgICAgICBkZXRhaWxzLgoKICAgICAg
ICAtbyBPcHRpbWl6ZS4gV2hlbiBhdXRvbG9hZGluZywgdGFrZSB0aGUgdGltZSB0byBleGVjdXRl
CgogICAgICAgICAgICAgICAndGhlQ2hhckNvdW50PVwkKHdjIC1jIFwkdGhlRnVuY0ZpbGUpJwoK
ICAgICAgICAgICBmb3IgZWFjaCBmdW5jaW9uIGFuZAoKICAgICAgICAgICAgICAgIGlmIFwkdGhl
Q2hhckNvdW50IDwgXCRBVVRPTE9BRF9TSElNX09WRVJIRUFECgogICAgICAgICAgIGRvbid0IHNo
aW0gaXQsIGp1c3QgZXZhbCBkaXJlY3RseS4KCiAgICAgICAgLXkgU3VtbWFyKHkpLiBQcmludCB0
aGUgbnVtYmVyIG9mIGxvYWRlZCwgZXhwb3J0ZWQgYW5kIG9wdGltaXplZAogICAgICAgICAgIGZ1
bmN0aW9ucy4KCiAgICAgICAgLXYgVHVybnMgdXAgdGhlIGNoYXR0aW5lc3MuCgpOT1RFUwoKICAg
ICAgICBvIENhbGxpbmcgJ2F1dG9sb2FkJyBvbiBhIGZ1bmN0aW9uIHRoYXQgYWxyZWFkeSBleGlz
dHMgKGVpdGhlciBzaGltbWVkCiAgICAgICAgICBvciBleHBhbmRlZCkgc2lsZW50bHkgaWdub3Jl
cyB0aGUgcmVxdWVzdCB0byBsb2FkIHRoZSBzaGltIHVubGVzcyBpdAogICAgICAgICAgaGFzIGJl
ZW4gcHJldmlvdXNseSByZW1vdmVkICgtdSkgb3IgeW91IGZvcmNlIHRoZSByZWxvYWQgKC1yKS4K
CiAgICAgICAgbyBDaGFuZ2luZyBhbmQgcmVsb2FkaW5nIGEgZnVuY3Rpb24gdGhhdCBoYXMgYmVl
biBleHBvcnRlZCBkb2VzIG5vdAogICAgICAgICAgcmVxdWlyZSBpdCBiZSByZS1leHBvcnRlZDsg
dGhlIG1vZGlmaWNhdGlvbnMgd2lsbCBhcHBlYXIgaW4KICAgICAgICAgIHN1YnNlcXVlbnQgc3Vi
c2hlbGxzLgoKICAgICAgICBvIFVzaW5nICctMScKCiAgICAgICAgICBJZiB5b3UgYXJlIHJ1bm5p
bmcgdW5kZXIgc2V0IC14IGFuZC9vciBzZXQgLXYsIHlvdSBtYXkgc2VlIHRoYXQgdGhlCiAgICAg
ICAgICBzaGltIGRvZXMgbm90IGFwcGVhciB0byAid29yayI7IGluc3RlYWQgb2Ygc2VlaW5nIHRo
ZSBzaGltIGZpcnN0IGFuZAogICAgICAgICAgdGhlIHJlYWwgY29kZSBzdWJzZXF1ZW50bHksIHlv
dSBtYXkgc2VlIHRoZSBzaGltIGV2YWx1YXRlZCBtdWx0aXBsZQogICAgICAgICAgdGltZXMuCgog
ICAgICAgICAgVGhpcyBtYXkgbm90IGJlIGFuIGVycm9yOyByZXZpZXcgeW91ciBjb2RlLiBXaGF0
IGlzIG1vc3QgbGlrZWx5CiAgICAgICAgICBoYXBwZW5pbmcgaXMgdGhhdCB5b3UgYXJlIGNhbGxp
bmcgdGhlIGZ1bmN0aW9uIGluIHN1YnNoZWxscyB2aWEKICAgICAgICAgIGJhY2t0aWNrcyBvciAk
KCksIG9yIGluIGEgc2NyaXB0IHRoYXQgaXMgbm90IGJlaW5nIHNvdXJjZWQgaW50byB0aGUKICAg
ICAgICAgIGN1cnJlbnQgZW52aXJvbm1lbnQuIElmIHlvdSBoYXZlIG5vdCBwcmV2aW91c2x5IGNh
bGxlZCB0aGUgZnVuY3Rpb24KICAgICAgICAgIGluIHF1ZXN0aW9uIGF0IHlvdXIgY29tbWFuZCBs
aW5lIG9yIGluIGEgc2NyaXB0IHRoYXQgd2FzIHNvdXJjZWQgaW50bwogICAgICAgICAgdGhlIGN1
cnJlbnQgZW52aXJub21lbnQsIHRoZW4gdGhlIHZhcmlvdXMgc3Vic2hlbGxzIGFyZSBnb2luZyB0
bwogICAgICAgICAgZW5jb3VudGVyIHRoZSBzaGltIGFuZCByZXBsYWNlIHdpdGggdGhlIHJlYWwg
Y29kZSBiZWZvcmUgZXhlY3V0aW5nLgoKICAgICAgICAgIFJlbWVtYmVyLCBob3dldmVyLCB0aGF0
IGVudmlyb25tZW50IG1vZGlmaWNhdGlvbnMgdGhhdCBvY2N1ciBpbiBhCiAgICAgICAgICBzdWJz
aGVsbCBhcmUgTk9UIHByb3BhZ2F0ZWQgYmFjayB0byB0aGUgY2FsbGluZyBzaGVsbCBvciBvdmVy
IHRvIGFueQogICAgICAgICAgc2libGluZyBzaGVsbHMuIFNvLCBpZiB5b3UgY2FsbCBhbiBhdXRv
bG9hZGVkIGZ1bmN0aW9uIGluIGEgdmVyeQogICAgICAgICAgdGlnaHQgbG9vcCBvZiB2ZXJ5IG1h
bnkgc3Vic2hlbGxzLCB5b3UgbWF5IHdhbnQgdG8gbWFrZSBhbiAnYXV0b2xvYWQKICAgICAgICAg
IC1sJyBjYWxsIGJlZm9yZSB5b3Ugc3RhcnQgeW91ciBsb29wLiAnLWwnIHdpbGwgaW5zdHJ1Y3Qg
J2F1dG9sb2FkJyB0bwogICAgICAgICAgYnlwYXNzIHRoZSBzaGltIGNyZWF0aW9uIGFuZCBqdXN0
IHNvdXJjZSBpbiB0aGUgZnVuY3Rpb24ncyBmaWxlCiAgICAgICAgICBkaXJlY3RseS4gRm9yIGEg
ZmV3IGNhbGxzLCB0aGUgb3ZlcmhlYWQgb2YgcmVwZWF0ZWRseSBydW5uaW5nIHRoZQogICAgICAg
ICAgc2hpbSBpcyBub3QgZXhwZW5zaXZlLCBidXQgaW4gYSB0aWdodCBsb29wLCBpdCBtaWdodCBi
ZS4gQ2F2ZWF0CiAgICAgICAgICBQcm9ncmFtZXIuCgogICAgICAgIG8gQWx0aG91Z2ggdGhlIG51
bWJlciBvZiBmdW5jdGlvbnMgaW4gdGhlIGVudmlyb25tZW50IGRvZXMgbm90IGNoYW5nZQogICAg
ICAgICAgYnkgdXNpbmcgJ2F1dG9sb2FkJywgdGhlIGFtb3VudCBvZiBtZW1vcnkgdGhleSB0YWtl
IHVwIGNhbiBiZSBncmVhdGx5CiAgICAgICAgICByZWR1Y2VkLCBkZXBlbmRpbmcgb24gdGhlIHNp
emUgb2YgeW91ciBmdW5jdGlvbnMuIElmIHlvdSBoYXZlIGEgbG90CiAgICAgICAgICBvZiBzbWFs
bCBmdW5jdGlvbnMsIHRoZW4gaXQgaXMgcG9zc2libGUgdGhhdCB0aGUgc2hpbSB0ZXh0IHdpbGwg
YmUKICAgICAgICAgIGxhcmdlciB0aGFuIHlvdXIgYWN0dWFsIGZ1bmN0aW9ucywgcmVuZGVyaW5n
IHRoZSBtZW1vcnkgc2F2aW5ncyBtb290LgoKICAgICAgICAgICdzbWFsbCcgaW4gdGhpcyBjYXNl
IGNhbiBiZSBkZXRlcm1pbmVkIGJ5IGNhbGxpbmcgdGhlIGZ1bmN0aW9uCiAgICAgICAgICAnYXV0
b2xvYWRfY2FsY19zaGltc2l6ZScgd2l0aCB0aGUgbmFtZSBvZiB0aGUgZnVuY3Rpb24gdG8gZGV0
ZXJtaW5lCiAgICAgICAgICBpdHMgc2hpbSBzaXplLgoKICAgICAgICBvIEluIG9yZGVyIHRvIHN1
cHBvcnQgdGhlIC1wIGFuZCAtcyBvcHRpb25zLCB3ZSBuZWVkIGEgd2F5IHRvIGRldGVybWluZQog
ICAgICAgICAgaWYgYSBmdW5jdGlvbiAnZnVuYycgaGFzIGJlZW4gYXV0b2xvYWRlZCBvciBpZiBp
dCB3YXMgbG9hZGVkCiAgICAgICAgICBkaXJlZGN0bHkuIEluIG9yZGVyIHRvIGRvIHRoYXQsIHdl
IG1vZGlmeSB0aGUgZnVuY3Rpb24ncyBjb2RlIGJ5CiAgICAgICAgICBhZGRpbmcgdGhlIHRleHQK
CiAgICAgICAgICAgICAgbG9jYWwgIEFVVE9MT0FERUQ9J2Z1bmMnOwoKICAgICAgICAgIHRvIHRo
ZSBzaGltIGFuZCB0byB0aGUgYWN0dWFsIGZ1bmN0aW9uIHRleHQsIGp1c3QgYWZ0ZXIgdGhlIG9w
ZW5pbmcKICAgICAgICAgIGJyYWNlLiBUaGVuIHN1cHBvcnRpbmcgLXAgYW5kIC1zIGlzIGp1c3Qg
YSBtYXR0ZXIgb2YgZ3JlcHBpbmcgdGhyb3VnaAogICAgICAgICAgYWxsIHRoZSBmdW5jdGlvbiB0
ZXh0IGluIG1lbW9yeS4gRXZlbiB0aG91Z2ggZ3JlcHBpbmcgdGhyb3VnaCB0aGUKICAgICAgICAg
IGVudmlyb25tZW50IG1heSBub3QgYmUgdGhlIG1vc3QgZWZmaWNpZW50IHdheSB0byBzdXBwb3J0
IHRoaXMsIGl0IGlzCiAgICAgICAgICB0aGUgc2ltcGxlc3QgdG8gaW1wbGVtZW50IGZvciAtcCBh
bmQgLXMgb3BlcmF0aW9ucyB0aGF0IGFyZSBub3QKICAgICAgICAgIGhlYXZpbHkgdXNlZC4KCiAg
ICAgICAgICBBcyBhIGNvbnNxdWVuY2Ugb2YgdGhpcyAoYW5kIG90aGVyIHJlYXNvbnMpLCB0aGUg
QVVUT0xPQUQqIG5hbWVzcGFjZQogICAgICAgICAgaXMgcmVzZXJ2ZWQgZm9yIGF1dG9sb2FkaW5n
LiBNYWtlIHN1cmUgeW91IGNoZWNrIGFueSBmdW5jdGlvbnMgdGhhdAogICAgICAgICAgeW91IGJy
aW5nIHVuZGVyIGF1dG9sb2FkIGZvciB1c2Ugb2YgdmFyaWFibGVzIG9yIGZ1bmN0aW9ucyB0aGF0
IHN0YXJ0CiAgICAgICAgICB3aXRoIEFVVE9MT0FEIGFuZCBjaGFuZ2UgdGhlbS4KCiAgICAgICAg
byBUaGUgZWFzaWVzdCB3YXkgdG8gbG9hZCBzaGltcyBmb3IgYWxsIGZ1bmN0aW9ucyBvbiB0aGUg
RlBBVEggaXMgdG8gcnVuCgogICAgICAgICAgICAgICBhdXRvbG9hZCAtZiAteAoKICAgICAgICAg
IGluIHRoZSBwcm9maWxlIHRoYXQgZ2V0cyBydW4gZm9yIGxvZ2luIHNoZWxscy4KCiAgICAgICAg
ICBXaGVuIGNhbGxlZCBpbiB0aGUgcHJvZmlsZSBvZiBhIGxvZ2luIHNoZWxsIHdoZXJlIG5vIGRl
ZmluaXRpb25zCiAgICAgICAgICBleGlzdCwgLWYgd2lsbCBsb2FkIGFsbCBmdW5jdGlvbnMgaXQg
Y2FuIGZpbmQgb24gRlBBVEggYW5kIC14IHdpbGwKICAgICAgICAgIGV4cG9ydCBhbGwgb2YgdGhv
c2UgZnVuY3Rpb25zIHRvIGJlIGF2YWlsYWJsZSBpbiBzdWJzaGVsbHMgd2hlbiB0aGlzCiAgICAg
ICAgICBpcyBjYWxsZWQgaW4gYSBsb2dpbiBzaGVsbC4gVXNpbmcgdGhpcyBvcHRpb24gd2lsbCBy
ZWxpZXZlIHlvdSBvZiB0aGUKICAgICAgICAgIG5lZWQgdG8gY2FsbCAnYXV0b2xvYWQnIGFmdGVy
IEV2ZXJ5IFNpbmdsZSBGdW5jdGlvbiBEZWZpbml0aW9uLCBub3IKICAgICAgICAgIHdpbGwgeW91
IG5lZWQgdG8gY2FsbCBpdCBpbiBzdWJzaGVsbHMuCgogICAgICAgICAgVGhlIG9ubHkgdGhpbmcg
bGVmdCB0byBkbyBpcyB0byBsb2FkIHVwIHRoZSBhdXRvbG9hZCBmdW5jdGlvbiBpdHNlbGYKICAg
ICAgICAgIGFuZCBpdHMgaGVscGVyIGZ1bmN0aW9ucy4gVGhhdCBuZWVkcyB0byBoYXBwZW4gaW4g
eW91ciBwcm9maWxlOgoKICAgICAgICAgICAgZXhwb3J0IEZQQVRIPX4vZnVuY3Rpb25zICAgICAg
ICMgb3Igd2hlcmV2ZXIgeW91IHN0YXNoIHRoZW0KICAgICAgICAgICAgaWYgWyAteiAkKGRlY2xh
cmUgLUYgYXV0b2xvYWQpIF0KICAgICAgICAgICAgdGhlbgogICAgICAgICAgICAgIC4gfi9iaW4v
YXV0b2xvYWQgICAgICAgICAgICAgIyBvciB3aGVyZXZlciB5b3UndmUgcHV0IGl0CiAgICAgICAg
ICAgIGZpCgogICAgICAgICAgVGhlICdpZicgc3RhdGVtZW50IGlzIHVzZWQgdG8gbWFrZSBzdXJl
IHdlIGRvbid0IHJlbG9hZCBhdXRvbG9hZAogICAgICAgICAgbmVlZGxlc3NseS4gU291cmNpbmcg
aW4gdGhlIGF1dG9sb2FkIHNjcmlwdCBsb2FkcyB0aGUgJ2F1dG9sb2FkJwogICAgICAgICAgZnVu
Y3Rpb24gYW5kIGFsbCBvZiBpdHMgc3VwcG9ydCBmdW5jdGlvbnMuIEFkZGl0aW9uYWxseSwgd2Ug
ZXhwb3J0CiAgICAgICAgICBhbGwgb2YgdGhlc2UgZnVuY3Rpb25zIHNvIHRoYXQgdGhleSBhcmUg
YXZhaWxhYmxlIGluIHN1YnNoZWxsczsgeW91CiAgICAgICAgICBkbyBub3QgaGF2ZSB0byByZS1z
b3VyY2UgdGhlIGF1dG9sb2FkIGZpbGUgaW4gJy5iYXNocmMnLgoKICAgICAgICBvIEV2ZW4gd2l0
aCBhbGwgb2YgdGhlc2Ugc2hlbmFuaWdhbnMsIHlvdSB3aWxsIGZpbmQgY2FzZXMgd2hlcmUgbm8K
ICAgICAgICAgIG1hdHRlciBob3cgaGFyZCB5b3UgdHJ5LCB5b3VyIGF1dG9sb2FkZWQgZnVuY3Rp
b25zIHdpbGwgYmUKICAgICAgICAgIHVuYXZhaWxhYmxlIHRvIHlvdSwgZXZlbiBpZiB5b3UgcnVu
ICdhdXRvbG9hZCAteCAtZicuIFRoZSB0eXBpY2FsCiAgICAgICAgICBjb25kaXRpb24gZm9yIHRo
aXMgaXMgc3RhcnRpbmcgdXAgbm90IGEgc3Vic2hlbGwsIGJ1dCBhIGJyYW5kIG5ldwogICAgICAg
ICAgRElGRkVSRU5UIHNoZWxsLiBBbmQgdGhlIHR5cGljYWwgZXhhbXBsZSBvZiB0aGlzIGlzIGdp
dCBleHRlbnRpb25zLgoKICAgICAgICAgIEF0IHRoZSB0aW1lIG9mIHRoaXMgd3JpdGluZywgZ2l0
IGV4dGVudGlvbnMgd29yayBieSB0YWtpbmcgYSBjb21tYW5kCiAgICAgICAgICAnZ2l0IGZvbycg
YW5kIGxvb2tpbmcgZm9yIGEgZmlsZSAnZ2l0LWZvbycgb24gdGhlIHBhdGguICdnaXQnIHRoZW4K
ICAgICAgICAgIGV4ZWN1dGVzICdnaXQtZm9vJyBpbiBhIG5ldyBzaGVsbCAtIGl0IGV4ZWN1dGVz
IHlvdXIgY29tbWFuZCBpbgogICAgICAgICAgL2Jpbi9zaC4gVGhhdCdzIG5vdCBhIHN1YnNoZWxs
IG9mIHlvdXIgcHJvY2Vzcy4gSXQgd2lsbCBub3QgZ2V0IHlvdXIKICAgICAgICAgIGV4cG9ydGVk
IHNoZWxsIGZ1bmN0aW9ucy4gQmFsbGdhbWUgb3Zlci4KCiAgICAgICAgICBJZiB5b3UgZmluZCB0
aGF0IHlvdSB3YW50IHlvdXIgZnVuY3Rpb25zIHRvIGJlIGF2YWlsYWJsZSBpbiBzdWNoCiAgICAg
ICAgICBjaXJjdW1zdGFuY2VzLCBjb252ZXJ0IHRoZW0gYmFjayB0byBwbGFpbiBvbGQgc2NyaXB0
cywgbWFrZSBzdXJlIHRoZXkKICAgICAgICAgIGFyZSAnc2gnIGNvbXBsaWFudCBhbmQgdGFrZSB0
aGUgcmVhZC9wYXJzZSBoaXQgZXZlcnkgdGltZSB0aGV5IGFyZQogICAgICAgICAgcnVuLgoKRU9I
Cn0KCmF1dG9sb2FkKCkKewogICAgaWYgKCggJCMgPT0gMCApKSA7IHRoZW4gX2F1dG9sb2FkX2R1
bXA7IHJldHVybjsgZmkKCiAgICBsb2NhbCBvcHQgT1BUSU5EIE9QVEFSRwogICAgbG9jYWwgcGFz
c3RocnUKICAgIGxvY2FsIGR1bXBvcHQKICAgIHdoaWxlIGdldG9wdHMgcHN1ZW1hOnl4cnZsb2hm
IG9wdAogICAgZG8KICAgICAgICBjYXNlICRvcHQgaW4KICAgICAgICAgICAgcHxzKSBkdW1wb3B0
PSIkZHVtcG9wdCAtJHtvcHR9Ijs7CiAgICAgICAgICAgIHUpIHNoaWZ0ICQoKE9QVElORC0xKSk7
IF9hdXRvbG9hZF9yZW1vdmUgIiRAIjsgcmV0dXJuOzsKICAgICAgICAgICAgZSkgc2hpZnQgJCgo
T1BUSU5ELTEpKTsgX2F1dG9sb2FkX2VkaXQgIiRAIjsgcmV0dXJuOzsKICAgICAgICAgICAgbSkg
c2hpZnQgJCgoT1BUSU5ELTEpKTsgX2F1dG9sb2FkX3BhZ2UgIiRAIjsgcmV0dXJuOzsKICAgICAg
ICAgICAgeHxyfHZ8bHx5fGZ8bykgcGFzc3RocnU9IiRwYXNzdGhydSAtJG9wdCI7OwogICAgICAg
ICAgICBhKSBwYXNzdGhydT0iJHBhc3N0aHJ1IC0kb3B0ICRPUFRBUkciOzsKICAgICAgICAgICAg
aCkgX2F1dG9sb2FkX2hlbHA7IHJldHVybjs7CiAgICAgICAgICAgICopIGVjaG8gImF1dG9sb2Fk
OiB1c2FnZTogYXV0b2xvYWQgWy1wdVV4XSBbZnVuY3Rpb24gLi4uXSIgPiYyOyByZXR1cm47Owog
ICAgICAgIGVzYWMKICAgIGRvbmUKCiAgICBzaGlmdCAkKCgkT1BUSU5ELTEpKQogICAgaWYgWyAt
biAiJGR1bXBvcHQiIF0KICAgIHRoZW4KICAgICAgICBfYXV0b2xvYWRfZHVtcCAkZHVtcG9wdAog
ICAgZWxzZQogICAgICAgIF9hbG9hZCAkcGFzc3RocnUgIiRAIgogICAgZmkKfQoKYXV0b3JlbG9h
ZCAoKQp7CiAgICBhdXRvbG9hZCAtciAiJEAiCn0KCiMjIFdoZW4gd2Ugc291cmNlIGluIGF1dG9s
b2FkLCB3ZSBleHBvcnQgKGJ1dCBOT1QgYXV0b2xvYWQpIHRoZSBhdXRvbG9hZAojIyBmdW5jdGlv
bnMgc28gdGhhdCB0aGV5IGFyZSBhdmFpbGFibGUgaW4gc3Vic2hlbGxzIGFuZCB5b3UgZG9uJ3Qg
aGF2ZSB0bwojIyBzb3VyY2UgaW4gdGhlIGF1dG9sb2FkIGZpbGUgaW4gc3Vic2hlbGxzLgpleHBv
cnQgLWYgX2Fsb2FkIFwKICAgICAgIF9hdXRvbG9hZF9kdW1wIFwKICAgICAgIF9hdXRvbG9hZF9l
ZGl0IFwKICAgICAgIF9hdXRvbG9hZF9oZWxwIFwKICAgICAgIF9hdXRvbG9hZF9wYWdlIFwKICAg
ICAgIF9hdXRvbG9hZF9yZXNvbHZlIFwKICAgICAgIF9hdXRvbG9hZF9zcGxpdF9mcGF0aCBcCiAg
ICAgICBhdXRvbG9hZCBcCiAgICAgICBhdXRvbG9hZF9jYWxjX3NoaW1zaXplIFwKICAgICAgIGF1
dG9yZWxvYWQK
--94eb2c0d9296fbb9200556d88f2a
Content-Type: application/x-troff; name="autoload.v4.t"
Content-Disposition: attachment; filename="autoload.v4.t"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_j6elsv4t1

IyEvYmluL2Jhc2gKCndvcmtkaXI9JChta3RlbXAgLWQpCgpjcCBhdXRvbG9hZCAkd29ya2RpcgoK
Y2QgJHdvcmtkaXIKcHdkCgouIC4vYXV0b2xvYWQKCmZ1bmNsaXN0PSdBTFRFU1RfZnVuYzEgQUxU
RVNUX2Z1bmNleHBvcnQgQUxURVNUX2Z1bmN1Jwpmb3IgZnVuY25hbWUgaW4gJGZ1bmNsaXN0OyBk
bwogICAgY2F0IDw8RU9GRlVOQyA+ICRmdW5jbmFtZQokZnVuY25hbWUgKCkKewplY2hvIHRoaXMg
aXMgJGZ1bmNuYW1lCgp9CkVPRkZVTkMKCmRvbmUKCmV4cG9ydCBGUEFUSD0kd29ya2RpcgoKYXV0
b2xvYWQgQUxURVNUX2Z1bmMxIEFMVEVTVF9mdW5jdQphdXRvbG9hZCAteCBBTFRFU1RfZnVuY2V4
cG9ydAoKb2s9MApmYWlsZWQ9MAoKZm9yIGZ1bmNuYW1lIGluICRmdW5jbGlzdDsgZG8KCiAgICB0
ZXN0bmFtZT0iJGZ1bmNuYW1lIGxvYWRlZCIKICAgIGdvdD0kKHR5cGUgJGZ1bmNuYW1lIDI+JjEp
CiAgICBpZiBbWyAkZ290ID1+ICIkZnVuY25hbWU6IG5vdCBmb3VuZCIgXV07IHRoZW4KICAgICAg
ICBlY2hvICIjIyBGYWlsZWQgJHRlc3RuYW1lIgogICAgICAgICgoZmFpbGVkKz0xKSkKICAgIGVs
c2UKICAgICAgICBlY2hvICJvayAtICR0ZXN0bmFtZSIKICAgICAgICAoKG9rKz0xKSkKCiAgICAg
ICAgdGVzdG5hbWU9IiRmdW5jbmFtZSBpcyBhIHNoaW0iCiAgICAgICAgaWYgW1sgISAkZ290ID1+
ICJJU19TSElNIiBdXTsgdGhlbgogICAgICAgICAgICBlY2hvICIjIyBGYWlsZWQgJHRlc3RuYW1l
IgogICAgICAgICAgICAoKGZhaWxlZCs9MSkpCiAgICAgICAgZWxzZQogICAgICAgICAgICBlY2hv
ICJvayAtICR0ZXN0bmFtZSIKICAgICAgICAgICAgKChvays9MSkpCgogICAgICAgICAgICB0ZXN0
bmFtZT0iJGZ1bmNuYW1lIHNoaW0gZXhlY3V0ZWQiCiAgICAgICAgICAgICRmdW5jbmFtZSA+IC9k
ZXYvbnVsbAogICAgICAgICAgICBnb3Q9JCh0eXBlICRmdW5jbmFtZSAyPiYxKQogICAgICAgICAg
ICBpZiBbWyAkZ290ID1+ICJJU19TSElNIiBdXTsgdGhlbgogICAgICAgICAgICAgICAgZWNobyAi
IyMgRmFpbGVkICR0ZXN0bmFtZSIKICAgICAgICAgICAgICAgICgoZmFpbGVkKz0xKSkKICAgICAg
ICAgICAgZWxzZQogICAgICAgICAgICAgICAgZWNobyAib2sgLSAkdGVzdG5hbWUiCiAgICAgICAg
ICAgICAgICAoKG9rKz0xKSkKICAgICAgICAgICAgZmkKICAgICAgICBmaQogICAgZmkKZG9uZQoK
ZnVuY25hbWU9QUxURVNUX2Z1bmMxCnRlc3RuYW1lPSIkZnVuY25hbWUgc2hpbSByZWxvYWRlZCIK
YXV0b2xvYWQgLXIgJGZ1bmNuYW1lCmdvdD0kKHR5cGUgJGZ1bmNuYW1lIDI+JjEpCmlmIFtbICEg
JGdvdCA9fiAiSVNfU0hJTSIgXV07IHRoZW4KICAgIGVjaG8gIiMjIEZhaWxlZCAkdGVzdG5hbWUi
CiAgICAoKGZhaWxlZCs9MSkpCmVsc2UKICAgIGVjaG8gIm9rIC0gJHRlc3RuYW1lIgogICAgKChv
ays9MSkpCmZpCgpmdW5jbmFtZT1BTFRFU1RfZnVuY3UKdGVzdG5hbWU9IiRmdW5jbmFtZSBzaGlt
IHVubG9hZGVkIgphdXRvbG9hZCAtdSAkZnVuY25hbWUKZ290PSQodHlwZSAkZnVuY25hbWUgMj4m
MSkKaWYgW1sgISAkZ290ID1+ICIkZnVuY25hbWU6IG5vdCBmb3VuZCIgXV07IHRoZW4KICAgIGVj
aG8gIiMjIEZhaWxlZCAkdGVzdG5hbWUiCiAgICAoKGZhaWxlZCs9MSkpCmVsc2UKICAgIGVjaG8g
Im9rIC0gJHRlc3RuYW1lIgogICAgKChvays9MSkpCmZpCgp0ZXN0bmFtZT0iYXV0b2xvYWQgLXAi
CmdvdD0kKGF1dG9sb2FkIC1wIHwgZ3JlcCBBTFRFU1QpCmlmIFtbICEgJGdvdCA9fiAiYXV0b2xv
YWQgQUxURVNUX2Z1bmMxIiBdXSB8fCBcCiAgICAgICBbWyAhICRnb3QgPX4gImF1dG9sb2FkIEFM
VEVTVF9mdW5jZXhwb3J0IiBdXSA7IHRoZW4KZWNobyAiIyMgRmFpbGVkICR0ZXN0bmFtZSIKICAg
ICgoZmFpbGVkKz0xKSkKZWxzZQogICAgZWNobyAib2sgLSAkdGVzdG5hbWUiCiAgICAoKG9rKz0x
KSkKZmkKCnRlc3RuYW1lPSJhdXRvbG9hZCAtcyIKZWNobyAiRXhlY3V0aW5nICR0ZXN0bmFtZSwg
Y291bGQgdGFrZSBhIGxvbmcgdGltZS4uLiIKZ290PSQoYXV0b2xvYWQgLXMgfCBncmVwIEFMVEVT
VCkKaWYgW1sgISAkZ290ID1+ICJBTFRFU1RfZnVuYzEgbm90IGV4cG9ydGVkIG5vdCBleGVjdXRl
ZCIgXV0gfHwgXAogICAgICAgW1sgISAkZ290ID1+ICJBTFRFU1RfZnVuY2V4cG9ydCBleHBvcnRl
ZCBleGVjdXRlZCIgXV0gOyB0aGVuCiAgICBlY2hvICIjIyBGYWlsZWQgJHRlc3RuYW1lIgogICAg
ZWNobyAiIyMgICAgZ290OiAkZ290IgogICAgKChmYWlsZWQrPTEpKQplbHNlCiAgICBlY2hvICJv
ayAtICR0ZXN0bmFtZSIKICAgICgob2srPTEpKQpmaQoKdGVzdG5hbWU9ImF1dG9sb2FkIC1yIC1h
ICRGUEFUSCIKYXV0b2xvYWQgLXIgLWEgJEZQQVRICmxvY2FsZmFpbGVkPTAKbG9jYWxvaz0wCmZv
ciBmdW5jbmFtZSBpbiAkZnVuY2xpc3Q7IGRvCiAgICBnb3Q9JCh0eXBlICRmdW5jbmFtZSAyPiYx
KQogICAgaWYgW1sgJGdvdCA9fiAiJGZ1bmNuYW1lOiBub3QgZm91bmQiIF1dOyB0aGVuCiAgICAg
ICAgZWNobyAiIyMgRmFpbGVkICR0ZXN0bmFtZSAtICRmdW5jbmFtZSIKICAgICAgICAoKGxvY2Fs
ZmFpbGVkKz0xKSkKICAgIGVsc2UKICAgICAgICAoKGxvY2Fsb2srPTEpKQogICAgICAgIGlmIFtb
ICEgJGdvdCA9fiAiSVNfU0hJTSIgXV07IHRoZW4KICAgICAgICAgICAgKChsb2NhbGZhaWxlZCs9
MSkpCiAgICAgICAgZWxzZQogICAgICAgICAgICAoKGxvY2Fsb2srPTEpKQogICAgICAgIGZpCiAg
ICBmaQpkb25lCmlmICgobG9jYWxmYWlsZWQ9PTApKTsgdGhlbgogICAgZWNobyAib2sgLSAkdGVz
dG5hbWUiCiAgICAoKG9rKz0xKSkKZWxzZQogICAgKChmYWlsZWQrPTEpKQpmaQoKdGVzdG5hbWU9
ImF1dG9sb2FkIC11ICRmdW5jbGlzdCIKYXV0b2xvYWQgLXUgJGZ1bmNsaXN0CmxvY2FsZmFpbGVk
PTAKbG9jYWxvaz0wCmZvciBmdW5jbmFtZSBpbiAkZnVuY2xpc3Q7IGRvCiAgICBnb3Q9JCh0eXBl
ICRmdW5jbmFtZSAyPiYxKQogICAgaWYgW1sgISAkZ290ID1+ICIkZnVuY25hbWU6IG5vdCBmb3Vu
ZCIgXV07IHRoZW4KICAgICAgICBlY2hvICIjIyBGYWlsZWQgJHRlc3RuYW1lIC0gJGZ1bmNuYW1l
IgogICAgICAgICgobG9jYWxmYWlsZWQrPTEpKQogICAgZWxzZQogICAgICAgICgobG9jYWxvays9
MSkpCiAgICBmaQpkb25lCmlmICgobG9jYWxmYWlsZWQ9PTApKTsgdGhlbgogICAgZWNobyAib2sg
LSAkdGVzdG5hbWUiCiAgICAoKG9rKz0xKSkKZWxzZQogICAgKChmYWlsZWQrPTEpKQpmaQoKdGVz
dG5hbWU9ImF1dG9sb2FkIC1yIC1mIgphdXRvbG9hZCAtciAtZgpsb2NhbGZhaWxlZD0wCmxvY2Fs
b2s9MApmb3IgZnVuY25hbWUgaW4gJGZ1bmNsaXN0OyBkbwogICAgZ290PSQodHlwZSAkZnVuY25h
bWUgMj4mMSkKICAgIGlmIFtbICRnb3QgPX4gIiRmdW5jbmFtZTogbm90IGZvdW5kIiBdXTsgdGhl
bgogICAgICAgIGVjaG8gIiMjIEZhaWxlZCAkdGVzdG5hbWUgLSAkZnVuY25hbWUiCiAgICAgICAg
KChsb2NhbGZhaWxlZCs9MSkpCiAgICBlbHNlCiAgICAgICAgKChsb2NhbG9rKz0xKSkKICAgICAg
ICBpZiBbWyAhICRnb3QgPX4gIklTX1NISU0iIF1dOyB0aGVuCiAgICAgICAgICAgICgobG9jYWxm
YWlsZWQrPTEpKQogICAgICAgIGVsc2UKICAgICAgICAgICAgKChsb2NhbG9rKz0xKSkKICAgICAg
ICBmaQogICAgZmkKZG9uZQppZiAoKGxvY2FsZmFpbGVkPT0wKSk7IHRoZW4KICAgIGVjaG8gIm9r
IC0gJHRlc3RuYW1lIgogICAgKChvays9MSkpCmVsc2UKICAgICgoZmFpbGVkKz0xKSkKZmkKCmVj
aG8gJG9rIHBhc3NlZCwgJGZhaWxlZCBmYWlsZWQKZXhpdCAkZmFpbGVkCg==
--94eb2c0d9296fbb9200556d88f2a--


From MAILER-DAEMON Wed Aug 16 09:40:47 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dhyYx-0003jS-Mz
	for mharc-bug-bash@gnu.org; Wed, 16 Aug 2017 09:40:47 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:53173)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <klaasvanschelven@gmail.com>) id 1dhyTV-0000s8-P2
	for bug-bash@gnu.org; Wed, 16 Aug 2017 09:35:11 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <klaasvanschelven@gmail.com>) id 1dhyTU-0001Vx-GF
	for bug-bash@gnu.org; Wed, 16 Aug 2017 09:35:09 -0400
Received: from mail-wr0-x233.google.com ([2a00:1450:400c:c0c::233]:37222)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <klaasvanschelven@gmail.com>)
	id 1dhyTU-0001SB-6C
	for bug-bash@gnu.org; Wed, 16 Aug 2017 09:35:08 -0400
Received: by mail-wr0-x233.google.com with SMTP id z91so6423910wrc.4
	for <bug-bash@gnu.org>; Wed, 16 Aug 2017 06:35:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:sender:from:date:message-id:subject:to;
	bh=ab/8ffZW6BD5v5b9cZLkiRAUn/fNGf1Ez1MNNvTcXKU=;
	b=qJedoJNUgCvoOBh7K5F8G4oKnRKP7RxZ57/NBHFC81w4PDdTx0/y6hkBI/wIC5t+gB
	7nKnT3b4w429wHITKDDHRtj7NQiC2EcCYuzLkcCsfzViCozQ09ZTn0DlSjt3rV7s29e7
	kLNaNDyCZ25d3EEuVGdAobXRwgtGcDJIlvmRpB/6eECuxChXR19wRZptEnBzirXjh7FF
	NEw6baS0dF0wqVPGn1heWcUgLjZiE3cqy3JWzBx2C2szxDJpvBcKGA2rXvn8pHmWxJNd
	9A2tUtYH4OzJD4Zq1TwXiXU26KZC7vfjeBPYNuS4dO9+3D+LCaJ3nadlHABTEIMg3ySr
	O8Og==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:sender:from:date:message-id:subject
	:to; bh=ab/8ffZW6BD5v5b9cZLkiRAUn/fNGf1Ez1MNNvTcXKU=;
	b=V88drT+bnjlAm/ADhjqsID6JxRCUnhH3fZwY/2ZQtJGtsINKOknlME2om1os7CkqzC
	6hcmrHIxzFjUBhVQs2JjThX0+5VYS57SJ49j6vHH6dYLPQc8dLfpCS/9yiPcTTn5p1iD
	mZ3nnLDPmH0dt4xlY29SIjqYRRSIj7LSe32BY0n0anXdFDZYcFltwR9/GPxO7GkGxIDX
	qhAb3RxN5as8WIIvKbsuW4Fc0Nzip6jeiiWoNbj5Zvkd/cicSKKUfrwCf94sK+y6kNBa
	t4y6Lodhpukau2nw0nlNSNUhcgbVNHr92jluyK33vSDtb1a+CMJ3ghJiJgl0FCbbVC91
	KhJg==
X-Gm-Message-State: AHYfb5iHBqnVBDgSLhQTsWcyxjfZJuV7EVXbSr2hqHJJA25XlytuLJXF
	kY6LQ9aZlFC8mdAMOTjebvHZw5rFYLqgJ5E=
X-Received: by 10.28.45.198 with SMTP id t189mr1553732wmt.72.1502890505282;
	Wed, 16 Aug 2017 06:35:05 -0700 (PDT)
MIME-Version: 1.0
Sender: klaasvanschelven@gmail.com
Received: by 10.28.47.138 with HTTP; Wed, 16 Aug 2017 06:34:44 -0700 (PDT)
From: Klaas van Schelven <klaas@vanschelven.com>
Date: Wed, 16 Aug 2017 15:34:44 +0200
X-Google-Sender-Auth: WwDXh1KAnSrBLS2tjJC7DYWEzEY
Message-ID: <CACu42+7+c6f+jryX97dUYn61j7LnCZHYWF24KB=YdnuFu_emiw@mail.gmail.com>
Subject: Re: "HISTSIZE=999999999" cause bash failure after lastest upgrade
To: bug-bash@gnu.org
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2a00:1450:400c:c0c::233
X-Mailman-Approved-At: Wed, 16 Aug 2017 09:40:46 -0400
Content-Type: text/plain; charset="UTF-8"
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 16 Aug 2017 13:35:11 -0000

Hello Chet,

I'm replying to a 2-year old bug; I think it's still relevant.

subject: "HISTSIZE=999999999" cause bash failure after lastest upgrade
link: https://lists.gnu.org/archive/html/bug-bash/2016-09/msg00113.html
text bellow:

> > Bash Version: 4.4
>
> > Patch Level: 0
> > Release Status: release
> >
> > Description:
> >       I use a huge value for HISTSIZE (=999999999) to enable infinite
> >       history items. The actural size of ~/.bash_history is only 4MB
now.
> >       Everything worked fine before the lastest upgrade. Now bash refuse
> >       me to login due to memory allocation failure. After choosing
> >       a smaller HISTSIZE, bash still eatup too much unnesssary memory.
> >
> > Repeat-By:
> >       open a workable terminal with small HISTSIZE setting,
> >       $ echo HISTSIZE=999999999 > ~/test.rc
> >       $ bash --rcfile ~/test.rc
> >         bash: xmalloc: cannot allocate 8000000008 bytes (114688 bytes
> > allocated)
>
> Since you've specified the desired history size, bash tries to allocate
> enough entries to hold all of the entries.  The assumption is that this
> will reduce the number of allocations/reallocations and the number of
> times the history list has to be copied as it's reallocated.  I suppose
> I should cap the maximum value for which that occurs instead of trusting
> the supplied max number of entries.
>
> Chet
>

I'm on GNU bash, version 4.4.5(1) myself.

I'm not sure the solution mentioned above is sufficient to solve all
relevant variant problems caused by the pre-allocation of the memory.

In particular, I ran into this myself with a value of HISTSIZE=100000000 (8
zeros), which gobbled up approximately 1GB of memory per bash instance.

Experimenting a bit led to  HISTSIZE=1000000000 (9 zeros), which was enough
to crash and is apparently still under this cap (if that is implemented in
4.4.5(1) at all).

The fall out of this problem is potentially quite large, e.g. lockout from
remote systems if bash is the default installed shell and the only user
with access has some arbitrarily large HISTSIZE configured.

Aside from this particular scenario I would question the trade-off of
pre-allocation more generally. Besides the waste of memory, even for
non-crashing cases, there's also a performance penalty on startup (in the
1GB case mentioned above, this was visible with the naked eye).

Until not too long ago the option of setting -1 as a value for HISTSIZE was
not available (bash 4.3 introduced it) , so I imagine instances of very
large values are not entirely uncommon.

Klaas

From MAILER-DAEMON Wed Aug 16 10:02:09 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dhytd-0001mN-9Z
	for mharc-bug-bash@gnu.org; Wed, 16 Aug 2017 10:02:09 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:58492)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dhyta-0001ke-Uj
	for bug-bash@gnu.org; Wed, 16 Aug 2017 10:02:08 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dhytU-0001K8-Qy
	for bug-bash@gnu.org; Wed, 16 Aug 2017 10:02:07 -0400
Received: from mpv1-2015.cwru.edu ([129.22.103.226]:22552
	helo=mpv1-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1dhytU-0001HT-L7
	for bug-bash@gnu.org; Wed, 16 Aug 2017 10:02:00 -0400
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv1-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AOG27269; Wed, 16 Aug 2017 10:01:53 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id BIM16191 (AUTH cpr);
	Wed, 16 Aug 2017 10:01:52 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: "HISTSIZE=999999999" cause bash failure after lastest upgrade
To: Klaas van Schelven <klaas@vanschelven.com>, bug-bash@gnu.org
References: <CACu42+7+c6f+jryX97dUYn61j7LnCZHYWF24KB=YdnuFu_emiw@mail.gmail.com>
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <1b2c4b07-9e80-bbff-18a1-ea5d40a48741@case.edu>
Date: Wed, 16 Aug 2017 10:01:52 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <CACu42+7+c6f+jryX97dUYn61j7LnCZHYWF24KB=YdnuFu_emiw@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Junkmail-Status: score=7/60, host=mpv1-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.16.131215:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__SUBJ_ALPHA_END, __TO_MALFORMED_2, __TO_NAME,
	__TO_NAME_DIFF_FROM_ACC, __REFERENCES, __HAS_FROM,
	FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA,
	__USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION,
	__IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE,
	__REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC,
	__FROM_DOMAIN_IN_ANY_CC1, __FROM_DOMAIN_IN_ANY_CC2,
	__REPLYTO_SAMEAS_FROM_DOMAIN, __ANY_URI, __URI_WITH_PATH,
	URI_ENDS_IN_HTML, __URI_NO_WWW, __CP_URI_IN_BODY,
	__C230066_P5, __FRAUD_MONEY_CURRENCY_DOLLAR,
	__SUBJ_ALPHA_NEGATE, __MULTIPLE_URI_TEXT, __URI_IN_BODY,
	__URI_NOT_IMG, __NO_HTML_TAG_RAW,
	BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_900_999,
	__MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01,
	HTML_00_10, __FRAUD_MONEY_CURRENCY, BODY_SIZE_5000_LESS,
	IN_REP_TO, MSG_THREAD, [TRUNCATED],
	so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.226
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 16 Aug 2017 14:02:08 -0000

On 8/16/17 9:34 AM, Klaas van Schelven wrote:

> 
> I'm on GNU bash, version 4.4.5(1) myself.

And you tested with this version?
> 
> I'm not sure the solution mentioned above is sufficient to solve all
> relevant variant problems caused by the pre-allocation of the memory.

It appears to work with the current version, and should work with 4.4.5,
since it was addressed in patch 1.

$ ./bash --version
GNU bash, version 4.4.12(2)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ HISTSIZE=1000000000 ./bash
$ echo $HISTSIZE
1000000000


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Wed Aug 16 19:39:57 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1di7um-0002EK-Ul
	for mharc-bug-bash@gnu.org; Wed, 16 Aug 2017 19:39:56 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:50779)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <lizhao.informatics@gmail.com>) id 1di4Wi-0007vD-7T
	for bug-bash@gnu.org; Wed, 16 Aug 2017 16:02:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <lizhao.informatics@gmail.com>) id 1di4Wh-0002Ac-8V
	for bug-bash@gnu.org; Wed, 16 Aug 2017 16:02:52 -0400
Received: from mail-oi0-x229.google.com ([2607:f8b0:4003:c06::229]:33578)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <lizhao.informatics@gmail.com>)
	id 1di4Wh-0002AC-2o
	for bug-bash@gnu.org; Wed, 16 Aug 2017 16:02:51 -0400
Received: by mail-oi0-x229.google.com with SMTP id f11so47056627oic.0
	for <bug-bash@gnu.org>; Wed, 16 Aug 2017 13:02:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:from:date:message-id:subject:to;
	bh=TRq/ZQaUVrpm600M69tD8CACBglQYR+7rvYNzvK/4SU=;
	b=c4tUkVpnCo0Jy2/B9oHRigY6agyglAdfNttjSrMYLuZ8oOzx3dSyV0rg/jhGiaWhyZ
	f7c/mRCs1ZzaON2+/dJJrw/Nl5nJ//7duSWfOSxd/ahLzfWxI8gFX4r54JIkpgNS9jNA
	ABluQ3vEvwXetgzyU3XEz1nfrsy2Bu7DTFOGznr3IOTMs87En1nDILMAffNwYUlzz7N0
	kEX2ivS8om8G9VKivrYzez/NCDqgXNbU5ApTEONxeDmPCf1Gx75pHDX/S4lzzRMeUy0F
	NTqH85cNcNjvbGlVhCPhKTL7ZWORBhlfOSSzVDjJELLNzcCw0HkF0YXBGHc3WkeHu3i5
	yWRA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
	bh=TRq/ZQaUVrpm600M69tD8CACBglQYR+7rvYNzvK/4SU=;
	b=YwWYKhIEoyMFjslfvtOjKodOXnJSQrS9a7dSiCEYrkwM6aLaQD9AZ0HHC/D6rFt9Sl
	ju9xR4LvPXcxMG6pmCBWRuiVOHYGaehITC+B7XUIYrfVjy+ZhFo5R81wLdWiQiLIj3NS
	/OacGVEprwRMj1bmq8Ki1EkiBalqFGv71V3n5PzYtGJaJZo+hezsfWmovai5QUh4bE0q
	g6KCQzCsb8wkzsE4X5OiA71z6quF35oO/42NfkdE7umwwJ0XsvzSbyFO7vyeFI6BhNTs
	3b1gYJeWlGmEZjmD2QxkngiQqZI0zY5HUF+vUzWYBWHxLURZysWq9+EZiRKk4wCH77Mu
	vtWA==
X-Gm-Message-State: AHYfb5iRcAdmPPkVRVT0UbVrKWqZQhYhml9rr/T6SrbEoFAsnUSlnNuc
	97WEmUA6aNoANJJK7Z+DB248fSgUzhHl
X-Received: by 10.202.205.80 with SMTP id d77mr3530051oig.13.1502913768148;
	Wed, 16 Aug 2017 13:02:48 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.74.142.88 with HTTP; Wed, 16 Aug 2017 13:02:47 -0700 (PDT)
From: Zhao Li <lizhao.informatics@gmail.com>
Date: Wed, 16 Aug 2017 15:02:47 -0500
Message-ID: <CAD5gOuRsWZG_-rdL4rS_hH47FapPdLhugs6Sd1kmoJvE=2okHQ@mail.gmail.com>
Subject: Performance issue of find function in Gluster File System
To: bug-bash@gnu.org
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:4003:c06::229
X-Mailman-Approved-At: Wed, 16 Aug 2017 19:39:55 -0400
Content-Type: text/plain; charset="UTF-8"
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 16 Aug 2017 20:02:53 -0000

Hi,

I found there is a big difference of time performance between "ls" function
and "find" function in Gluster File System
<https://gluster.readthedocs.io/en/latest/Administrator%20Guide/GlusterFS%20Introduction/>.
Here is the minimal working example.

mkdir tmp
touch tmp/{000..300}.txt

time find ./ -path '*tmp*' -name '*.txt'> /dev/null
real 0m42.629s
user 0m0.675s
sys 0m1.438s

time ls tmp/*.txt > /dev/null
real 0m0.042s
user 0m0.003s
sys 0m0.003s

So I am wondering what C code you use for "ls" and "find" and how you
explain "*" in "ls" and "find" to lead to this big difference in Gluster
File System.

Thanks a lot.
Zhao

From MAILER-DAEMON Wed Aug 16 23:05:34 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1diB7m-0004db-5Q
	for mharc-bug-bash@gnu.org; Wed, 16 Aug 2017 23:05:34 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:44947)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1diB7k-0004cL-0q
	for bug-bash@gnu.org; Wed, 16 Aug 2017 23:05:32 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1diB7g-0004YY-TJ
	for bug-bash@gnu.org; Wed, 16 Aug 2017 23:05:31 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:41152
	helo=Ishtar.sc.tlinx.org)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <bash@tlinx.org>) id 1diB7g-0004Pu-Iv
	for bug-bash@gnu.org; Wed, 16 Aug 2017 23:05:28 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
	v7H35ILp098185; Wed, 16 Aug 2017 20:05:20 -0700
Message-ID: <599507EE.1010400@tlinx.org>
Date: Wed, 16 Aug 2017 20:05:18 -0700
From: L A Walsh <bash@tlinx.org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: Zhao Li <lizhao.informatics@gmail.com>
CC: bug-bash@gnu.org
Subject: Re: Performance issue of find function in Gluster File System
References: <CAD5gOuRsWZG_-rdL4rS_hH47FapPdLhugs6Sd1kmoJvE=2okHQ@mail.gmail.com>
In-Reply-To: <CAD5gOuRsWZG_-rdL4rS_hH47FapPdLhugs6Sd1kmoJvE=2okHQ@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
	timestamps) [generic] [fuzzy]
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 17 Aug 2017 03:05:32 -0000

Zhao Li wrote:
> So I am wondering what C code you use for "ls" and "find" and how you
> explain "*" in "ls" and "find" to lead to this big difference in Gluster
> File System.
>   
---
    Nothing to do with Gluster, bash, ls or find, but w/the example.
I did both w/output to files in ./tmp -- you need to start
at the same place in both.

your 'find' command should be:

time find tmp/*.txt -path '*tmp*' -name '*.txt'> /dev/null

I.e.: use the same starting point: 'tmp/*.txt'






From MAILER-DAEMON Thu Aug 17 01:52:43 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1diDjX-00039H-3Q
	for mharc-bug-bash@gnu.org; Thu, 17 Aug 2017 01:52:43 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:36191)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1diDjT-00033z-BF
	for bug-bash@gnu.org; Thu, 17 Aug 2017 01:52:40 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1diDjS-00052o-6x
	for bug-bash@gnu.org; Thu, 17 Aug 2017 01:52:39 -0400
Received: from mail-qt0-x22e.google.com ([2607:f8b0:400d:c0d::22e]:37994)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <pierre.gaston@gmail.com>)
	id 1diDjS-00051Q-2X
	for bug-bash@gnu.org; Thu, 17 Aug 2017 01:52:38 -0400
Received: by mail-qt0-x22e.google.com with SMTP id t37so32311172qtg.5
	for <bug-bash@gnu.org>; Wed, 16 Aug 2017 22:52:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc; bh=z7023sJ2ONdfVtPiFkZ5xajzg9wFtgCu/OzJ2eltz4k=;
	b=s/LCRfkJPfx7Xr6FIyzaa3nnsPWTZRMbdnHj+gJ2qodWCf8CgVoz6mYv6GU5DJG9OW
	Ihbdv92PN0tv9IDqrmMLBfjeSn54GjS1X1MtDYcwavKRGv98Erj5OAlpNKNpzImKYSRS
	7PK3uq1cxjMn6hHOC7mZnUJc7lM6RqK2Ss2sdaYZ6/7aCp/gUXYgYuSs4//aKv7+OkQ/
	6aq95lxNRg8oNUXPtXPIIH6E3vX0FQ8eYwRX628SgiM9J0Trl4aDcoCsNziZRlWS+bH2
	wsRV6stQASVkiQ0PcRA3yKnecRajTI0m9RQ8ZyNcN+UQl88BF6zBEGKmOaS6gVJIar+G
	B70g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to:cc;
	bh=z7023sJ2ONdfVtPiFkZ5xajzg9wFtgCu/OzJ2eltz4k=;
	b=g8OzuYKS/BUh1PogsOOo2XTxkcF8Eiz9qsCwrZm3l3nfei/x2mFPWxq/2QF6Bdsl/0
	zUcVnrdmnzLKRjBOUqaYV5WzVdHG5mNRkiPs3nkRl/X1qcE1ji7O7YyrLM45kidW/jI5
	ZnqaXIJ0C9owdfV8RyqsFDaic9R+F26SVlpwFZsVTpDCXKiOnJrUuFQ5jqkpJfF9MBJP
	4vcjMYW9dbpiCF8dGNNI+52dNKzPuAZ2b3K2eBHc89l67zoQKqSEAhV2Hk2KuBuLxrSh
	Oj7V0cRZB4OzEf8q8UkkctjhDwp2ZR6yGpDBxQxeMKgFJ1jbg+LKvdwyOXZwlwN5CjNc
	q8lw==
X-Gm-Message-State: AHYfb5jYCfUCnO4+qlfrI/thsG8BZDP+vbqj+bKdV5zI39s3aek+rkMH
	KSlbPoASN4qW0Mm2FC95dNHb3Yq3TA==
X-Received: by 10.200.40.204 with SMTP id j12mr5476693qtj.139.1502949156087;
	Wed, 16 Aug 2017 22:52:36 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.12.171.2 with HTTP; Wed, 16 Aug 2017 22:52:15 -0700 (PDT)
In-Reply-To: <CAD5gOuRsWZG_-rdL4rS_hH47FapPdLhugs6Sd1kmoJvE=2okHQ@mail.gmail.com>
References: <CAD5gOuRsWZG_-rdL4rS_hH47FapPdLhugs6Sd1kmoJvE=2okHQ@mail.gmail.com>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Thu, 17 Aug 2017 08:52:15 +0300
Message-ID: <CAPSX3sTF1kHy4VS2iwg930te4+6B=hiBr4ye554XmKAUQi_c7w@mail.gmail.com>
Subject: Re: Performance issue of find function in Gluster File System
To: Zhao Li <lizhao.informatics@gmail.com>
Cc: "bug-bash@gnu.org" <bug-bash@gnu.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:400d:c0d::22e
Content-Type: text/plain; charset="UTF-8"
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 17 Aug 2017 05:52:40 -0000

On Wed, Aug 16, 2017 at 11:02 PM, Zhao Li <lizhao.informatics@gmail.com>
wrote:

> Hi,
>
> I found there is a big difference of time performance between "ls" function
> and "find" function in Gluster File System
> <https://gluster.readthedocs.io/en/latest/Administrator%20Gu
> ide/GlusterFS%20Introduction/>.
> Here is the minimal working example.
>
> mkdir tmp
> touch tmp/{000..300}.txt
>
> time find ./ -path '*tmp*' -name '*.txt'> /dev/null
> real 0m42.629s
> user 0m0.675s
> sys 0m1.438s
>
> time ls tmp/*.txt > /dev/null
> real 0m0.042s
> user 0m0.003s
> sys 0m0.003s
>
> So I am wondering what C code you use for "ls" and "find" and how you
> explain "*" in "ls" and "find" to lead to this big difference in Gluster
> File System.
>
> Thanks a lot.
> Zhao
>

There are several differences, first note  that "ls" is not the one finding
the files. The shell is expanding *.txt then ls is passed all the files as
arguments.
*.txt is not recursive so only the files directly under /tmp will be search

In your find command, -path matches the whole path (/ included) and your
find command will descend in all the directories, whether they match tmp or
not, so depending on where you started to search from, it may search your
whole / partition.

A more comparable command would be:

find /tmp -name tmp -o -prune -name '*.txt' -print

or if your find command supports it:

find /tmp -maxdepth 1 -name '*.txt'

Note also that ls and find are separate tools that are not developed along
with bash.

For gnu find: https://www.gnu.org/software/findutils/
For gnu ls: https://www.gnu.org/software/coreutils/coreutils.html

But there are also other implementation for various systems.

From MAILER-DAEMON Thu Aug 17 10:01:01 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1diLM5-0006jL-5J
	for mharc-bug-bash@gnu.org; Thu, 17 Aug 2017 10:01:01 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56245)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1diLLy-0006eh-Hf
	for bug-bash@gnu.org; Thu, 17 Aug 2017 10:00:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1diLLq-0004hM-Qn
	for bug-bash@gnu.org; Thu, 17 Aug 2017 10:00:54 -0400
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:21158
	helo=mpv3-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1diLLq-0004hB-Kt
	for bug-bash@gnu.org; Thu, 17 Aug 2017 10:00:46 -0400
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id ANG77973; Thu, 17 Aug 2017 10:00:44 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id BIN54222 (AUTH cpr);
	Thu, 17 Aug 2017 10:00:42 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: Performance issue of find function in Gluster File System
To: Zhao Li <lizhao.informatics@gmail.com>, bug-bash@gnu.org
References: <CAD5gOuRsWZG_-rdL4rS_hH47FapPdLhugs6Sd1kmoJvE=2okHQ@mail.gmail.com>
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <affcf028-952b-ff41-f464-135b61e83863@case.edu>
Date: Thu, 17 Aug 2017 10:00:40 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <CAD5gOuRsWZG_-rdL4rS_hH47FapPdLhugs6Sd1kmoJvE=2okHQ@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Junkmail-Status: score=7/60, host=mpv3-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.17.124816:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__SUBJ_ALPHA_END, __TO_MALFORMED_2, __TO_NAME,
	__TO_NAME_DIFF_FROM_ACC, __REFERENCES, __HAS_FROM,
	FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA,
	__USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION,
	__IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE,
	__REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC,
	__FROM_DOMAIN_IN_ANY_CC1, __FROM_DOMAIN_IN_ANY_CC2,
	__REPLYTO_SAMEAS_FROM_DOMAIN, __ANY_URI, __HTTPS_URI,
	__URI_WITH_PATH, __URI_NO_WWW, __CP_URI_IN_BODY,
	__STOCK_PHRASE_7, __SUBJ_ALPHA_NEGATE,
	__MULTIPLE_URI_TEXT, __URI_IN_BODY, __URI_NOT_IMG,
	__FORWARDED_MSG, __NO_HTML_TAG_RAW,
	BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_800_899,
	__MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01,
	HTML_00_10, BODY_SIZE_5000_LESS, IN_REP_TO, MSG_THREAD,
	__FROM_DOMAIN_IN_RCPT, __TO_REAL_NAMES, [TRUNCATED],
	so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 17 Aug 2017 14:00:59 -0000

On 8/16/17 4:02 PM, Zhao Li wrote:
> Hi,
> 
> I found there is a big difference of time performance between "ls" function
> and "find" function in Gluster File System
> <https://gluster.readthedocs.io/en/latest/Administrator%20Guide/GlusterFS%20Introduction/>.
> Here is the minimal working example.
> 
> mkdir tmp
> touch tmp/{000..300}.txt
> 
> time find ./ -path '*tmp*' -name '*.txt'> /dev/null
> real 0m42.629s
> user 0m0.675s
> sys 0m1.438s
> 
> time ls tmp/*.txt > /dev/null
> real 0m0.042s
> user 0m0.003s
> sys 0m0.003s

These are not comparable commands.  It might be worth your while to
consider why and how the different commands operate.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Thu Aug 17 10:40:30 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1diLyI-0006MB-Mw
	for mharc-bug-bash@gnu.org; Thu, 17 Aug 2017 10:40:30 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:39775)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <matthew.persico@gmail.com>) id 1diLyF-0006Jr-Uj
	for bug-bash@gnu.org; Thu, 17 Aug 2017 10:40:29 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <matthew.persico@gmail.com>) id 1diLyE-0005Um-HX
	for bug-bash@gnu.org; Thu, 17 Aug 2017 10:40:27 -0400
Received: from mail-lf0-x235.google.com ([2a00:1450:4010:c07::235]:36546)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <matthew.persico@gmail.com>)
	id 1diLyE-0005Mi-4N
	for bug-bash@gnu.org; Thu, 17 Aug 2017 10:40:26 -0400
Received: by mail-lf0-x235.google.com with SMTP id o85so30597868lff.3
	for <bug-bash@gnu.org>; Thu, 17 Aug 2017 07:40:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc; bh=26chkhk62i3VDfFs5CUnJJyR3s2LTbNVM4HUYRhv25w=;
	b=jw/qH9dKsSm6t5ywjO9YqIA955jlBXroLmAO6xth4MgvVwsOiXoFWBrW75EjZi7bz3
	7Npmm7IiXrmJ1V1zNKL8r2MDd4iQQ7o5Yzrd1nqLytBtbd00ukmjLfk9bJaZvFsnW3z1
	gsJ4YVJO2m7eFHZCqwJivwIZnwcmUQ8rwuPHWJ95QN1jAZ9GzpuE4/caS115p7/9Ab9N
	ITF+T8rLth6JcG2RSmsVRBoKkGzkvJIE2ul0jDSL1UnxYfahzF20Jz8KXbwux3iC95Mk
	4z+U3yv/n/Icoosb1ipDoZ85s3m+C9Bn27MDCTHkz3MPRHvb49wlskMU0CpIhBTILBpD
	lNnw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to:cc;
	bh=26chkhk62i3VDfFs5CUnJJyR3s2LTbNVM4HUYRhv25w=;
	b=kxiTW+HLI931MD9z3o1KBAu7Jeet1NJ/heUyKzLIBki0+Z57W9PAlCcWQOf7i4yDsY
	n0kdJW/77cEtvios3HH3VpvAaPdu1BiP1SpowlXtLy4mroc0JCtylAYVrkXUrSrVZ/hc
	ZOAknnWH9YdImmYOz+3+smqgN7fbNNXnFwKLY3jDLBEnylYBEWityLjs5b6MQKdsbIjW
	mMzh+Af7I15GuytgJouHnKsLu4c+FyX6npJOLAPT8OHh+i+uK6yE2ENusdydOSUgnlMj
	ZD5L2yjW2UW8uxNm4L7vyLUPUGafudFdq7GqJgC1KCjyiHpq27vWtq6LQka4uekE2JuX
	eM+g==
X-Gm-Message-State: AHYfb5gI1dOIi7zKaI1kF3/Ak/stuXhcfadCBjwS0E5CHUBh+VSK9WB9
	b/9QoB+exkCIsPZJsLfmffUgBsC3CA==
X-Received: by 10.25.211.7 with SMTP id k7mr608614lfg.232.1502980822504; Thu,
	17 Aug 2017 07:40:22 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.25.99.139 with HTTP; Thu, 17 Aug 2017 07:40:01 -0700 (PDT)
In-Reply-To: <CAL20dLAU7q0gOOtkDbRokrjkcf8XTFOZ-wcJZDsA1cadesjF3A@mail.gmail.com>
References: <CAL20dLBsQEAPCidjL+vv2=nDJaKP2X5zgrKpi0qe-a86+hC6+g@mail.gmail.com>
	<CAOSMAuvzKTU8JK9vS5TmXf4ArbK_BNSy4JRdFRbwG3-seZD7_g@mail.gmail.com>
	<CAL20dLAC+1XyRfNTHb5EKdK-ebA+M=q-djZDkG+C_8+ag4-wWg@mail.gmail.com>
	<5da6c99c-c530-952c-5921-77ca89d7cf12@case.edu>
	<CAL20dLDANnMoZoZumRihcKbWNMXvxUW_9Os=EAuKSV-oXz_rsg@mail.gmail.com>
	<68576480-e27d-292f-1c45-1b2470663e87@case.edu>
	<CAL20dLAU7q0gOOtkDbRokrjkcf8XTFOZ-wcJZDsA1cadesjF3A@mail.gmail.com>
From: Matthew Persico <matthew.persico@gmail.com>
Date: Thu, 17 Aug 2017 10:40:01 -0400
Message-ID: <CAL20dLDHeZCiydOmO8f4sRwWhhiYrn0WhZRtrNy6PFbYv7KMXw@mail.gmail.com>
Subject: Re: Patch for autoload.v3 to allow export of function
To: Chester Ramey <chet.ramey@case.edu>
Cc: "bug-bash@gnu.org" <bug-bash@gnu.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2a00:1450:4010:c07::235
Content-Type: text/plain; charset="UTF-8"
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 17 Aug 2017 14:40:29 -0000

It has finally occurred to me after 24 hours that attachments are pretty
useless in this forum. I will repost this evening with the contents in the
mail body. And, since this is not longer a patch but really a rerwite, I'll
use a fresh thread.

On Wed, Aug 16, 2017 at 1:56 AM, Matthew Persico <matthew.persico@gmail.com>
wrote:

> Please see the attached 'autoload.v4' and 'autoload.v4.t'.
>
> On Mon, Aug 14, 2017 at 10:30 AM, Chet Ramey <chet.ramey@case.edu> wrote:
>
>> On 8/11/17 6:55 PM, Matthew Persico wrote:
>>
>> > What I propose to do between steps 2 and 3 is
>> >
>> > 2.1 - After sourcing the function in, type the function to get its text
>> > 2.2 - type appears to pretty print function code. No matter how sloppy
>> or
>> > compact your function is on disk, type presents it to you in a
>> particular
>> > format. To wit, for a function 'foo'
>> >
>> > foo is a function
>> > foo ()
>> > {
>> >     first line of code
>> >     ....
>> > }
>> >
>> > That's regular. Therefore it can be parsed.
>> >
>> > 2.3 - With the output of the type command, I strip out line 1 and after
>> > line 3, I add the text
>> >
>> > local AUTOLOADED='foo'
>> >
>> > 2.4 - evaling the modified code updates the function to include that
>> line
>> >
>> > 2.5 - Determining if a function is autoloaded is as simple as executing
>> > (something like)
>> >
>> > $ type foo | grep 'local AUTOLOADED='foo'.
>> >
>> > which is REALLY REALLY fast, even under Cygwin on Windows 10. Yeah,
>> that's
>> > one of the environments I'm using for testing.
>> >
>> > No more unexportable arrays and hashes. Self documenting. And
>> 'AUTOLOADED'
>> > can be changed to something less likely to clash with existing code.
>> And we
>> > document that any function you are going to autoload must avoid using
>> the
>> > variable AUTOLOADED, or whatever it is eventually.
>> >
>> > So, before I post code here, what say you all? Is the idea of doing this
>> > code injection so hideous that it would never be accepted, or is it
>> worth
>> > submitting the code for perusal?
>>
>> Of course it's worth submitting the code for folks to look at. It might be
>> possible to add a couple more checks to insulate it against possible
>> future
>> changes to the `type' output.
>>
>> --
>> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>>                  ``Ars longa, vita brevis'' - Hippocrates
>> Chet Ramey, UTech, CWRU    chet@case.edu
>> http://cnswww.cns.cwru.edu/~chet/
>>
>
>
>
> --
> Matthew O. Persico
>



-- 
Matthew O. Persico

From MAILER-DAEMON Fri Aug 18 11:48:24 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dijVY-00039u-NN
	for mharc-bug-bash@gnu.org; Fri, 18 Aug 2017 11:48:24 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:44724)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <van@star.ocn.ne.jp>) id 1dij6V-00036W-7B
	for bug-bash@gnu.org; Fri, 18 Aug 2017 11:22:32 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <van@star.ocn.ne.jp>) id 1dij6R-0002mL-7s
	for bug-bash@gnu.org; Fri, 18 Aug 2017 11:22:31 -0400
Received: from mogw0440.ocn.ad.jp ([118.23.109.23]:59102)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <van@star.ocn.ne.jp>) id 1dij6Q-0002l5-OF
	for bug-bash@gnu.org; Fri, 18 Aug 2017 11:22:27 -0400
Received: from mf-smf-ucb013.ocn.ad.jp (mf-smf-ucb013.ocn.ad.jp
	[153.149.228.232])
	by mogw0440.ocn.ad.jp (Postfix) with ESMTP id 8E55E4824A
	for <bug-bash@gnu.org>; Sat, 19 Aug 2017 00:22:21 +0900 (JST)
Received: from mf-smf-ucb013.ocn.ad.jp (mf-smf-ucb013 [153.149.228.232])
	by mf-smf-ucb013.ocn.ad.jp (Postfix) with ESMTP id 77B4BA0023B
	for <bug-bash@gnu.org>; Sat, 19 Aug 2017 00:22:21 +0900 (JST)
Received: from ntt.pod01.mv-mta-ucb029 (mv-mta-ucb029.ocn.ad.jp
	[153.149.230.163])
	by mf-smf-ucb013.ocn.ad.jp (Switch-3.3.4/Switch-3.3.4) with ESMTP id
	v7IFMLPZ064065
	for <bug-bash@gnu.org>; Sat, 19 Aug 2017 00:22:21 +0900
Received: from smtp.ocn.ne.jp ([153.149.227.134])
	by ntt.pod01.mv-mta-ucb029 with 
	id yfNM1v0012ud8JZ01fNMCw; Fri, 18 Aug 2017 15:22:21 +0000
Received: from [10.0.1.40] (p480186-ipngn7701hodogaya.kanagawa.ocn.ne.jp
	[153.225.194.186]) by smtp.ocn.ne.jp (Postfix) with ESMTPA
	for <bug-bash@gnu.org>; Sat, 19 Aug 2017 00:22:21 +0900 (JST)
To: bug-bash@gnu.org
From: vanou <van@star.ocn.ne.jp>
Subject: Document bug of 'for' compound command
Message-ID: <1ca37384-c4be-ba00-c5c3-ca86a0d6651d@star.ocn.ne.jp>
Date: Sat, 19 Aug 2017 00:22:20 +0900
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
	Thunderbird/52.2.1
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy]
X-Received-From: 118.23.109.23
X-Mailman-Approved-At: Fri, 18 Aug 2017 11:48:23 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 18 Aug 2017 15:22:32 -0000

Hello,

I think, there is document bug related to 'for' compound command in both 
Man page and Info doc.


In man page, description of 'for' compound command ...

****************************************************************************************************
*  for (( expr1 ; expr2 ; expr3 )) ; do list ; done
*     First, the arithmetic expression expr1 is evaluated according
*     to the rules described below under ARITHMETIC EVALUATION.
*     The arithmetic  expression  expr2 is  then evaluated  repeatedly
*     until it evaluates to 
zero.                                          <-- not zero, but 1
*     Each time expr2 evaluates to a non-zero 
value,                       <-- not non-zero,but 0
*     list is executed and the arithmetic expression expr3 is evaluated.
*     If any expression is omitted, it behaves as if it evaluates to 
1.    <-- not 1, but 0
*     The return value is the exit status of the last command in list
*     that is executed, or false if any of the expressions is invalid.
****************************************************************************************************


And same document bug in Info documentation of bash.

This bug is seen at bash 4.4.

Thanks,
Vanou



From MAILER-DAEMON Fri Aug 18 12:00:01 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dijgm-0000MU-R1
	for mharc-bug-bash@gnu.org; Fri, 18 Aug 2017 12:00:00 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:52908)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1dijgk-0000Ks-NB
	for bug-bash@gnu.org; Fri, 18 Aug 2017 11:59:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1dijgj-00055R-Rv
	for bug-bash@gnu.org; Fri, 18 Aug 2017 11:59:58 -0400
Received: from mail-qk0-x234.google.com ([2607:f8b0:400d:c09::234]:33453)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <pierre.gaston@gmail.com>)
	id 1dijgj-000556-Mr
	for bug-bash@gnu.org; Fri, 18 Aug 2017 11:59:57 -0400
Received: by mail-qk0-x234.google.com with SMTP id a77so55230379qkb.0
	for <bug-bash@gnu.org>; Fri, 18 Aug 2017 08:59:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc; bh=F3tDd7STpZem7Xw4cNg/5CFY5zL6dyzsnrj7mneI6NM=;
	b=c0AKr6SxtaXw3SkFhVvCEilSVJVGRTLbv/sqdof5KZTuaG4mp1jkyfC5Ku5thx8jzZ
	hAVmPJv6Fh2kHtHWh/mQwUL/scm86KD4sByp9tL+mS7CKhudYzecQvWj7FAtcFQzDmCS
	tFLuKiGK0U74cEKCVuP2B64QRrusJeUxLxBeszTxxdsNdr/wzzKLRayVtTGJag1iukxB
	wcDuIbNM6hoQMV9mc4DhqQRw/yPGjhJv0F5455+zlZ6WiAR4qHDZDN7qSEPtX346OEpc
	wSGOUaT6qZy9ou6FRCWKEmpoISw4xVGsO1GPHZf/319Zdcs4Cg8E0PE7T4sado1nekda
	kzZA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to:cc;
	bh=F3tDd7STpZem7Xw4cNg/5CFY5zL6dyzsnrj7mneI6NM=;
	b=mh+2KD3DOMdNoLxrOnQzxhvxXpRmGEqu/js3JiaBXaUK6jRCYA9Xvb/QVehdZiYj11
	4Bn6A1GE6RTEJG4zg7ozqF2P92ql2yG1WvPJRNAzA0lWosynERqaIA4b1fcbQSXpcudK
	BYkbbIcovVV3A+0Sfrc5ue9kYJ2ofd17gTVwZ4zhXNpVTtuonnBpqVd9UxGJjzYYV9uY
	aSFBi2cxpy5nr5oXu9xI5HzBQVtNclZWLjk2dCBun0P5ZZ8SICY7U7O58W3Gz/Bc2G6T
	ADFcQBrG9B9xJ+lMLNpjsvimwcQuPDLiK4lot3BKdkJ4JqGDRm6dV5sFtO0zxNIBQ87f
	m2Wg==
X-Gm-Message-State: AHYfb5jNVwJQuJ2IrI6O93Sly/4TktFnKgD/XFA1kb5tuNEhehnetqeE
	bHVAuvQjzf+cTG40Ri3nLJkEMUIT6rQAPYs=
X-Received: by 10.55.127.1 with SMTP id a1mr7402641qkd.335.1503071995816; Fri,
	18 Aug 2017 08:59:55 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.12.171.2 with HTTP; Fri, 18 Aug 2017 08:59:35 -0700 (PDT)
In-Reply-To: <1ca37384-c4be-ba00-c5c3-ca86a0d6651d@star.ocn.ne.jp>
References: <1ca37384-c4be-ba00-c5c3-ca86a0d6651d@star.ocn.ne.jp>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Fri, 18 Aug 2017 18:59:35 +0300
Message-ID: <CAPSX3sTWNQbS0SGj5DSNNLUajkswXXkaNCmLK9zzZ45-6D+SZQ@mail.gmail.com>
Subject: Re: Document bug of 'for' compound command
To: vanou <van@star.ocn.ne.jp>
Cc: "bug-bash@gnu.org" <bug-bash@gnu.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:400d:c09::234
Content-Type: text/plain; charset="UTF-8"
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 18 Aug 2017 15:59:59 -0000

On Fri, Aug 18, 2017 at 6:22 PM, vanou <van@star.ocn.ne.jp> wrote:

> Hello,
>
> I think, there is document bug related to 'for' compound command in both
> Man page and Info doc.
>
>
> In man page, description of 'for' compound command ...
>
> ************************************************************
> ****************************************
> *  for (( expr1 ; expr2 ; expr3 )) ; do list ; done
> *     First, the arithmetic expression expr1 is evaluated according
> *     to the rules described below under ARITHMETIC EVALUATION.
> *     The arithmetic  expression  expr2 is  then evaluated  repeatedly
> *     until it evaluates to zero.
> <-- not zero, but 1
> *     Each time expr2 evaluates to a non-zero value,
>  <-- not non-zero,but 0
> *     list is executed and the arithmetic expression expr3 is evaluated.
> *     If any expression is omitted, it behaves as if it evaluates to 1.
> <-- not 1, but 0
> *     The return value is the exit status of the last command in list
> *     that is executed, or false if any of the expressions is invalid.
> ************************************************************
> ****************************************
>
>
> And same document bug in Info documentation of bash.
>
> This bug is seen at bash 4.4.
>
> Thanks,
> Vanou
>
>
> The documentation seems ok, what makes you think the contrary?
eg
for ((;0;)); do echo foo;done # prints nothing
for ((;1;)); do echo foo;done # is infinte
for ((;;)); do echo foo;done # is also infinite

From MAILER-DAEMON Fri Aug 18 12:12:18 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dijsg-0001Bv-4h
	for mharc-bug-bash@gnu.org; Fri, 18 Aug 2017 12:12:18 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56311)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1dijse-0001Ab-8B
	for bug-bash@gnu.org; Fri, 18 Aug 2017 12:12:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1dijsd-00045U-6O
	for bug-bash@gnu.org; Fri, 18 Aug 2017 12:12:16 -0400
Received: from mail-oi0-x22a.google.com ([2607:f8b0:4003:c06::22a]:35025)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <pyroinajar@gmail.com>)
	id 1dijsd-000429-0e
	for bug-bash@gnu.org; Fri, 18 Aug 2017 12:12:15 -0400
Received: by mail-oi0-x22a.google.com with SMTP id e124so101355000oig.2
	for <bug-bash@gnu.org>; Fri, 18 Aug 2017 09:12:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:sender:in-reply-to:references:from:date:message-id
	:subject:to:cc;
	bh=Z2Skq76ARIEjChm2tq4K4gWApqbhSlAAzXf/kMmCVnk=;
	b=uLf+2A6ZvFj0kPSrX2xfujD6Sd3XRBfbhVZvOjzk57WbjM84OdtTJZD28qvsLCMYbv
	uUD//x77xkWZB+7MTES0xOHQC57JVeTX5N+LkD8CPm3SpitCnUJL9EcAmFFe0137qfRm
	uduupkubAyjPxKoaDn+7UGCNtpD8ONnmrYUQRYwD6x2J4oQaKUShwhR5AtSbjNuZsgT8
	cX37eAI572wm49e2pulTY4Rs243he0lMLVL3LsO9tzM16WT2RIFFf+DTGxPYyekOIERs
	6oGI3Uf8DEoLz5uyKqvUOkQzeqQ6c270mfx/Q/glrXI3MOsaR1d+k58cOuFYpNxNKdz2
	PA0w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
	:date:message-id:subject:to:cc;
	bh=Z2Skq76ARIEjChm2tq4K4gWApqbhSlAAzXf/kMmCVnk=;
	b=R8UVA6SNGuwhc+IUUXc4EDeX0RHh8K5gnKdU4XFa2l6sMah+HPj1hM1pq4gV5oXIfD
	t0JQENd/gkEbCqzheJmt1/vXbZqwnRjL0PGJJYIeaCrEi1mdgi9WpsI1cAwfvaIPKDPS
	TcJWRkPNEUAlOfHK8PEZHjkxHIX05xJ2eRlXs5Wu+/BPoMETL9Use1TW+RL6XecwCYsd
	ArpbKMJcZYs/aBFGzY+J2ovigFcAXeq/8IjsrKXRRwyQFQzT0HTgiCCUSUylIjFa4Xrf
	yQ7m0Bu24TivUNGy1MxrUN3vy6vLGJLN8Jk4kYcYD+u/ya223Z8wBAr+RKpDKrwrqTs+
	HhHQ==
X-Gm-Message-State: AHYfb5j4kXalx/5zOyH5R2cG0L1QBEmXIjz48w7n7rF2cc+ewfdHHJsK
	RDGx5JyW7tLRn9F5xnyrL2tmvDA2KQ==
X-Received: by 10.202.235.4 with SMTP id j4mr12790315oih.43.1503072733037;
	Fri, 18 Aug 2017 09:12:13 -0700 (PDT)
MIME-Version: 1.0
Sender: pyroinajar@gmail.com
Received: by 10.74.85.66 with HTTP; Fri, 18 Aug 2017 09:12:12 -0700 (PDT)
In-Reply-To: <CAPSX3sTWNQbS0SGj5DSNNLUajkswXXkaNCmLK9zzZ45-6D+SZQ@mail.gmail.com>
References: <1ca37384-c4be-ba00-c5c3-ca86a0d6651d@star.ocn.ne.jp>
	<CAPSX3sTWNQbS0SGj5DSNNLUajkswXXkaNCmLK9zzZ45-6D+SZQ@mail.gmail.com>
From: DJ Mills <danielmills1@gmail.com>
Date: Fri, 18 Aug 2017 12:12:12 -0400
X-Google-Sender-Auth: vEiBDy3EWaopotxAp3C_JqsK858
Message-ID: <CAPg6Z0-Ma+BCdo7bWFbV6AS-UDM0buNgJGDPc_=kVtTwuC4mkQ@mail.gmail.com>
Subject: Re: Document bug of 'for' compound command
To: Pierre Gaston <pierre.gaston@gmail.com>
Cc: vanou <van@star.ocn.ne.jp>, "bug-bash@gnu.org" <bug-bash@gnu.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:4003:c06::22a
Content-Type: text/plain; charset="UTF-8"
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 18 Aug 2017 16:12:17 -0000

It's an arithmetic expression, 1 is true and 0 is false. This is not the
same as the exit status of a command

On Fri, Aug 18, 2017 at 11:59 AM, Pierre Gaston <pierre.gaston@gmail.com>
wrote:

> On Fri, Aug 18, 2017 at 6:22 PM, vanou <van@star.ocn.ne.jp> wrote:
>
> > Hello,
> >
> > I think, there is document bug related to 'for' compound command in both
> > Man page and Info doc.
> >
> >
> > In man page, description of 'for' compound command ...
> >
> > ************************************************************
> > ****************************************
> > *  for (( expr1 ; expr2 ; expr3 )) ; do list ; done
> > *     First, the arithmetic expression expr1 is evaluated according
> > *     to the rules described below under ARITHMETIC EVALUATION.
> > *     The arithmetic  expression  expr2 is  then evaluated  repeatedly
> > *     until it evaluates to zero.
> > <-- not zero, but 1
> > *     Each time expr2 evaluates to a non-zero value,
> >  <-- not non-zero,but 0
> > *     list is executed and the arithmetic expression expr3 is evaluated.
> > *     If any expression is omitted, it behaves as if it evaluates to 1.
> > <-- not 1, but 0
> > *     The return value is the exit status of the last command in list
> > *     that is executed, or false if any of the expressions is invalid.
> > ************************************************************
> > ****************************************
> >
> >
> > And same document bug in Info documentation of bash.
> >
> > This bug is seen at bash 4.4.
> >
> > Thanks,
> > Vanou
> >
> >
> > The documentation seems ok, what makes you think the contrary?
> eg
> for ((;0;)); do echo foo;done # prints nothing
> for ((;1;)); do echo foo;done # is infinte
> for ((;;)); do echo foo;done # is also infinite
>

From MAILER-DAEMON Fri Aug 18 13:19:12 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dikvP-0005Rz-Vf
	for mharc-bug-bash@gnu.org; Fri, 18 Aug 2017 13:19:12 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:43726)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <van@star.ocn.ne.jp>) id 1dikvM-0005PS-3i
	for bug-bash@gnu.org; Fri, 18 Aug 2017 13:19:09 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <van@star.ocn.ne.jp>) id 1dikvI-0000Pu-UE
	for bug-bash@gnu.org; Fri, 18 Aug 2017 13:19:08 -0400
Received: from mogw1231.ocn.ad.jp ([153.149.235.32]:52073)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <van@star.ocn.ne.jp>) id 1dikvI-0000PG-7d
	for bug-bash@gnu.org; Fri, 18 Aug 2017 13:19:04 -0400
Received: from mf-smf-ucb013.ocn.ad.jp (mf-smf-ucb013.ocn.ad.jp
	[153.149.228.232])
	by mogw1231.ocn.ad.jp (Postfix) with ESMTP id 5FB7CD001F7;
	Sat, 19 Aug 2017 02:19:01 +0900 (JST)
Received: from mf-smf-ucb013.ocn.ad.jp (mf-smf-ucb013 [153.149.228.232])
	by mf-smf-ucb013.ocn.ad.jp (Postfix) with ESMTP id 44344A00238;
	Sat, 19 Aug 2017 02:19:01 +0900 (JST)
Received: from ntt.pod01.mv-mta-ucb025 (mv-mta-ucb025.ocn.ad.jp
	[153.149.142.99])
	by mf-smf-ucb013.ocn.ad.jp (Switch-3.3.4/Switch-3.3.4) with ESMTP id
	v7IHIxWF022320; Sat, 19 Aug 2017 02:19:01 +0900
Received: from smtp.ocn.ne.jp ([153.149.227.166])
	by ntt.pod01.mv-mta-ucb025 with 
	id yhK01v0013c2f7501hK0w8; Fri, 18 Aug 2017 17:19:00 +0000
Received: from [10.0.1.40] (p480186-ipngn7701hodogaya.kanagawa.ocn.ne.jp
	[153.225.194.186]) by smtp.ocn.ne.jp (Postfix) with ESMTPA;
	Sat, 19 Aug 2017 02:19:00 +0900 (JST)
Subject: Re: Document bug of 'for' compound command
To: DJ Mills <danielmills1@gmail.com>, Pierre Gaston <pierre.gaston@gmail.com>
Cc: "bug-bash@gnu.org" <bug-bash@gnu.org>
References: <1ca37384-c4be-ba00-c5c3-ca86a0d6651d@star.ocn.ne.jp>
	<CAPSX3sTWNQbS0SGj5DSNNLUajkswXXkaNCmLK9zzZ45-6D+SZQ@mail.gmail.com>
	<CAPg6Z0-Ma+BCdo7bWFbV6AS-UDM0buNgJGDPc_=kVtTwuC4mkQ@mail.gmail.com>
From: vanou <van@star.ocn.ne.jp>
Message-ID: <cd8be9c6-6588-bf92-6306-dcbe64ae6a4e@star.ocn.ne.jp>
Date: Sat, 19 Aug 2017 02:19:00 +0900
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
	Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <CAPg6Z0-Ma+BCdo7bWFbV6AS-UDM0buNgJGDPc_=kVtTwuC4mkQ@mail.gmail.com>
Content-Language: en-US
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From: 153.149.235.32
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 18 Aug 2017 17:19:10 -0000

Thanks Pierre Gaston and DJ Mills,

I misunderstood arithmetic expression and now make sense.

Thank you.


On 08/19/2017 01:12 AM, DJ Mills wrote:
> It's an arithmetic expression, 1 is true and 0 is false. This is not 
> the same as the exit status of a command
>
> On Fri, Aug 18, 2017 at 11:59 AM, Pierre Gaston 
> <pierre.gaston@gmail.com <mailto:pierre.gaston@gmail.com>> wrote:
>
>     On Fri, Aug 18, 2017 at 6:22 PM, vanou <van@star.ocn.ne.jp
>     <mailto:van@star.ocn.ne.jp>> wrote:
>
>     > Hello,
>     >
>     > I think, there is document bug related to 'for' compound command
>     in both
>     > Man page and Info doc.
>     >
>     >
>     > In man page, description of 'for' compound command ...
>     >
>     > ************************************************************
>     > ****************************************
>     > *  for (( expr1 ; expr2 ; expr3 )) ; do list ; done
>     > *     First, the arithmetic expression expr1 is evaluated according
>     > *     to the rules described below under ARITHMETIC EVALUATION.
>     > *     The arithmetic  expression  expr2 is  then evaluated 
>     repeatedly
>     > *     until it evaluates to zero.
>     > <-- not zero, but 1
>     > *     Each time expr2 evaluates to a non-zero value,
>     >  <-- not non-zero,but 0
>     > *     list is executed and the arithmetic expression expr3 is
>     evaluated.
>     > *     If any expression is omitted, it behaves as if it
>     evaluates to 1.
>     > <-- not 1, but 0
>     > *     The return value is the exit status of the last command in
>     list
>     > *     that is executed, or false if any of the expressions is
>     invalid.
>     > ************************************************************
>     > ****************************************
>     >
>     >
>     > And same document bug in Info documentation of bash.
>     >
>     > This bug is seen at bash 4.4.
>     >
>     > Thanks,
>     > Vanou
>     >
>     >
>     > The documentation seems ok, what makes you think the contrary?
>     eg
>     for ((;0;)); do echo foo;done # prints nothing
>     for ((;1;)); do echo foo;done # is infinte
>     for ((;;)); do echo foo;done # is also infinite
>
>


From MAILER-DAEMON Sat Aug 19 20:30:49 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1djE8f-0000nk-S0
	for mharc-bug-bash@gnu.org; Sat, 19 Aug 2017 20:30:49 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:55605)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1djE8d-0000mh-GF
	for bug-bash@gnu.org; Sat, 19 Aug 2017 20:30:48 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1djE8a-0008BC-C2
	for bug-bash@gnu.org; Sat, 19 Aug 2017 20:30:47 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:36274
	helo=Ishtar.sc.tlinx.org)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <bash@tlinx.org>) id 1djE8Z-00084M-KE
	for bug-bash@gnu.org; Sat, 19 Aug 2017 20:30:44 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
	v7K0UYRq087769
	for <bug-bash@gnu.org>; Sat, 19 Aug 2017 17:30:36 -0700
Message-ID: <5998D82A.3030607@tlinx.org>
Date: Sat, 19 Aug 2017 17:30:34 -0700
From: L A Walsh <bash@tlinx.org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: bug-bash <bug-bash@gnu.org>
Subject: extension of file-test primitives?
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
	timestamps) [generic] [fuzzy]
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 20 Aug 2017 00:30:48 -0000

Curious, but how difficult or problematic would it be
to allow using brace-expansion (ex. {f,x} ) as a short-hand
to test/combine file-op tests like:

Allowing:

   test -{f,x} /bin/ls && ...
or
    if [[ -{f,x} $file ]]; then ... ; fi

instead of:

   test -f /bin/ls && test -x /bin/ls && ...


??


(maybe boring background):
Came from a spur-of-the-moment experimenting with bash equivalents
to perl's file-op chaining, like:

  if (-f -x "/bin/ls") { ... }

and came up with something a bit odd but working, but
a bit quirky looking for a lib-type function or alias:

  eval 'test -'{f,x}' /bin/ls && :' && echo executable file

and wondered if bash might adopt some shortcut for testing
multiple flags or if it was too specialized for such a minor
optimization...

just a minor curiosity if code was submitted...etc...etc...?





From MAILER-DAEMON Sat Aug 19 21:47:57 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1djFLI-00061V-Q9
	for mharc-bug-bash@gnu.org; Sat, 19 Aug 2017 21:47:56 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:34212)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <info@leonklingele.de>) id 1djFLH-00060S-3l
	for bug-bash@gnu.org; Sat, 19 Aug 2017 21:47:56 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <info@leonklingele.de>) id 1djFLE-0008Es-1V
	for bug-bash@gnu.org; Sat, 19 Aug 2017 21:47:55 -0400
Received: from sky.leonklingele.de ([212.53.140.36]:41834)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <info@leonklingele.de>)
	id 1djFLD-0008E4-Nq
	for bug-bash@gnu.org; Sat, 19 Aug 2017 21:47:51 -0400
Received: from localhost (localhost [127.0.0.1])
	by sky.leonklingele.de (Postfix) with ESMTP id 24E202A63D6;
	Sun, 20 Aug 2017 03:47:48 +0200 (CEST)
Received: from sky.leonklingele.de ([127.0.0.1])
	by localhost (sky.leonklingele.de [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id cyCc49YxxC0e; Sun, 20 Aug 2017 03:47:46 +0200 (CEST)
From: Leon Klingele <info@leonklingele.de>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=leonklingele.de;
	s=20160101; t=1503193666;
	bh=xfdHMSW2lPg3352RfT7OMG8vKGUnKY/CSGwNx8ohxB0=;
	h=From:Subject:Date:Cc:To:From;
	b=b/OF3ZbrRDB0GTTw00ZsV0YwHzj+v0pbeThxp5XenCKmsx+k0tV5s2vCjMQnRUYqP
	/6wd/sWFrifyMTueTOWhJ7xVjHUhTouTR0ZrcrQx6HKk+6QJLA7JfwqptkPT2jmiN4
	nOvumzGC4jVVfS/IfDBEaaLAkd4f3jtFeGaIq677PT9PYKX9m9Caf64S3KXPC/4TPJ
	W9DKBm8hLqsg8HVlf6XmyIt1JcgXG5raEpRilPEHnGVMmOIqU0yJn7SO6rhmnLi384
	CsMP6RguxWs33BGdtSNgsKCbo/OyMYDBe2VyeblzNPh9G/hCMdLzouZOObxxwMRfIv
	onHXYtTTd0dyg==
Content-Type: multipart/signed;
	boundary="Apple-Mail=_877F2EC2-3C2F-4344-9FA8-EB83328F602F";
	protocol="application/pgp-signature"; micalg=pgp-sha512
Subject: Re: Line wrapping issues
Date: Sun, 20 Aug 2017 03:47:47 +0200
Message-Id: <CB1AC5C9-F770-448B-8071-5446227EF7CA@leonklingele.de>
Cc: angel@16bits.net,
 danielmills1@gmail.com
To: bug-bash@gnu.org
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From: 212.53.140.36
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 20 Aug 2017 01:47:56 -0000


--Apple-Mail=_877F2EC2-3C2F-4344-9FA8-EB83328F602F
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

On 2017-08-14 =C3=81ngel wrote:
> I guess the sourced file corresponds to this script?
> https://github.com/junegunn/fzf/blob/master/shell/completion.bash
Yes.

On 2017-08-14 DJ Mills wrote:
> You can try shopt -s checkwinsize to see if that helps
checkwinsize is already enabled :/

How to debug this?

--Apple-Mail=_877F2EC2-3C2F-4344-9FA8-EB83328F602F
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJZmOpEAAoJEIOuwP66pdSDP5oP/jh93DwaTLuX57yFnjOr8w3u
6ad0mm97MLZp5aJqwusY4cHXsOKlvcLObyxaRc/HcFW2m0ssKpp5qEMBnzD1fQk4
PdArnl2thd2oavJmQ+L7hdZ2lDg8ghaxbeQXFY20U+9yJ+016G/9qA9LYnvecf0g
z7hrXQ++VJ1PgytN3Y6I5RJKbVhL7KPcVeXkQh5nDoAOPnruHtQynTRNJqkkhR37
guOhZfEsicwmGfhnpd8CxCIA28dik528/fkrU6jQOL7uQIBoQZolENNVxGa71EGj
f0LEmH/M8kgdpuov9Z8JNCz7g5lyw7kWiodbCSGg2dpaAoRpjhdjmKe1OS8HBmKs
sVkH7KjdDoji2s99CdlkG73iEuK1r6Ey3IT+JnFxIBrAHX50uY2lZ47oQlGQHdAB
/kNr8hEZcmqCJxUigGeIXQfiiO984PL4KwnoV9X/cZafTvlOLLRaOtM6KIWIXO2E
1tE3BmwAozt0YXxnN3Cwb8hYsFodeaDY/dRZLHa7xnbxxwIiul1IpVVD4o03FCJX
LkKEkEFCd7AgSViqKv2AE4EpxAByFlX4NsEb+93iYsHAJ2WzTrwrVOnrbnkcJQ5N
Veu+Wzdw5P/OT0g2xnp51/ePLVyIC24xC6Iq+TAt5Ay6Nv70KfGgQs2a/YkHEzRH
r3M0VgiqOErWDTgS2PCx
=sAi2
-----END PGP SIGNATURE-----

--Apple-Mail=_877F2EC2-3C2F-4344-9FA8-EB83328F602F--


From MAILER-DAEMON Sat Aug 19 21:53:00 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1djFQC-0007zm-EX
	for mharc-bug-bash@gnu.org; Sat, 19 Aug 2017 21:53:00 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:34676)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <peterpasschier@gmail.com>) id 1djFQA-0007z0-P1
	for bug-bash@gnu.org; Sat, 19 Aug 2017 21:52:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <peterpasschier@gmail.com>) id 1djFQ7-00022D-OC
	for bug-bash@gnu.org; Sat, 19 Aug 2017 21:52:58 -0400
Received: from mail-pg0-x232.google.com ([2607:f8b0:400e:c05::232]:35847)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <peterpasschier@gmail.com>)
	id 1djFQ7-00021X-Hk
	for bug-bash@gnu.org; Sat, 19 Aug 2017 21:52:55 -0400
Received: by mail-pg0-x232.google.com with SMTP id i12so81891339pgr.3
	for <bug-bash@gnu.org>; Sat, 19 Aug 2017 18:52:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=sender:from:subject:to:references:message-id:date:user-agent
	:mime-version:in-reply-to:content-language:content-transfer-encoding;
	bh=qPHHbzWzGRiDnzgdcZJzqUSuFp8KiiPx3qUKEOTc7LQ=;
	b=SjhzffBAwOWUFRBO86NZNuZ+4H8Vm8C2xqNfrSePdYhzIN9cUiS/dzSkeLvoefs7Vl
	3q35Xv8arsaDd7meRHNddrNJkdUs5vPEN8XM8i3L3A8CjCDW/fW72escPH7TLRxMYE/J
	mbBNb5rSwW34j4nL5RdNIP2RsRKwqwIx4YqJR7L/C7ms2UQXhNIhFGfJ0yohOjaY8Bcw
	/IZSKqMUbIJ2rMrPiu3hbPcC2hqRnyaJJeUVVdD12VJsdnMwJAHgZo2QSiGKicHAH1nN
	p/MGTAxGa5kw1Ay50FQxKJ7qRR6dz2h04IfTBUts17+pFyhqXYAtCY2+mSV/a8oyMWVA
	/Yxg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:sender:from:subject:to:references:message-id
	:date:user-agent:mime-version:in-reply-to:content-language
	:content-transfer-encoding;
	bh=qPHHbzWzGRiDnzgdcZJzqUSuFp8KiiPx3qUKEOTc7LQ=;
	b=RLLlOZKSgamjLaX79Cw7Xm8mqO7WVU2W5uUM25PgzA7oxFvkzxeQw5qeWrEWHKOv0z
	A2q/43BsPv5z6Re7e92u3LrOCGEFXj70p5Z3KASzIZtaMYY54sLWEezwfmuzNir1Bcog
	hKU7PReWdERJXyiaYjnPTB48LTFhH0H/khgiprVKx46JcLgRZ22Y3IRyN7z7+4vJOqnk
	Sfjh3w60a2uciSGtmZbKTsKz9crj7mrhUYAMPa78hVTwvqEB7O30OSMLGPhhmfN0ACke
	PTWOd8kcdA5eyiL2MpNCmhZX4/IRBo1GZX8SJegQkfAlUUO+l74yi3owqQCohF39Awds
	4Lbw==
X-Gm-Message-State: AHYfb5iu6yFmDL1En9TecIZKzStdiwddTUF1JBOsTzvCJUW0b57BCOjp
	y4ch/R1EbjphC4M8
X-Received: by 10.84.217.132 with SMTP id p4mr7238848pli.297.1503193972848;
	Sat, 19 Aug 2017 18:52:52 -0700 (PDT)
Received: from [192.168.4.102] ([171.4.67.68])
	by smtp.gmail.com with ESMTPSA id
	o1sm15560104pgq.10.2017.08.19.18.52.50 for <bug-bash@gnu.org>
	(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Sat, 19 Aug 2017 18:52:51 -0700 (PDT)
Sender: Peter Passchier <peterpasschier@gmail.com>
From: PePa <peterkelly@passchier.net>
X-Google-Original-From: PePa <solusos@passchier.net>
Subject: Re: extension of file-test primitives?
To: bug-bash <bug-bash@gnu.org>
References: <5998D82A.3030607@tlinx.org>
Message-ID: <7023b203-395b-c63e-7678-eccbc1d19be2@passchier.net>
Date: Sun, 20 Aug 2017 08:52:47 +0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
	Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <5998D82A.3030607@tlinx.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: nl
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:400e:c05::232
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 20 Aug 2017 01:52:59 -0000

In that case, would not [[ =fx $file ]] be more workable and in line 
with common GNU short commandline option practice??

Peter


On 08/20/2017 07:30 AM, L A Walsh wrote:
> Curious, but how difficult or problematic would it be
> to allow using brace-expansion (ex. {f,x} ) as a short-hand
> to test/combine file-op tests like:
> 
> Allowing:
> 
>    test -{f,x} /bin/ls && ...
> or
>     if [[ -{f,x} $file ]]; then ... ; fi
> 
> instead of:
> 
>    test -f /bin/ls && test -x /bin/ls && ...
> 
> 
> ??
> 
> 
> (maybe boring background):
> Came from a spur-of-the-moment experimenting with bash equivalents
> to perl's file-op chaining, like:
> 
>   if (-f -x "/bin/ls") { ... }
> 
> and came up with something a bit odd but working, but
> a bit quirky looking for a lib-type function or alias:
> 
>   eval 'test -'{f,x}' /bin/ls && :' && echo executable file
> 
> and wondered if bash might adopt some shortcut for testing
> multiple flags or if it was too specialized for such a minor
> optimization...
> 
> just a minor curiosity if code was submitted...etc...etc...?
> 
> 
> 
> 


From MAILER-DAEMON Sun Aug 20 17:20:19 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1djXdr-0006Qb-F8
	for mharc-bug-bash@gnu.org; Sun, 20 Aug 2017 17:20:19 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:42742)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1djXdo-0006PN-P4
	for bug-bash@gnu.org; Sun, 20 Aug 2017 17:20:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1djXdl-0006qv-LH
	for bug-bash@gnu.org; Sun, 20 Aug 2017 17:20:16 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:57046
	helo=Ishtar.sc.tlinx.org)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <bash@tlinx.org>) id 1djXdl-0006pk-A0
	for bug-bash@gnu.org; Sun, 20 Aug 2017 17:20:13 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
	v7KLK6gs067992; Sun, 20 Aug 2017 14:20:08 -0700
Message-ID: <5999FD06.8030204@tlinx.org>
Date: Sun, 20 Aug 2017 14:20:06 -0700
From: L A Walsh <bash@tlinx.org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: Leon Klingele <info@leonklingele.de>
CC: bug-bash@gnu.org
Subject: Re: Line wrapping issues
References: <CB1AC5C9-F770-448B-8071-5446227EF7CA@leonklingele.de>
In-Reply-To: <CB1AC5C9-F770-448B-8071-5446227EF7CA@leonklingele.de>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
	timestamps) [generic] [fuzzy]
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 20 Aug 2017 21:20:17 -0000

Leon Klingele wrote:
> How to debug this?
Try removing all functionality in fzf that still allows you to
reproduce the bug.

'fzf' is producing "some output" which is causing confusion;
trying to narrow that down would be the likely way to proceed.

Alternatively, you might try running your combination in something
that stores all I/O.  Googling 'recording a tty session' will
bring up several programs that work to record a session.

Then you can find the output that is causing the confusion.
Then its a matter of determining if it is the correct output
and if so, put it in a separate shell script and "echo"
it to output as a demo of how the [correct?] output causes
bash to misbehave.  Either that or you'll see that the output
isn't correct for what you are wanting it to do.

(I.e. if you were expecting it to goto a new line on linux
and it only put out a 'CR', you'd see that the output was
incorrect).

Make sense?




From MAILER-DAEMON Sun Aug 20 17:20:49 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1djXeL-0006j5-87
	for mharc-bug-bash@gnu.org; Sun, 20 Aug 2017 17:20:49 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:42787)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1djXeJ-0006ha-2V
	for bug-bash@gnu.org; Sun, 20 Aug 2017 17:20:47 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1djXeF-0007gD-0d
	for bug-bash@gnu.org; Sun, 20 Aug 2017 17:20:46 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:57070
	helo=Ishtar.sc.tlinx.org)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <bash@tlinx.org>) id 1djXeE-0007cq-HZ
	for bug-bash@gnu.org; Sun, 20 Aug 2017 17:20:42 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
	v7KLKcmZ067999; Sun, 20 Aug 2017 14:20:40 -0700
Message-ID: <5999FD26.5060008@tlinx.org>
Date: Sun, 20 Aug 2017 14:20:38 -0700
From: L A Walsh <bash@tlinx.org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: PePa <peterkelly@passchier.net>
CC: bug-bash <bug-bash@gnu.org>
Subject: Re: extension of file-test primitives?
References: <5998D82A.3030607@tlinx.org>
	<7023b203-395b-c63e-7678-eccbc1d19be2@passchier.net>
In-Reply-To: <7023b203-395b-c63e-7678-eccbc1d19be2@passchier.net>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
	timestamps) [generic] [fuzzy]
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 20 Aug 2017 21:20:48 -0000

PePa wrote:
> In that case, would not [[ =fx $file ]] be more workable and in line 
> with common GNU short commandline option practice??

Do you mean '-fx' ?  I assume you are meaning as an alternate?
It would be fine with me, even better on an aesthetic sense, however,
Bash already has multi-character ops starting with a dash.

While "-ge $file" could probably be parsed reliably apart from
"$file2 -ge $file", they look similar to a human and might create
more confusion than help.  (-ge $file == exists & groupid set), vs
testing contents of integer vars $file2 and $file for integer-var $file2
being greater-than-or-equal to integer-var $file.

Leveraging the curly brace format, implying [[ -{g,e} $file ]] would be
similar to the quoted example I mentioned.  I.e. -- it would be
a matter of applying brace expansion even though quotes didn't exist.

I.e. instead of:

 eval 'test -'{g,e}' /bin/ls && :' && echo executable file

one could remove the eval, quotes and extra '&& :' at the end and
use:

  test -{g,e} /bin/ls && echo executable file

I _think_ people who are familiar w/brace expansion would
easily understand this new form and not confuse it with
existing features.

Does that make sense?
-l



From MAILER-DAEMON Sun Aug 20 18:12:04 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1djYRw-0005FR-9R
	for mharc-bug-bash@gnu.org; Sun, 20 Aug 2017 18:12:04 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:45494)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <info@leonklingele.de>) id 1djY82-0002Vx-Do
	for bug-bash@gnu.org; Sun, 20 Aug 2017 17:51:33 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <info@leonklingele.de>) id 1djY7y-0006oh-I3
	for bug-bash@gnu.org; Sun, 20 Aug 2017 17:51:30 -0400
Received: from sky.leonklingele.de ([212.53.140.36]:40606)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <info@leonklingele.de>)
	id 1djY7y-0006mj-82
	for bug-bash@gnu.org; Sun, 20 Aug 2017 17:51:26 -0400
Received: from localhost (localhost [127.0.0.1])
	by sky.leonklingele.de (Postfix) with ESMTP id 6F2222A649D;
	Sun, 20 Aug 2017 23:50:54 +0200 (CEST)
Received: from sky.leonklingele.de ([127.0.0.1])
	by localhost (sky.leonklingele.de [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id APuA8zeK39qD; Sun, 20 Aug 2017 23:50:52 +0200 (CEST)
Content-Type: multipart/signed;
	boundary="Apple-Mail=_8406B6E2-5C01-4F6B-A437-7A47E2B62B6E";
	protocol="application/pgp-signature"; micalg=pgp-sha512
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=leonklingele.de;
	s=20160101; t=1503265852;
	bh=hGVysPu+0CihEF1IkEiNOtKSEisaV+XpSymbs+hOTx8=;
	h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
	b=ixDHr2OeXlGtrqALeFe/pNcLdsdiIrg8wsYxwZZfNVnLTT8jsf0DqjsAPhFo6IB82
	mCWk0tcblDL7noAHBzzZG9y05orurlIv16mjs2qvzZGgxjya5uxxKDzRynIaQF6na0
	MQuaO8xMedED0Rnh0HwB658c37hj6dINP8JvQHiWx7ssoNfKtKmLloRVPCdzwlIFSK
	T6VcS4MRkE+um0Pp6Jos8XNDlBj/amA2ojEBtEnqVNtX6BwXOt+d7AFs3NT6J6iiZX
	VujByto6H+zSp1o/x6T3cXxN0Zsskv2DqawxMFwNDKxOu6R6oXrwbw7OBxlsFk7vo8
	IUvmVauga6GAA==
Subject: Re: Line wrapping issues
From: Leon Klingele <info@leonklingele.de>
In-Reply-To: <5999FD06.8030204@tlinx.org>
Date: Sun, 20 Aug 2017 23:50:59 +0200
Cc: bug-bash@gnu.org
Message-Id: <F6E5D5E6-6522-4E5A-8A6A-7DE80FAF8154@leonklingele.de>
References: <CB1AC5C9-F770-448B-8071-5446227EF7CA@leonklingele.de>
	<5999FD06.8030204@tlinx.org>
To: L A Walsh <bash@tlinx.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From: 212.53.140.36
X-Mailman-Approved-At: Sun, 20 Aug 2017 18:12:03 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 20 Aug 2017 21:51:34 -0000


--Apple-Mail=_8406B6E2-5C01-4F6B-A437-7A47E2B62B6E
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

> you might try running your combination in something that stores
> all I/O

Awesome idea! I did record a session with 'script'.
Replay it as follows:

$ git clone =
https://gist.github.com/leonklingele/e3e3754cc0362e0e982823709db032eb =
bash-fzf
$ cd $_
$ cat typescript

Now take a look at the second line which ends as follows:
abc abc abc"abc abc abc
The last three abc blocks (after the closing quote) shouldn't be there.

This must be caused by some of the control characters.

--Apple-Mail=_8406B6E2-5C01-4F6B-A437-7A47E2B62B6E
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJZmgRDAAoJEIOuwP66pdSDdZsP+QGnPAKcQ0WSLxxfqHZ6u+F6
j8KzropWqMdO+AEaV6Mi1bu+AAVA5U6558+uxITJ071DX5qqCDWWWDA0bJlurKKv
P5ijBytOzyxkYgDJPitMTUbQTJWXmvD6oQGiqXzkmgkPpDdnivUX9Tfcaxi9mI1A
tNBKwU5UC7Q78+BY542KT1FNzr6Mi2ZFCyKMsmaV2e+tt3An4+Rk0f3j43/gVBZq
/iyWPM6kiv2+XZmpGeNGz34JtKXnJgeC9ebyCi/yDTlfR7HouwWvpDJ40hPkjIpD
t5AqvOUHI9QpiOe4ELi+MHSCmGcD/Z4R716+6as1b3ERP2aKXYqszc/VCiXHs6oD
CrsPmto4WYugKP+GGbJZrggFFGzF0KMbkgNsSFyJjGN5Iwezod/hZ7MzwT0sY/RN
pclji2ZfC4IzOEKjdmdYqmaiLy9U7pj6B84eih0wazbblIkvOHh2JxnCm6bKUlRt
h7EJZGngN9DBKtW+J7iI6qYicdORx0drdpewZ0H+LYk/57tcvzGZwcvVqxlfmwOE
FDjiAWuRLYdbuNvolUFP6a1mKQ03YuTSiTnJhti1X+J+WCFPA4V+JIyu34rXEMPO
6abHNQrhfaGclyvQhz33K+1Z+95mJ88d8e5NbASdok6+tLSphsrRlOPYkydxZeaZ
GoGy6QJxQqtj6mwRRYO5
=nIXP
-----END PGP SIGNATURE-----

--Apple-Mail=_8406B6E2-5C01-4F6B-A437-7A47E2B62B6E--


From MAILER-DAEMON Sun Aug 20 20:05:40 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1djaDr-0005tF-UR
	for mharc-bug-bash@gnu.org; Sun, 20 Aug 2017 20:05:39 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:58207)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <peterpasschier@gmail.com>) id 1djaDp-0005rY-T2
	for bug-bash@gnu.org; Sun, 20 Aug 2017 20:05:38 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <peterpasschier@gmail.com>) id 1djaDk-0000Is-TG
	for bug-bash@gnu.org; Sun, 20 Aug 2017 20:05:37 -0400
Received: from mail-pg0-x22d.google.com ([2607:f8b0:400e:c05::22d]:37480)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <peterpasschier@gmail.com>)
	id 1djaDk-0000Hi-Ie
	for bug-bash@gnu.org; Sun, 20 Aug 2017 20:05:32 -0400
Received: by mail-pg0-x22d.google.com with SMTP id y129so89133984pgy.4
	for <bug-bash@gnu.org>; Sun, 20 Aug 2017 17:05:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=sender:subject:cc:references:from:message-id:date:user-agent
	:mime-version:in-reply-to:content-language:content-transfer-encoding;
	bh=ZvtC+xqhYP4leSajhBH3WciXKsQajOJyWch48Qnge7A=;
	b=PQKJLJZgnJ37g3YiBPoTzChLG5T/SnC7+WFLEOgXAW2agW5v0nPEKPEGP/lKOVIFNj
	iaaida79pcsNkF4OTMwnnL9xBifJYh2KU41L3gmGUtWzXpJtTmihJDq1ttqT3Uuf1KTH
	ts/m+mdDbpTZQEjSu3PkyAWUNdrSsVc7IOEtoptRB+AhkNeoFeJV9iUOu/QaeXF2M8ZL
	E1c30K5R1DX+gUh4wiFYO+bWB3NSX8HDGb1ffV6NK1pbcgZv7GD0bC+dplDKXCfJGM1r
	9bTMLiBwb6kHa/ZOApI9o7x8z3sWZ11ftglpQcXdgbFSUtoifF9tvjFkGLp0uKNIgRwP
	snzw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:sender:subject:cc:references:from:message-id
	:date:user-agent:mime-version:in-reply-to:content-language
	:content-transfer-encoding;
	bh=ZvtC+xqhYP4leSajhBH3WciXKsQajOJyWch48Qnge7A=;
	b=n9absRWMZro8hGg9R0FFDLLA2PUIkDzcnhC7x3qaTOsHbu8Mzfwb7/lcnj4T/F34Fx
	YAWUhli+2LsezFmfHSwrIveK35VTRTximPNuXP2ZU8Wrt9msp/jslh8QnB11BSXpXavW
	KkFejz9xxgHR+hg10WvvM8NTzn7pKRpD02N4Zbe1f5AWAajjhcgE3+iid0IYiXbVU5bK
	OWPW8o11wmRSEqwG+txIZ39DRSDQYva6MBl0BflAh2ofGVOQ1tT9ipqhGFKDOcZReP7/
	bKqZtYUQPXr4G/UcvKMJyO1mB10KAgG7vY6o6xJIk8PlmRpBYiwiNGzVyRkI1EPv8h2y
	5I5Q==
X-Gm-Message-State: AHYfb5hxkbLtCCkFOazflD0osrub7KwZKtDv1pX2qfWBnvMRgDPQNolH
	VEtlpHs1zPharKSl
X-Received: by 10.84.218.195 with SMTP id g3mr17782051plm.304.1503273931077;
	Sun, 20 Aug 2017 17:05:31 -0700 (PDT)
Received: from [192.168.4.102] ([171.4.67.68])
	by smtp.gmail.com with ESMTPSA id l1sm18581979pgf.2.2017.08.20.17.05.29
	for <bug-bash@gnu.org>
	(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Sun, 20 Aug 2017 17:05:30 -0700 (PDT)
Sender: Peter Passchier <peterpasschier@gmail.com>
Subject: Re: extension of file-test primitives?
Cc: bug-bash <bug-bash@gnu.org>
References: <5998D82A.3030607@tlinx.org>
	<7023b203-395b-c63e-7678-eccbc1d19be2@passchier.net>
	<5999FD26.5060008@tlinx.org>
From: Peter & Kelly Passchier <peterkelly@passchier.net>
Message-ID: <c20e25d3-9284-81d4-ce3a-e6826b91b615@passchier.net>
Date: Mon, 21 Aug 2017 07:05:28 +0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
	Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <5999FD26.5060008@tlinx.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: nl
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:400e:c05::22d
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 Aug 2017 00:05:38 -0000

Sorry, indeed I meant: [[ -fx $file ]]
All -ge -ne -eq etc. options are binary operators, while these new ones 
wpuld be unary, so I think the parsing would be unequivocal.

Peter


On 08/21/2017 04:20 AM, L A Walsh wrote:
> PePa wrote:
>> In that case, would not [[ =fx $file ]] be more workable and in line 
>> with common GNU short commandline option practice??
> 
> Do you mean '-fx' ?  I assume you are meaning as an alternate?
> It would be fine with me, even better on an aesthetic sense, however,
> Bash already has multi-character ops starting with a dash.
> 
> While "-ge $file" could probably be parsed reliably apart from
> "$file2 -ge $file", they look similar to a human and might create
> more confusion than help.  (-ge $file == exists & groupid set), vs
> testing contents of integer vars $file2 and $file for integer-var $file2
> being greater-than-or-equal to integer-var $file.
> 
> Leveraging the curly brace format, implying [[ -{g,e} $file ]] would be
> similar to the quoted example I mentioned.  I.e. -- it would be
> a matter of applying brace expansion even though quotes didn't exist.
> 
> I.e. instead of:
> 
> eval 'test -'{g,e}' /bin/ls && :' && echo executable file
> 
> one could remove the eval, quotes and extra '&& :' at the end and
> use:
> 
>   test -{g,e} /bin/ls && echo executable file
> 
> I _think_ people who are familiar w/brace expansion would
> easily understand this new form and not confuse it with
> existing features.
> 
> Does that make sense?
> -l
> 
> 


From MAILER-DAEMON Mon Aug 21 09:27:49 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1djmk9-0004GA-3c
	for mharc-bug-bash@gnu.org; Mon, 21 Aug 2017 09:27:49 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41545)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1djmk6-0004Dd-IJ
	for bug-bash@gnu.org; Mon, 21 Aug 2017 09:27:47 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1djmk2-0000e6-Kx
	for bug-bash@gnu.org; Mon, 21 Aug 2017 09:27:46 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:58950 helo=svr4.eeg.ccf.org)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1djmk2-0000Kw-DV
	for bug-bash@gnu.org; Mon, 21 Aug 2017 09:27:42 -0400
Received: (qmail 8829 invoked from network); 21 Aug 2017 13:27:13 -0000
Received: from wooledg.eeg.ccf.org (10.76.172.97)
	by gateway.eeg.ccf.org with SMTP; Mon, 21 Aug 2017 09:27:13 -0400
Received: (qmail 28961 invoked by uid 563); 21 Aug 2017 13:27:13 -0000
Date: Mon, 21 Aug 2017 09:27:13 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: bug-bash@gnu.org
Subject: Re: extension of file-test primitives?
Message-ID: <20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
References: <5998D82A.3030607@tlinx.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <5998D82A.3030607@tlinx.org>
User-Agent: NeoMutt/20170113 (1.7.2)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 139.137.100.1
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 Aug 2017 13:27:47 -0000

On Sat, Aug 19, 2017 at 05:30:34PM -0700, L A Walsh wrote:
> Curious, but how difficult or problematic would it be
> to allow using brace-expansion (ex. {f,x} ) as a short-hand
> to test/combine file-op tests like:
> 
> Allowing:
> 
>   test -{f,x} /bin/ls && ...
> or
>    if [[ -{f,x} $file ]]; then ... ; fi
> 
> instead of:
> 
>   test -f /bin/ls && test -x /bin/ls && ...

You could write your own helper functions for this:

-fx() { test -f "$1" && test -x "$1"; }

if -fx /bin/ls; then ...; fi


From MAILER-DAEMON Mon Aug 21 12:47:18 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1djprC-0008AM-5O
	for mharc-bug-bash@gnu.org; Mon, 21 Aug 2017 12:47:18 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:48882)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1djprA-00088v-6R
	for bug-bash@gnu.org; Mon, 21 Aug 2017 12:47:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1djpr7-0003DL-3V
	for bug-bash@gnu.org; Mon, 21 Aug 2017 12:47:16 -0400
Received: from mpv2-2015.cwru.edu ([129.22.103.227]:45348
	helo=mpv1-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1djpr6-0003Cz-TX
	for bug-bash@gnu.org; Mon, 21 Aug 2017 12:47:13 -0400
Received: from mpv8-2015.CWRU.Edu (EHLO mpv8-2015.case.edu) ([129.22.103.210])
	by mpv2-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AON08134; Mon, 21 Aug 2017 12:47:09 -0400 (EDT)
Received: from h164.176.140.67.dynamic.ip.windstream.net (EHLO
	_192.168.254.15_) ([67.140.176.164])
	by mpv8-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id IMK71645 (AUTH cpr);
	Mon, 21 Aug 2017 12:47:08 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: Line wrapping issues
To: Leon Klingele <info@leonklingele.de>, bug-bash@gnu.org
References: <929ABEA3-78BE-4264-8E3F-7692CF2C541C@leonklingele.de>
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
Message-ID: <9be137d6-b01d-995e-1361-9996c85d784d@case.edu>
Date: Mon, 21 Aug 2017 12:47:07 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <929ABEA3-78BE-4264-8E3F-7692CF2C541C@leonklingele.de>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Junkmail-Status: score=7/60, host=mpv2-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.21.160617:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__SUBJ_ALPHA_END, __TO_MALFORMED_2, __TO_NAME,
	__TO_NAME_DIFF_FROM_ACC, __REFERENCES, __HAS_FROM,
	FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA,
	__USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION,
	__IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE,
	__REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC,
	__FROM_DOMAIN_IN_ANY_CC1, __FROM_DOMAIN_IN_ANY_CC2,
	__REPLYTO_SAMEAS_FROM_DOMAIN, __ANY_URI, __URI_WITH_PATH,
	__URI_NO_WWW, __CP_URI_IN_BODY,
	__FRAUD_MONEY_CURRENCY_DOLLAR, __SUBJ_ALPHA_NEGATE,
	__URI_IN_BODY, __URI_NOT_IMG, __FORWARDED_MSG,
	__NO_HTML_TAG_RAW, BODYTEXTP_SIZE_3000_LESS,
	BODY_SIZE_1200_1299, __MIME_TEXT_P1, __MIME_TEXT_ONLY,
	__URI_NS, HTML_00_01, HTML_00_10, __FRAUD_MONEY_CURRENCY,
	BODY_SIZE_5000_LESS, IN_REP_TO, MSG_THREAD,
	__FROM_DOMAIN_IN_RCPT, __TO_REAL_NAMES, [TRUNCATED],
	so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.227
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 Aug 2017 16:47:17 -0000

On 8/9/17 10:30 PM, Leon Klingele wrote:
> I'm experiencing line wrapping issues when using bash with fzf[1].
> The issue is described in [2] and it looks like it is not caused by fzf
> but instead by bash itself.
> 
> For the sake of completeness, here are the steps to reproduce:
> 
> 1. Use bash with fzf, this requires you to install fzf. See [3].
> 2. Do an echo "abc abc abc abc abc abc abc abc abc abc abc abc abc abc
> abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc" (so
> you have that command in your bash history)
> 3. export PS1="abc abc abc abc abc abc abc abc abc abc abc abc abc abc
> abc"
> 4. Activate fzf's reverse-i-search (Ctrl + r) (you need to have
> sourc'ed fzf's $HOME/.fzf.bash file)
> 5. Select the echo "abc .." line, press enter

If these steps leave the cursor in a different position than readline
expects it to be (before step 4), even the redraw-current-line at the
end of the macro may not help. You could try replacing the key sequence
to redraw the current line with \c-l and see if that helps.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Mon Aug 21 12:48:48 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1djpse-0000NU-Dh
	for mharc-bug-bash@gnu.org; Mon, 21 Aug 2017 12:48:48 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:49264)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1djpsb-0000MH-ST
	for bug-bash@gnu.org; Mon, 21 Aug 2017 12:48:46 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1djpsX-0003qk-00
	for bug-bash@gnu.org; Mon, 21 Aug 2017 12:48:45 -0400
Received: from mpv1-2015.cwru.edu ([129.22.103.226]:50259
	helo=mpv1-2015.case.edu) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1djpsW-0003qT-Qb
	for bug-bash@gnu.org; Mon, 21 Aug 2017 12:48:40 -0400
Received: from mpv8-2015.CWRU.Edu (EHLO mpv8-2015.case.edu) ([129.22.103.210])
	by mpv1-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AOI06024; Mon, 21 Aug 2017 12:48:35 -0400 (EDT)
Received: from h164.176.140.67.dynamic.ip.windstream.net (EHLO
	_192.168.254.15_) ([67.140.176.164])
	by mpv8-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id IMK72886 (AUTH cpr);
	Mon, 21 Aug 2017 12:48:34 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu, bug-bash@gnu.org
Subject: Re: Line wrapping issues
To: Leon Klingele <info@leonklingele.de>, L A Walsh <bash@tlinx.org>
References: <CB1AC5C9-F770-448B-8071-5446227EF7CA@leonklingele.de>
	<5999FD06.8030204@tlinx.org>
	<F6E5D5E6-6522-4E5A-8A6A-7DE80FAF8154@leonklingele.de>
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
Message-ID: <15bfcac3-1c55-787c-e27d-8d5b66ff42fc@case.edu>
Date: Mon, 21 Aug 2017 12:48:34 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <F6E5D5E6-6522-4E5A-8A6A-7DE80FAF8154@leonklingele.de>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Junkmail-Status: score=8/60, host=mpv1-2015.case.edu
X-Junkmail-PrAS-Raw: score=8/60, refid=2.7.2:2017.8.21.160617:17:8.317, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR, __MULTIPLE_RCPTS_CC_X2,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__SUBJ_ALPHA_END, __TO_MALFORMED_2, __TO_NAME,
	__TO_NAME_DIFF_FROM_ACC, __REFERENCES, __HAS_FROM,
	FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA,
	__USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION,
	__IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE,
	__REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC,
	__FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN,
	__ANY_URI, __URI_WITH_PATH, __URI_NO_WWW,
	__CP_URI_IN_BODY, __SUBJ_ALPHA_NEGATE, __URI_IN_BODY,
	__URI_NOT_IMG, __FORWARDED_MSG, __NO_HTML_TAG_RAW,
	BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_400_499,
	__MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01,
	HTML_00_10, BODY_SIZE_5000_LESS, IN_REP_TO, MSG_THREAD,
	__FROM_DOMAIN_IN_RCPT, __TO_REAL_NAMES,
	MULTIPLE_REAL_RCPTS, LEGITIMATE_SIGNS, [TRUNCATED],
	so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.226
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 Aug 2017 16:48:46 -0000

On 8/20/17 5:50 PM, Leon Klingele wrote:
>> you might try running your combination in something that stores
>> all I/O
> 
> Awesome idea! I did record a session with 'script'.

Please send your typescript to the list.

Chet


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Mon Aug 21 13:06:37 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1djq9t-0007Q5-By
	for mharc-bug-bash@gnu.org; Mon, 21 Aug 2017 13:06:37 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56141)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1djq9r-0007PV-ES
	for bug-bash@gnu.org; Mon, 21 Aug 2017 13:06:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1djq9n-0008Lh-Gl
	for bug-bash@gnu.org; Mon, 21 Aug 2017 13:06:35 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:45388
	helo=Ishtar.sc.tlinx.org)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <bash@tlinx.org>) id 1djq9n-0008KF-0P
	for bug-bash@gnu.org; Mon, 21 Aug 2017 13:06:31 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
	v7LH6Lxn047551; Mon, 21 Aug 2017 10:06:24 -0700
Message-ID: <599B130D.4050702@tlinx.org>
Date: Mon, 21 Aug 2017 10:06:21 -0700
From: L A Walsh <bash@tlinx.org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: Peter & Kelly Passchier <peterkelly@passchier.net>
CC: bug-bash <bug-bash@gnu.org>
Subject: Re: extension of file-test primitives?
References: <5998D82A.3030607@tlinx.org>	<7023b203-395b-c63e-7678-eccbc1d19be2@passchier.net>	<5999FD26.5060008@tlinx.org>
	<c20e25d3-9284-81d4-ce3a-e6826b91b615@passchier.net>
In-Reply-To: <c20e25d3-9284-81d4-ce3a-e6826b91b615@passchier.net>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
	timestamps) [generic] [fuzzy]
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 Aug 2017 17:06:36 -0000

Peter & Kelly Passchier wrote:
> Sorry, indeed I meant: [[ -fx $file ]]
> All -ge -ne -eq etc. options are binary operators, while these new 
> ones wpuld be unary, so I think the parsing would be unequivocal.
---
    Yeah, but as I said:

>> While "-ge $file" could probably be parsed reliably apart from
>> "$file2 -ge $file", they look similar to a human and might create
>> more confusion than help.  

>>
>> I _think_ people who are familiar w/brace expansion would
>> easily understand this new form and not confuse it with
>> existing features.

How many humans might waste time looking over a "-ge", and
either having an extra operand before, or not changing what they
meant?

Human time is far more costly than computer time, thus my
suggestion to make them hard to confuse and have them look
like an existing construct (brace expansion) being re-used
to shorten a sequence of file-ops.




From MAILER-DAEMON Mon Aug 21 13:29:58 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1djqWS-00019V-Pm
	for mharc-bug-bash@gnu.org; Mon, 21 Aug 2017 13:29:58 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:35415)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <info@leonklingele.de>) id 1djqWP-00017R-JE
	for bug-bash@gnu.org; Mon, 21 Aug 2017 13:29:54 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <info@leonklingele.de>) id 1djqWM-0006C6-G4
	for bug-bash@gnu.org; Mon, 21 Aug 2017 13:29:53 -0400
Received: from sky.leonklingele.de ([212.53.140.36]:34000)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <info@leonklingele.de>)
	id 1djqWL-00069R-VI
	for bug-bash@gnu.org; Mon, 21 Aug 2017 13:29:50 -0400
Received: from localhost (localhost [127.0.0.1])
	by sky.leonklingele.de (Postfix) with ESMTP id 7717A2A6497;
	Mon, 21 Aug 2017 19:29:44 +0200 (CEST)
Received: from sky.leonklingele.de ([127.0.0.1])
	by localhost (sky.leonklingele.de [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id tyL7FDwk3gKL; Mon, 21 Aug 2017 19:29:43 +0200 (CEST)
Content-Type: multipart/signed;
	boundary="Apple-Mail=_EAA70D35-98D2-45E4-AE0E-8612E30B222C";
	protocol="application/pgp-signature"; micalg=pgp-sha512
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=leonklingele.de;
	s=20160101; t=1503336582;
	bh=nrlXXYTXvYUDw3ANMCALashqoL3b/vM8SClcIAGfFgI=;
	h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
	b=CVdpH6WUmdqWhpCFpENzIOLuWNYHp5r6as4bGIUOyA76pkBXNPTGSdglilPQcdm6+
	RPaf1nnkEazrj+gmeJOW/ORhsxLkGAoPoVZA9KoEYHyNoh+ujHhdwHts91Lpk590Z+
	Alg4k9WNLO55FkPMBRPc7SLcdPgQUCSINr34AVh1GqD7PfgbdSyseem8FetwG53mYI
	3st827nELisrcTjJPsOQqOf9LbpB1+oCFqBv5H0Cxgxejl3NvTY6Zjk0fvxqHyOIrh
	J/Q2P+gDAvjm2/1DRR1zxAdsqVmJICo8deZ1viyMlALZWRN7WFaicDFMq4OoT1X+i9
	jR4yBw6uC/FvQ==
Subject: Re: Line wrapping issues
From: Leon Klingele <info@leonklingele.de>
In-Reply-To: <15bfcac3-1c55-787c-e27d-8d5b66ff42fc@case.edu>
Date: Mon, 21 Aug 2017 19:29:52 +0200
Cc: L A Walsh <bash@tlinx.org>,
 bug-bash@gnu.org
Message-Id: <6D04808E-52AC-43AB-B68B-D87E1DE219D7@leonklingele.de>
References: <CB1AC5C9-F770-448B-8071-5446227EF7CA@leonklingele.de>
	<5999FD06.8030204@tlinx.org>
	<F6E5D5E6-6522-4E5A-8A6A-7DE80FAF8154@leonklingele.de>
	<15bfcac3-1c55-787c-e27d-8d5b66ff42fc@case.edu>
To: chet.ramey@case.edu
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From: 212.53.140.36
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 Aug 2017 17:29:55 -0000


--Apple-Mail=_EAA70D35-98D2-45E4-AE0E-8612E30B222C
Content-Type: multipart/mixed;
	boundary="Apple-Mail=_FC5EE5B8-9F01-4563-AB8E-08B056DEE613"


--Apple-Mail=_FC5EE5B8-9F01-4563-AB8E-08B056DEE613
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii

> Please send your typescript to the list.

Here you go (see attachment).

> If these steps leave the cursor in a different position than readline
> expects it to be (before step 4), even the redraw-current-line at the
> end of the macro may not help. You could try replacing the key sequence
> to redraw the current line with \c-l and see if that helps.

I can't quite follow you. Which "key sequence" are you referring to?
Pressing Ctrl+l indeed fixes the issue but also clears the screen
which I'd try to avoid -> only a workaround.


--Apple-Mail=_FC5EE5B8-9F01-4563-AB8E-08B056DEE613
Content-Disposition: attachment;
	filename=typescript
Content-Type: application/octet-stream;
	name="typescript"
Content-Transfer-Encoding: quoted-printable

Script=20started=20on=20Sun=20Aug=2020=2023:41:16=202017=0ALorem=20ipsum=20=
dolor=20sit=20amet,=20consetetur=20sadipscing=20elitr,=20sed=20diam=20=
nonumy=20=08=1B[K`__fzf_history__`=1B[J=1B[6n=0A=1B[G=0A=1B[G=0A=1B[G=0A=
=1B[G=0A=1B[G=0A=1B[G=0A=1B[G=0A=1B[G=0A=1B[G=0A=1B[G=0A=1B[G=0A=1B[G=0A=
=1B[G=0A=1B[G=0A=1B[G=0A=1B[G=0A=1B[G=0A=1B[G=0A=1B[G=0A=1B[G=0A=
=1B[G=1B[?1000h=1B[20A=1B[G=1B[K=1B[s=1B[6n=0D=1B[;m=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=0D=1B[1B=0D=1B[;m=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=0D=1B[1B=0D=1B[;m=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=0D=1B[1B=0D=1B[;m=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=0D=1B[1B=0D=
=1B[;m=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=0D=1B[1B=0D=1B[;m=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=0D=1B[1B=0D=1B[;m=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=0D=1B[1B=0D=1B[;m=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=0D=1B[1B=0D=1B[;m=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=0D=1B[1B=0D=1B[;m=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=0D=
=1B[1B=0D=1B[;m=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=0D=1B[1B=0D=
=1B[;m=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=0D=1B[1B=0D=1B[;m=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=0D=1B[1B=0D=1B[;m=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=0D=1B[1B=0D=1B[;m=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=0D=1B[1B=0D=1B[;m=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=0D=1B[1B=0D=1B[;m=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=0D=
=1B[1B=0D=1B[;m=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=0D=1B[1B=0D=
=1B[;m=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=0D=1B[1B=0D=1B[;m=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=0D=1B[1B=0D=1B[;m=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=0D=0D=1B[;m=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=0D=1B[;1;38;5;110m>=20=1B[m=1B[;1m=1B[m=0D=1B[2C=1B[1A=0D=1B[;m=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=0D=1B[;1;38;5;148m\=1B[m=0D=
=1B[2C=1B[;38;5;144m0/0=20+S=1B[m=0D=1B[;m=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=0D=0D=1B[2C=1B[;38;5;144m0/1=20+S=1B[m=1B[1B=0D=1B[2C=1B[2A=0D=
=1B[;1;38;5;161;48;5;236m>=1B[m=1B[;1;38;5;254;48;5;236m=20=
=1B[m=1B[;1;38;5;254;48;5;236m=20=20=20=201=20=20echo=20"abc=20abc=20abc=20=
abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20=
abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20=
abc=20abc=20abc"=1B[m=1B[1B=0D=1B[;m=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=0D=0D=1B[2C=1B[;38;5;144m1/1=20+S=1B[m=1B[1B=0D=1B[2C=0D=1B[2C=1B[1=
A=0D=1B[;m=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=0D=0D=
=1B[2C=1B[;38;5;144m1/1=20+S=1B[m=1B[1B=0D=1B[2C=0D=1B[;m=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=0D=1B[;1;38;5;110m>=20=1B[m=1B[;1m=1B[m=1B[20A=
=0D=1B[A=1B[J=1B[?1000l=08=08=08=08=08=08=08=08=08=08=08=08=08=08=08=08=08=
!1=1B[K=08=08echo=20"abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20=
abc=20abc=20abc=20abc=20abc=20abc=20abc=0Dc=20abc=20abc=20abc=20abc=20=
abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc"=1B[A=0D=
=1B[KLorem=20ipsum=20dolor=20sit=20amet,=20consetetur=20sadipscing=20=
elitr,=20sed=20diam=20nonumyecho=20"abc=20abc=20abc=20abc=20abc=20abc=20=
abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=0Dc=20abc=20=
abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20=
abc"=0D=0Aabc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20=
abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=20=
abc=20abc=20abc=20abc=20abc=20abc=20abc=20abc=0D=0ALorem=20ipsum=20dolor=20=
sit=20amet,=20consetetur=20sadipscing=20elitr,=20sed=20diam=20nonumyexit=0D=
=0A=0AScript=20done=20on=20Sun=20Aug=2020=2023:41:25=202017=0A=

--Apple-Mail=_FC5EE5B8-9F01-4563-AB8E-08B056DEE613
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii




--Apple-Mail=_FC5EE5B8-9F01-4563-AB8E-08B056DEE613--

--Apple-Mail=_EAA70D35-98D2-45E4-AE0E-8612E30B222C
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJZmxiQAAoJEIOuwP66pdSDu5AQAIcyoTJblDmYsxmy3edZz+az
uK6A7WhKdieTUdqmS0HvayPe4gRjUWsQNuNM1RXmcXvSrx0biLHsxbwvR9z2UHxS
0u71HgUeumvetfi7syy10B7pLIdQFW9rArkTJQu7w4Y4339FQqqgadR1eyzL/BbK
vpRmrMJZSgevdUc3iTXW7h0wPjKNfFtM7xwbLlSdQUQyqIJ+bJpF+kTeWZ4d+PyW
rpAE9PCl0AtVIZfsUY1VX4TdXmfC7Hc7ZCNGNjv5t45rC2UeDJIL61gGl5OHwxKd
3agcw3vg5HK2jChyX/ZFXhbwXuR0E11lCUGB0mjNMiaxo/Dr7+FHvlIKPKArRBUO
U94HjOlkCNuJHY/H9nu4vsi1o23FwNAllX7j1Qcw9jaiT1ZpWuajVkVkGUu2U12i
9oBegjR5Y22jVCM/9kg/KsYGliUUEkmn+DE6Go8znjbMAGodOdrwWa+3t9/40Fve
sUpngScnP7VYhAbcjTJIZBqzeECd9dHJlu23i2ki39p35gBRmsg4M/g0n1BM/QYX
j8gi1erIT572cLLteuasNnJ5w0+GjDQroiYMaw+OEP9ypdLqy3u6zSh47eW7H0cG
hXNI+XJKE8V8Bdef9Ep2jR/ZbYdSeeJWUK+AC8eYxco4lXNe6ORHZ1bxz8c0HG9y
l//zBkX7z8YWHw2TALog
=dayk
-----END PGP SIGNATURE-----

--Apple-Mail=_EAA70D35-98D2-45E4-AE0E-8612E30B222C--


From MAILER-DAEMON Mon Aug 21 15:54:38 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1djsmU-0001G7-A5
	for mharc-bug-bash@gnu.org; Mon, 21 Aug 2017 15:54:38 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41043)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1djsmR-0001Dw-CQ
	for bug-bash@gnu.org; Mon, 21 Aug 2017 15:54:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1djsmO-0006YY-M5
	for bug-bash@gnu.org; Mon, 21 Aug 2017 15:54:35 -0400
Received: from mpv2-2015.cwru.edu ([129.22.103.227]:13455
	helo=mpv1-2015.case.edu) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1djsmO-0006YH-GN
	for bug-bash@gnu.org; Mon, 21 Aug 2017 15:54:32 -0400
Received: from mpv8-2015.CWRU.Edu (EHLO mpv8-2015.case.edu) ([129.22.103.210])
	by mpv2-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AON17583; Mon, 21 Aug 2017 15:54:27 -0400 (EDT)
Received: from h164.176.140.67.dynamic.ip.windstream.net (EHLO
	_192.168.254.15_) ([67.140.176.164])
	by mpv8-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id IMM15380 (AUTH cpr);
	Mon, 21 Aug 2017 15:54:26 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: extension of file-test primitives?
To: L A Walsh <bash@tlinx.org>, bug-bash <bug-bash@gnu.org>
References: <5998D82A.3030607@tlinx.org>
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
Message-ID: <482362b8-b58e-4a98-cc0b-e6545b29eb8d@case.edu>
Date: Mon, 21 Aug 2017 15:54:26 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <5998D82A.3030607@tlinx.org>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Junkmail-Status: score=7/60, host=mpv2-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.21.190916:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC,
	__REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID,
	__SANE_MSGID, DATE_TZ_NA, __USER_AGENT,
	__MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT,
	__CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY,
	__REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1,
	__FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN,
	__ANY_URI, __URI_WITH_PATH, __URI_NO_WWW,
	__CP_URI_IN_BODY, __FRAUD_MONEY_CURRENCY_DOLLAR,
	__SUBJ_ALPHA_NEGATE, __URI_IN_BODY, __URI_NOT_IMG,
	__FORWARDED_MSG, __NO_HTML_TAG_RAW,
	BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_1000_1099,
	__MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01,
	HTML_00_10, __FRAUD_MONEY_CURRENCY, BODY_SIZE_5000_LESS,
	IN_REP_TO, MSG_THREAD, __FROM_DOMAIN_IN_RCPT,
	__TO_REAL_NAMES, [TRUNCATED], so=2010-03-03 19:42:08,
	dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.227
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 Aug 2017 19:54:36 -0000

On 8/19/17 8:30 PM, L A Walsh wrote:
> Curious, but how difficult or problematic would it be
> to allow using brace-expansion (ex. {f,x} ) as a short-hand
> to test/combine file-op tests like:
> 
> Allowing:
> 
>   test -{f,x} /bin/ls && ...
> or
>    if [[ -{f,x} $file ]]; then ... ; fi
> 
> instead of:
> 
>   test -f /bin/ls && test -x /bin/ls && ...

In addition to changing the established meaning of brace expansion, this
would require that brace expansion understand the command word (test,
primarily) and change accordingly, and create an incompatibility between
the shell's builtin test and a test binary. That incompatibility would be
almost impossible to resolve.

If you want a new operator as syntactic sugar for composing expressions,
it would be better that it not resemble existing features.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Mon Aug 21 16:08:42 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1djt06-0007GD-BW
	for mharc-bug-bash@gnu.org; Mon, 21 Aug 2017 16:08:42 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:43373)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1djt04-0007DV-Jp
	for bug-bash@gnu.org; Mon, 21 Aug 2017 16:08:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1djt01-0007aV-Cy
	for bug-bash@gnu.org; Mon, 21 Aug 2017 16:08:40 -0400
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:8561
	helo=mpv3-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1djt01-0007ZY-77
	for bug-bash@gnu.org; Mon, 21 Aug 2017 16:08:37 -0400
Received: from mpv8-2015.CWRU.Edu (EHLO mpv8-2015.case.edu) ([129.22.103.210])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id ANI18887; Mon, 21 Aug 2017 16:08:32 -0400 (EDT)
Received: from h164.176.140.67.dynamic.ip.windstream.net (EHLO
	_192.168.254.15_) ([67.140.176.164])
	by mpv8-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id IMM25258 (AUTH cpr);
	Mon, 21 Aug 2017 16:08:31 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: extension of file-test primitives?
To: PePa <peterkelly@passchier.net>, bug-bash <bug-bash@gnu.org>
References: <5998D82A.3030607@tlinx.org>
	<7023b203-395b-c63e-7678-eccbc1d19be2@passchier.net>
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
Message-ID: <35e58843-77e5-a3ea-9bac-7831bb4caf2d@case.edu>
Date: Mon, 21 Aug 2017 16:08:30 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <7023b203-395b-c63e-7678-eccbc1d19be2@passchier.net>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Junkmail-Status: score=7/60, host=mpv3-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.21.194816:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC,
	__REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID,
	__SANE_MSGID, DATE_TZ_NA, __USER_AGENT,
	__MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT,
	__CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY,
	__REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1,
	__FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN,
	__ANY_URI, __URI_WITH_PATH, __URI_NO_WWW,
	__CP_URI_IN_BODY, __FRAUD_MONEY_CURRENCY_DOLLAR,
	__SUBJ_ALPHA_NEGATE, __URI_IN_BODY, __URI_NOT_IMG,
	__NO_HTML_TAG_RAW, BODYTEXTP_SIZE_3000_LESS,
	BODY_SIZE_500_599, __MIME_TEXT_P1, __MIME_TEXT_ONLY,
	__URI_NS, HTML_00_01, HTML_00_10, __FRAUD_MONEY_CURRENCY,
	BODY_SIZE_5000_LESS, IN_REP_TO, MSG_THREAD,
	__FROM_DOMAIN_IN_RCPT, __TO_REAL_NAMES,
	MULTIPLE_REAL_RCPTS, [TRUNCATED], so=2010-03-03 19:42:08,
	dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 Aug 2017 20:08:41 -0000

On 8/19/17 9:52 PM, PePa wrote:
> In that case, would not [[ =fx $file ]] be more workable and in line with
> common GNU short commandline option practice??

Something. And not a character that's already a shell metacharacter,
either, which cuts down the available choices. `=', `+', or maybe
(though it's a distant third) `--'.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Mon Aug 21 16:10:07 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1djt1T-0008F2-KL
	for mharc-bug-bash@gnu.org; Mon, 21 Aug 2017 16:10:07 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:43669)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1djt1S-0008Ck-8V
	for bug-bash@gnu.org; Mon, 21 Aug 2017 16:10:07 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1djt1P-000879-0Q
	for bug-bash@gnu.org; Mon, 21 Aug 2017 16:10:06 -0400
Received: from mpv2-2015.cwru.edu ([129.22.103.227]:15498
	helo=mpv1-2015.case.edu) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1djt1O-00086y-Qw
	for bug-bash@gnu.org; Mon, 21 Aug 2017 16:10:02 -0400
Received: from mpv8-2015.CWRU.Edu (EHLO mpv8-2015.case.edu) ([129.22.103.210])
	by mpv2-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AON18189; Mon, 21 Aug 2017 16:09:57 -0400 (EDT)
Received: from h164.176.140.67.dynamic.ip.windstream.net (EHLO
	_192.168.254.15_) ([67.140.176.164])
	by mpv8-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id IMM26144 (AUTH cpr);
	Mon, 21 Aug 2017 16:09:57 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu, bug-bash <bug-bash@gnu.org>
Subject: Re: extension of file-test primitives?
To: L A Walsh <bash@tlinx.org>, PePa <peterkelly@passchier.net>
References: <5998D82A.3030607@tlinx.org>
	<7023b203-395b-c63e-7678-eccbc1d19be2@passchier.net>
	<5999FD26.5060008@tlinx.org>
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
Message-ID: <eff83c0e-98ae-ff02-da01-fb4bbe099a72@case.edu>
Date: Mon, 21 Aug 2017 16:09:56 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <5999FD26.5060008@tlinx.org>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Junkmail-Status: score=8/60, host=mpv2-2015.case.edu
X-Junkmail-PrAS-Raw: score=8/60, refid=2.7.2:2017.8.21.190916:17:8.317, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR, __MULTIPLE_RCPTS_CC_X2,
	__CC_NAME, __CC_NAME_DIFF_FROM_ACC,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC,
	__REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID,
	__SANE_MSGID, DATE_TZ_NA, __USER_AGENT,
	__MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT,
	__CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY,
	__REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC2,
	__REPLYTO_SAMEAS_FROM_DOMAIN, __ANY_URI, __URI_WITH_PATH,
	__URI_NO_WWW, __CP_URI_IN_BODY,
	__FRAUD_MONEY_CURRENCY_DOLLAR, __SUBJ_ALPHA_NEGATE,
	__URI_IN_BODY, __URI_NOT_IMG, __FORWARDED_MSG,
	__NO_HTML_TAG_RAW, BODYTEXTP_SIZE_3000_LESS,
	BODY_SIZE_500_599, __MIME_TEXT_P1, __MIME_TEXT_ONLY,
	__URI_NS, HTML_00_01, HTML_00_10, __FRAUD_MONEY_CURRENCY,
	BODY_SIZE_5000_LESS, IN_REP_TO, MSG_THREAD,
	__FROM_DOMAIN_IN_RCPT, [TRUNCATED],
	so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.227
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 Aug 2017 20:10:07 -0000

On 8/20/17 5:20 PM, L A Walsh wrote:
> PePa wrote:
>> In that case, would not [[ =fx $file ]] be more workable and in line with
>> common GNU short commandline option practice??
> 
> Do you mean '-fx' ?  I assume you are meaning as an alternate?

No. If you're going to propose different functionality, don't use
something that can easily be confused with something that already
exists.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Mon Aug 21 16:11:11 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1djt2V-0000P9-PS
	for mharc-bug-bash@gnu.org; Mon, 21 Aug 2017 16:11:11 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:43866)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1djt2T-0000Nd-RM
	for bug-bash@gnu.org; Mon, 21 Aug 2017 16:11:10 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1djt2Q-0000xS-Mb
	for bug-bash@gnu.org; Mon, 21 Aug 2017 16:11:09 -0400
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:8953
	helo=mpv3-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1djt2Q-0000vY-Gh
	for bug-bash@gnu.org; Mon, 21 Aug 2017 16:11:06 -0400
Received: from mpv7-2015.CWRU.Edu (EHLO mpv7-2015.case.edu) ([129.22.103.242])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id ANI19005; Mon, 21 Aug 2017 16:11:04 -0400 (EDT)
Received: from h164.176.140.67.dynamic.ip.windstream.net (EHLO
	_192.168.254.15_) ([67.140.176.164])
	by mpv7-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id ILJ41734 (AUTH cpr);
	Mon, 21 Aug 2017 16:11:03 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: extension of file-test primitives?
To: Greg Wooledge <wooledg@eeg.ccf.org>, bug-bash@gnu.org
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
Message-ID: <37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
Date: Mon, 21 Aug 2017 16:11:03 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Junkmail-Status: score=7/60, host=mpv3-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.21.194816:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC,
	__REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID,
	__SANE_MSGID, DATE_TZ_NA, __USER_AGENT,
	__MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT,
	__CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY,
	__REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1,
	__FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN,
	__ANY_URI, __URI_WITH_PATH, __URI_NO_WWW,
	__CP_URI_IN_BODY, __STOCK_PHRASE_7,
	__FRAUD_MONEY_CURRENCY_DOLLAR, __SUBJ_ALPHA_NEGATE,
	__URI_IN_BODY, __URI_NOT_IMG, __FORWARDED_MSG,
	__NO_HTML_TAG_RAW, BODY_SIZE_600_699,
	BODYTEXTP_SIZE_3000_LESS, __MIME_TEXT_P1,
	__MIME_TEXT_ONLY, __URI_NS, HTML_00_01, HTML_00_10,
	__FRAUD_MONEY_CURRENCY, BODY_SIZE_5000_LESS, IN_REP_TO,
	MSG_THREAD, __FROM_DOMAIN_IN_RCPT, __TO_REAL_NAMES,
	[TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 Aug 2017 20:11:11 -0000

On 8/21/17 9:27 AM, Greg Wooledge wrote:
> On Sat, Aug 19, 2017 at 05:30:34PM -0700, L A Walsh wrote:

>> Allowing:
>>
>>   test -{f,x} /bin/ls && ...
>> or
>>    if [[ -{f,x} $file ]]; then ... ; fi
>>
>> instead of:
>>
>>   test -f /bin/ls && test -x /bin/ls && ...
> 
> You could write your own helper functions for this:
> 
> -fx() { test -f "$1" && test -x "$1"; }

This is indeed a quick and easy way to implement desired functionality.
Shell functions can do a lot.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Tue Aug 22 10:34:50 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkAGY-0000XU-D1
	for mharc-bug-bash@gnu.org; Tue, 22 Aug 2017 10:34:50 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:43574)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkAGS-0000QL-PE
	for bug-bash@gnu.org; Tue, 22 Aug 2017 10:34:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkAGM-0004Hz-5u
	for bug-bash@gnu.org; Tue, 22 Aug 2017 10:34:43 -0400
Received: from mpv1-2015.cwru.edu ([129.22.103.226]:58054
	helo=mpv1-2015.case.edu) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkAGL-0004Hd-Uk
	for bug-bash@gnu.org; Tue, 22 Aug 2017 10:34:38 -0400
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv1-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AOI43167; Tue, 22 Aug 2017 10:34:32 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id BIS85511 (AUTH cpr);
	Tue, 22 Aug 2017 10:34:31 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu, L A Walsh <bash@tlinx.org>, bug-bash@gnu.org
Subject: Re: Line wrapping issues
To: Leon Klingele <info@leonklingele.de>
References: <CB1AC5C9-F770-448B-8071-5446227EF7CA@leonklingele.de>
	<5999FD06.8030204@tlinx.org>
	<F6E5D5E6-6522-4E5A-8A6A-7DE80FAF8154@leonklingele.de>
	<15bfcac3-1c55-787c-e27d-8d5b66ff42fc@case.edu>
	<6D04808E-52AC-43AB-B68B-D87E1DE219D7@leonklingele.de>
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <6a715ea8-6187-d4f3-b6e6-799b93e63462@case.edu>
Date: Tue, 22 Aug 2017 10:34:24 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <6D04808E-52AC-43AB-B68B-D87E1DE219D7@leonklingele.de>
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature";
	boundary="gIN1QrIUknRH5AFsG49jD3Q7tW6SmRiLT"
X-Junkmail-Status: score=8/60, host=mpv1-2015.case.edu
X-Junkmail-PrAS-Raw: score=8/60, refid=2.7.2:2017.8.22.140316:17:8.510, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR, __MULTIPLE_RCPTS_CC_X2,
	__CC_NAME, __CC_NAME_DIFF_FROM_ACC,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__SUBJ_ALPHA_END, __TO_MALFORMED_2, __TO_NAME,
	__TO_NAME_DIFF_FROM_ACC, __REFERENCES, __HAS_FROM,
	FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA,
	__USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION,
	__IN_REP_TO, __CT, __CTYPE_HAS_BOUNDARY,
	__CTYPE_MULTIPART, __REPLYTO_SAMEAS_FROM_ADDY,
	__REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC2,
	__REPLYTO_SAMEAS_FROM_DOMAIN, __MIME_TEXT_P2,
	__HAS_ATTACHMENT1, __ANY_URI, __URI_WITH_PATH,
	__URI_NO_WWW, FRAUD_ATTACH, __CP_URI_IN_BODY,
	__SUBJ_ALPHA_NEGATE, __URI_IN_BODY, __URI_NOT_IMG,
	__FORWARDED_MSG, __NO_HTML_TAG_RAW,
	__ATTACHMENT_SIZE_0_10K, __HAS_ATTACHMENT2,
	BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_2000_2999,
	__MIME_TEXT_P1, __URI_NS, HTML_00_01, HTML_00_10,
	[TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.226
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 22 Aug 2017 14:34:49 -0000

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--gIN1QrIUknRH5AFsG49jD3Q7tW6SmRiLT
From: Chet Ramey <chet.ramey@case.edu>
Reply-To: chet.ramey@case.edu
To: Leon Klingele <info@leonklingele.de>
Cc: chet.ramey@case.edu, L A Walsh <bash@tlinx.org>, bug-bash@gnu.org
Message-ID: <6a715ea8-6187-d4f3-b6e6-799b93e63462@case.edu>
Subject: Re: Line wrapping issues
References: <CB1AC5C9-F770-448B-8071-5446227EF7CA@leonklingele.de>
 <5999FD06.8030204@tlinx.org>
 <F6E5D5E6-6522-4E5A-8A6A-7DE80FAF8154@leonklingele.de>
 <15bfcac3-1c55-787c-e27d-8d5b66ff42fc@case.edu>
 <6D04808E-52AC-43AB-B68B-D87E1DE219D7@leonklingele.de>
In-Reply-To: <6D04808E-52AC-43AB-B68B-D87E1DE219D7@leonklingele.de>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 8/21/17 1:29 PM, Leon Klingele wrote:
>> Please send your typescript to the list.
>=20
> Here you go (see attachment).

Thanks. I'll see if it reveals anything I don't expect.

>> If these steps leave the cursor in a different position than readline
>> expects it to be (before step 4), even the redraw-current-line at the
>> end of the macro may not help. You could try replacing the key sequenc=
e
>> to redraw the current line with \c-l and see if that helps.
>=20
> I can't quite follow you. Which "key sequence" are you referring to?
> Pressing Ctrl+l indeed fixes the issue but also clears the screen
> which I'd try to avoid -> only a workaround.

The fzf redefinition of the ^R key sequence as a macro.  That macro ends
with \C-x\C-r, which it redefines to bind to "redraw-current-line". If
you replace those characters with \C-l, does it redraw correctly (after
clearing the screen, of course)?

--=20
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~c=
het/


--gIN1QrIUknRH5AFsG49jD3Q7tW6SmRiLT
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iHIEARECADIWIQR8ATX7CIqvbGbGULm7WGnwZOp0qwUCWZxA9xQcY2hldC5yYW1l
eUBjYXNlLmVkdQAKCRC7WGnwZOp0q9L2AJ9DtGCG42g7nTw/cI8R+cE2prCqWQCg
jqyzmwQ5rxeoXvym7D/CoiX7QNU=
=VbS4
-----END PGP SIGNATURE-----

--gIN1QrIUknRH5AFsG49jD3Q7tW6SmRiLT--



From MAILER-DAEMON Tue Aug 22 14:26:44 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkDsy-0001nd-TD
	for mharc-bug-bash@gnu.org; Tue, 22 Aug 2017 14:26:44 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56297)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <info@leonklingele.de>) id 1dkDsw-0001mw-RV
	for bug-bash@gnu.org; Tue, 22 Aug 2017 14:26:43 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <info@leonklingele.de>) id 1dkDst-0002Io-Ln
	for bug-bash@gnu.org; Tue, 22 Aug 2017 14:26:42 -0400
Received: from sky.leonklingele.de ([212.53.140.36]:60226)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <info@leonklingele.de>)
	id 1dkDst-0002Hw-Bv
	for bug-bash@gnu.org; Tue, 22 Aug 2017 14:26:39 -0400
Received: from localhost (localhost [127.0.0.1])
	by sky.leonklingele.de (Postfix) with ESMTP id F30292A6595;
	Tue, 22 Aug 2017 20:26:32 +0200 (CEST)
Received: from sky.leonklingele.de ([127.0.0.1])
	by localhost (sky.leonklingele.de [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id zZb8U3MiL3js; Tue, 22 Aug 2017 20:26:31 +0200 (CEST)
Content-Type: multipart/signed;
	boundary="Apple-Mail=_77A19620-F2FC-40DF-9D5A-549FA36AA585";
	protocol="application/pgp-signature"; micalg=pgp-sha512
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=leonklingele.de;
	s=20160101; t=1503426391;
	bh=i7+trSBdYL+NVRepVlbBeECGXlz4mSdeGXrfQCgaCUc=;
	h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
	b=ZpDclVDy4C28kN09RVIPfravsOv9Z1YP9M97spBqxkTk9lbbwtwWB3jS+irzq2sA9
	wistb2ByTWnlbDzRZFWEhnC0Hyvqe/p3E1zvvURK3SrqL1nWZaxQMPAmiEEnH5mM8i
	ARNE21Zk1jBtHQUzpRd37rueepy1EfTwSBXTYayUzsD9M9b/W/jSH+ecTcGQ/EaOlG
	YJw9CkSDAeejj+VjtwBsTZSL55CZVCrHBqmxBMyvhj9RATqHSRK43SWHZfpJJvYEuM
	2Ap3xwaB/R/n4IzxtQVXdby8PXv+Td1436xG7t1YB49luY4Jve3iTReO7sQo3HF9tY
	XeTOkUUR7SuqA==
Subject: Re: Line wrapping issues
From: Leon Klingele <info@leonklingele.de>
In-Reply-To: <6a715ea8-6187-d4f3-b6e6-799b93e63462@case.edu>
Date: Tue, 22 Aug 2017 20:26:43 +0200
Cc: L A Walsh <bash@tlinx.org>,
 bug-bash@gnu.org
Message-Id: <A9F6F403-AD83-4B48-9AC6-F5E047BA98A1@leonklingele.de>
References: <CB1AC5C9-F770-448B-8071-5446227EF7CA@leonklingele.de>
	<5999FD06.8030204@tlinx.org>
	<F6E5D5E6-6522-4E5A-8A6A-7DE80FAF8154@leonklingele.de>
	<15bfcac3-1c55-787c-e27d-8d5b66ff42fc@case.edu>
	<6D04808E-52AC-43AB-B68B-D87E1DE219D7@leonklingele.de>
	<6a715ea8-6187-d4f3-b6e6-799b93e63462@case.edu>
To: chet.ramey@case.edu
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From: 212.53.140.36
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 22 Aug 2017 18:26:44 -0000


--Apple-Mail=_77A19620-F2FC-40DF-9D5A-549FA36AA585
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

> That macro ends with \C-x\C-r

Actually it ends in \e^\er, it lands in the if-block for me:
=
https://github.com/junegunn/fzf/blob/55ee4186aa688e524e041971d588a6f002486=
deb/shell/key-bindings.bash#L83

Replacing \C-r with \C-l "solves" the issue, but again clears the
screen which I'd try to avoid.

Are you unable to reproduce the issue?

--Apple-Mail=_77A19620-F2FC-40DF-9D5A-549FA36AA585
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJZnHdjAAoJEIOuwP66pdSDwUoP/0EuEi2i4u/KQqlU7BGpwKGp
PF46Z2p4XJW4HjixAnwflbu/qMlWYSCxbuIRGVX05+Fz67E5pQJMWo3D/yi8e0hE
HQJT+ehvrIjqUKkUFimuoY7QwLGx/kxOi4dj0Fg6EfFOfUrHjbieUOKzQ978qKMc
y3ukC869zPT450HThVB3PlhIlAFzImS+ga9vWLXQmFd3eYZTkGWCMiQXUj0zalef
n3UchD5X+TJoOm0nQHIeFoEayvgyXxWF/H1FH46HCHkS7neMc/VQWzJe8vHTZL+t
0iThqJFKBM5xLIFgn1G4ex7H0iMV1caxr9RP6DikQnXaWc27vrNztFQea74jdOJJ
EWvfW0QMRb5ferZnJ9tS4X9s8tc9f5HHcttJHEKwd6F92Wg6khgrTbg7GdsYO+8g
TFE+y8CNDS8LYyXG4P+YQCtH3/uAUxaUorolu8fNbHF7b6qmmfXdSrtKKTgYeAa3
ekHxw6DKpPfT43fnXiFq13/54ADf8CN0BtLDm6N65umkoRB3jVFXkIy91psoYJog
8Gk4OmZaDGwWLrEWkx5qJFZw2MYARGlZKKEK9jokNJJ82BUeUFCvfZvGfEScHWL1
xHLB9cscy+runezQWLEZ4F4SKxj/cnTxJcfqtU02MGQD/xfAa7oRkrQU3sQyR/01
p7Xrx/eIytLX4AvTksKm
=O1+J
-----END PGP SIGNATURE-----

--Apple-Mail=_77A19620-F2FC-40DF-9D5A-549FA36AA585--


From MAILER-DAEMON Tue Aug 22 14:34:47 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkE0l-0006ZY-Do
	for mharc-bug-bash@gnu.org; Tue, 22 Aug 2017 14:34:47 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:58016)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkE0j-0006Xi-5q
	for bug-bash@gnu.org; Tue, 22 Aug 2017 14:34:46 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkE0f-0007X0-Vt
	for bug-bash@gnu.org; Tue, 22 Aug 2017 14:34:45 -0400
Received: from mpv4-2015.cwru.edu ([129.22.103.195]:53141
	helo=mpv4-2015.case.edu) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkE0f-0007WU-Pz
	for bug-bash@gnu.org; Tue, 22 Aug 2017 14:34:41 -0400
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv4-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AND60271; Tue, 22 Aug 2017 14:34:36 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id BIT31775 (AUTH cpr);
	Tue, 22 Aug 2017 14:34:36 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu, L A Walsh <bash@tlinx.org>, bug-bash@gnu.org
Subject: Re: Line wrapping issues
To: Leon Klingele <info@leonklingele.de>
References: <CB1AC5C9-F770-448B-8071-5446227EF7CA@leonklingele.de>
	<5999FD06.8030204@tlinx.org>
	<F6E5D5E6-6522-4E5A-8A6A-7DE80FAF8154@leonklingele.de>
	<15bfcac3-1c55-787c-e27d-8d5b66ff42fc@case.edu>
	<6D04808E-52AC-43AB-B68B-D87E1DE219D7@leonklingele.de>
	<6a715ea8-6187-d4f3-b6e6-799b93e63462@case.edu>
	<A9F6F403-AD83-4B48-9AC6-F5E047BA98A1@leonklingele.de>
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <c2f69a37-0986-7158-aacc-b52ea7e0bb51@case.edu>
Date: Tue, 22 Aug 2017 14:34:28 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <A9F6F403-AD83-4B48-9AC6-F5E047BA98A1@leonklingele.de>
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature";
	boundary="UODvQwRr6gNfrWUqRwWjFEtk0lUnhPmnT"
X-Junkmail-Status: score=8/60, host=mpv4-2015.case.edu
X-Junkmail-PrAS-Raw: score=8/60, refid=2.7.2:2017.8.22.172716:17:8.317, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR, __MULTIPLE_RCPTS_CC_X2,
	__CC_NAME, __CC_NAME_DIFF_FROM_ACC,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__SUBJ_ALPHA_END, __TO_MALFORMED_2, __TO_NAME,
	__TO_NAME_DIFF_FROM_ACC, __REFERENCES, __HAS_FROM,
	FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA,
	__USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION,
	__IN_REP_TO, __CT, __CTYPE_HAS_BOUNDARY,
	__CTYPE_MULTIPART, __REPLYTO_SAMEAS_FROM_ADDY,
	__REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC2,
	__REPLYTO_SAMEAS_FROM_DOMAIN, __MIME_TEXT_P2,
	__HAS_ATTACHMENT1, __ANY_URI, __HTTPS_URI,
	__URI_WITH_PATH, __URI_NO_WWW, __CP_URI_IN_BODY,
	__SUBJ_ALPHA_NEGATE, __MULTIPLE_URI_TEXT, __URI_IN_BODY,
	__URI_NOT_IMG, __FORWARDED_MSG, __NO_HTML_TAG_RAW,
	__ATTACHMENT_SIZE_0_10K, __HAS_ATTACHMENT2,
	BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_2000_2999,
	__MIME_TEXT_P1, __URI_NS, HTML_00_01, [TRUNCATED],
	so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.195
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 22 Aug 2017 18:34:46 -0000

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--UODvQwRr6gNfrWUqRwWjFEtk0lUnhPmnT
From: Chet Ramey <chet.ramey@case.edu>
Reply-To: chet.ramey@case.edu
To: Leon Klingele <info@leonklingele.de>
Cc: chet.ramey@case.edu, L A Walsh <bash@tlinx.org>, bug-bash@gnu.org
Message-ID: <c2f69a37-0986-7158-aacc-b52ea7e0bb51@case.edu>
Subject: Re: Line wrapping issues
References: <CB1AC5C9-F770-448B-8071-5446227EF7CA@leonklingele.de>
 <5999FD06.8030204@tlinx.org>
 <F6E5D5E6-6522-4E5A-8A6A-7DE80FAF8154@leonklingele.de>
 <15bfcac3-1c55-787c-e27d-8d5b66ff42fc@case.edu>
 <6D04808E-52AC-43AB-B68B-D87E1DE219D7@leonklingele.de>
 <6a715ea8-6187-d4f3-b6e6-799b93e63462@case.edu>
 <A9F6F403-AD83-4B48-9AC6-F5E047BA98A1@leonklingele.de>
In-Reply-To: <A9F6F403-AD83-4B48-9AC6-F5E047BA98A1@leonklingele.de>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 8/22/17 2:26 PM, Leon Klingele wrote:
>> That macro ends with \C-x\C-r
>=20
> Actually it ends in \e^\er, it lands in the if-block for me:
> https://github.com/junegunn/fzf/blob/55ee4186aa688e524e041971d588a6f002=
486deb/shell/key-bindings.bash#L83

Ah, you're using the vi-mode binding. Yes, it applies equally to that
version, replacing the `\er', which is bound to redraw-current-line,
with \C-l.

>=20
> Replacing \C-r with \C-l "solves" the issue, but again clears the
> screen which I'd try to avoid.

I understand you'd like to avoid that.

>=20
> Are you unable to reproduce the issue?

I'd prefer not to install the ton of software I need to try and replicate=

it, so I'm looking at what those who have can tell me.

--=20
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~c=
het/


--UODvQwRr6gNfrWUqRwWjFEtk0lUnhPmnT
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iHIEARECADIWIQR8ATX7CIqvbGbGULm7WGnwZOp0qwUCWZx5NRQcY2hldC5yYW1l
eUBjYXNlLmVkdQAKCRC7WGnwZOp0q7LSAJwMKOdpLFpYCYJ9giMZ9+opD7yqPACg
lrJC9Cdw4BOpffiACnGMHRKO/Ng=
=uHol
-----END PGP SIGNATURE-----

--UODvQwRr6gNfrWUqRwWjFEtk0lUnhPmnT--



From MAILER-DAEMON Tue Aug 22 14:45:05 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkEAj-0002SQ-RD
	for mharc-bug-bash@gnu.org; Tue, 22 Aug 2017 14:45:05 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:59382)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1dkEAh-0002Ra-Ej
	for bug-bash@gnu.org; Tue, 22 Aug 2017 14:45:04 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1dkEAe-0004Yj-2U
	for bug-bash@gnu.org; Tue, 22 Aug 2017 14:45:03 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:47696
	helo=Ishtar.sc.tlinx.org)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <bash@tlinx.org>) id 1dkEAd-0004Qx-PU
	for bug-bash@gnu.org; Tue, 22 Aug 2017 14:44:59 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
	v7MIimus056212; Tue, 22 Aug 2017 11:44:50 -0700
Message-ID: <599C7BA0.30900@tlinx.org>
Date: Tue, 22 Aug 2017 11:44:48 -0700
From: L A Walsh <bash@tlinx.org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: chet.ramey@case.edu
CC: bug-bash <bug-bash@gnu.org>
Subject: Re: extension of file-test primitives?
References: <5998D82A.3030607@tlinx.org>
	<482362b8-b58e-4a98-cc0b-e6545b29eb8d@case.edu>
In-Reply-To: <482362b8-b58e-4a98-cc0b-e6545b29eb8d@case.edu>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
	timestamps) [generic] [fuzzy]
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 22 Aug 2017 18:45:04 -0000


Chet Ramey wrote:
> [this would] create an incompatibility between
> the shell's builtin test and a test binary. That incompatibility would be
> almost impossible to resolve.
>   
----
    Agreed.  So I agree that limiting this to use with '[['
would be a better choice that would eliminate such problems.

(reordered this to be first so I could 'reword' following
examples for clarity)

> On 8/19/17 8:30 PM, L A Walsh wrote:
>   
>> Curious, but how difficult or problematic would it be
>> to allow using brace-expansion (ex. {f,x} ) as a short-hand
>> to test/combine file-op tests like allowing:
>>
>>   [[ -{f,x} /bin/ls ]] && ...
>> or
>>    if [[ -{f,x} $file ]]; then ... ; fi
>>
>> instead of:
>>
>>   [[ -f /bin/ls && test -x /bin/ls ]] && ...
>>     
>
>   

Regarding:
> ... changing the established meaning of brace expansion,
----
    On a conceptual level, brace expansion expands
a string like '[[\ -{f,x}\ /bin/ls\ ]]' to:

  [[ -f /bin/ls ]] [[ -x /bin/ls ]]

I wasn't thinking of the current brace expansion routines
changing to implement this, but only in adding a new file-op
meta test -{X,Y[,Z[,...]]} that allows existing file operators
to be used in place of X, Y, Z.  This meta-op would only
be added to '[[' to avoid equivalent syntax expectations
out of external binaries.

As an example of conceptual equivalence of brace-expansion
in the two cases, this already works, using the standard
meaning for brace expansion (line numbers added for
ease of reference):

1) eval "
2)    [[ -"{f,x}" /bin/ls ]] &&
3)       :" &&
4)        ...(true case)...

For use as a file-op in a conditional test,  operator I was suggesting
removing lines 1 & 3 and the quotes, leaving

2)   [[ -{f,x} /bin/ls ]] &&
4)       ...(true case)...

The brace expansion would function, conceptually, the same (even
though I'm not envisioning the implementation being done through
a modification of brace expansion).





From MAILER-DAEMON Tue Aug 22 14:45:47 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkEBP-00030Q-T8
	for mharc-bug-bash@gnu.org; Tue, 22 Aug 2017 14:45:47 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:59477)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1dkEBO-0002z0-5j
	for bug-bash@gnu.org; Tue, 22 Aug 2017 14:45:47 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1dkEBL-0005XT-36
	for bug-bash@gnu.org; Tue, 22 Aug 2017 14:45:46 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:47724
	helo=Ishtar.sc.tlinx.org)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <bash@tlinx.org>) id 1dkEBK-0005Uq-Bk
	for bug-bash@gnu.org; Tue, 22 Aug 2017 14:45:42 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
	v7MIja2r056336; Tue, 22 Aug 2017 11:45:38 -0700
Message-ID: <599C7BD0.6070503@tlinx.org>
Date: Tue, 22 Aug 2017 11:45:36 -0700
From: L A Walsh <bash@tlinx.org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: chet.ramey@case.edu
CC: bug-bash <bug-bash@gnu.org>
Subject: Re: extension of file-test primitives?
References: <5998D82A.3030607@tlinx.org>
	<7023b203-395b-c63e-7678-eccbc1d19be2@passchier.net>
	<5999FD26.5060008@tlinx.org>
	<eff83c0e-98ae-ff02-da01-fb4bbe099a72@case.edu>
In-Reply-To: <eff83c0e-98ae-ff02-da01-fb4bbe099a72@case.edu>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
	timestamps) [generic] [fuzzy]
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 22 Aug 2017 18:45:47 -0000

Oops: meant to include this w/other response, but oh well..

Chet Ramey wrote:
>> PePa wrote:
>>     
>>> In that case, would not [[ -fx $file ]] be more workable and in line with common GNU short commandline option practice??
>>>       
>
> No. If you're going to propose different functionality, don't use
> something that can easily be confused with something that already
> exists.
>   
---
    That's why I suggested the {f,x} instead as noted in my response
to PePa.  I too thought it might be confused w/something that already
exists.




From MAILER-DAEMON Wed Aug 23 00:26:04 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkNEy-00006i-N8
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 00:26:04 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:57478)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1dkNEv-0008Vv-Sf
	for bug-bash@gnu.org; Wed, 23 Aug 2017 00:26:02 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1dkNEs-0003GS-Pm
	for bug-bash@gnu.org; Wed, 23 Aug 2017 00:26:01 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:41128
	helo=Ishtar.sc.tlinx.org)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <bash@tlinx.org>) id 1dkNEs-00039z-7s
	for bug-bash@gnu.org; Wed, 23 Aug 2017 00:25:58 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
	v7N4PiJ0088778; Tue, 22 Aug 2017 21:25:46 -0700
Message-ID: <599D03C8.2070604@tlinx.org>
Date: Tue, 22 Aug 2017 21:25:44 -0700
From: L A Walsh <bash@tlinx.org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: chet.ramey@case.edu
CC: Greg Wooledge <wooledg@eeg.ccf.org>, bug-bash@gnu.org
Subject: Re: extension of file-test primitives?
References: <5998D82A.3030607@tlinx.org>	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
In-Reply-To: <37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
	timestamps) [generic] [fuzzy]
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 04:26:03 -0000

Chet Ramey wrote:
> On 8/21/17 9:27 AM, Greg Wooledge wrote:
>   
>> You could write your own helper functions for this:
>>
>> -fx() { test -f "$1" && test -x "$1"; }
>>     
>
> This is indeed a quick and easy way to implement desired functionality.
> Shell functions can do a lot.
>   
----
    Alas, they don't work inside [[...]] with other
file-test operators:

[[ -fx /bin/ls && -s /bin/ls ]] && echo ok
-bash: conditional binary operator expected
-bash: syntax error near `/bin/ls'







From MAILER-DAEMON Wed Aug 23 08:36:56 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkUu0-00033s-81
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 08:36:56 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:36628)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1dkUtw-000336-EX
	for bug-bash@gnu.org; Wed, 23 Aug 2017 08:36:55 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1dkUtr-0000r7-8S
	for bug-bash@gnu.org; Wed, 23 Aug 2017 08:36:52 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:33578 helo=svr4.eeg.ccf.org)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1dkUtr-0000Lg-24
	for bug-bash@gnu.org; Wed, 23 Aug 2017 08:36:47 -0400
Received: (qmail 38063 invoked from network); 23 Aug 2017 12:36:17 -0000
Received: from wooledg.eeg.ccf.org (10.76.172.97)
	by gateway.eeg.ccf.org with SMTP; Wed, 23 Aug 2017 08:36:17 -0400
Received: (qmail 7310 invoked by uid 563); 23 Aug 2017 12:36:17 -0000
Date: Wed, 23 Aug 2017 08:36:17 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: L A Walsh <bash@tlinx.org>
Cc: bug-bash@gnu.org
Subject: Re: extension of file-test primitives?
Message-ID: <20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <599D03C8.2070604@tlinx.org>
User-Agent: NeoMutt/20170113 (1.7.2)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 139.137.100.1
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 12:36:55 -0000

On Tue, Aug 22, 2017 at 09:25:44PM -0700, L A Walsh wrote:
> Chet Ramey wrote:
> > On 8/21/17 9:27 AM, Greg Wooledge wrote:
> > > You could write your own helper functions for this:
> > > 
> > > -fx() { test -f "$1" && test -x "$1"; }
> > 
> > This is indeed a quick and easy way to implement desired functionality.
> > Shell functions can do a lot.
> ----
>    Alas, they don't work inside [[...]] with other
> file-test operators:
> 
> [[ -fx /bin/ls && -s /bin/ls ]] && echo ok

They're not intended to work that way.  If you want to test f+x+s then
you just make another function:

-fxs() { test -f "$1" && test -x "$1" && test -s "$1"; }

if -fxs /bin/ls; then ...

You could also take the original function and combine it with a test
command:

if -fx /bin/ls && test -s /bin/ls; then ...

Or, since you seem to be infatuated with the [[ command:

if -fx /bin/ls && [[ -s /bin/ls ]]; then ...


All of your syntactic proposals have problems.  First, curly braces.
These already have their own semantics, and what you are proposing
does not work with those semantics.  You proposed:

[[ -{f,x} $file ]]

With standard curly brace semantics (ignoring [['s stupid magic
parser-bending rules for the moment) this expands to:

[[ -f -x $file ]]

If we use single brackets and set -x we can even witness the shell
expanding it thus.

wooledg:~$ [ -{f,x} file ]
+ '[' -f -x file ']'
bash: [: -x: binary operator expected


Second, you proposed test -fx.  But this collides with existing
multi-character test options.  Specifically, test has the options -e,
-f, and -ef.  So your proposal of letter-concatenation would take
the -e and -f options and squash them together into -ef, which would
collide with the "two files are hard links to the same inode" option.

Likewise, the unary options -n and -t would combine into -nt which
collides with the binary "mtime is newer than" option.

Sure, you might argue that there is no reason to combine -e and -f
together, since one implies the other; or that no sane person would
ever combine -n and -t together; but that's not the point.  The point
is to avoid reader confusion.  It's already bad enough that the -a
option is overloaded and has two completely different meanings.  Let's
not compound that mistake.


From MAILER-DAEMON Wed Aug 23 08:55:22 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkVBq-0001jz-85
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 08:55:22 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41412)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1dkVBo-0001je-8M
	for bug-bash@gnu.org; Wed, 23 Aug 2017 08:55:21 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1dkVBk-000133-8w
	for bug-bash@gnu.org; Wed, 23 Aug 2017 08:55:20 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:32794
	helo=Ishtar.sc.tlinx.org)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <bash@tlinx.org>) id 1dkVBj-00012J-TG
	for bug-bash@gnu.org; Wed, 23 Aug 2017 08:55:16 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
	v7NCt8kM028597; Wed, 23 Aug 2017 05:55:10 -0700
Message-ID: <599D7B2C.5000509@tlinx.org>
Date: Wed, 23 Aug 2017 05:55:08 -0700
From: L A Walsh <bash@tlinx.org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: Greg Wooledge <wooledg@eeg.ccf.org>
CC: bug-bash@gnu.org
Subject: Re: extension of file-test primitives?
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
In-Reply-To: <20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
	timestamps) [generic] [fuzzy]
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 12:55:21 -0000



Greg Wooledge wrote:
>
>
> They're not intended to work that way.  If you want to test f+x+s then
> you just make another function:
>
> -fxs() { test -f "$1" && test -x "$1" && test -s "$1"; }
>   
How many different single-ops?  over 20?  That's 20 factorial
combos.  You wanna include that in a script?  um...
>
> All of your syntactic proposals have problems.  First, curly braces.
> These already have their own semantics, and what you are proposing
> does not work with those semantics.  You proposed:
>
> [[ -{f,x} $file ]]
>
> With standard curly brace semantics (ignoring [['s stupid magic
> parser-bending rules for the moment) this expands to:
>   
----
    Nope.. can't ignore '[['s special rules.  That's why this
can work.
>
>
> Second, you proposed test -fx.
I did not -- that was PePa's idea which had nothing to do with
my proposal.  My initial design avoided that issue specifically for
that reason.   I spoke out against using a combined op like -ge
(as you would suggest for a function name) because it conflicts
with existing two character operators.

The rest of your argument against merged primitives like
funcs -ef, -fe... etc. applies to your using function names
with those names as well as PePa's idea.

The only form I proposed is -{X,Y,Z....} and after Chet pointed
out the compat probs with external 'test' binaries, I limited
to only being used with '[[' -- which has its own compat rules --
that being the reason I agreed w/Chet to limit it to use
with '[[' -- right Chet?  ;-)






From MAILER-DAEMON Wed Aug 23 08:56:10 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkVCc-0001yt-Dy
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 08:56:10 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41672)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <peterpasschier@gmail.com>) id 1dkVCZ-0001yV-Qz
	for bug-bash@gnu.org; Wed, 23 Aug 2017 08:56:08 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <peterpasschier@gmail.com>) id 1dkVCV-0001Ul-Ql
	for bug-bash@gnu.org; Wed, 23 Aug 2017 08:56:07 -0400
Received: from mail-pf0-x236.google.com ([2607:f8b0:400e:c00::236]:34400)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <peterpasschier@gmail.com>)
	id 1dkVCV-0001TN-KW
	for bug-bash@gnu.org; Wed, 23 Aug 2017 08:56:03 -0400
Received: by mail-pf0-x236.google.com with SMTP id h75so138808pfh.1
	for <bug-bash@gnu.org>; Wed, 23 Aug 2017 05:56:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=sender:subject:cc:references:from:message-id:date:user-agent
	:mime-version:in-reply-to:content-language:content-transfer-encoding;
	bh=+3YDfuLDbHf9r6xU2SRLS2a5lpPGmQULYo7ny6o707k=;
	b=FuzwGDBvIbfZBRI9HdPmyii0XKzq4+AU8DgY7x3vmcZGidHm6qbSA+id+PAjX9MDhs
	wrLT6eqxcMKzRF89+KVqEE2Tv3sLTV2/+L8KKoYeo/QjY3dsJdgj0ZCQp0jSKDc/N0+n
	IUIfDWzvKl8PSz9jzwkENSBdwZo8nySrUh+U29jow67iq2aScKVOurFEQV3vy/u/fd2z
	39m7JyE3+msZKqUykC3t5G5SUzHWfXmQMbp66rgYkjH8+cZ7FYAR/VOh3rD6t3Cgaq7B
	6EwLi5z68y24scPxrLdItJtfTWswnBX4QMOCKryfM5kN9mqc4TzY4npBLi3jbqe2e+y6
	dGjA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:sender:subject:cc:references:from:message-id
	:date:user-agent:mime-version:in-reply-to:content-language
	:content-transfer-encoding;
	bh=+3YDfuLDbHf9r6xU2SRLS2a5lpPGmQULYo7ny6o707k=;
	b=rgZ5KDNz9HaCWDzLxB5PdZgAf70WDI5tEWEh1jGAE1TUYQVZ2/dm7mAZVHG21jhn8d
	Cyajhl47Vn4X7+gG/1quwbB0XKtmiiEDGoph5OnU+JnXxyJYmyxrLlyc3dCZlbloXipm
	WEKWJWh1Ak5mmRhE5LrJd0p3InWXtc1ni/HZ8p1zxdt+jKVZj75cMeGyHocdGWErTcOA
	uZfL0fH1cEgdtJr1eOBuUBiXy5TqKxu8qRn6kFVhKnvWA/qbHIDpzKGj08FSKjmihEfJ
	RKSNAp6tRzNGvquF/p/FYf3lsvbHDvJmRmqPGYoYCdOmV0KoUgSQfW3vgx8RM3WzCT+c
	5JZQ==
X-Gm-Message-State: AHYfb5jvoGt/1z4Ea1KUXD3Gv6yaLzt/a5Nka0tWbOLGKiNT7cI9iSIv
	BoL2axucuNOtlXqF
X-Received: by 10.84.217.206 with SMTP id d14mr2941026plj.319.1503492961003;
	Wed, 23 Aug 2017 05:56:01 -0700 (PDT)
Received: from [192.168.4.102] ([171.4.67.68])
	by smtp.gmail.com with ESMTPSA id
	r9sm3183105pfd.126.2017.08.23.05.55.57 for <bug-bash@gnu.org>
	(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Wed, 23 Aug 2017 05:55:58 -0700 (PDT)
Sender: Peter Passchier <peterpasschier@gmail.com>
Subject: Re: extension of file-test primitives?
Cc: bug-bash@gnu.org
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
From: Peter & Kelly Passchier <peterkelly@passchier.net>
Message-ID: <dfeddbd5-d843-d1b3-91a5-b2a2a45b465e@passchier.net>
Date: Wed, 23 Aug 2017 19:55:55 +0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
	Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:400e:c00::236
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 12:56:08 -0000

On 08/23/2017 07:36 PM, Greg Wooledge wrote:
> Second, you proposed test -fx.  But this collides with existing
> multi-character test options.  Specifically, test has the options -e,
> -f, and -ef.  So your proposal of letter-concatenation would take
> the -e and -f options and squash them together into -ef, which would
> collide with the "two files are hard links to the same inode" option.
> 
> Likewise, the unary options -n and -t would combine into -nt which
> collides with the binary "mtime is newer than" option.
> 
> Sure, you might argue that there is no reason to combine -e and -f
> together, since one implies the other; or that no sane person would
> ever combine -n and -t together; but that's not the point.  The point
> is to avoid reader confusion.  It's already bad enough that the -a
> option is overloaded and has two completely different meanings.  Let's
> not compound that mistake.

I was the one proposing combining the UNARY operators in a way like -fx, 
and your -a example shows that there is a precedent. Unary and binary 
operators are different, so there is no confusion for the parser or for 
the user. It would just work for the person who would like to use it. 
The combining would only be allowed (and only make sense) for the unary 
operators, and it would lead to a  much cleaner and more readable 
source. It is also in line with common GNU combining-short-options 
syntax. Users might even expect this to work already.

This change would not hurt backwards compatibility and enhance bash in a 
clean way, making things more readable where they would/could be used.

Peter




From MAILER-DAEMON Wed Aug 23 09:10:26 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkVQP-000167-UY
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 09:10:25 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:45974)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1dkVQO-00014X-19
	for bug-bash@gnu.org; Wed, 23 Aug 2017 09:10:24 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1dkVQK-00017P-P9
	for bug-bash@gnu.org; Wed, 23 Aug 2017 09:10:24 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:33610 helo=svr4.eeg.ccf.org)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1dkVQK-000174-GG
	for bug-bash@gnu.org; Wed, 23 Aug 2017 09:10:20 -0400
Received: (qmail 39851 invoked from network); 23 Aug 2017 13:10:19 -0000
Received: from wooledg.eeg.ccf.org (10.76.172.97)
	by gateway.eeg.ccf.org with SMTP; Wed, 23 Aug 2017 09:10:19 -0400
Received: (qmail 7535 invoked by uid 563); 23 Aug 2017 13:10:19 -0000
Date: Wed, 23 Aug 2017 09:10:19 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Peter & Kelly Passchier <peterkelly@passchier.net>
Cc: bug-bash@gnu.org
Subject: Re: extension of file-test primitives?
Message-ID: <20170823131019.y5k4iu2f5by2n2qy@eeg.ccf.org>
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<dfeddbd5-d843-d1b3-91a5-b2a2a45b465e@passchier.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <dfeddbd5-d843-d1b3-91a5-b2a2a45b465e@passchier.net>
User-Agent: NeoMutt/20170113 (1.7.2)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 139.137.100.1
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 13:10:25 -0000

On Wed, Aug 23, 2017 at 07:55:55PM +0700, Peter & Kelly Passchier wrote:
> I was the one proposing combining the UNARY operators in a way like -fx, and
> your -a example shows that there is a precedent. Unary and binary operators
> are different, so there is no confusion for the parser or for the user.

No, trust me, there *IS* confusion for the users.  Try hanging out
in #bash for a while and you'll see (unless you gouge your eyes out
first).


From MAILER-DAEMON Wed Aug 23 09:16:30 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkVWI-0004d9-IS
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 09:16:30 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:46905)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkVWF-0004Zd-Ux
	for bug-bash@gnu.org; Wed, 23 Aug 2017 09:16:28 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkVWD-0004ty-Ao
	for bug-bash@gnu.org; Wed, 23 Aug 2017 09:16:27 -0400
Received: from mpv2-2015.cwru.edu ([129.22.103.227]:47061
	helo=mpv1-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1dkVWD-0004tB-4h
	for bug-bash@gnu.org; Wed, 23 Aug 2017 09:16:25 -0400
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv2-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AON81934; Wed, 23 Aug 2017 09:16:20 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id BIU12430 (AUTH cpr);
	Wed, 23 Aug 2017 09:16:20 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu, bug-bash@gnu.org
Subject: Re: extension of file-test primitives?
To: Peter & Kelly Passchier <peterkelly@passchier.net>
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<dfeddbd5-d843-d1b3-91a5-b2a2a45b465e@passchier.net>
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <8cc50ced-e4cf-4e6d-b0d9-0e777a195142@case.edu>
Date: Wed, 23 Aug 2017 09:16:19 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <dfeddbd5-d843-d1b3-91a5-b2a2a45b465e@passchier.net>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Junkmail-Status: score=8/60, host=mpv2-2015.case.edu
X-Junkmail-PrAS-Raw: score=8/60, refid=2.7.2:2017.8.23.120016:17:8.317, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR, __MULTIPLE_RCPTS_CC_X2,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC,
	__REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID,
	__SANE_MSGID, DATE_TZ_NA, __USER_AGENT,
	__MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT,
	__CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY,
	__REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC2,
	__REPLYTO_SAMEAS_FROM_DOMAIN, __ANY_URI, __URI_WITH_PATH,
	__URI_NO_WWW, __CP_URI_IN_BODY, __SUBJ_ALPHA_NEGATE,
	__URI_IN_BODY, __URI_NOT_IMG, __NO_HTML_TAG_RAW,
	BODYTEXTP_SIZE_400_LESS, BODYTEXTP_SIZE_3000_LESS,
	BODY_SIZE_300_399, __MIME_TEXT_P1, __MIME_TEXT_ONLY,
	__URI_NS, HTML_00_01, HTML_00_10, BODY_SIZE_5000_LESS,
	IN_REP_TO, MSG_THREAD, __FROM_DOMAIN_IN_RCPT,
	__TO_REAL_NAMES, MULTIPLE_REAL_RCPTS, LEGITIMATE_SIGNS,
	__SINGLE_URI_TEXT, [TRUNCATED], so=2010-03-03 19:42:08,
	dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.227
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 13:16:28 -0000

On 8/23/17 8:55 AM, Peter & Kelly Passchier wrote:

> Users
> might even expect this to work already.

Nobody expects this to work already; it never has and there's no reason
to think it would.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Wed Aug 23 09:22:34 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkVcA-00066c-J9
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 09:22:34 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:48405)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1dkVc9-00065p-CL
	for bug-bash@gnu.org; Wed, 23 Aug 2017 09:22:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1dkVc8-0008DJ-Hu
	for bug-bash@gnu.org; Wed, 23 Aug 2017 09:22:33 -0400
Received: from mail-qt0-x232.google.com ([2607:f8b0:400d:c0d::232]:38673)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <pierre.gaston@gmail.com>)
	id 1dkVc8-0008CW-DY
	for bug-bash@gnu.org; Wed, 23 Aug 2017 09:22:32 -0400
Received: by mail-qt0-x232.google.com with SMTP id 57so450092qtu.5
	for <bug-bash@gnu.org>; Wed, 23 Aug 2017 06:22:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc; bh=b24gxAlIAIRtejl2Su8s4aTzGGJFvQEWgydHJu+huhQ=;
	b=Th0mEf47LfUbzzMNqjMGEY0RzIBjj6i777lprvcUkTHX2ewZZ5Png2eKmWYP1EhOJa
	gdBbKy1fD4pVdizcRC3cNgP6Ykw5w4Jhi+eBn3UObHIZjNeE/sFn3P81Kmk/N6/uJvPJ
	SFAiKRCJbFPGlkM0rfq9myetqE/pr60rMRMzHpfeWCguiMlViXgdocxle2L8DqjLlFH+
	Nh/nhRfzJy7bH1gZiE7vCquC0m+5b3vsnG30hxj0IhLwzAmR4ngyCJG4I2Sd9CU7+o0a
	lv06vY2nrJjPVFTqiybCImwKyOqnYlRVZBRjn9d3YfjstxOLoyDKPUypi6sks3XGBa29
	6Zuw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to:cc;
	bh=b24gxAlIAIRtejl2Su8s4aTzGGJFvQEWgydHJu+huhQ=;
	b=KDlABJ4+rYECTmQ1jzpdddjhvL+dkz3oSyRw9uxxw7HuECwa/+gZ+N3fHEw3Zfgn93
	wwKx61dAR8Bl6uV5qvx6B1W3nwrrDNtjrRRRZopW+ZEWdRpfXkOZj0S8sDsoW2xxnflk
	HhZSS75pUZZIrY49sslYqUE29y/qLQsBKI9FihomAoW+bnNn3wdOCLozlHtWuNeG0Bfd
	XybrvSO+wx+eKJZdUkpliv7N31adon+XMjYYcT+Trkds2FCyZF8vGVmWsRM4Y8IilwrC
	TF8/6LPRt5jYuvjM52V78ybxvhYcWYd5Gb20jZ3/HtkRFCqFtsTQNLIJxMZ47lfGzS0P
	hfyw==
X-Gm-Message-State: AHYfb5hMF7gvPnergWxmZCoYozfOmU/xIfVJwQll4YsHSIEPZzZAWeJK
	8HCwiGlTO90fxVk7BqHhcZqcx5Li2Q==
X-Received: by 10.237.48.4 with SMTP id 4mr3422473qte.176.1503494550650; Wed,
	23 Aug 2017 06:22:30 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.12.171.2 with HTTP; Wed, 23 Aug 2017 06:22:09 -0700 (PDT)
In-Reply-To: <599D7B2C.5000509@tlinx.org>
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<599D7B2C.5000509@tlinx.org>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Wed, 23 Aug 2017 16:22:09 +0300
Message-ID: <CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
Subject: Re: extension of file-test primitives?
To: L A Walsh <bash@tlinx.org>
Cc: Greg Wooledge <wooledg@eeg.ccf.org>, "bug-bash@gnu.org" <bug-bash@gnu.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:400d:c0d::232
Content-Type: text/plain; charset="UTF-8"
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 13:22:34 -0000

On Wed, Aug 23, 2017 at 3:55 PM, L A Walsh <bash@tlinx.org> wrote:

>
>
> Greg Wooledge wrote:
>
>>
>>
>> They're not intended to work that way.  If you want to test f+x+s then
>> you just make another function:
>>
>> -fxs() { test -f "$1" && test -x "$1" && test -s "$1"; }
>>
>>
> How many different single-ops?  over 20?  That's 20 factorial
> combos.  You wanna include that in a script?  um...
>

You can use a loop, here is hack(ish) function that perhaps work (ie not
tested too much)

 testfile () {
    local OPTIND=1 f=${!#}
    while getopts abcdefghLkprsSuwxOGN opt;
          do
             case $opt in
               [abcdefghLkprsSuwxOGN]) test -$opt $f  || return 1;;
               *)return 1;;
             esac;
           done
 }

if testfile -fx file;then.

From MAILER-DAEMON Wed Aug 23 09:34:55 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkVo7-0000hO-4q
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 09:34:55 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:50729)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1dkVo4-0000fy-KT
	for bug-bash@gnu.org; Wed, 23 Aug 2017 09:34:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1dkVo0-0005k3-Ao
	for bug-bash@gnu.org; Wed, 23 Aug 2017 09:34:52 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:33622 helo=svr4.eeg.ccf.org)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1dkVo0-0005jh-2i
	for bug-bash@gnu.org; Wed, 23 Aug 2017 09:34:48 -0400
Received: (qmail 40049 invoked from network); 23 Aug 2017 13:34:46 -0000
Received: from wooledg.eeg.ccf.org (10.76.172.97)
	by gateway.eeg.ccf.org with SMTP; Wed, 23 Aug 2017 09:34:46 -0400
Received: (qmail 7736 invoked by uid 563); 23 Aug 2017 13:34:46 -0000
Date: Wed, 23 Aug 2017 09:34:46 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: "bug-bash@gnu.org" <bug-bash@gnu.org>
Subject: Re: extension of file-test primitives?
Message-ID: <20170823133446.b3nswi63vugutkzf@eeg.ccf.org>
Mail-Followup-To: "bug-bash@gnu.org" <bug-bash@gnu.org>
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<599D7B2C.5000509@tlinx.org>
	<CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
User-Agent: NeoMutt/20170113 (1.7.2)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 139.137.100.1
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 13:34:53 -0000

On Wed, Aug 23, 2017 at 04:22:09PM +0300, Pierre Gaston wrote:
>  testfile () {
>     local OPTIND=1 f=${!#}
>     while getopts abcdefghLkprsSuwxOGN opt;
>           do
>              case $opt in
>                [abcdefghLkprsSuwxOGN]) test -$opt $f  || return 1;;

"$f"

>                *)return 1;;
>              esac;
>            done
>  }
> 
> if testfile -fx file;then.

Add the quotes, make opt local too, and I think we have a winner.


From MAILER-DAEMON Wed Aug 23 09:37:59 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkVr5-0002FY-Hw
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 09:37:59 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:51880)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkVr3-0002DR-99
	for bug-bash@gnu.org; Wed, 23 Aug 2017 09:37:58 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkVqz-00085H-56
	for bug-bash@gnu.org; Wed, 23 Aug 2017 09:37:57 -0400
Received: from mpv2-2015.cwru.edu ([129.22.103.227]:51223
	helo=mpv1-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1dkVqy-000857-V7
	for bug-bash@gnu.org; Wed, 23 Aug 2017 09:37:53 -0400
Received: from mpv6-2015.CWRU.Edu (EHLO mpv6-2015.case.edu) ([129.22.103.202])
	by mpv2-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AON83345; Wed, 23 Aug 2017 09:37:51 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id BIN71196 (AUTH cpr);
	Wed, 23 Aug 2017 09:37:51 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: extension of file-test primitives?
To: "bug-bash@gnu.org" <bug-bash@gnu.org>
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<599D7B2C.5000509@tlinx.org>
	<CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
	<20170823133446.b3nswi63vugutkzf@eeg.ccf.org>
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <fa0c0b89-a97c-1f1b-2729-a7e2ec603b2c@case.edu>
Date: Wed, 23 Aug 2017 09:37:51 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <20170823133446.b3nswi63vugutkzf@eeg.ccf.org>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Junkmail-Status: score=7/60, host=mpv2-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.23.130316:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__TO_MALFORMED_2, __TO_NO_NAME, __TO_NAME, __REFERENCES,
	__HAS_FROM, FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID,
	DATE_TZ_NA, __USER_AGENT, __MOZILLA_USER_AGENT,
	__MIME_VERSION, __IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE,
	__REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC,
	__FROM_DOMAIN_IN_ANY_CC1, __FROM_DOMAIN_IN_ANY_CC2,
	__REPLYTO_SAMEAS_FROM_DOMAIN, __ANY_URI, __URI_WITH_PATH,
	__URI_NO_WWW, __CP_URI_IN_BODY,
	__FRAUD_MONEY_CURRENCY_DOLLAR, __SUBJ_ALPHA_NEGATE,
	__URI_IN_BODY, __URI_NOT_IMG, __FORWARDED_MSG,
	__NO_HTML_TAG_RAW, BODYTEXTP_SIZE_3000_LESS,
	BODY_SIZE_900_999, __MIME_TEXT_P1, __MIME_TEXT_ONLY,
	__URI_NS, HTML_00_01, HTML_00_10, __FRAUD_MONEY_CURRENCY,
	BODY_SIZE_5000_LESS, IN_REP_TO, MSG_THREAD,
	__FROM_DOMAIN_IN_RCPT, MULTIPLE_REAL_RCPTS,
	LEGITIMATE_SIGNS, [TRUNCATED], so=2010-03-03 19:42:08,
	dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.227
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 13:37:58 -0000

On 8/23/17 9:34 AM, Greg Wooledge wrote:
> On Wed, Aug 23, 2017 at 04:22:09PM +0300, Pierre Gaston wrote:
>>  testfile () {
>>     local OPTIND=1 f=${!#}
>>     while getopts abcdefghLkprsSuwxOGN opt;
>>           do
>>              case $opt in
>>                [abcdefghLkprsSuwxOGN]) test -$opt $f  || return 1;;
> 
> "$f"
> 
>>                *)return 1;;
>>              esac;
>>            done
>>  }
>>
>> if testfile -fx file;then.
> 
> Add the quotes, make opt local too, and I think we have a winner.
This has the advantage of supporting both syntax options: a single
option with multiple operators or a series of options, each with one
or more operators, combined with a single operand.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Wed Aug 23 09:55:59 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkW8V-0001rW-Eu
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 09:55:59 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56949)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1dkW8T-0001rL-7f
	for bug-bash@gnu.org; Wed, 23 Aug 2017 09:55:58 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1dkW8Q-0000cj-0X
	for bug-bash@gnu.org; Wed, 23 Aug 2017 09:55:57 -0400
Received: from mout.web.de ([212.227.17.11]:60968)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <dethrophes@web.de>) id 1dkW8P-0000c1-NR
	for bug-bash@gnu.org; Wed, 23 Aug 2017 09:55:53 -0400
Received: from Galaxy-Tab-S2.fritz.box ([79.219.217.62]) by smtp.web.de
	(mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id
	0Mb90x-1e0FhF3mqB-00KkDU; Wed, 23 Aug 2017 15:55:43 +0200
Date: Wed, 23 Aug 2017 15:51:09 +0200
User-Agent: K-9 Mail for Android
In-Reply-To: <fa0c0b89-a97c-1f1b-2729-a7e2ec603b2c@case.edu>
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<599D7B2C.5000509@tlinx.org>
	<CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
	<20170823133446.b3nswi63vugutkzf@eeg.ccf.org>
	<fa0c0b89-a97c-1f1b-2729-a7e2ec603b2c@case.edu>
MIME-Version: 1.0
Content-Type: text/plain;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable
Subject: Re: extension of file-test primitives?
To: chet.ramey@case.edu, Chet Ramey <chet.ramey@case.edu>,
	"bug-bash@gnu.org" <bug-bash@gnu.org>
From: Dethrophes <dethrophes@web.de>
Message-ID: <081B3548-F9FC-4B2E-A711-981B745A39F5@web.de>
X-Provags-ID: V03:K0:fkm/zpHWKY9RhfSGyXDAcSNdWoWwJwnY3M/hpDsPuoW7/AUFJPB
	PMStvUSwUx89/Gu0Ob1BAuuNO3emKJeP9TiGV0OAdeirKOu70MJnvslDDmV9uSC4d09dmMp
	7ChhnPryXScFLhDbh4DLX31A4nqmH/cHQQxXM4HqvKOZYRhceInbTPY9qfrdFqXnpXwiLws
	3O/DZfmS+3LtpU1Xjo6Kg==
X-UI-Out-Filterresults: notjunk:1;V01:K0:uoLuR40pLek=:pgyd9qNXJRGkj/Q7r0w+3p
	vyUJXZcmUC8GtgL4tvpWkDJdnWPRJiDCtt9Ea9Mdh26wEurckh6ha+YssegsewTqbh/Ul1gZe
	dGXjE1vDyD/9hthtWuiQTFN9l+1JUg+8h/FoL69SpcXlTnldmtG/JO3B1M8HU+vfZNX5qIw7V
	01ghhaD3VD5U0eMDL9eC1ykXJ9fgd0EMlt9H0K8LHqEpEqnxv37nlq2kN4BRgnBMkRHDFiBAK
	XDwrjLfPSz7t2Xh0hX+xMhRN23Fa52H96airPZUN1FZ/TlG/kHJC4Qw5Kuz2j7U5dj0iAxpos
	LhK9EFi0sDgSpY36PrV4glzbR+698/hWyny4U3DBenPPDb0CQ13m1ThEvkYySOOQqpKd47ZHC
	rUIIO8R4Hi5AnF2FqWVxyKnfSGJg4jKsXfI9lsAK5nZB694vYUo5H4SXvc9gsFrdMhMPrfkVN
	t6eyjNrnTImhNn2ll0ZnGnUyd8DC7gkKnLSTTmed6MUbeOxVZuTEwlTGY1dAGS6986FSS1KOh
	piDwGktcfdGCMQEKMs5Lg3VICNNYfSp6nW9F2rlDA2ggj2Sngrct1oCm/k1Z1VWu3tBe8Lscb
	seE3n4un1ZwQjBQKwFs+Ha8Tn5lkrAeunfRYtQREJhESNhcGa9nfmpzYVJ1FsElH+FwRjr2aV
	2KOkPmBdIeo21HTj9gpAzNQ6zUrc8t/K7eKQHhpNnM1lpLAGGyfhwc1eg2pzQqmN5Uxw189fX
	iBzQK2CuvfO45qEGvroU770hqxmQYJ8Mn8QzY7E+nvXkueK+zPq3I48Vwh0m14IVMnTvKhvaS
	1s+z8pGpv8oqroSFexDzEdnS3K6ytbgOyEy0COk/4pb/PK+C5I=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 212.227.17.11
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 13:55:58 -0000



On August 23, 2017 3:37:51 PM GMT+02:00, Chet Ramey <chet=2Eramey@case=2Ee=
du> wrote:
>On 8/23/17 9:34 AM, Greg Wooledge wrote:
>> On Wed, Aug 23, 2017 at 04:22:09PM +0300, Pierre Gaston wrote:
>>>  testfile () {
>>>     local OPTIND=3D1 f=3D${!#}
>>>     while getopts abcdefghLkprsSuwxOGN opt;
>>>           do
>>>              case $opt in
>>>                [abcdefghLkprsSuwxOGN]) test -$opt $f  || return 1;;
>>=20
>> "$f"
>>=20
>>>                *)return 1;;
>>>              esac;
>>>            done
>>>  }
>>>
>>> if testfile -fx file;then=2E
>>=20
>> Add the quotes, make opt local too, and I think we have a winner=2E
>This has the advantage of supporting both syntax options: a single
>option with multiple operators or a series of options, each with one
>or more operators, combined with a single operand=2E

Not really as it changes the meaning of=20
test -f file -a -x file
Which I always understood as the correct way of doing this in the first pl=
ace=2E=2E=2E

The only optimisation would be to possible cache the stat to save on syste=
m io=2E

--=20
Envoy=C3=A9 de mon t=C3=A9l=C3=A9phone Android avec K-9 Mail=2E Excusez la=
 bri=C3=A8vet=C3=A9=2E


From MAILER-DAEMON Wed Aug 23 10:02:54 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkWFC-0005Pw-0q
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 10:02:54 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:58878)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkWF9-0005PW-4D
	for bug-bash@gnu.org; Wed, 23 Aug 2017 10:02:52 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkWF3-0004s0-Hm
	for bug-bash@gnu.org; Wed, 23 Aug 2017 10:02:51 -0400
Received: from mpv4-2015.cwru.edu ([129.22.103.195]:22669
	helo=mpv4-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1dkWF3-0004re-Bh
	for bug-bash@gnu.org; Wed, 23 Aug 2017 10:02:45 -0400
Received: from mpv6-2015.CWRU.Edu (EHLO mpv6-2015.case.edu) ([129.22.103.202])
	by mpv4-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AND88283; Wed, 23 Aug 2017 10:02:41 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id BIN77624 (AUTH cpr);
	Wed, 23 Aug 2017 10:02:40 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: extension of file-test primitives?
To: Dethrophes <dethrophes@web.de>, "bug-bash@gnu.org" <bug-bash@gnu.org>
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<599D7B2C.5000509@tlinx.org>
	<CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
	<20170823133446.b3nswi63vugutkzf@eeg.ccf.org>
	<fa0c0b89-a97c-1f1b-2729-a7e2ec603b2c@case.edu>
	<081B3548-F9FC-4B2E-A711-981B745A39F5@web.de>
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <593186a4-f19a-eca5-9aea-a522bb4e74d2@case.edu>
Date: Wed, 23 Aug 2017 10:02:40 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <081B3548-F9FC-4B2E-A711-981B745A39F5@web.de>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Junkmail-Status: score=7/60, host=mpv4-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.23.132416:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC,
	__REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID,
	__SANE_MSGID, DATE_TZ_NA, __USER_AGENT,
	__MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT,
	__CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY,
	__REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1,
	__FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN,
	__ANY_URI, __URI_WITH_PATH, __URI_NO_WWW,
	__CP_URI_IN_BODY, __SUBJ_ALPHA_NEGATE, __URI_IN_BODY,
	__URI_NOT_IMG, __FORWARDED_MSG, __NO_HTML_TAG_RAW,
	BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_1000_1099,
	__MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01,
	HTML_00_10, BODY_SIZE_5000_LESS, IN_REP_TO, MSG_THREAD,
	__FROM_DOMAIN_IN_RCPT, __TO_REAL_NAMES,
	MULTIPLE_REAL_RCPTS, LEGITIMATE_SIGNS, __SINGLE_URI_TEXT,
	[TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.195
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 14:02:52 -0000

On 8/23/17 9:51 AM, Dethrophes wrote:

>>>> if testfile -fx file;then.
>>>
>>> Add the quotes, make opt local too, and I think we have a winner.
>> This has the advantage of supporting both syntax options: a single
>> option with multiple operators or a series of options, each with one
>> or more operators, combined with a single operand.
> 
> Not really as it changes the meaning of 
> test -f file -a -x file

It is not a drop-in replacement for test; it is syntactic sugar for
compound test operations. If you're concerned about this, add a test
before the loop to ensure that there are only two arguments to the function
and restrict it to that syntax option only.

> Which I always understood as the correct way of doing this in the first place...

It's not as good as multiple test commands: test -f file && test -x file.
There's no ambiguity and you get short-circuiting.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Wed Aug 23 10:25:10 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkWak-00075f-DV
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 10:25:10 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:37594)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1dkWaf-00071V-6L
	for bug-bash@gnu.org; Wed, 23 Aug 2017 10:25:08 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1dkWab-0000bO-0A
	for bug-bash@gnu.org; Wed, 23 Aug 2017 10:25:05 -0400
Received: from mout.web.de ([212.227.15.3]:55585)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <dethrophes@web.de>) id 1dkWaa-0000ay-MP
	for bug-bash@gnu.org; Wed, 23 Aug 2017 10:25:00 -0400
Received: from Galaxy-Tab-S2.fritz.box ([79.219.217.62]) by smtp.web.de
	(mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id
	0Lj2Cs-1d8SHR1oJq-00dGvk; Wed, 23 Aug 2017 16:24:55 +0200
Date: Wed, 23 Aug 2017 16:24:55 +0200
User-Agent: K-9 Mail for Android
In-Reply-To: <593186a4-f19a-eca5-9aea-a522bb4e74d2@case.edu>
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<599D7B2C.5000509@tlinx.org>
	<CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
	<20170823133446.b3nswi63vugutkzf@eeg.ccf.org>
	<fa0c0b89-a97c-1f1b-2729-a7e2ec603b2c@case.edu>
	<081B3548-F9FC-4B2E-A711-981B745A39F5@web.de>
	<593186a4-f19a-eca5-9aea-a522bb4e74d2@case.edu>
MIME-Version: 1.0
Content-Type: text/plain;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable
Subject: Re: extension of file-test primitives?
To: chet.ramey@case.edu, Chet Ramey <chet.ramey@case.edu>,
	"bug-bash@gnu.org" <bug-bash@gnu.org>
From: Dethrophes <dethrophes@web.de>
Message-ID: <8F2C9600-3C7E-4AAA-B8D0-11DE43CA1416@web.de>
X-Provags-ID: V03:K0:zwQJ8YPbzpkOYdCYdLbbDQzUOvEu597v/rXYHoF/IhkAxffosj9
	ht8kVsMAcB4J0XzoPlgoi/1BwEDZ/bBBzFZA6SWBVyyKXIZnNPPDpsJdbTAfNlhA20RKuY8
	SMK77vrquHDZtTtO2IQiUYKxOSXedsrhHWPT3UpdCPYe9GeNiDXkF01dc3cmNQxjVnobHlz
	a3tYBN1Cgo6hr2MRNNzBw==
X-UI-Out-Filterresults: notjunk:1;V01:K0:uyCNu0QCjyQ=:3KWZXJkyNiy0MpoDKuNfko
	ykjhIrmvS4TwbUjCVW2/vCYXb4K7lwoYWiwAzX3AJhwvrq65bg18A9Eb/r3GN/EYWIt0vwC58
	18UG+sVqDXfCokoa6DIqalzTZA9sjCgmwnjC4e6/0H+bZk7yKKz9ILT58YuniXVd5gKa8+fM/
	UINHveLy2Aw1FTTePqObYwkhOHscf0ANA/S3O+kNu0HzznqdIVDJVHSYmsAH6rzwUPWjra+en
	3q/aQFTAOkOWLVWmrRDf42e0Hyeb5gv0CQgsn2EWmAqk41NrlUgvjKy90HZ+3LMuReaeJe8/4
	upMNC3P0YgD1dzp5g6XrfE826/9j30Ar6hXk6yQBO2kw/flHj79NROogKW6tEEIvAtAdCRNBg
	FFmSCC5y6lpNYXeTT4rHcmlnCuIN2VMQtBrGN/PIo2XeNly8YiE9kEpMP9L9Dt3w4zN7LVfhi
	Ryjr/ldOuXjDBNS9RpFUVBiU8rF/TGUoZDWW+JN8bKWmjjxFTR9o6Kb81NpzharyystXkEH8v
	fdeXeihul2uIzG2TaHNLVNoEzoNlmW2NJjnFIZRBTx6d6FDFB+SV44PhRxVmOPuhXZOnLfWd0
	TIFLR+5Fj8k+NmqfMAfyD4xcgJCaNoqoAt9N7VXHW8xE92daI0ZdFDRCWn+xCa45Y8rb4QlYw
	Bp6wSvxJF1wr9dQizpLF5StWj3p1gEJWVs7W2ZyAXex/1IlTsHRPJNuz/MJZyvwC8nXNyEnUq
	4sIISjFDEMoSKcWjApb3YP/aJlI+tZairw+o/Jwe+8YdUxC0R8IW7DXCu0BQRhuoQh+ngbrGh
	XIKJ6IhICtHv+x+nQEJHS1ZvaIdgkxcA2iW2ImnIysr4PV1wcY=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 212.227.15.3
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 14:25:09 -0000



>
>> Which I always understood as the correct way of doing this in the
>first place=2E=2E=2E
>
>It's not as good as multiple test commands: test -f file && test -x
>file=2E
>There's no ambiguity and you get short-circuiting=2E

Only if you are using the test built-in, otherwise the latter means 2 spaw=
ns/forks however the shell in question calls the test exec=2E


--=20
Envoy=C3=A9 de mon t=C3=A9l=C3=A9phone Android avec K-9 Mail=2E Excusez la=
 bri=C3=A8vet=C3=A9=2E


From MAILER-DAEMON Wed Aug 23 10:27:12 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkWch-0008KZ-UR
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 10:27:11 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:38284)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkWcg-0008JD-5X
	for bug-bash@gnu.org; Wed, 23 Aug 2017 10:27:11 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkWcc-0002pf-NN
	for bug-bash@gnu.org; Wed, 23 Aug 2017 10:27:10 -0400
Received: from mpv2-2015.cwru.edu ([129.22.103.227]:3701
	helo=mpv1-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1dkWcc-0002of-Hx
	for bug-bash@gnu.org; Wed, 23 Aug 2017 10:27:06 -0400
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv2-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AON89109; Wed, 23 Aug 2017 10:27:03 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id BIU28908 (AUTH cpr);
	Wed, 23 Aug 2017 10:27:02 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: extension of file-test primitives?
To: Dethrophes <dethrophes@web.de>, "bug-bash@gnu.org" <bug-bash@gnu.org>
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<599D7B2C.5000509@tlinx.org>
	<CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
	<20170823133446.b3nswi63vugutkzf@eeg.ccf.org>
	<fa0c0b89-a97c-1f1b-2729-a7e2ec603b2c@case.edu>
	<081B3548-F9FC-4B2E-A711-981B745A39F5@web.de>
	<593186a4-f19a-eca5-9aea-a522bb4e74d2@case.edu>
	<8F2C9600-3C7E-4AAA-B8D0-11DE43CA1416@web.de>
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <255c313b-a104-57f7-68dc-2bee9862d3a8@case.edu>
Date: Wed, 23 Aug 2017 10:27:02 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <8F2C9600-3C7E-4AAA-B8D0-11DE43CA1416@web.de>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Junkmail-Status: score=7/60, host=mpv2-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.23.140316:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC,
	__REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID,
	__SANE_MSGID, DATE_TZ_NA, __USER_AGENT,
	__MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT,
	__CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY,
	__REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1,
	__FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN,
	__ANY_URI, __URI_WITH_PATH, __URI_NO_WWW,
	__CP_URI_IN_BODY, __SUBJ_ALPHA_NEGATE, __URI_IN_BODY,
	__URI_NOT_IMG, __FORWARDED_MSG, __NO_HTML_TAG_RAW,
	BODY_SIZE_700_799, BODYTEXTP_SIZE_3000_LESS,
	__MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01,
	HTML_00_10, BODY_SIZE_5000_LESS, IN_REP_TO, MSG_THREAD,
	__FROM_DOMAIN_IN_RCPT, __TO_REAL_NAMES,
	MULTIPLE_REAL_RCPTS, LEGITIMATE_SIGNS, __SINGLE_URI_TEXT,
	[TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.227
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 14:27:11 -0000

On 8/23/17 10:24 AM, Dethrophes wrote:
> 
> 
>>
>>> Which I always understood as the correct way of doing this in the
>> first place...
>>
>> It's not as good as multiple test commands: test -f file && test -x
>> file.
>> There's no ambiguity and you get short-circuiting.
> 
> Only if you are using the test built-in, otherwise the latter means 2 spawns/forks however the shell in question calls the test exec.

Since bash has a test builtin, this isn't exactly on point. But you have
to accept this kind of micro-inefficiency with a shell that sacrifices
speed for size.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Wed Aug 23 10:46:39 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkWvX-0004Ou-NC
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 10:46:39 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:45231)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1dkWvU-0004Mf-PK
	for bug-bash@gnu.org; Wed, 23 Aug 2017 10:46:37 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1dkWvR-0006fY-N7
	for bug-bash@gnu.org; Wed, 23 Aug 2017 10:46:36 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:33662 helo=svr4.eeg.ccf.org)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1dkWvR-0006cv-HM
	for bug-bash@gnu.org; Wed, 23 Aug 2017 10:46:33 -0400
Received: (qmail 40883 invoked from network); 23 Aug 2017 14:46:32 -0000
Received: from wooledg.eeg.ccf.org (10.76.172.97)
	by gateway.eeg.ccf.org with SMTP; Wed, 23 Aug 2017 10:46:32 -0400
Received: (qmail 8276 invoked by uid 563); 23 Aug 2017 14:46:32 -0000
Date: Wed, 23 Aug 2017 10:46:32 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: bug-bash@gnu.org
Subject: Re: extension of file-test primitives?
Message-ID: <20170823144632.3plocjwkyztlh7gf@eeg.ccf.org>
Mail-Followup-To: bug-bash@gnu.org
References: <37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<599D7B2C.5000509@tlinx.org>
	<CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
	<20170823133446.b3nswi63vugutkzf@eeg.ccf.org>
	<fa0c0b89-a97c-1f1b-2729-a7e2ec603b2c@case.edu>
	<081B3548-F9FC-4B2E-A711-981B745A39F5@web.de>
	<593186a4-f19a-eca5-9aea-a522bb4e74d2@case.edu>
	<8F2C9600-3C7E-4AAA-B8D0-11DE43CA1416@web.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <8F2C9600-3C7E-4AAA-B8D0-11DE43CA1416@web.de>
User-Agent: NeoMutt/20170113 (1.7.2)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 139.137.100.1
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 14:46:37 -0000

On Wed, Aug 23, 2017 at 04:24:55PM +0200, Dethrophes wrote:
> >
> >> Which I always understood as the correct way of doing this in the
> >first place...
> >
> >It's not as good as multiple test commands: test -f file && test -x
> >file.
> >There's no ambiguity and you get short-circuiting.
> 
> Only if you are using the test built-in, otherwise the latter means 2 spawns/forks however the shell in question calls the test exec.

The comparison was against "test -f file -a -x file" which is deprecated.
The use of "-a" as a logical AND is not mandated by POSIX except in
"obsolescent XSI" mode.

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
http://pubs.opengroup.org/onlinepubs/9699919799/help/codes.html#OB%20XSI

So if you're using test ... -a ... then you're almost certainly relying
on test being bash's builtin version.  And since this is bug-bash, we
generally assume you are using bash.

There is also test(1) in GNU coreutils, which currently still supports
the binary -a, but the coreutils 8.26 man page says "NOTE:  Binary  -a
and -o are inherently ambiguous.  Use 'test EXPR1 && test EXPR2' or
'test EXPR1 || test EXPR2' instead."

But, writing a script that relies on test being the one provided by
GNU coreutils (or any other version which implements the obsolescent
XSI deprecated feature set) is also extremely silly.


From MAILER-DAEMON Wed Aug 23 10:49:46 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkWyY-00075n-Jh
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 10:49:46 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:46468)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1dkWyV-00073k-FP
	for bug-bash@gnu.org; Wed, 23 Aug 2017 10:49:44 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1dkWyS-0007qL-Cu
	for bug-bash@gnu.org; Wed, 23 Aug 2017 10:49:43 -0400
Received: from mout.web.de ([212.227.15.4]:60330)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <dethrophes@web.de>) id 1dkWyS-0007pz-2T
	for bug-bash@gnu.org; Wed, 23 Aug 2017 10:49:40 -0400
Received: from [192.168.178.132] ([79.219.217.62]) by smtp.web.de (mrweb002
	[213.165.67.108]) with ESMTPSA (Nemesis) id 0Lzrwh-1dXYTs1K2l-014zHj;
	Wed, 23 Aug 2017 16:49:35 +0200
Subject: Re: extension of file-test primitives?
To: chet.ramey@case.edu, "bug-bash@gnu.org" <bug-bash@gnu.org>
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<599D7B2C.5000509@tlinx.org>
	<CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
	<20170823133446.b3nswi63vugutkzf@eeg.ccf.org>
	<fa0c0b89-a97c-1f1b-2729-a7e2ec603b2c@case.edu>
	<081B3548-F9FC-4B2E-A711-981B745A39F5@web.de>
	<593186a4-f19a-eca5-9aea-a522bb4e74d2@case.edu>
	<8F2C9600-3C7E-4AAA-B8D0-11DE43CA1416@web.de>
	<255c313b-a104-57f7-68dc-2bee9862d3a8@case.edu>
From: dethrophes <dethrophes@web.de>
Message-ID: <eef2091f-ee1f-662d-2a7d-661401ef9441@web.de>
Date: Wed, 23 Aug 2017 16:49:34 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
	Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <255c313b-a104-57f7-68dc-2bee9862d3a8@case.edu>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Provags-ID: V03:K0:DJcwAWtgTmc5qYLaS4/nftqJQBUmEeJ7HDG/IzeFhEiOKCq9f3Q
	AsghmiQGqZTRJVhg4pjjuq1j8kM/IemR2yarB/TApqLgivDkwFiXiKBG+ZTgHwcTIvogUKU
	4CS3VeBSR/CwscBqPdiTLxmUSsfdvZJVLuGxTrIjIUuL3BZolvvaer8X5vUEH5Zt9lOcdQ3
	R+G5doqM0ms6JrOz5Z2HA==
X-UI-Out-Filterresults: notjunk:1;V01:K0:233kYmRG7mc=:8t26DJ1nvVBS7ZWhU/bEjl
	OmnHNzrEhvz603BhqwzQScRnnpGtV69zGVfVR/IODALmfE3++8NQDZoJz1LGWbql/CEXCOy4s
	LuI+K4gOegoS6jL/zkI68uzt38TawnStK1714i7UaOi75ks5WS3pnf1rarCGDK7q7lfsGsuVf
	aFf3mv9Yh3i6vt4IBN3Ju4ddteEyBlEKpNJ0e6hv1dDRFiv+8q4x30Pcs4QwzdAXA++aW4qW6
	FNzzPB19iWxx9JItE1iY1uoA38q/cR5VAR2tylkllXhRSoz3Ccnp/AT6N9FzQFE2DC66Y7tEX
	+y3rVdon0hxMvqsSoNmw1EkYsxMNl8Ldmi7ngMMbzFZD2TynsbcUUAHnpPZjfyo64+lU1JwJA
	tEVR6K57+wrLAQ3pR0Je5x+OzeF8Q+Ud+6/YY3grlVPL3WgEZwjvJ2Asde8fiI0/kGbOpOQmT
	DFBZs+RxolVkJOv2vsNaZmSNgfUzdODdAObQGnZj3qoS5RjU8ztpadV2B8vizqM3CnhsPVdg1
	QnKxDkAwGJNRh0tQEoOS9D86mP2u1cv8RVCvCbbOp2U1ZgtKq55UDj58RGcLImNOWW6X2gn/s
	bUR2EFsbYN8PO96ekLKjJTjo0+J4XpB7vc5AqK44RPa+nr4N52IT28I8vAytTEOMXgwgIw3fN
	33AkTxBLMt1AE+WlLojpwaVwjjZvEzYaHU8a/MpPu+SsTw4EQmsM66I+E1JNdpxsHQawkJwaV
	UG8w64dPuJVFAFoaMXvxOgxMAvK2XfsC0NLK1NJnUP+ARpdTx6PmSW7PsWx5kV4PNKAx76iQQ
	kPw51qWHJ2s7ZijSTD39AXdvoylLoPpC8QV3Pos+pGacd45OQI=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 212.227.15.4
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 14:49:44 -0000

Well technically I don't *have* to accept the performance penalty.

As I can just use the posix comform syntax, which is quicker.

And just becasue I was curious as to how much quicker it is. Now 
admittedly it's not the biggest difference in perf, but I don't see any 
real point in using a slower one.

     test_file_1(){
         test -f "${1:?Missing Test File}" -a -x "${1}"
     }

     test_file_2(){
         test -f "${1:?Missing Test File}" && test -x "${1}"
     }

     test_case(){
         local cnt=${1:?Missing repeat count}
         local test_func=${2:?Missing Test Function}
         local test_file=${3:?Missing Test File}

         echo "${test_func}" "${test_file}"
         while [ $(((cnt -= 1 ) )) != 0 ]; do
       "${test_func}" "${test_file}"
         done
     }
     : ${TMPDIR:=/tmp}
     setup_test(){
         touch "${TMPDIR}/file"
         touch "${TMPDIR}/exec_file"
         chmod a+x "${TMPDIR}/exec_file"
         time test_case 10000 test_file_1 "${TMPDIR}/file"
         time test_case 10000 test_file_2 "${TMPDIR}/file"
         time test_case 10000 test_file_1 "${TMPDIR}/exec_file"
         time test_case 10000 test_file_2 "${TMPDIR}/exec_file"
     }

~/ks_qnx/test_bash.sh setup_test
test_file_1 /tmp/file

real    0m0.132s
user    0m0.128s
sys     0m0.004s
test_file_2 /tmp/file

real    0m0.148s
user    0m0.116s
sys     0m0.028s
test_file_1 /tmp/exec_file

real    0m0.138s
user    0m0.128s
sys     0m0.008s
test_file_2 /tmp/exec_file

real    0m0.153s
user    0m0.128s
sys     0m0.024s


Am 23.08.2017 um 16:27 schrieb Chet Ramey:
> On 8/23/17 10:24 AM, Dethrophes wrote:
>>
>>>> Which I always understood as the correct way of doing this in the
>>> first place...
>>>
>>> It's not as good as multiple test commands: test -f file && test -x
>>> file.
>>> There's no ambiguity and you get short-circuiting.
>> Only if you are using the test built-in, otherwise the latter means 2 spawns/forks however the shell in question calls the test exec.
> Since bash has a test builtin, this isn't exactly on point. But you have
> to accept this kind of micro-inefficiency with a shell that sacrifices
> speed for size.
>



From MAILER-DAEMON Wed Aug 23 10:58:18 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkX6o-0004LZ-8d
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 10:58:18 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:49758)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1dkX6m-0004Jb-30
	for bug-bash@gnu.org; Wed, 23 Aug 2017 10:58:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1dkX6h-0004IO-80
	for bug-bash@gnu.org; Wed, 23 Aug 2017 10:58:16 -0400
Received: from mout.web.de ([212.227.15.4]:52325)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <dethrophes@web.de>) id 1dkX6g-0004HN-U2
	for bug-bash@gnu.org; Wed, 23 Aug 2017 10:58:11 -0400
Received: from [192.168.178.132] ([79.219.217.62]) by smtp.web.de (mrweb002
	[213.165.67.108]) with ESMTPSA (Nemesis) id 0Mbhen-1e0pbZ11DZ-00J23M
	for <bug-bash@gnu.org>; Wed, 23 Aug 2017 16:58:08 +0200
Subject: Re: extension of file-test primitives?
To: bug-bash@gnu.org
References: <37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<599D7B2C.5000509@tlinx.org>
	<CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
	<20170823133446.b3nswi63vugutkzf@eeg.ccf.org>
	<fa0c0b89-a97c-1f1b-2729-a7e2ec603b2c@case.edu>
	<081B3548-F9FC-4B2E-A711-981B745A39F5@web.de>
	<593186a4-f19a-eca5-9aea-a522bb4e74d2@case.edu>
	<8F2C9600-3C7E-4AAA-B8D0-11DE43CA1416@web.de>
	<20170823144632.3plocjwkyztlh7gf@eeg.ccf.org>
From: dethrophes <dethrophes@web.de>
Message-ID: <7833747e-d278-ced5-9d6f-95fce6305ff5@web.de>
Date: Wed, 23 Aug 2017 16:58:08 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
	Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <20170823144632.3plocjwkyztlh7gf@eeg.ccf.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K0:p+F+cl29zGFzKYmNYB3/K5pWRvLYPUo3OEI1EQvBXI8xI61S5t+
	QLrYRY0c1ybnmJDJaa/XJ/oKgRqsVC0wnkeoCeyvOLqHBm2SLfSipMSoUkyq5tS5fCYHL4X
	ozxm9tw0mnW+DIXo+FgnJekHYwPWt4m73cWMpjVsF4FgILCLnEww4p4NSWLpN54aibL9yen
	45jDXqATwZJrC/z6gPwqA==
X-UI-Out-Filterresults: notjunk:1;V01:K0:TKAo7OEpwm0=:DDDNSJEbG1HXB1Egw8aU7V
	Jtz3fmrGOqHRSbTfKfu/68hxfulE6Fg6MLNm641FvHcnzxK1xViUQrGlV4iy9yBiaX+F0U0n4
	CPc9+o2kHhGrYxWG9qmxJxJXuUFz/zsobkBgD3cHB5aP+1GruWRrI4cgC+QAQrkjue0PPmQDk
	2IiHNV1Hh63S3Tp5eBXppTGhCWSbC+ICVoYNoykAf0hSi5qyRHZpEjCJiCJT9UVFa+UaLjx/Y
	GBA/3Xi+UQ5EjLga8N1MMoaattbpnROYUBjqJJMZeZuC2yWRFnGIFktJR+tnKRjzE5+QbBcmn
	8i2lptFN2KPtbt+PZlMKcvAmQEMCYtGlUx5xiJiM8m1GwoS/VqJzq12rBVXvFY08HNOQJULtj
	S2gY/3f65E+GL98a39WO04ytD1/iLXFk5/1g7j5rE2TyrM4PdbHDDDazg9+plHY2WxLrEMxgd
	feuyifVNAqvb/CijZ0hD3+lTnCUN0ZYZ6Ix+nIaRnl1Cadx1VUPBe7R/e0vUJebJ4HcfOXJz2
	FfUpScUfVp8msj5YQ1gRuNGC6T/MUyGQmbgqLFKZ4gE6lNxCJ7kAWCY8gT64BOzvr78sAA/mP
	N/TXo0ftMPAqUaCnN6pVoiDueGTOum5dKQeK3g6qkx2T2G8xweyZDWoWn1pM2qHOLFY38Z7WL
	HN/2mHjdxA2ozzOdgIw30L1cxKKejkNaxOuxMpB4WGJFh5iwtX0g3441f2uRX0JXeHlYyV0gB
	bXqKAkMTKMjuMEpZDuOymUjirGUMt9EY/PpHmOijktpRB9He1HqorET95EsSddmsZCtK6zXFM
	hxlk10AM8Vn485ykzKMIubt7q2AyXsjUBzTvnWiiHWeJYrR5hc=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 212.227.15.4
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 14:58:17 -0000



Am 23.08.2017 um 16:46 schrieb Greg Wooledge:
> On Wed, Aug 23, 2017 at 04:24:55PM +0200, Dethrophes wrote:
>>>> Which I always understood as the correct way of doing this in the
>>> first place...
>>>
>>> It's not as good as multiple test commands: test -f file && test -x
>>> file.
>>> There's no ambiguity and you get short-circuiting.
>> Only if you are using the test built-in, otherwise the latter means 2 spawns/forks however the shell in question calls the test exec.
> The comparison was against "test -f file -a -x file" which is deprecated.
> The use of "-a" as a logical AND is not mandated by POSIX except in
> "obsolescent XSI" mode.
>
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
> http://pubs.opengroup.org/onlinepubs/9699919799/help/codes.html#OB%20XSI
>
> So if you're using test ... -a ... then you're almost certainly relying
> on test being bash's builtin version.  And since this is bug-bash, we
> generally assume you are using bash.
>
> There is also test(1) in GNU coreutils, which currently still supports
> the binary -a, but the coreutils 8.26 man page says "NOTE:  Binary  -a
> and -o are inherently ambiguous.  Use 'test EXPR1 && test EXPR2' or
> 'test EXPR1 || test EXPR2' instead."
>
> But, writing a script that relies on test being the one provided by
> GNU coreutils (or any other version which implements the obsolescent
> XSI deprecated feature set) is also extremely silly.
Ok I wasn't aware of that it is depricated.
Having said that it is pretty widely supported. I make use of this in 
pdksh, bash, dash, ksh and in a couple of test implementations not just 
the gnu one.



From MAILER-DAEMON Wed Aug 23 11:00:35 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkX91-0005sw-Iv
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 11:00:35 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:50434)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkX8v-0005rB-2p
	for bug-bash@gnu.org; Wed, 23 Aug 2017 11:00:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkX8q-000585-8k
	for bug-bash@gnu.org; Wed, 23 Aug 2017 11:00:29 -0400
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:5923
	helo=mpv3-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1dkX8q-00052c-38
	for bug-bash@gnu.org; Wed, 23 Aug 2017 11:00:24 -0400
Received: from mpv6-2015.CWRU.Edu (EHLO mpv6-2015.case.edu) ([129.22.103.202])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id ANI92392; Wed, 23 Aug 2017 11:00:17 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id BIN89511 (AUTH cpr);
	Wed, 23 Aug 2017 11:00:17 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: extension of file-test primitives?
To: dethrophes <dethrophes@web.de>, "bug-bash@gnu.org" <bug-bash@gnu.org>
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<599D7B2C.5000509@tlinx.org>
	<CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
	<20170823133446.b3nswi63vugutkzf@eeg.ccf.org>
	<fa0c0b89-a97c-1f1b-2729-a7e2ec603b2c@case.edu>
	<081B3548-F9FC-4B2E-A711-981B745A39F5@web.de>
	<593186a4-f19a-eca5-9aea-a522bb4e74d2@case.edu>
	<8F2C9600-3C7E-4AAA-B8D0-11DE43CA1416@web.de>
	<255c313b-a104-57f7-68dc-2bee9862d3a8@case.edu>
	<eef2091f-ee1f-662d-2a7d-661401ef9441@web.de>
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <1a4f0b82-abb7-4036-99b2-864b907cc353@case.edu>
Date: Wed, 23 Aug 2017 11:00:17 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <eef2091f-ee1f-662d-2a7d-661401ef9441@web.de>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Junkmail-Status: score=7/60, host=mpv3-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.23.134517:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__TO_MALFORMED_2, __TO_NAME, __REFERENCES, __HAS_FROM,
	FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA,
	__USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION,
	__IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE,
	__REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC,
	__FROM_DOMAIN_IN_ANY_CC1, __FROM_DOMAIN_IN_ANY_CC2,
	__REPLYTO_SAMEAS_FROM_DOMAIN, __ANY_URI, __URI_WITH_PATH,
	__URI_NO_WWW, __CP_URI_IN_BODY, __SUBJ_ALPHA_NEGATE,
	__URI_IN_BODY, __URI_NOT_IMG, __NO_HTML_TAG_RAW,
	BODY_SIZE_600_699, BODYTEXTP_SIZE_3000_LESS,
	__MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01,
	HTML_00_10, BODY_SIZE_5000_LESS, IN_REP_TO, MSG_THREAD,
	__FROM_DOMAIN_IN_RCPT, MULTIPLE_REAL_RCPTS,
	LEGITIMATE_SIGNS, __SINGLE_URI_TEXT, SINGLE_URI_IN_BODY,
	__PHISH_SPEAR_STRUCTURE_1, BODY_SIZE_1000_LESS,
	[TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 15:00:34 -0000

On 8/23/17 10:49 AM, dethrophes wrote:
> Well technically I don't *have* to accept the performance penalty.
> 
> As I can just use the posix comform syntax, which is quicker.

Wait, which posix-conforming syntax? Because your original example, which
had five arguments to `test', is explicitly unspecified:

>4 arguments:
    The results are unspecified.

unless you're on an XSI-conformant system.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Wed Aug 23 11:13:41 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkXLg-00048Q-Ul
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 11:13:40 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:54734)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1dkXLe-00046e-0b
	for bug-bash@gnu.org; Wed, 23 Aug 2017 11:13:38 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1dkXLa-0005VO-0k
	for bug-bash@gnu.org; Wed, 23 Aug 2017 11:13:37 -0400
Received: from mout.web.de ([212.227.15.14]:60112)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <dethrophes@web.de>) id 1dkXLZ-0005UE-OB
	for bug-bash@gnu.org; Wed, 23 Aug 2017 11:13:33 -0400
Received: from [192.168.178.132] ([79.219.217.62]) by smtp.web.de (mrweb002
	[213.165.67.108]) with ESMTPSA (Nemesis) id 0MCqSB-1dtdtp0MFf-009htD;
	Wed, 23 Aug 2017 17:13:30 +0200
Subject: Re: extension of file-test primitives?
To: chet.ramey@case.edu, "bug-bash@gnu.org" <bug-bash@gnu.org>
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<599D7B2C.5000509@tlinx.org>
	<CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
	<20170823133446.b3nswi63vugutkzf@eeg.ccf.org>
	<fa0c0b89-a97c-1f1b-2729-a7e2ec603b2c@case.edu>
	<081B3548-F9FC-4B2E-A711-981B745A39F5@web.de>
	<593186a4-f19a-eca5-9aea-a522bb4e74d2@case.edu>
	<8F2C9600-3C7E-4AAA-B8D0-11DE43CA1416@web.de>
	<255c313b-a104-57f7-68dc-2bee9862d3a8@case.edu>
	<eef2091f-ee1f-662d-2a7d-661401ef9441@web.de>
	<1a4f0b82-abb7-4036-99b2-864b907cc353@case.edu>
From: dethrophes <dethrophes@web.de>
Message-ID: <08b93a13-e2b8-1caf-bd00-c6ee1fee94fe@web.de>
Date: Wed, 23 Aug 2017 17:13:29 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
	Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <1a4f0b82-abb7-4036-99b2-864b907cc353@case.edu>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Provags-ID: V03:K0:m7oCiLjBQE22gAovfBr0FL/Cf7YgVLv4bGRdfVNldaBvz7P3gjX
	tlaygRaO1PWlyyhAWKKBuYd9m4NbW/wrMGOzrPhS8gwftyaPEug7p76+PKd6UIlulJmsWip
	NX18nCGvGAhLMdmMDj3AspNPnJO8EgqMOUDqH55rrN8O0p2hI0A9+XaPCCKbkpNp9Nj6Qnb
	2639MKyEQoGaMdkB6JZPA==
X-UI-Out-Filterresults: notjunk:1;V01:K0:zwDWuHXD704=:f+U7uthS1I6i7JIvFjTSsO
	GvgjxipcYP54Im78pe6V1IlxUDk9HbG7G9iXNrqdzs8VknlkGtjswOFbazky26AA8gmMaVbBo
	hmVT+/ytUK2MkzMMqr3a3ZkHmlCg/btqBeXoqrigijeM11grNCz2zm88t7CyKvtlZoB845Aqm
	2y1p/OATUL3+wOMEOo2D+u4yijfcy1asTnm2U4CxVTsm3qblpI0CYI8fR+KCtN70SHaDidkSz
	h3yFl84Yi3xRzsSpTa7Cxz/ttuH4TIditQqmaFQzdiBGro4HOGnb7moKAFQhMKTd7oA6xMLky
	lyjEdR+CU5HTLja6G1OXJIReKrwwNNuJUy2B+ivu29GJA7jImx7CPfSBZ1efjgXsNOWM+vP0P
	42bD3tEXU2Rhzs4WAUef7QX6kAr3Xo+xU20JTaaCJv2qF5VtCjfUWJ3o2ngWlz5rcqmEMuLGI
	LJIjbLXIabSzK4sq61TbEcpvDqWwl7vsC4e2C5nkBgE6H6c/LC67nVTirGhrTd5YUW58Cv9PE
	uvoLe2nCbtz9MmLY/FJNMm1NWJXUWIJyUiJZQp2cotdXg0GAYUvg5jZuhoq55G7Zoz8LsBRR/
	TlhhMhkJLKTcSHr4f49t4ehPChuXuiY87DioaoOeNy3pLOHjUfiuYsSb/AnzFH5v5yz/+UiOk
	lDEtre4o2AfUway67eLyZNeTlBNlfDJh14xnpFAbQwOGQyHGJx7Yd+37Se5pync68PQ8HofRg
	t138N/kmfebpvUYkz2DHJ+AZ37Od6WhTANEzolN/jEKyXBFmKZF2qFmAkAdJVPG8jLUj11fWa
	pTrEIIkyMbEcS+3UXXO3sCX8HInDCzExZwCiS0jWEzcEMHUjQg=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 212.227.15.14
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 15:13:39 -0000

Yhea I just learned that now, it's been at least a decade since I looked 
at the posix spec on test.

Should probably update the bash help to reflect that

as help bash (in my version at least) only says

       EXPR1 -a EXPR2 True if both expr1 AND expr2 are true.
       EXPR1 -o EXPR2 True if either expr1 OR expr2 is true.

The main oses I work on are XSI conform.


Am 23.08.2017 um 17:00 schrieb Chet Ramey:
> On 8/23/17 10:49 AM, dethrophes wrote:
>> Well technically I don't *have* to accept the performance penalty.
>>
>> As I can just use the posix comform syntax, which is quicker.
> Wait, which posix-conforming syntax? Because your original example, which
> had five arguments to `test', is explicitly unspecified:
>
>> 4 arguments:
>      The results are unspecified.
>
> unless you're on an XSI-conformant system.
>



From MAILER-DAEMON Wed Aug 23 11:17:44 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkXPc-0007Fq-7j
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 11:17:44 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56047)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkXPa-0007Eb-FO
	for bug-bash@gnu.org; Wed, 23 Aug 2017 11:17:43 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkXPW-00089W-FE
	for bug-bash@gnu.org; Wed, 23 Aug 2017 11:17:42 -0400
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:9574
	helo=mpv3-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1dkXPW-00089C-9T
	for bug-bash@gnu.org; Wed, 23 Aug 2017 11:17:38 -0400
Received: from mpv6-2015.CWRU.Edu (EHLO mpv6-2015.case.edu) ([129.22.103.202])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id ANI93564; Wed, 23 Aug 2017 11:17:34 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id BIN94286 (AUTH cpr);
	Wed, 23 Aug 2017 11:17:33 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: extension of file-test primitives?
To: dethrophes <dethrophes@web.de>, "bug-bash@gnu.org" <bug-bash@gnu.org>
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<599D7B2C.5000509@tlinx.org>
	<CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
	<20170823133446.b3nswi63vugutkzf@eeg.ccf.org>
	<fa0c0b89-a97c-1f1b-2729-a7e2ec603b2c@case.edu>
	<081B3548-F9FC-4B2E-A711-981B745A39F5@web.de>
	<593186a4-f19a-eca5-9aea-a522bb4e74d2@case.edu>
	<8F2C9600-3C7E-4AAA-B8D0-11DE43CA1416@web.de>
	<255c313b-a104-57f7-68dc-2bee9862d3a8@case.edu>
	<eef2091f-ee1f-662d-2a7d-661401ef9441@web.de>
	<1a4f0b82-abb7-4036-99b2-864b907cc353@case.edu>
	<08b93a13-e2b8-1caf-bd00-c6ee1fee94fe@web.de>
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <6ed41311-3f76-8282-93a1-b68297080966@case.edu>
Date: Wed, 23 Aug 2017 11:17:33 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <08b93a13-e2b8-1caf-bd00-c6ee1fee94fe@web.de>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Junkmail-Status: score=7/60, host=mpv3-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.23.144517:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__TO_MALFORMED_2, __TO_NAME, __REFERENCES, __HAS_FROM,
	FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA,
	__USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION,
	__IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE,
	__REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC,
	__FROM_DOMAIN_IN_ANY_CC1, __FROM_DOMAIN_IN_ANY_CC2,
	__REPLYTO_SAMEAS_FROM_DOMAIN, __ANY_URI, __URI_WITH_PATH,
	__URI_NO_WWW, __CP_URI_IN_BODY, __HIGHBITS,
	__SUBJ_ALPHA_NEGATE, __URI_IN_BODY, __URI_NOT_IMG,
	__FORWARDED_MSG, __NO_HTML_TAG_RAW, BODY_SIZE_600_699,
	BODYTEXTP_SIZE_3000_LESS, __MIME_TEXT_P1,
	__MIME_TEXT_ONLY, __URI_NS, HTML_00_01, HTML_00_10,
	BODY_SIZE_5000_LESS, IN_REP_TO, MSG_THREAD,
	__FROM_DOMAIN_IN_RCPT, MULTIPLE_REAL_RCPTS,
	LEGITIMATE_SIGNS, __SINGLE_URI_TEXT, SINGLE_URI_IN_BODY,
	[TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 15:17:43 -0000

On 8/23/17 11:13 AM, dethrophes wrote:
> Yhea I just learned that now, it's been at least a decade since I looked at
> the posix spec on test.
> 
> Should probably update the bash help to reflect that
> 
> as help bash (in my version at least) only says
> 
>       EXPR1 -a EXPR2 True if both expr1 AND expr2 are true.
>       EXPR1 -o EXPR2 True if either expr1 OR expr2 is true.

Why update the help documentation? Bash supports it. It's just deprecated
in the posix standard.


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Wed Aug 23 11:54:14 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkXyw-0004wO-4j
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 11:54:14 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:35953)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1dkXyu-0004w3-CP
	for bug-bash@gnu.org; Wed, 23 Aug 2017 11:54:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1dkXyr-0000OT-AL
	for bug-bash@gnu.org; Wed, 23 Aug 2017 11:54:12 -0400
Received: from mout.web.de ([212.227.15.14]:57676)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <dethrophes@web.de>) id 1dkXyr-0000O1-0G
	for bug-bash@gnu.org; Wed, 23 Aug 2017 11:54:09 -0400
Received: from [192.168.178.132] ([79.219.217.62]) by smtp.web.de (mrweb002
	[213.165.67.108]) with ESMTPSA (Nemesis) id 0LkhUq-1dA6lb3U0a-00aYpK;
	Wed, 23 Aug 2017 17:54:03 +0200
Subject: Re: extension of file-test primitives?
To: chet.ramey@case.edu, "bug-bash@gnu.org" <bug-bash@gnu.org>
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<599D7B2C.5000509@tlinx.org>
	<CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
	<20170823133446.b3nswi63vugutkzf@eeg.ccf.org>
	<fa0c0b89-a97c-1f1b-2729-a7e2ec603b2c@case.edu>
	<081B3548-F9FC-4B2E-A711-981B745A39F5@web.de>
	<593186a4-f19a-eca5-9aea-a522bb4e74d2@case.edu>
	<8F2C9600-3C7E-4AAA-B8D0-11DE43CA1416@web.de>
	<255c313b-a104-57f7-68dc-2bee9862d3a8@case.edu>
	<eef2091f-ee1f-662d-2a7d-661401ef9441@web.de>
	<1a4f0b82-abb7-4036-99b2-864b907cc353@case.edu>
	<08b93a13-e2b8-1caf-bd00-c6ee1fee94fe@web.de>
	<6ed41311-3f76-8282-93a1-b68297080966@case.edu>
From: dethrophes <dethrophes@web.de>
Message-ID: <17669292-8026-2a03-12c0-cd0fc45ff8c5@web.de>
Date: Wed, 23 Aug 2017 17:54:03 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
	Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <6ed41311-3f76-8282-93a1-b68297080966@case.edu>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Provags-ID: V03:K0:XsP4IlgPo/wggg1Spnc1aX6rzUO7/YRmfrs5toCvsFRWV7C5eYp
	9XuUQnnY5pLuPiESzFBUyWzzz+967LXIOycxyN8MDpH9TPUaEwsZLGuXEo8n6S9Ig313BUi
	OVhY8IZKEIGRCj3ZPwJ4CQ/Fi9SV2HYQvKwzfQ5XNjekgGjFHiT5bN8h7DnsoBTeE6pPNts
	O3CAwVXf3yzRBxrnoT1jA==
X-UI-Out-Filterresults: notjunk:1;V01:K0:bmjX8SH7EkQ=:B0YzJyho4iKWx49EFyNghB
	ZByI+6NJC333qHoWEx3ibUQ6n2EHQWkqQJal3mMIA9cgmhEGM+pBhX6JdB0PlB3Caf9R/n9Ia
	5ib77TaFaW3eVq/RBtOOmj4J9bgMb5FG7w25GSwvDzOB4IcTxQQg+uWnSNOnmwgx8egLMFQsU
	VhY03dp8D6NEIhA9S17InsOB8X2/za7SLrDNw2L+evwKGIJMRNNyR7keMxhoYHydZt7mYWJqS
	8aYG8yVyIQ3oPXvmjlvT/OpYzdrci7Rjyb4QsbTnTGcbf4YEnEfo+JTMOwT6gN8CVKAalvYJn
	P3cJL2uKr1VmtiPFglICQrY5Q8sEfPQ9D+ql6+QvBYs9g0KR5izo+YuYxTng8+w9akBI6N3i1
	Lxc2pHD9DCYn5Ps8ITrPxLUSYLM3yMdYuRHeoHcUgVmOX3Azlk0eUolpNu/n60nY9u4SuLsy6
	Med+5ir6/ZvsklJQ8YEPMSCxShfnbMQ1acFBLGZU92yl/BxMTuJRFJc5NWuZZz6KVRAp4icN4
	l+GfKMLvf1RRYJQvwaJwNv7Ux92WyAeln3210zimbFQVMEkdj8NbGD/5wTxd1DdMcInkFu+Ud
	1MKJnU7BbyuaarecoCPKeqKmRled2oNPeDQfi70/jsC10ai1Nd2d3i8itM7PocK5g3r637j39
	iKwB3TxFBf4yNtv5wDUkmv+bC5PqzGpz1Db+VZLrrnOBeeus+H2rUqmBWKZVq3dPMywGXXVgM
	Ew/1PCLwQEXmM3g0TYzZYcGZ83sBhwlN6Y7qXTal0nYqE+urcZ+x8Zw6er+VEzBP+1TFvkg6t
	UhEAkZil1KlCZSuWg17E7aqHf3+1AixQXI0RjK0ZHFSxTCFcEg=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 212.227.15.14
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 15:54:13 -0000

Ok I inferred incorrectly that bash was also depricating it.

And just because I was curious.

I added the other syntaxes I'm aware of to see how they compared.
looks like [[ -e file && -x file ]], is the quickest.


     test_file_1(){
         test -f "${1}" -a -x "${1}"
     }

     test_file_2(){
         test -f "${1}" && test -x "${1}"
     }

     test_file_3(){
         [  -f  "${1}" -a  -x  "${1}" ]
     }

     test_file_4(){
         [[ -f "${1}" && -x "${1}" ]]
     }

     test_file_5(){
         [ -f "${1}" ] && [ -x "${1}" ]
     }

     test_file_6(){
         [[ -f "${1}" ]] && [[ -x "${1}" ]]
     }
     test_case(){
         local cnt=${1:?Missing repeat count}
         local test_func=${2}
         local test_file=${3}

         echo "${test_func}" "${test_file}"
         time {
         while [ $(((cnt -= 1 ) )) != 0 ]; do
       "${test_func}" "${test_file}"
         done
         }
     }
     : ${TMPDIR:=/tmp}
     setup_test(){
         touch "${TMPDIR}/file"
         touch "${TMPDIR}/exec_file"
         chmod a+x "${TMPDIR}/exec_file"
         for cFile in "${TMPDIR}/file" "${TMPDIR}/exec_file" ; do
             for cTest in test_file_{1,2,3,4,5,6} ; do
                 time=$(test_case 10000 "${cTest}" "${cFile}" 2>&1)
                 echo ${time}
             done
         done
     }

./test_bash.sh setup_test
test_file_1 /tmp/file real 0m0.144s user 0m0.132s sys 0m0.008s
test_file_2 /tmp/file real 0m0.146s user 0m0.136s sys 0m0.008s
test_file_3 /tmp/file real 0m0.142s user 0m0.136s sys 0m0.004s
test_file_4 /tmp/file real 0m0.138s user 0m0.120s sys 0m0.016s
test_file_5 /tmp/file real 0m0.172s user 0m0.160s sys 0m0.008s
test_file_6 /tmp/file real 0m0.123s user 0m0.100s sys 0m0.020s
test_file_1 /tmp/exec_file real 0m0.138s user 0m0.116s sys 0m0.020s
test_file_2 /tmp/exec_file real 0m0.151s user 0m0.140s sys 0m0.008s
test_file_3 /tmp/exec_file real 0m0.142s user 0m0.140s sys 0m0.000s
test_file_4 /tmp/exec_file real 0m0.118s user 0m0.112s sys 0m0.004s
test_file_5 /tmp/exec_file real 0m0.162s user 0m0.148s sys 0m0.012s
test_file_6 /tmp/exec_file real 0m0.142s user 0m0.132s sys 0m0.004s



Am 23.08.2017 um 17:17 schrieb Chet Ramey:
> On 8/23/17 11:13 AM, dethrophes wrote:
>> Yhea I just learned that now, it's been at least a decade since I looked at
>> the posix spec on test.
>>
>> Should probably update the bash help to reflect that
>>
>> as help bash (in my version at least) only says
>>
>>        EXPR1 -a EXPR2 True if both expr1 AND expr2 are true.
>>        EXPR1 -o EXPR2 True if either expr1 OR expr2 is true.
> Why update the help documentation? Bash supports it. It's just deprecated
> in the posix standard.
>
>



From MAILER-DAEMON Wed Aug 23 13:32:12 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkZVk-0000I8-H6
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 13:32:12 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:35231)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkZVf-0000Hn-EA
	for bug-bash@gnu.org; Wed, 23 Aug 2017 13:32:11 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dkZVc-00075r-Ae
	for bug-bash@gnu.org; Wed, 23 Aug 2017 13:32:07 -0400
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:32827
	helo=mpv3-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1dkZVc-00074s-5K
	for bug-bash@gnu.org; Wed, 23 Aug 2017 13:32:04 -0400
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id ANJ01024; Wed, 23 Aug 2017 13:31:59 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id BIU66550 (AUTH cpr);
	Wed, 23 Aug 2017 13:31:58 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: extension of file-test primitives?
To: dethrophes <dethrophes@web.de>, "bug-bash@gnu.org" <bug-bash@gnu.org>
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<599D7B2C.5000509@tlinx.org>
	<CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
	<20170823133446.b3nswi63vugutkzf@eeg.ccf.org>
	<fa0c0b89-a97c-1f1b-2729-a7e2ec603b2c@case.edu>
	<081B3548-F9FC-4B2E-A711-981B745A39F5@web.de>
	<593186a4-f19a-eca5-9aea-a522bb4e74d2@case.edu>
	<8F2C9600-3C7E-4AAA-B8D0-11DE43CA1416@web.de>
	<255c313b-a104-57f7-68dc-2bee9862d3a8@case.edu>
	<eef2091f-ee1f-662d-2a7d-661401ef9441@web.de>
	<1a4f0b82-abb7-4036-99b2-864b907cc353@case.edu>
	<08b93a13-e2b8-1caf-bd00-c6ee1fee94fe@web.de>
	<6ed41311-3f76-8282-93a1-b68297080966@case.edu>
	<17669292-8026-2a03-12c0-cd0fc45ff8c5@web.de>
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <2082e3d8-7b7e-4ce6-a717-18aefc8d02a3@case.edu>
Date: Wed, 23 Aug 2017 13:31:58 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <17669292-8026-2a03-12c0-cd0fc45ff8c5@web.de>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Junkmail-Status: score=7/60, host=mpv3-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.23.164816:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__TO_MALFORMED_2, __TO_NAME, __REFERENCES, __HAS_FROM,
	FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA,
	__USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION,
	__IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE,
	__REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC,
	__FROM_DOMAIN_IN_ANY_CC1, __FROM_DOMAIN_IN_ANY_CC2,
	__REPLYTO_SAMEAS_FROM_DOMAIN, __ANY_URI, __URI_WITH_PATH,
	__URI_NO_WWW, __CP_URI_IN_BODY, __SUBJ_ALPHA_NEGATE,
	__URI_IN_BODY, __URI_NOT_IMG, __NO_HTML_TAG_RAW,
	BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_400_499,
	__MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01,
	HTML_00_10, BODY_SIZE_5000_LESS, IN_REP_TO, MSG_THREAD,
	__FROM_DOMAIN_IN_RCPT, MULTIPLE_REAL_RCPTS,
	LEGITIMATE_SIGNS, __SINGLE_URI_TEXT, SINGLE_URI_IN_BODY,
	__PHISH_SPEAR_STRUCTURE_1, BODY_SIZE_1000_LESS,
	[TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 17:32:11 -0000

On 8/23/17 11:54 AM, dethrophes wrote:
> Ok I inferred incorrectly that bash was also depricating it.

Well, it's supported because it's historical syntax, but that doesn't
mean I won't recommend a superior alternative.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Wed Aug 23 15:27:39 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkbJT-00045l-3e
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 15:27:39 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:60566)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1dkbJN-00041v-B6
	for bug-bash@gnu.org; Wed, 23 Aug 2017 15:27:37 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1dkbJH-0002yY-8e
	for bug-bash@gnu.org; Wed, 23 Aug 2017 15:27:33 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:48692
	helo=Ishtar.sc.tlinx.org)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <bash@tlinx.org>) id 1dkbJH-0002v3-0e
	for bug-bash@gnu.org; Wed, 23 Aug 2017 15:27:27 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
	v7NJRGfp064936; Wed, 23 Aug 2017 12:27:18 -0700
Message-ID: <599DD714.2030203@tlinx.org>
Date: Wed, 23 Aug 2017 12:27:16 -0700
From: L A Walsh <bash@tlinx.org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: Pierre Gaston <pierre.gaston@gmail.com>
CC: "bug-bash@gnu.org" <bug-bash@gnu.org>
Subject: Re: extension of file-test primitives?
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<599D7B2C.5000509@tlinx.org>
	<CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
In-Reply-To: <CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
	timestamps) [generic] [fuzzy]
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 19:27:38 -0000

Interesting....clever, even though not well vetted here, either.

Pierre Gaston wrote:
> You can use a loop, here is hack(ish) function that perhaps work (ie 
> not tested too much):
> testfile () {
>   local OPTIND=1 f=${!#}
>   while getopts abcdefghLkprsSuwxOGN opt; do
>     case $opt in
>       [abcdefghLkprsSuwxOGN]) test -$opt $f  || return 1;;
>       *)return 1;;
>     esac;
>   done
>  }
> if testfile -fx file;then.
----
However, I am not wild about the way it creates use of
two character tests (-ge) that I, Chet and Greg don't
like due to confusion with existing infix operators.
It's more likely to create maintenance problems just based
on that attribute alone.

I also don't like having to split it apart from other '[['
operators. 

FWIW, I always use '[[' ... ']]', if for no other
reason than not having to use quotes, as well the consistency
of using '&&' and '||' that test and '[' can't use.

Trying to remember that something like:
   > a=1 b=2; test 1 == $a && 2 == $b && echo hi
   -bash: 2: command not found
doesn't work wastes time, as well as
   > a=1 b=2; test 1 == $a -a 2 == $b && echo hi
not working with '[[', where in changing to '[[':
   > a=1 b=2; [[ 1 == $a -a 2 == $b ]] && echo hi
   -bash: syntax error in conditional expression
   -bash: syntax error near `-a'

Even parens need special handling, outside of '[['.

I'd also have to remember to change the conjunction ops. I.e.
changing "-a" to '&&':
   > a=1 b=2; [[ 1 == $a && 2 == $b ]] && echo hi

The [[ operator can be seamlessly changed to numeric ops:
   > a=1 b=2; (( 1 == $a && 2 == $b )) && echo hi

A lot of special casing when updating such usage, as well
as it not being readily combinable in [[...]] with other
tests.

The idea was to add a way to allow a shorthand that wouldn't
require secondary knowledge (what does testfile do), or
a need for including it.






From MAILER-DAEMON Wed Aug 23 15:57:38 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkbmU-0004Jv-7V
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 15:57:38 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:37637)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1dkbmS-0004Jn-5R
	for bug-bash@gnu.org; Wed, 23 Aug 2017 15:57:37 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1dkbmN-0001Hu-Kk
	for bug-bash@gnu.org; Wed, 23 Aug 2017 15:57:36 -0400
Received: from mx1.redhat.com ([209.132.183.28]:36810)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <eblake@redhat.com>) id 1dkbmN-0001Hc-Ad
	for bug-bash@gnu.org; Wed, 23 Aug 2017 15:57:31 -0400
Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com
	[10.5.11.15])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.redhat.com (Postfix) with ESMTPS id D571F7E424;
	Wed, 23 Aug 2017 19:57:29 +0000 (UTC)
DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D571F7E424
Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com;
	dmarc=none (p=none dis=none) header.from=redhat.com
Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com;
	spf=fail smtp.mailfrom=eblake@redhat.com
Received: from [10.10.124.155] (ovpn-124-155.rdu2.redhat.com [10.10.124.155])
	by smtp.corp.redhat.com (Postfix) with ESMTP id 2984A5D753;
	Wed, 23 Aug 2017 19:57:28 +0000 (UTC)
Subject: Re: extension of file-test primitives?
To: chet.ramey@case.edu, dethrophes <dethrophes@web.de>,
	"bug-bash@gnu.org" <bug-bash@gnu.org>
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<599D7B2C.5000509@tlinx.org>
	<CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
	<20170823133446.b3nswi63vugutkzf@eeg.ccf.org>
	<fa0c0b89-a97c-1f1b-2729-a7e2ec603b2c@case.edu>
	<081B3548-F9FC-4B2E-A711-981B745A39F5@web.de>
	<593186a4-f19a-eca5-9aea-a522bb4e74d2@case.edu>
	<8F2C9600-3C7E-4AAA-B8D0-11DE43CA1416@web.de>
	<255c313b-a104-57f7-68dc-2bee9862d3a8@case.edu>
	<eef2091f-ee1f-662d-2a7d-661401ef9441@web.de>
	<1a4f0b82-abb7-4036-99b2-864b907cc353@case.edu>
	<08b93a13-e2b8-1caf-bd00-c6ee1fee94fe@web.de>
	<6ed41311-3f76-8282-93a1-b68297080966@case.edu>
From: Eric Blake <eblake@redhat.com>
Openpgp: url=http://people.redhat.com/eblake/eblake.gpg
Organization: Red Hat, Inc.
Message-ID: <c84c30fb-9f6e-ab19-6a4e-3426bb54bc6c@redhat.com>
Date: Wed, 23 Aug 2017 14:57:28 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
	Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <6ed41311-3f76-8282-93a1-b68297080966@case.edu>
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="KAa63Xx2lEAvPACIeIms574L8rDx9EBi9"
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
	(mx1.redhat.com [10.5.110.27]);
	Wed, 23 Aug 2017 19:57:30 +0000 (UTC)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 209.132.183.28
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 19:57:37 -0000

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--KAa63Xx2lEAvPACIeIms574L8rDx9EBi9
From: Eric Blake <eblake@redhat.com>
To: chet.ramey@case.edu, dethrophes <dethrophes@web.de>,
 "bug-bash@gnu.org" <bug-bash@gnu.org>
Message-ID: <c84c30fb-9f6e-ab19-6a4e-3426bb54bc6c@redhat.com>
Subject: Re: extension of file-test primitives?
References: <5998D82A.3030607@tlinx.org>
 <20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
 <37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu> <599D03C8.2070604@tlinx.org>
 <20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org> <599D7B2C.5000509@tlinx.org>
 <CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
 <20170823133446.b3nswi63vugutkzf@eeg.ccf.org>
 <fa0c0b89-a97c-1f1b-2729-a7e2ec603b2c@case.edu>
 <081B3548-F9FC-4B2E-A711-981B745A39F5@web.de>
 <593186a4-f19a-eca5-9aea-a522bb4e74d2@case.edu>
 <8F2C9600-3C7E-4AAA-B8D0-11DE43CA1416@web.de>
 <255c313b-a104-57f7-68dc-2bee9862d3a8@case.edu>
 <eef2091f-ee1f-662d-2a7d-661401ef9441@web.de>
 <1a4f0b82-abb7-4036-99b2-864b907cc353@case.edu>
 <08b93a13-e2b8-1caf-bd00-c6ee1fee94fe@web.de>
 <6ed41311-3f76-8282-93a1-b68297080966@case.edu>
In-Reply-To: <6ed41311-3f76-8282-93a1-b68297080966@case.edu>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 08/23/2017 10:17 AM, Chet Ramey wrote:
> On 8/23/17 11:13 AM, dethrophes wrote:
>> Yhea I just learned that now, it's been at least a decade since I look=
ed at
>> the posix spec on test.
>>
>> Should probably update the bash help to reflect that
>>
>> as help bash (in my version at least) only says
>>
>>       EXPR1 -a EXPR2 True if both expr1 AND expr2 are true.
>>       EXPR1 -o EXPR2 True if either expr1 OR expr2 is true.
>=20
> Why update the help documentation? Bash supports it. It's just deprecat=
ed
> in the posix standard.

Not just deprecated, but inherently ambiguous.  There are situations
where you CANNOT tell whether the user meant -a to mean the binary
operator or a string being tested against, because POSIX (intentionally)
does not specify enough precedence rules in how to parse > 4 arguments.

--=20
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


--KAa63Xx2lEAvPACIeIms574L8rDx9EBi9
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEzBAEBCAAdFiEEccLMIrHEYCkn0vOqp6FrSiUnQ2oFAlmd3igACgkQp6FrSiUn
Q2qCfQgAoKd9Bj1zPeY03Txy/l+oEtOYtBCd4LYh+GQMPNPpEb0iOIBBagcq4yB9
BBMhPjCVOuRkjtj+fMN9CDLoHuzGiys46iy0ytNWok8q2/+YGH82YMEvLOrz6OaB
vsARTXjDtdhrGmQV3XQnvXliPz2uAiknYzjBIgdMhpVWGHAIDdlQQJeC/js2vJk+
KSmg0ieeszsaXg3HWRjktzfbYGQNEh6pW9WvMkGZNkL4ZtL/+S6mS9z/IVuDMYin
iiqCo9QodxJ5bprbfYhU4x8QXLUJBNDpXa5qSNRNdKEZMGKAyQrN+aNHUXgou45B
qQPmAuUj22/Ru6xudObNLJywbJcdeQ==
=RI95
-----END PGP SIGNATURE-----

--KAa63Xx2lEAvPACIeIms574L8rDx9EBi9--


From MAILER-DAEMON Wed Aug 23 16:11:24 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dkbzo-0008FD-5a
	for mharc-bug-bash@gnu.org; Wed, 23 Aug 2017 16:11:24 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:39971)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1dkbzl-0008Ey-Ux
	for bug-bash@gnu.org; Wed, 23 Aug 2017 16:11:22 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1dkbzk-00074v-UQ
	for bug-bash@gnu.org; Wed, 23 Aug 2017 16:11:21 -0400
Received: from mail-oi0-x22d.google.com ([2607:f8b0:4003:c06::22d]:35379)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <pyroinajar@gmail.com>)
	id 1dkbzk-00072a-PE
	for bug-bash@gnu.org; Wed, 23 Aug 2017 16:11:20 -0400
Received: by mail-oi0-x22d.google.com with SMTP id r200so11958025oie.2
	for <bug-bash@gnu.org>; Wed, 23 Aug 2017 13:11:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:sender:in-reply-to:references:from:date:message-id
	:subject:to:cc;
	bh=WYFxFJmysmTYiM+mRXd3CbqoMFygGYuUuPU/knTojjU=;
	b=ZZ1zM5HQCHMXXyrEK4bQjpQSDQW/uyBVvoJZ+FfPFZyb0HqAIqoN6jhg84SelD9+OR
	1r7e70lpPk4y2uLBBQlzGFz8zg2ARXB6pHawGw42dJzDYXYNwvU2cKOF8BxrIdHb94bZ
	TQpdCUPQKjaPzZfXSeA8bGNlI1yde2iZDsiQ52+f5w6H5ln7rfU3IxV3UtY3diPO5JD+
	BQCErRegdoL3bRSOOxv+5I8MuSnJXu5imem6N65l8lG/JGsG3RWPoCfHSegyFTVwbf0Y
	3MNFeowCvxCSfwLt5bTUnbbDfPuL3PTFncrMczkQL1tzegRmds9SHOQneNeJFftNR5XT
	g1eA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
	:date:message-id:subject:to:cc;
	bh=WYFxFJmysmTYiM+mRXd3CbqoMFygGYuUuPU/knTojjU=;
	b=sfMb3+vEjfQp55UCroGRoLeSMpIKfNggkKjPea16mHaiKFdjyYe/P/0tdiPyaSMF8u
	B9JjrvTSz8f3rCjMHaN5FnC5Xwm3fn8qlzS5doj3p3VU9bxoaFYNx2yJ4RKdlMgiTAAO
	2/IwaxfdfB2k2t0yj5gxgYkT/5P/hew6Z+wy83pWYgFhpZow9T9+V2x9PhIhvrmFJuNG
	EnqxpIO7KHKCfzD/ZHZF80SqvrAJ8kg87+RCpn0F1xQWbcRrsVHessWYA/bzI5EoBmgG
	OyfOl2gCwDEdxvJNibtdq0PugJMHWJl21CnvIDYk0G6Gx5ZRVmskVArTO0TGTWeCY9t8
	V1dw==
X-Gm-Message-State: AHYfb5iWTUtq8kaajUcYUm3czN+ZfydGAtiOXEAU6BsLTHByO2L/H3N2
	XxF8RHHQJazTHxwygAfk8sp8Ms43nw==
X-Received: by 10.202.214.20 with SMTP id n20mr5272255oig.48.1503519078656;
	Wed, 23 Aug 2017 13:11:18 -0700 (PDT)
MIME-Version: 1.0
Sender: pyroinajar@gmail.com
Received: by 10.74.85.66 with HTTP; Wed, 23 Aug 2017 13:11:17 -0700 (PDT)
In-Reply-To: <c84c30fb-9f6e-ab19-6a4e-3426bb54bc6c@redhat.com>
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<599D7B2C.5000509@tlinx.org>
	<CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
	<20170823133446.b3nswi63vugutkzf@eeg.ccf.org>
	<fa0c0b89-a97c-1f1b-2729-a7e2ec603b2c@case.edu>
	<081B3548-F9FC-4B2E-A711-981B745A39F5@web.de>
	<593186a4-f19a-eca5-9aea-a522bb4e74d2@case.edu>
	<8F2C9600-3C7E-4AAA-B8D0-11DE43CA1416@web.de>
	<255c313b-a104-57f7-68dc-2bee9862d3a8@case.edu>
	<eef2091f-ee1f-662d-2a7d-661401ef9441@web.de>
	<1a4f0b82-abb7-4036-99b2-864b907cc353@case.edu>
	<08b93a13-e2b8-1caf-bd00-c6ee1fee94fe@web.de>
	<6ed41311-3f76-8282-93a1-b68297080966@case.edu>
	<c84c30fb-9f6e-ab19-6a4e-3426bb54bc6c@redhat.com>
From: DJ Mills <danielmills1@gmail.com>
Date: Wed, 23 Aug 2017 16:11:17 -0400
X-Google-Sender-Auth: QoXENrT-zCf9jk1ThtPBNDDQ97k
Message-ID: <CAPg6Z09m-bZf-5POae=mVyrRvmesmyFPECH-4X-8sbhwzfOEHw@mail.gmail.com>
Subject: Re: extension of file-test primitives?
To: Eric Blake <eblake@redhat.com>
Cc: Chet Ramey <chet.ramey@case.edu>, dethrophes <dethrophes@web.de>, 
	"bug-bash@gnu.org" <bug-bash@gnu.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:4003:c06::22d
Content-Type: text/plain; charset="UTF-8"
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Aug 2017 20:11:23 -0000

On Wed, Aug 23, 2017 at 3:57 PM, Eric Blake <eblake@redhat.com> wrote:

>
> Not just deprecated, but inherently ambiguous.  There are situations
> where you CANNOT tell whether the user meant -a to mean the binary
> operator or a string being tested against, because POSIX (intentionally)
> does not specify enough precedence rules in how to parse > 4 arguments.
>
> --
> Eric Blake, Principal Software Engineer
> Red Hat, Inc.           +1-919-301-3266
> Virtualization:  qemu.org | libvirt.org
>
>
What would you expect [ ! -a foo ] to do?

It's always true, because it treats -a as the logical AND there. And that's
with 3 arguments, which is defined but unexpected behavior

From MAILER-DAEMON Thu Aug 24 15:41:52 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dky0l-0006Yk-WA
	for mharc-bug-bash@gnu.org; Thu, 24 Aug 2017 15:41:52 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56605)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dky0i-0006Vt-Qi
	for bug-bash@gnu.org; Thu, 24 Aug 2017 15:41:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dky0d-000402-VR
	for bug-bash@gnu.org; Thu, 24 Aug 2017 15:41:48 -0400
Received: from mpv4-2015.cwru.edu ([129.22.103.195]:56726
	helo=mpv4-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1dky0d-0003yC-Pt
	for bug-bash@gnu.org; Thu, 24 Aug 2017 15:41:43 -0400
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv4-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id ANE55826; Thu, 24 Aug 2017 15:41:35 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id BIW60606 (AUTH cpr);
	Thu, 24 Aug 2017 15:41:34 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: extension of file-test primitives?
To: Eric Blake <eblake@redhat.com>, dethrophes <dethrophes@web.de>,
	"bug-bash@gnu.org" <bug-bash@gnu.org>
References: <5998D82A.3030607@tlinx.org>
	<20170821132713.cdh34ewie57ja6tg@eeg.ccf.org>
	<37987298-5402-2e7d-384d-4c2bcf4b2ba3@case.edu>
	<599D03C8.2070604@tlinx.org>
	<20170823123617.hpcsbtjvsjjq6fvw@eeg.ccf.org>
	<599D7B2C.5000509@tlinx.org>
	<CAPSX3sTaHPNsC_yOd6SkKyCUr8MKKomL9LPc_237xsQOty68SQ@mail.gmail.com>
	<20170823133446.b3nswi63vugutkzf@eeg.ccf.org>
	<fa0c0b89-a97c-1f1b-2729-a7e2ec603b2c@case.edu>
	<081B3548-F9FC-4B2E-A711-981B745A39F5@web.de>
	<593186a4-f19a-eca5-9aea-a522bb4e74d2@case.edu>
	<8F2C9600-3C7E-4AAA-B8D0-11DE43CA1416@web.de>
	<255c313b-a104-57f7-68dc-2bee9862d3a8@case.edu>
	<eef2091f-ee1f-662d-2a7d-661401ef9441@web.de>
	<1a4f0b82-abb7-4036-99b2-864b907cc353@case.edu>
	<08b93a13-e2b8-1caf-bd00-c6ee1fee94fe@web.de>
	<6ed41311-3f76-8282-93a1-b68297080966@case.edu>
	<c84c30fb-9f6e-ab19-6a4e-3426bb54bc6c@redhat.com>
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <b735335b-b7b2-d792-9bb9-34123c8d7e23@case.edu>
Date: Thu, 24 Aug 2017 15:41:34 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <c84c30fb-9f6e-ab19-6a4e-3426bb54bc6c@redhat.com>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Junkmail-Status: score=7/60, host=mpv4-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.24.182716:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC,
	__REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID,
	__SANE_MSGID, DATE_TZ_NA, __USER_AGENT,
	__MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT,
	__CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY,
	__REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1,
	__REPLYTO_SAMEAS_FROM_DOMAIN, __ANY_URI, __URI_WITH_PATH,
	__URI_NO_WWW, __CP_URI_IN_BODY, __SUBJ_ALPHA_NEGATE,
	__URI_IN_BODY, __URI_NOT_IMG, __FORWARDED_MSG,
	__NO_HTML_TAG_RAW, BODYTEXTP_SIZE_3000_LESS,
	BODY_SIZE_800_899, __MIME_TEXT_P1, __MIME_TEXT_ONLY,
	__URI_NS, HTML_00_01, HTML_00_10, BODY_SIZE_5000_LESS,
	IN_REP_TO, MSG_THREAD, __FROM_DOMAIN_IN_RCPT,
	__TO_REAL_NAMES, MULTIPLE_REAL_RCPTS, LEGITIMATE_SIGNS,
	__SINGLE_URI_TEXT, SINGLE_URI_IN_BODY, [TRUNCATED],
	so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.195
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 24 Aug 2017 19:41:50 -0000

On 8/23/17 3:57 PM, Eric Blake wrote:

>>>       EXPR1 -a EXPR2 True if both expr1 AND expr2 are true.
>>>       EXPR1 -o EXPR2 True if either expr1 OR expr2 is true.
>>
>> Why update the help documentation? Bash supports it. It's just deprecated
>> in the posix standard.
> 
> Not just deprecated, but inherently ambiguous.  

And that's why it's deprecated. However, working code will continue to
work, and new code that is (unwisely) written to use more than four
arguments will work in the unambiguous situations. And we'll continue
to recommend that people stick to conditional expressions with four
arguments or fewer and combine them using and/or lists.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Thu Aug 24 21:49:21 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dl3kP-0006b1-Bi
	for mharc-bug-bash@gnu.org; Thu, 24 Aug 2017 21:49:21 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:54957)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1dl3kM-0006an-JC
	for bug-bash@gnu.org; Thu, 24 Aug 2017 21:49:19 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1dl3kJ-0000jM-HN
	for bug-bash@gnu.org; Thu, 24 Aug 2017 21:49:18 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:37764
	helo=Ishtar.sc.tlinx.org)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <bash@tlinx.org>) id 1dl3kJ-0000i5-AM
	for bug-bash@gnu.org; Thu, 24 Aug 2017 21:49:15 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
	v7P1n8DV013782
	for <bug-bash@gnu.org>; Thu, 24 Aug 2017 18:49:10 -0700
Message-ID: <599F8214.2050004@tlinx.org>
Date: Thu, 24 Aug 2017 18:49:08 -0700
From: L A Walsh <bash@tlinx.org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: bug-bash <bug-bash@gnu.org>
Subject: aliases not supported by default in non-interactive mode...but POSIX
	required?
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
	timestamps) [generic] [fuzzy]
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 25 Aug 2017 01:49:19 -0000

I was directed to the POSIX section on aliases and it doesn't
say they are only to be enabled during interactive mode, but
seem to be a required compatibility feature even when running
non-interactively:

=====


        2.3.1 Alias Substitution

^[UP XSI <javascript:open_code('UP XSI')>] [Option Start] The processing 
of aliases shall be supported on all XSI-conformant systems or if the 
system supports the User Portability Utilities option (and the rest of 
this section is not further marked for these options). [Option End]

After a token has been delimited, but before applying the grammatical 
rules in Shell Grammar 
<http://pubs.opengroup.org/onlinepubs/007904975/utilities/xcu_chap02.html#tag_02_10> 
, a resulting word that is identified to be the command name word of a 
simple command shall be examined to determine whether it is an unquoted, 
valid alias name. However, reserved words in correct grammatical context 
shall not be candidates for alias substitution. A valid alias name (see 
the Base Definitions volume of IEEE Std 1003.1-2001, Section 3.10, Alias 
Name 
<http://pubs.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap03.html#tag_03_10>) 
shall be one that has been defined by the /alias/ 
<http://pubs.opengroup.org/onlinepubs/007904975/utilities/alias.html> 
utility and not subsequently undefined using /unalias/ 
<http://pubs.opengroup.org/onlinepubs/007904975/utilities/unalias.html>. 
Implementations also may provide predefined valid aliases that are in 
effect when the shell is invoked. To prevent infinite loops in recursive 
aliasing, if the shell is not currently processing an alias of the same 
name, the word shall be replaced by the value of the alias; otherwise, 
it shall not be replaced.

====

However, in testing posix and non-posix modes  in bash 4.4.12, I don't
see aliases being enabled in scripts.

To be POSIX conformant, wouldn't they have to be on?

Why do some people say aliases shouldn't be used, when they are
POSIX required for compatibility?









From MAILER-DAEMON Thu Aug 24 21:59:28 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dl3uC-0000b4-Ba
	for mharc-bug-bash@gnu.org; Thu, 24 Aug 2017 21:59:28 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:55982)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dl3uA-0000aw-CF
	for bug-bash@gnu.org; Thu, 24 Aug 2017 21:59:27 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dl3u7-0004gq-AR
	for bug-bash@gnu.org; Thu, 24 Aug 2017 21:59:26 -0400
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:59060
	helo=mpv3-2015.case.edu) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dl3u7-0004gN-1W
	for bug-bash@gnu.org; Thu, 24 Aug 2017 21:59:23 -0400
Received: from mpv8-2015.CWRU.Edu (EHLO mpv8-2015.case.edu) ([129.22.103.210])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id ANJ65129; Thu, 24 Aug 2017 21:59:19 -0400 (EDT)
Received: from h201.73.130.174.dynamic.ip.windstream.net (EHLO
	_192.168.254.13_) ([174.130.73.201])
	by mpv8-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id INS77211 (AUTH cpr);
	Thu, 24 Aug 2017 21:59:19 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: aliases not supported by default in non-interactive mode...but
	POSIX required?
To: L A Walsh <bash@tlinx.org>, bug-bash <bug-bash@gnu.org>
References: <599F8214.2050004@tlinx.org>
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
Message-ID: <748e4d73-f27b-96cf-6b43-f24f3cde416d@case.edu>
Date: Thu, 24 Aug 2017 21:59:18 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <599F8214.2050004@tlinx.org>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Junkmail-Status: score=7/60, host=mpv3-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.25.3316:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC,
	__REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID,
	__SANE_MSGID, DATE_TZ_NA, __USER_AGENT,
	__MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT,
	__CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY,
	__REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1,
	__FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN,
	__ANY_URI, __URI_WITH_PATH, URI_ENDS_IN_HTML,
	__URI_NO_WWW, __CP_URI_IN_BODY,
	__FRAUD_MONEY_CURRENCY_DOLLAR, __SUBJ_ALPHA_NEGATE,
	__MULTIPLE_URI_TEXT, __URI_IN_BODY, __URI_NOT_IMG,
	__FORWARDED_MSG, __NO_HTML_TAG_RAW,
	BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_1000_1099,
	__MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01,
	HTML_00_10, __FRAUD_MONEY_CURRENCY, BODY_SIZE_5000_LESS,
	IN_REP_TO, MSG_THREAD, [TRUNCATED],
	so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 25 Aug 2017 01:59:27 -0000

On 8/24/17 9:49 PM, L A Walsh wrote:

> However, in testing posix and non-posix modes  in bash 4.4.12, I don't
> see aliases being enabled in scripts.
> 
> To be POSIX conformant, wouldn't they have to be on?

They are:

$ ../bash-4.4-patched/bash --version
GNU bash, version 4.4.12(4)-release (x86_64-apple-darwin15.6.0)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ cat x6
set -o posix
alias lf='echo lf'
lf
$ ../bash-4.4-patched/bash ./x6
lf
$ ../bash-4.4-patched/sh ./x6
lf
$ cat x6a
alias lf='echo lf'
lf
$ ../bash-4.4-patched/bash -o posix ./x6a
lf
$ ../bash-4.4-patched/sh ./x6a
lf



-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Thu Aug 24 22:23:00 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dl4Gv-0005uy-Id
	for mharc-bug-bash@gnu.org; Thu, 24 Aug 2017 22:22:57 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:57986)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1dl4Gs-0005uR-D0
	for bug-bash@gnu.org; Thu, 24 Aug 2017 22:22:55 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1dl4Gp-00057m-7S
	for bug-bash@gnu.org; Thu, 24 Aug 2017 22:22:54 -0400
Received: from mx1.redhat.com ([209.132.183.28]:48330)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <eblake@redhat.com>) id 1dl4Go-00057J-U4
	for bug-bash@gnu.org; Thu, 24 Aug 2017 22:22:51 -0400
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
	[10.5.11.12])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.redhat.com (Postfix) with ESMTPS id A90C55F739;
	Fri, 25 Aug 2017 02:22:49 +0000 (UTC)
DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A90C55F739
Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com;
	dmarc=none (p=none dis=none) header.from=redhat.com
Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com;
	spf=fail smtp.mailfrom=eblake@redhat.com
Received: from [10.10.123.71] (ovpn-123-71.rdu2.redhat.com [10.10.123.71])
	by smtp.corp.redhat.com (Postfix) with ESMTP id 46BC418118;
	Fri, 25 Aug 2017 02:22:49 +0000 (UTC)
Subject: Re: aliases not supported by default in non-interactive mode...but
	POSIX required?
To: L A Walsh <bash@tlinx.org>, bug-bash <bug-bash@gnu.org>
References: <599F8214.2050004@tlinx.org>
From: Eric Blake <eblake@redhat.com>
Openpgp: url=http://people.redhat.com/eblake/eblake.gpg
Organization: Red Hat, Inc.
Message-ID: <3a320f9b-8417-cc06-ee7d-85fecc01dab3@redhat.com>
Date: Thu, 24 Aug 2017 21:22:48 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
	Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <599F8214.2050004@tlinx.org>
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="s8QqEjmq3bwFdNCCOjNIaSE5X2nDmu5KU"
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
	(mx1.redhat.com [10.5.110.39]);
	Fri, 25 Aug 2017 02:22:49 +0000 (UTC)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 209.132.183.28
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 25 Aug 2017 02:22:55 -0000

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--s8QqEjmq3bwFdNCCOjNIaSE5X2nDmu5KU
From: Eric Blake <eblake@redhat.com>
To: L A Walsh <bash@tlinx.org>, bug-bash <bug-bash@gnu.org>
Message-ID: <3a320f9b-8417-cc06-ee7d-85fecc01dab3@redhat.com>
Subject: Re: aliases not supported by default in non-interactive mode...but
 POSIX required?
References: <599F8214.2050004@tlinx.org>
In-Reply-To: <599F8214.2050004@tlinx.org>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 08/24/2017 08:49 PM, L A Walsh wrote:
>=20
> However, in testing posix and non-posix modes  in bash 4.4.12, I don't
> see aliases being enabled in scripts.

That's what happens when you run your script in bash mode, rather than
POSIX mode.

>=20
> To be POSIX conformant, wouldn't they have to be on?

Only if you are running bash in POSIX mode to begin with.  If you are
running in bash mode, then it is assumed that you will explicitly enable
alias expansion in your script, because you (should) know that bash's
defaults differ from the POSIX rules.  (And why does bash disable
aliases by default? Because it helps remind people that shell functions
are better than aliases)

>=20
> Why do some people say aliases shouldn't be used, when they are
> POSIX required for compatibility?

They exist solely for back-compat (for the same reason that 'set -e'
exists), and have very non-intuitive behavior on when they take effect
(for example, wrapping your entire script in {} can effectively bypass
any aliases attempted within your script - because aliases are expanded
at parse time rather than execution time but you have to parse to the
closing }). In almost every respect, shell functions are better and more
powerful than aliases.  And the few hacks where aliases can be used to
do things that shell functions cannot do, like temporarily disabling
globbing so that you can write 'find raw*glob' instead of 'find
"quoted*glob"', are so gross that I can only point you to the web page
discussing how gross they are:
https://www.chiark.greenend.org.uk/~sgtatham/aliases.html

--=20
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


--s8QqEjmq3bwFdNCCOjNIaSE5X2nDmu5KU
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEzBAEBCAAdFiEEccLMIrHEYCkn0vOqp6FrSiUnQ2oFAlmfifgACgkQp6FrSiUn
Q2oOCgf/bf4HoaWWO74oG+3OVWyA0Pd1hsdYKNWM4RMROh/MXWPbkVCH5kqzd1CE
ncXJQ5nY92cQdPmyiYSialoyIU38XA/CZQ7tdVyzIGt9YHdsZJ0h5dRZ7yOO5Iut
cAbrcW/XIyDBJdvwkshgqwqPePDshpDITSq8x65XouFgvcPkprmExjCILudfLv6k
51tcB1RdYAG4gs/1cdyn00nzA++28hEkVElhROUgV9BUHI5gSqPtK10u9asSkG4d
TDKfo7DrGMaTI7RT+4Oct0UCFhVh6UAuCklT/cFNEpNL2ShPVfjpowpOd1gBa9bv
JYkQgUEM1LB1qeYKKS8zZQoJp4VSXg==
=O5K9
-----END PGP SIGNATURE-----

--s8QqEjmq3bwFdNCCOjNIaSE5X2nDmu5KU--


From MAILER-DAEMON Thu Aug 24 23:00:11 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dl4qx-0007nS-4k
	for mharc-bug-bash@gnu.org; Thu, 24 Aug 2017 23:00:11 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:36867)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1dl4qu-0007k8-6O
	for bug-bash@gnu.org; Thu, 24 Aug 2017 23:00:09 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1dl4qq-0000re-2P
	for bug-bash@gnu.org; Thu, 24 Aug 2017 23:00:08 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:40740
	helo=Ishtar.sc.tlinx.org)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <bash@tlinx.org>) id 1dl4qp-0000pU-SX
	for bug-bash@gnu.org; Thu, 24 Aug 2017 23:00:04 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
	v7P2xxxK018027
	for <bug-bash@gnu.org>; Thu, 24 Aug 2017 20:00:01 -0700
Message-ID: <599F92AF.8020407@tlinx.org>
Date: Thu, 24 Aug 2017 19:59:59 -0700
From: L A Walsh <bash@tlinx.org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: bug-bash <bug-bash@gnu.org>
Subject: Re: aliases not supported by default in non-interactive mode...but
	POSIX required?
References: <599F8214.2050004@tlinx.org>
	<3a320f9b-8417-cc06-ee7d-85fecc01dab3@redhat.com>
In-Reply-To: <3a320f9b-8417-cc06-ee7d-85fecc01dab3@redhat.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
	timestamps) [generic] [fuzzy]
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 25 Aug 2017 03:00:09 -0000



Eric Blake wrote:
> On 08/24/2017 08:49 PM, L A Walsh wrote:
>   
>> However, in testing posix and non-posix modes  in bash 4.4.12, I don't
>> see aliases being enabled in scripts.
>>     
>
> That's what happens when you run your script in bash mode, rather than
> POSIX mode.
>   
My scripts were:

#!/bin/sh
shopt -s |grep expand

and

#!/bin/bash --posix
shopt -s |grep expand

On cygwin they show:
expand_aliases on

On linux they neither one shows expand_aliases as 'on'.

How does starting a script with "#!/bin/sh start a script in
bash mode?


>   
>> To be POSIX conformant, wouldn't they have to be on?
>>     
>
> Only if you are running bash in POSIX mode to begin with.  If you are
> running in bash mode, then it is assumed that you will explicitly enable
> alias expansion in your script.
So by default, break POSIX compatibility.  That doesn't sound useful.

Though when "-e" was changed in bash, both bash and posix mode were changed.
I asked why -e was not just changed in posix mode and why the old
behavior couldn't be retained in bash mode.  Was told the new POSIX standard
was desired.

So... why not with aliases as well.  With 2004 and 2008 standards, aliases
are standard.  If POSIX conformity is used to change historic "-e" behavior
(that used to only exist after a "simple [external] command" -- not
shell functions or complex ones as newer posix has changed things), then
seems aliases should conform as well.


>> Why do some people say aliases shouldn't be used, when they are
>> POSIX required for compatibility?
>>     
> They exist solely for back-compat 
----
    That isn't true.  Functions don't replace aliases for all purposes.

> In almost every respect,
    "In almost every respect" != all, I.e. "in almost every respect" = "for
most purposes". 
>  shell functions are better
===
    not always.
>  and more powerful than aliases.
    depends on definition of power.

>   And the few hacks where aliases can be used to
> do things that shell functions cannot do, like temporarily disabling
> globbing so that you can write 'find raw*glob' instead of 'find
> "quoted*glob"', are so gross that I can only point you to the web page
> discussing how gross they are:
> https://www.chiark.greenend.org.uk/~sgtatham/aliases.html
>   
----
    That's another place where aliases can be used -- though not the one
I was thinking of.  Seems there are several places where they can
be used.  How is pointing to a one-sided argument of how bad something
can be on a random webpage not like a fake-news source?

    I used them to write "debugpush [dbgop]"/"debugpop" commands to be
used in scripts that would save current flags, apply selected
debug flags for a specific function/subroutine, then restore the flags
upon exit.  I also use them to increase legibility and maintainability
in my scripts -- neither having anything to do with "quoted*glop".

    But for those convinced aliases are limited to ugly hacks, I
am sure they'd never see other solutions offered by aliases that
functions either don't work with or would be much more complex to
create.




From MAILER-DAEMON Fri Aug 25 09:08:03 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dlELD-000665-C6
	for mharc-bug-bash@gnu.org; Fri, 25 Aug 2017 09:08:03 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:33022)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet@caleb.ins.cwru.edu>) id 1dlELB-00065y-0z
	for bug-bash@gnu.org; Fri, 25 Aug 2017 09:08:01 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet@caleb.ins.cwru.edu>) id 1dlEL7-0004w6-Ok
	for bug-bash@gnu.org; Fri, 25 Aug 2017 09:08:00 -0400
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:32019
	helo=mpv3-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet@caleb.ins.cwru.edu>)
	id 1dlEL7-0004vd-HD
	for bug-bash@gnu.org; Fri, 25 Aug 2017 09:07:57 -0400
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id ANJ74628; Fri, 25 Aug 2017 09:07:55 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id BIX29358; Fri, 25 Aug 2017 09:07:49 -0400 (EDT)
Received: by caleb.ins.cwru.edu (Postfix, from userid 286)
	id 700FFF8596C; Fri, 25 Aug 2017 09:07:48 -0400 (EDT)
Date: Fri, 25 Aug 2017 08:48:00 -0400
Resent-Date: Fri, 25 Aug 2017 09:07:48 -0400
From: Chet Ramey <chet.ramey@case.edu>
To: L A Walsh <bash@tlinx.org>
Subject: Re: aliases not supported by default in non-interactive mode...but
	POSIX required?
Cc: chet.ramey@case.edu
Reply-To: chet.ramey@case.edu
References: <599F8214.2050004@tlinx.org>
	<3a320f9b-8417-cc06-ee7d-85fecc01dab3@redhat.com>
	<599F92AF.8020407@tlinx.org>
In-Reply-To: <599F92AF.8020407@tlinx.org>
Resent-From: Chet Ramey <chet.ramey@case.edu>
Resent-To: bug-bash@gnu.org
Message-ID: <170825130748.AA04285.SM@caleb.ins.cwru.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-original-authentication-results:x-gm-message-state:delivered-to
	:reply-to:cc:subject:to:references:from:organization:message-id:date
	:user-agent:mime-version:in-reply-to:content-language
	:content-transfer-encoding;
	bh=0S0YWNQw2W198Z3Mb+F/uvv2meabeBnJbpL1XzQ/Zc8=;
	b=m3peKsjbPbLtbMhF+XkO53a+hXgmhK4tK+/4nveZbrCrk9kRhTghrNA+d46Nj52iOL
	g5CsiLcVtmSdiYmWGiAtQwt0LEP9k+uZd/HRIrNHiTKEAeYIeLyuwtzNQDurimIXMfsl
	ZvH/+j68pORruMfPSEMX5VuTx22MClOdes/LHJFm1yHPnig8etUMOn1hd7R1EYDpPl6b
	e1KOG0zkUsDqluYeT2d+s6aOxunDmWEHzFvAg1loCHeN4EX/nVDED/nO7VdiFDRAeqwJ
	TzFeFX74iarRSO0j201qDXe1Y6fqTZZN51IG9RH4lQJRQWQFmmTqEb+ylb6AHphAWGsj
	rClQ==
X-Original-Authentication-Results: mx.google.com;
	spf=softfail (google.com: domain of
	transitioning chet.ramey@case.edu does not designate
	129.22.1.18 as permitted sender)
	smtp.mailfrom=chet.ramey@case.edu
X-Gm-Message-State: AHYfb5itZe+StdyamBGAKoV1l9q5c6m4IrfbcdKjQCSnv3tqxylQmo1d
	lOgnUUyDdl5B50cusYBRwk+GmuWD4HA/5VpHdIvN1zI/5wfscvkj35BGSkpEQW6uf5FdE+n/rxw
	XC0WMIu+VIagEgdsH+lISAy1cofsQSeJl9mLMSZO8nGDa
X-Received: X-Received
X-Received: by 10.80.164.6 with SMTP id u6mr5923698edb.250.1503665287651;
	Fri, 25 Aug 2017 05:48:07 -0700 (PDT)
X-Forwarded-To: chet@chet-mail.tis.cwru.edu
X-Forwarded-For: cpr@case.edu chet@chet-mail.tis.cwru.edu
X-Delivered-To: cpr@cwru.edu
X-ARC-Seal: i=1; a=rsa-sha256; t=1503665285; cv=none;
	d=google.com; s=arc-20160816;
	b=eLB43mArk4Azysw6YtOc8UzsdOsXYMS7N9B6hVJbSKPsC/3G8VQWNrB4TVSO2c0zBW
	5gOhc6jcFgQ/V3wivwFcMLzjz5XVv9R87Ylna7vjlmfXEpxqosT0BBWX9YGE7HtQKzIt
	Wz5TigECnXmGTf39WdQm7HMYOj0uG8nYNPI5BxydC4TnhXVBLXE1Yu7Anf9aiWOksneo
	LhB/wMyolIVa09x9jcqVyUpCcwhUrE89DelsqMBmLx177Xzv9y1VqleWMgHAUpwS4xae
	tb6Xu0fy2X2xmCaUg7s9trZ0tBTn4SOVPOXTi3XtDUupKnAr5Vh4JBmaX+xWiP+5B58S
	ZY8g==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
	s=arc-20160816; 
	h=content-transfer-encoding:content-language:in-reply-to:mime-version
	:user-agent:date:message-id:organization:from:references:to:subject
	:cc:reply-to:arc-authentication-results;
	bh=0S0YWNQw2W198Z3Mb+F/uvv2meabeBnJbpL1XzQ/Zc8=;
	b=ZNNhGHmw1gd+/VJf7qQ3Ssjs9BefztqD2dv77tiMfCmq/3oZV7tTMANc/RodjjGjeg
	U2FAOl83zHh3xJ/UKJ1cEci1C7pTtNTG6QF+FlhtBJNi/Bs36I0ne8SHYQJnqz6w7B2F
	KjriTvRH0AqOXK2iiuT9PwAreNg1bziLfzlV1/O+sVB5+z03nsghpfRVxy5SYkDrSvsc
	jWctEXyNYNq/tqZWaLLPbfXhd1oUX+wQRD+bMUMmhBMeeKC6yb9BtEsJz/3KmgWrctOT
	uHMwtW1bwLU0AT15sop4/ruVEHDsQi0mA7lfxkM1+6FbtRyNauyUCPM7WmPrB2bItmeI
	KvSA==
X-ARC-Authentication-Results: i=1; mx.google.com;
	spf=softfail (google.com: domain of transitioning chet.ramey@case.edu
	does not designate 129.22.1.18 as permitted sender)
	smtp.mailfrom=chet.ramey@case.edu
X-Received-SPF: softfail (google.com: domain of transitioning
	chet.ramey@case.edu does not designate 129.22.1.18 as permitted
	sender) client-ip=129.22.1.18; 
X-Authentication-Results: mx.google.com;
	spf=softfail (google.com: domain of transitioning chet.ramey@case.edu
	does not designate 129.22.1.18 as permitted sender)
	smtp.mailfrom=chet.ramey@case.edu
X-Organization: ITS, Case Western Reserve University
X-User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
X-Content-Language: en-US
Resent-Message-Id: <20170825130749.700FFF8596C@caleb.ins.cwru.edu>
X-Junkmail-Status: score=7/60, host=mpv3-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.25.124516:17:7.944, ip=,
	rules=DATE_TZ_NA, __HAS_FROM, FROM_EDU_TLD,
	__TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__HAS_CC_HDR, __HAS_REPLYTO, __REFERENCES, __IN_REP_TO,
	__X_RESENT_FROM, __HAS_MSGID, __SANE_MSGID,
	__MIME_VERSION, __CT, __CT_TEXT_PLAIN, __CTE,
	__X_FORWARDED_TO, __REPLYTO_SAMEAS_FROM_ADDY,
	__REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1,
	__REPLYTO_SAMEAS_FROM_DOMAIN, __ANY_URI, __URI_WITH_PATH,
	URI_ENDS_IN_HTML, __URI_NO_WWW, __CP_URI_IN_BODY,
	__FRAUD_MONEY_CURRENCY_DOLLAR, __SUBJ_ALPHA_NEGATE,
	__MULTIPLE_URI_TEXT, __URI_IN_BODY, __URI_NOT_IMG,
	__NO_HTML_TAG_RAW, BODY_SIZE_700_799,
	BODYTEXTP_SIZE_3000_LESS, __MIME_TEXT_P1,
	__MIME_TEXT_ONLY, __URI_NS, HTML_00_01, HTML_00_10,
	__FRAUD_MONEY_CURRENCY, BODY_SIZE_5000_LESS, IN_REP_TO,
	MSG_THREAD, __FROM_DOMAIN_IN_RCPT, __TO_REAL_NAMES,
	MULTIPLE_REAL_RCPTS, [TRUNCATED], so=2010-03-03 19:42:08,
	dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 25 Aug 2017 13:08:02 -0000

On 8/24/17 10:59 PM, L A Walsh wrote:

> How does starting a script with "#!/bin/sh start a script in
> bash mode?

It doesn't:

$ ./bash --version
GNU bash, version 4.4.12(4)-release (x86_64-apple-darwin15.6.0)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ cat x6a
#!./sh
alias lf='echo lf'
lf
$ cat x6
#! ./bash --posix
alias lf='echo lf'
lf
$ ./x6
lf
$ ./x6a
lf

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



From MAILER-DAEMON Sun Aug 27 09:20:58 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dlxUo-0006WK-6R
	for mharc-bug-bash@gnu.org; Sun, 27 Aug 2017 09:20:58 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:35771)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <nsajko@gmail.com>) id 1dlvD4-0004WD-6H
	for bug-bash@gnu.org; Sun, 27 Aug 2017 06:54:32 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <nsajko@gmail.com>) id 1dlvD3-0002Uw-Cm
	for bug-bash@gnu.org; Sun, 27 Aug 2017 06:54:30 -0400
Received: from mail-lf0-x229.google.com ([2a00:1450:4010:c07::229]:34293)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <nsajko@gmail.com>) id 1dlvD3-0002Ta-5D
	for bug-bash@gnu.org; Sun, 27 Aug 2017 06:54:29 -0400
Received: by mail-lf0-x229.google.com with SMTP id d17so12842725lfe.1
	for <bug-bash@gnu.org>; Sun, 27 Aug 2017 03:54:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:from:date:message-id:subject:to;
	bh=9o7zrSUtdUPxr4QS0wLJ3mJdzZQTqcVoqy1AgsqmQqU=;
	b=ffaTX9VTU5AJjNKfUgfdSc3zhVd19CjeVoAxVrrYQe9597fbRha5beYEuacNQnrjsd
	8U77gtT6zHSnnzjw57y7Z62jfGclm3jVmraohUbaxzytdVJbJUihwNbm5q8021QU2Da5
	5NHe1PLwRAX+u3NvZmAe+fqUN9Yhqy1LclmBBdIh3N5r2uXZICPKuIAYD3JM6jkicezc
	6B5KmpJLLqrcQ30W5FgyMNw4+IcTkhKtT5sgp2rOry2do8xOAYy28lvB9dRU/IZTbQmR
	dYZgJ+G1d1i79mWkeazhLNm/fAlSqO3FO/v/6bqzgWt5jZhROewulweFpt1j8/85jrkZ
	q1tw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
	bh=9o7zrSUtdUPxr4QS0wLJ3mJdzZQTqcVoqy1AgsqmQqU=;
	b=SMnoXEBd8FTBkQEp4geO5vIu7ssr3zLtgFOft+kCJKrC4X9EG5GEJwsvQE7IDkI9O8
	TIhCTTjipYH4B6FqfeQjuXxZJfQn++RKaYoOpyzM2ctgUeVsOERRUCvYYmWWZH100J9E
	AnJU51Jpbsfzi/poLXFAS6aK49GKpNaooXLJyQ4EhK9Yc8agVcC7ErEFkodHcRLFsNo6
	jj2zqwwxXHg7NyO+rJoGrh2LpCFifm1B4ulc7iFngZEig0AX5suIKI1OvTVLRt73WIAy
	W1pww6wlGLHp6r3NuyvgPFeRtLzhFni/D9cg3+s7pZEaAkB06YCcpWM0vwM6yROVvqTK
	Dpvg==
X-Gm-Message-State: AHYfb5gnGWm9sFQwE1Oe/JUuhPQebzGbyeBoGB5PcHEwoPOZ14P/gV0g
	9Jl/rMInF5Hkin3DXtzFXzUt/ljnwArV
X-Received: by 10.25.233.211 with SMTP id j80mr1162900lfk.250.1503831266115;
	Sun, 27 Aug 2017 03:54:26 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.25.77.20 with HTTP; Sun, 27 Aug 2017 03:54:25 -0700 (PDT)
From: Neven Sajko <nsajko@gmail.com>
Date: Sun, 27 Aug 2017 12:54:25 +0200
Message-ID: <CAL+bK4MZOZxwp+FEqWOyvx+-X2jXsE1VmyhNOzKr4CZAELbnPA@mail.gmail.com>
Subject: bash pollutes namespace it shouldn't touch when emulating sh
To: bug-bash@gnu.org
Content-Type: text/plain; charset="UTF-8"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2a00:1450:4010:c07::229
X-Mailman-Approved-At: Sun, 27 Aug 2017 09:20:57 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 27 Aug 2017 10:54:32 -0000

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu'
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale'
-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include
-I./lib  -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe
-fstack-protector-strong
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin'
-DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc'
-DSYS_BASH_LOGOUT='/etc/bash.bash_logout'
-DNON_INTERACTIVE_LOGIN_SHELLS -Wno-parentheses -Wno-format-security
uname output: Linux hp 4.12.8-2-ARCH #1 SMP PREEMPT Fri Aug 18
14:08:02 UTC 2017 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

Bash Version: 4.4
Patch Level: 12
Release Status: release

Description:

Some bash features (history expansions ...?) prevent executing
commands with the same name.

Repeat-By:

$ echo x"$histchars"x
xx
$ POSIXLY_CORRECT=1 sh
sh-4.4$ ^
sh: !!: event not found
sh-4.4$ histchars=,\\   # This should not have to be done...
sh-4.4$ ^
I, too, am in PATH!
sh-4.4$ # This was how it should have been in the first place!
sh-4.4$ unset histchars
sh-4.4$ ^
sh: :s^: no previous substitution

Fix:

Just remove those features while emulating sh. Or maybe, like it is
done for bashbug, check that there isn't a matching executable in
PATH.


From MAILER-DAEMON Sun Aug 27 10:08:42 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dlyF0-0005jn-4x
	for mharc-bug-bash@gnu.org; Sun, 27 Aug 2017 10:08:42 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56500)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dlyEy-0005jh-4N
	for bug-bash@gnu.org; Sun, 27 Aug 2017 10:08:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dlyEv-0002Gm-01
	for bug-bash@gnu.org; Sun, 27 Aug 2017 10:08:40 -0400
Received: from mpv4-2015.cwru.edu ([129.22.103.195]:30771
	helo=mpv4-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1dlyEu-0002Gb-P1
	for bug-bash@gnu.org; Sun, 27 Aug 2017 10:08:36 -0400
Received: from mpv8-2015.CWRU.Edu (EHLO mpv8-2015.case.edu) ([129.22.103.210])
	by mpv4-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id ANF36053; Sun, 27 Aug 2017 10:08:34 -0400 (EDT)
Received: from h201.73.130.174.dynamic.ip.windstream.net (EHLO
	_192.168.254.13_) ([174.130.73.201])
	by mpv8-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id IOJ93417 (AUTH cpr);
	Sun, 27 Aug 2017 10:08:33 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: bash pollutes namespace it shouldn't touch when emulating sh
To: Neven Sajko <nsajko@gmail.com>, bug-bash@gnu.org
References: <CAL+bK4MZOZxwp+FEqWOyvx+-X2jXsE1VmyhNOzKr4CZAELbnPA@mail.gmail.com>
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
Message-ID: <a6ef5133-679f-5233-5e80-795ea83a59e1@case.edu>
Date: Sun, 27 Aug 2017 10:08:32 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <CAL+bK4MZOZxwp+FEqWOyvx+-X2jXsE1VmyhNOzKr4CZAELbnPA@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Junkmail-Status: score=7/60, host=mpv4-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.27.132116:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC,
	__REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID,
	__SANE_MSGID, DATE_TZ_NA, __USER_AGENT,
	__MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT,
	__CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY,
	__REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1,
	__FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN,
	__ANY_URI, __URI_WITH_PATH, __URI_NO_WWW,
	__CP_URI_IN_BODY, __SUBJ_ALPHA_NEGATE, __URI_IN_BODY,
	__URI_NOT_IMG, __FORWARDED_MSG, __NO_HTML_TAG_RAW,
	BODY_SIZE_700_799, BODYTEXTP_SIZE_3000_LESS,
	__MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01,
	HTML_00_10, BODY_SIZE_5000_LESS, IN_REP_TO, MSG_THREAD,
	__FROM_DOMAIN_IN_RCPT, __TO_REAL_NAMES,
	MULTIPLE_REAL_RCPTS, LEGITIMATE_SIGNS, __SINGLE_URI_TEXT,
	[TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.195
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 27 Aug 2017 14:08:41 -0000

On 8/27/17 6:54 AM, Neven Sajko wrote:

> Bash Version: 4.4
> Patch Level: 12
> Release Status: release
> 
> Description:
> 
> Some bash features (history expansions ...?) prevent executing
> commands with the same name.

I am not sure what you think Posix mode should do here. Since Posix doesn't
standardize the behavior of `^', Bash is free to use it as part of history
expansion. If you think history expansion should behave differently,
either use histchars to change the default behavior or disable history
expansion.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Tue Aug 29 09:11:06 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dmgIM-000590-NK
	for mharc-bug-bash@gnu.org; Tue, 29 Aug 2017 09:11:06 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:45662)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jongrantuk@gmail.com>) id 1dmfpJ-00041u-3h
	for bug-bash@gnu.org; Tue, 29 Aug 2017 08:41:05 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jongrantuk@gmail.com>) id 1dmfpE-0000Wh-6v
	for bug-bash@gnu.org; Tue, 29 Aug 2017 08:41:05 -0400
Received: from mail-lf0-x236.google.com ([2a00:1450:4010:c07::236]:33907)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <jongrantuk@gmail.com>)
	id 1dmfpD-0000VI-VB
	for bug-bash@gnu.org; Tue, 29 Aug 2017 08:41:00 -0400
Received: by mail-lf0-x236.google.com with SMTP id d17so12855774lfe.1
	for <bug-bash@gnu.org>; Tue, 29 Aug 2017 05:40:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=sender:to:from:subject:message-id:date:user-agent:mime-version
	:content-language:content-transfer-encoding;
	bh=Jg4pANdyDAoDmrhzHijYRdtar2qpmfnaykaJGTLreNw=;
	b=cd0p8i6sphUTAxA73TLy2HCQVN2pFxLytMwjfB3DDno8RlOPPVRJtq7lmFh2eYjb7c
	fn0FdThqr0gltsAGHnSZTUy7n2wG20UAbTjSUjrPiLMEeSw5O9sYw4y2IGHn8PmDGnyo
	OtTj4o/t73QYdAdxOUydTJjajBeHg/HfmWZUBZx+NzYTr43GKbSsobqoOEymgY69IHgg
	F07eXSNBBeG5kBu+UlW80nXQLS5sP2HxhK3yXIKgNkVyJYhBWfcj2XIdUawQDHy+wGtY
	bnsI9SJE855K/d4Zj9X59olkAm6zW7Y9Jtt3NHSXSZzgR0A/85CCnTVTzZf3mytxjl96
	jH9Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:sender:to:from:subject:message-id:date
	:user-agent:mime-version:content-language:content-transfer-encoding;
	bh=Jg4pANdyDAoDmrhzHijYRdtar2qpmfnaykaJGTLreNw=;
	b=eULumyGNL72407Pqmv7DDOR+P8nbCh7cIW3V1wo7BkWfNbqKklfkquVTjVcIjUqhn/
	ujIUzE03J3OpHQwaPt7fSwtpMWvtAo+0Lf9ZPtsTVmC4WT3S3Lz1rTfOUOJvi7veDRfq
	hNGMbo8R7ROVLGTbLINAZGYFXLN+7f6IfBXcdskjzw7poahEqWcr86sHxuGW0rNh0XUv
	ohC1SyNL0sLORpYWCk8pC6DdRwrofV7LMzlvjfn5lLgLRYWT8M8VboQQooQrglv2hefR
	R6mwn+ajKs18NSNm+JWeRFZD9gbjrdBbLmWM4J9/cbbOyMaFEG6QuFqUXBTHt8LVwSSi
	tleg==
X-Gm-Message-State: AHYfb5iqVER2y37he2D2GrjVXQ/fcY+V3L5gni/gp7gY4KiXR6jie5fX
	SQesTB1G4EzV1un9
X-Received: by 10.25.80.1 with SMTP id e1mr26753lfb.153.1504010457048;
	Tue, 29 Aug 2017 05:40:57 -0700 (PDT)
Received: from [192.168.1.34] (host-87-255-31-247.bigtelecom.ru.
	[87.255.31.247]) by smtp.googlemail.com with ESMTPSA id
	z10sm591269lja.23.2017.08.29.05.40.55 for <bug-bash@gnu.org>
	(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Tue, 29 Aug 2017 05:40:56 -0700 (PDT)
Sender: Jonny Grant <jongrantuk@gmail.com>
To: bug-bash@gnu.org
From: Jonny Grant <jg@jguk.org>
Subject: Bash handling of ENOENT on missing files and directories
Message-ID: <08c3de9b-444a-1ce9-fd6f-e5a48ae519e4@jguk.org>
Date: Tue, 29 Aug 2017 15:40:54 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
	Thunderbird/52.2.1
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-GB
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2a00:1450:4010:c07::236
X-Mailman-Approved-At: Tue, 29 Aug 2017 09:11:05 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 29 Aug 2017 12:41:06 -0000

Hello

Could bash have some better handling of ENOENT for directories that 
don't exist and files that don't exist?

(B) is good, but (A) and (C) are problematic below.


$ bash --version
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)

A)
$ cd missingdir
bash: cd: missingdir: No such file or directory

B)
$ touch direct
$ cd direct
bash: cd: direct: Not a directory

Should not say a file, when "cd" command. Needs special handling

C)
$ ./main
-bash: ./main: No such file or directory


expected:


A)
$ cd missingdir
bash: cd: missingdir: No such directory

C)
$ ./main
-bash: ./main: No such file


Please keep my email address in any replies
Thanks
Jonny


From MAILER-DAEMON Tue Aug 29 09:22:19 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dmgTD-0002Ik-TB
	for mharc-bug-bash@gnu.org; Tue, 29 Aug 2017 09:22:19 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:57347)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1dmgTA-0002IC-Bd
	for bug-bash@gnu.org; Tue, 29 Aug 2017 09:22:18 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1dmgT5-0005OF-AO
	for bug-bash@gnu.org; Tue, 29 Aug 2017 09:22:16 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:41070 helo=svr4.eeg.ccf.org)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1dmgT5-000518-31
	for bug-bash@gnu.org; Tue, 29 Aug 2017 09:22:11 -0400
Received: (qmail 56842 invoked from network); 29 Aug 2017 13:21:41 -0000
Received: from wooledg.eeg.ccf.org (10.76.172.97)
	by gateway.eeg.ccf.org with SMTP; Tue, 29 Aug 2017 09:21:41 -0400
Received: (qmail 7741 invoked by uid 563); 29 Aug 2017 13:21:41 -0000
Date: Tue, 29 Aug 2017 09:21:41 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Jonny Grant <jg@jguk.org>
Cc: bug-bash@gnu.org
Subject: Re: Bash handling of ENOENT on missing files and directories
Message-ID: <20170829132141.kjtduuw54pavvdi2@eeg.ccf.org>
Mail-Followup-To: Jonny Grant <jg@jguk.org>, bug-bash@gnu.org
References: <08c3de9b-444a-1ce9-fd6f-e5a48ae519e4@jguk.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <08c3de9b-444a-1ce9-fd6f-e5a48ae519e4@jguk.org>
User-Agent: NeoMutt/20170113 (1.7.2)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 139.137.100.1
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 29 Aug 2017 13:22:18 -0000

On Tue, Aug 29, 2017 at 03:40:54PM +0300, Jonny Grant wrote:
> (B) is good, but (A) and (C) are problematic below.
> 
> A)
> $ cd missingdir
> bash: cd: missingdir: No such file or directory

How is this a problem?  It seems completely clear to me.  It tells
you what program generated the error, what the program was trying to
do, what argument was given, and what the result was.

The wording is taken directly from perror() and related library calls,
as translated for your locale.

wooledg:~$ grep -r 'No such file' /usr/include
/usr/include/asm-generic/errno-base.h:#define   ENOENT           2      /* No such file or directory */
/usr/include/rpcsvc/nfs_prot.x: NFSERR_NOENT=2,         /* No such file or directory */

The magic phrase "No such file or directory" tells the aware reader
that some system call failed with errno set to ENOENT.

> C)
> $ ./main
> -bash: ./main: No such file or directory

Again, I'm not seeing the problem.


From MAILER-DAEMON Tue Aug 29 09:36:12 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dmgge-00076i-5Q
	for mharc-bug-bash@gnu.org; Tue, 29 Aug 2017 09:36:12 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:33241)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dmggZ-00074q-Nw
	for bug-bash@gnu.org; Tue, 29 Aug 2017 09:36:10 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1dmggT-00048S-Pj
	for bug-bash@gnu.org; Tue, 29 Aug 2017 09:36:07 -0400
Received: from mpv4-2015.cwru.edu ([129.22.103.195]:19071
	helo=mpv4-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1dmggT-00047P-Jo
	for bug-bash@gnu.org; Tue, 29 Aug 2017 09:36:01 -0400
Received: from mpv6-2015.CWRU.Edu (EHLO mpv6-2015.case.edu) ([129.22.103.202])
	by mpv4-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id ANG05894; Tue, 29 Aug 2017 09:35:56 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id BIV95512 (AUTH cpr);
	Tue, 29 Aug 2017 09:35:53 -0400 (EDT)
Reply-To: chet.ramey@case.edu
Cc: chet.ramey@case.edu
Subject: Re: Bash handling of ENOENT on missing files and directories
To: Jonny Grant <jg@jguk.org>, bug-bash@gnu.org
References: <08c3de9b-444a-1ce9-fd6f-e5a48ae519e4@jguk.org>
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <55faa6dc-4009-5cec-65b4-fcdfa2de2341@case.edu>
Date: Tue, 29 Aug 2017 09:35:53 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
	Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <08c3de9b-444a-1ce9-fd6f-e5a48ae519e4@jguk.org>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Junkmail-Status: score=7/60, host=mpv4-2015.case.edu
X-Junkmail-PrAS-Raw: score=7/60, refid=2.7.2:2017.8.29.122116:17:7.944, ip=,
	rules=__HAS_REPLYTO, __HAS_CC_HDR,
	__BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT,
	__TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC,
	__REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID,
	__SANE_MSGID, DATE_TZ_NA, __USER_AGENT,
	__MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT,
	__CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY,
	__REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1,
	__FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN,
	__ANY_URI, __URI_WITH_PATH, __URI_NO_WWW,
	__CP_URI_IN_BODY, __SUBJ_ALPHA_NEGATE, __URI_IN_BODY,
	__URI_NOT_IMG, __FORWARDED_MSG, __NO_HTML_TAG_RAW,
	BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_400_499,
	__MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01,
	HTML_00_10, BODY_SIZE_5000_LESS, IN_REP_TO, MSG_THREAD,
	__FROM_DOMAIN_IN_RCPT, __TO_REAL_NAMES,
	MULTIPLE_REAL_RCPTS, LEGITIMATE_SIGNS, __SINGLE_URI_TEXT,
	[TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.195
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 29 Aug 2017 13:36:10 -0000

On 8/29/17 8:40 AM, Jonny Grant wrote:
> Hello
> 
> Could bash have some better handling of ENOENT for directories that don't
> exist and files that don't exist?

Better than the error message the OS associates with that errno? The one
that comes straight from strerror()?

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


From MAILER-DAEMON Wed Aug 30 07:13:45 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dn0wL-0000ZM-Jm
	for mharc-bug-bash@gnu.org; Wed, 30 Aug 2017 07:13:45 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:48397)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <nsajko@gmail.com>) id 1dn0wJ-0000ZF-9i
	for bug-bash@gnu.org; Wed, 30 Aug 2017 07:13:44 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <nsajko@gmail.com>) id 1dn0wE-0000ae-FW
	for bug-bash@gnu.org; Wed, 30 Aug 2017 07:13:43 -0400
Received: from mail-lf0-x232.google.com ([2a00:1450:4010:c07::232]:36346)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <nsajko@gmail.com>) id 1dn0wE-0000a2-3K
	for bug-bash@gnu.org; Wed, 30 Aug 2017 07:13:38 -0400
Received: by mail-lf0-x232.google.com with SMTP id z12so23226764lfd.3
	for <bug-bash@gnu.org>; Wed, 30 Aug 2017 04:13:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to; 
	bh=talThe2r/Zx7I3Rva85yo/7B1X3OIKyHTACBgJYrhjs=;
	b=HOmD7yVdMGakmfckSHXwcHsPs343d5Na0jztY1c67HUOG2MbLL6TWk4U5Aa2B0xhIp
	Foyt7qI4kQ6GAbwO2tlgz6Rpq+qzvv/QhsY8XQrjrdzce5n5/8OxDZr4y5fg91Y3QxSY
	3slWaDLgeF0jaH2YsxKZEnJ7uj3yCW4JJ08aPeIk37hN20sf86PXpof1D1ip8oa7n4rQ
	BsqQ8pacxcAI+0DiOO5f3umkhLQY07Y18gT91qOXDNJkFvX7wk7QLTLqn0AnNz1AeBtQ
	75DyC1G0WSQUQvEYPn5YEk/Vq3lmj9j/z5+lNfSPpFWz7tbjDUur9KDKbICi1D3myFrC
	jwMw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to;
	bh=talThe2r/Zx7I3Rva85yo/7B1X3OIKyHTACBgJYrhjs=;
	b=drCqkBhtGJk/kUyNy4ZbbTwIhASdhHf36rRW/QzGtbLjsmxnzCJmXmfim1eVsWdGAc
	GMIWLfwfYxJS2y54Zt0Oi/t7iYOBT4KIArBunlgpMX6LVDt5M7DNQ4iuvxZ+E/lI/qWS
	uyZeV5s25WmWav7HVa8lzMcN61pPY08Q3zgdifsx+9PKg7n8Q3T4y2DDZ4D6wKUJybEm
	ik59U1EgRbJwtOwb86YLjQmdxZmz3mUJYeWSu3UYygrbNlucPSWvzp7DzTCegCbEQkBp
	X7VPC5RDsLV7dB786BzuGRLrjNPTeutjRa5XjUDxfaEqA2lOTVdD29QCJ0LIEMo+Bs2n
	4+Zg==
X-Gm-Message-State: AHPjjUgU4vCH8KbaqYB8Zc8or7ODVU1CuJj5U2tY/yHlzpYOrWA3yox+
	+8xTU3wRWhF747taT75f+QC4VQxMxw==
X-Google-Smtp-Source: ADKCNb7j9bXN4t7sCjJtBPgccOqD7XNETlG/pzH5eyVWn/w4+/JJbe/YOnFXKNmQpUmw1EDzHeE9RvYM4P8A8rrtmQM=
X-Received: by 10.25.83.207 with SMTP id h76mr476423lfl.164.1504091615167;
	Wed, 30 Aug 2017 04:13:35 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.25.209.139 with HTTP; Wed, 30 Aug 2017 04:13:34 -0700 (PDT)
In-Reply-To: <62d4d174-918f-642a-0d93-7970764d2b45@case.edu>
References: <CAL+bK4MZOZxwp+FEqWOyvx+-X2jXsE1VmyhNOzKr4CZAELbnPA@mail.gmail.com>
	<a6ef5133-679f-5233-5e80-795ea83a59e1@case.edu>
	<CAL+bK4NLgC3Kixfa+LpCKL-8=w2H8DBq-ypmVBT2F-VNw=VihA@mail.gmail.com>
	<8dfb50fb-8a37-8bf9-d9aa-06042caab0fc@case.edu>
	<CAL+bK4NZwoHO=M3SzxVciWSoaCnELBmECUu2CJg1QbWjG5mmDQ@mail.gmail.com>
	<9ab4e418-be95-37b7-738a-84a8791a240a@case.edu>
	<CAL+bK4PdB8bw8mD8FFrCo9SAaFztB9PtfPTNewcYo5Pdx97PSQ@mail.gmail.com>
	<62d4d174-918f-642a-0d93-7970764d2b45@case.edu>
From: Neven Sajko <nsajko@gmail.com>
Date: Wed, 30 Aug 2017 13:13:34 +0200
Message-ID: <CAL+bK4PyqzWAEMSR-jeUXp4kkc7U_oKPTZfStcCsS2O3P9fB6g@mail.gmail.com>
Subject: Re: bash pollutes namespace it shouldn't touch when emulating sh
To: Chester Ramey <chet.ramey@case.edu>, bug-bash@gnu.org
Content-Type: text/plain; charset="UTF-8"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2a00:1450:4010:c07::232
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 30 Aug 2017 11:13:44 -0000

On 28 August 2017 at 17:54, Neven Sajko <nsajko@gmail.com> wrote:
> On 28 August 2017 at 15:05, Chet Ramey <chet.ramey@case.edu> wrote:
>> On 8/28/17 3:42 AM, Neven Sajko wrote:
>>>> I am not sure what you think Posix mode should do here. Since Posix doesn't
>>>> standardize the behavior of `^', Bash is free to use it as part of history
>>>> expansion. If you think history expansion should behave differently,
>>>> either use histchars to change the default behavior or disable history
>>>> expansion.
>>>
>>> Exactly *because* POSIX doesn't define "^" it should be possible to
>>> use it as you would use any other string. That means being able to
>>> execute ^ if it's in the search path, which is not possible. POSIX
>>> doesn't define histchars so it can't be the neccesary solution for sh
>>> ( i.e., bash emulating sh).
>>
>> A statement like this shows a fundamental misunderstanding of bash's
>> posix mode.
>>
>> Bash in posix mode is not `emulating sh', whatever that means.  Those
>> things that Posix does not standardize are available to the application,
>> in this case bash, to do with as it likes. They are outside the bounds
>> of standardization. When bash is in posix mode, it modifies certain
>> defaults that are not strictly Posix conformant. It doesn't turn off
>> anything that Posix doesn't specify.
>>
>>> sh is not being emulated if you're not compatible with it.
>>
>> The problem with a statement like this is the `it'. There is no single
>> `sh' that is a target for `emulation'. The best standard for `sh' is Posix,
>> and bash is conformant.
>>
>>> Try comparing bash with dash if the example I gave in the first mail
>>> isn't enough.
>>
>> It sounds like you want a shell that doesn't implement anything beyond
>> what Posix specifies. Bash is not that shell.
>>
>> --
>> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>>                  ``Ars longa, vita brevis'' - Hippocrates
>> Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/
>
> If there is an executable named '^', or anything else not equal to a
> function or builtin, and it is in a directory in PATH, any POSIX sh
> should allow to executing it by calling the command with the same
> name. If that's not true you're not POSIX compliant. Simple as that.
>
> Maybe reading http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_01_01
> would help?

On 29 August 2017 at 02:52, Neven Sajko <nsajko@gmail.com> wrote:
> On 28 August 2017 at 21:00, Chet Ramey <chet.ramey@case.edu> wrote:
>> On 8/28/17 11:54 AM, Neven Sajko wrote:
>>
>>> If there is an executable named '^', or anything else not equal to a
>>> function or builtin, and it is in a directory in PATH, any POSIX sh
>>> should allow to executing it by calling the command with the same
>>> name. If that's not true you're not POSIX compliant. Simple as that.
>>
>> That's just not how the standard works. As long as you implement the
>> features Posix standardizes, in the way Posix says they should work,
>> you conform. Posix doesn't say anything about features it doesn't
>> standardize. This is how you get additional metacharacters (&|), syntax
>> features (;;& and ;& case statement terminators), expanded quoting
>> ($'...'), new reserved words (`function', `coproc'), entirely new
>> compound commands (`select'), and transformations like brace and
>> history expansion. None of these things make a shell non-conforming.
>>
>> The standard is not prohibitive. There is an infinite number of things
>> that Posix doesn't cover.
>>
>> --
>> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>>                  ``Ars longa, vita brevis'' - Hippocrates
>> Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/
>
> The 'Command Search and Execution' section in POSIX explicitly defines
> a set of command names (alloc autoload bind ...) whose invocation as
> commands is unspecified (as can be seen from the URI provided in my
> previous message), and '^' is not among them.
>
> The fact is, a POSIX compatible shell would execute '^' if it is in
> the PATH. You might simply disable the conflicting features while in
> POSIX mode, or you could also check for an executable in the PATH with
> that name before disabling them, is that really a problem to do for
> POSIX mode?

On 29 August 2017 at 15:45, Chet Ramey <chet.ramey@case.edu> wrote:
> On 8/28/17 8:52 PM, Neven Sajko wrote:
>
>> The 'Command Search and Execution' section in POSIX explicitly defines
>> a set of command names (alloc autoload bind ...) whose invocation as
>> commands is unspecified (as can be seen from the URI provided in my
>> previous message), and '^' is not among them.
>
> That's not the intent of that section. Posix wants to set the execution
> order of special builtins, regular builtins, and shell functions. That
> section doesn't even list all of the regular builtins the various shells
> implement; it's not meant to be exhaustive.
>
>> The fact is, a POSIX compatible shell would execute '^' if it is in
>> the PATH.
>
> Saying this with certainty doesn't make it any more true.  Posix doesn't
> prohibit a shell from implementing a history expansion facility like
> bash's (or a brace expansion facility -- should {a,b} look for and
> execute a file named "{a,b}" from $PATH). It's simply outside the scope
> of the standard.
>
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/

(Sorry for going off list accidentally.)

Imagine a C API added a function that conflicted with user code, this
is the same thing.

That is what I meant with 'compatibility': bash's sh is not executing
a command because of its nonstandard feature.

Compare with gcc or gawk, they too provide compatibility switches for
disabling nonstandard extensions. As I thought bash did with its POSIX
mode.


From MAILER-DAEMON Wed Aug 30 07:39:52 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dn1Lc-0001rz-2W
	for mharc-bug-bash@gnu.org; Wed, 30 Aug 2017 07:39:52 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:54332)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <nsajko@gmail.com>) id 1dn1LZ-0001mc-DR
	for bug-bash@gnu.org; Wed, 30 Aug 2017 07:39:50 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <nsajko@gmail.com>) id 1dn1LY-0002LY-NB
	for bug-bash@gnu.org; Wed, 30 Aug 2017 07:39:49 -0400
Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]:34140)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <nsajko@gmail.com>) id 1dn1LY-0002LA-GJ
	for bug-bash@gnu.org; Wed, 30 Aug 2017 07:39:48 -0400
Received: by mail-lf0-x243.google.com with SMTP id o124so3739670lfo.1
	for <bug-bash@gnu.org>; Wed, 30 Aug 2017 04:39:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to; 
	bh=d/O+XSxLUbjzUfL1ugiXK69x8XzXElsKLi33uORba90=;
	b=ZRd1jUUncKUIcfBKihi4IDXbIsU8MaCv4qHIIyQAky9+nACAWJCQm9m5w9nGa3RvSy
	Rdnx3e1ruBNXUXkfuXa0R/ugnwxv8gGodnrIySq5dfLP979HZB+B27caEzk+T2Rz+7Rk
	3VPdsaVYtylGtPJlnGlAtJJEXUKeJ8KCpVkN77Mr+Df6Z+1a6o32BeFunWeg36rCXpbE
	Q6LQPO9vR+V8G2ON6XbaS3GAv5gXlNIMpkconOvsTvZpTdts6rj1xGisDcbRyyVJQwfQ
	Ga59BHctU3/AK7u21PjkPjUufmM69qVtdi7fD2+J8GoRdY8ow56dhlaf22Jwq0ibLO/N
	Ayzw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to;
	bh=d/O+XSxLUbjzUfL1ugiXK69x8XzXElsKLi33uORba90=;
	b=g03MvNJX4Y8AYYh46fqnrYadtRbQ+4F6ghMSL106ujr0vXF55ZNRr6ieiuwAGLy+p1
	NYyR9Bdt4S3C93FbbAfrheoQEN6JhLNIxiTwilqItppEsJGHTkzLqUkgRxYSU4/PoknN
	Vk4hSqNEXoJXjeai+DS6/A37Zfhyo64enK4i5nhe3kD+Uj3J75hMnPSrXVL+AQ99UZRU
	KzvPrVauAp2N+T6UE5iFWQTbBPVa0qRHA319+NLF/EPienIYgyCJlaSJ0FHvIwjBE/CK
	rcPMu9u6JSsaPmAYcqxjQtq3vv4/Dwri78cA9BjdUX/Gysj0mz0uF7jnSXIlHN0E+gIx
	Zw8w==
X-Gm-Message-State: AHYfb5jI+FTAY9LUT6vNHusuG/0TLzUI4BevaxfyISHcxo553VwIRJdF
	aqH8vuCURrWreEN1PrzU0B/COEVDUy88
X-Google-Smtp-Source: ADKCNb7Cs3bM7gBDHbLpga3rTPUBnejdHk9XfpogScmS5claFZeeeuoWvE4wBLX8GnPjtj1gc1OcuQ3aXMbvMxef7Kc=
X-Received: by 10.46.19.2 with SMTP id 2mr507640ljt.187.1504093187058; Wed, 30
	Aug 2017 04:39:47 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.25.209.139 with HTTP; Wed, 30 Aug 2017 04:39:46 -0700 (PDT)
In-Reply-To: <CAL+bK4PyqzWAEMSR-jeUXp4kkc7U_oKPTZfStcCsS2O3P9fB6g@mail.gmail.com>
References: <CAL+bK4MZOZxwp+FEqWOyvx+-X2jXsE1VmyhNOzKr4CZAELbnPA@mail.gmail.com>
	<a6ef5133-679f-5233-5e80-795ea83a59e1@case.edu>
	<CAL+bK4NLgC3Kixfa+LpCKL-8=w2H8DBq-ypmVBT2F-VNw=VihA@mail.gmail.com>
	<8dfb50fb-8a37-8bf9-d9aa-06042caab0fc@case.edu>
	<CAL+bK4NZwoHO=M3SzxVciWSoaCnELBmECUu2CJg1QbWjG5mmDQ@mail.gmail.com>
	<9ab4e418-be95-37b7-738a-84a8791a240a@case.edu>
	<CAL+bK4PdB8bw8mD8FFrCo9SAaFztB9PtfPTNewcYo5Pdx97PSQ@mail.gmail.com>
	<62d4d174-918f-642a-0d93-7970764d2b45@case.edu>
	<CAL+bK4PyqzWAEMSR-jeUXp4kkc7U_oKPTZfStcCsS2O3P9fB6g@mail.gmail.com>
From: Neven Sajko <nsajko@gmail.com>
Date: Wed, 30 Aug 2017 13:39:46 +0200
Message-ID: <CAL+bK4Mx-EBfv7TYDsOn85syUYS3iKLh7n=F+W1yUrkB8Vj4_Q@mail.gmail.com>
Subject: Re: bash pollutes namespace it shouldn't touch when emulating sh
To: Chester Ramey <chet.ramey@case.edu>, bug-bash@gnu.org
Content-Type: text/plain; charset="UTF-8"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2a00:1450:4010:c07::243
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 30 Aug 2017 11:39:50 -0000

...

> order of special builtins, regular builtins, and shell functions. That
> section doesn't even list all of the regular builtins the various shells

And, that list in POSIX that I linked too defines commands whose
invocation gives unspecified results, thus making them appropriate for
use as implementation-defined extensions without breaking the
interface.


From MAILER-DAEMON Wed Aug 30 08:25:50 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dn245-0001JR-Vy
	for mharc-bug-bash@gnu.org; Wed, 30 Aug 2017 08:25:50 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:36862)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <nsajko@gmail.com>) id 1dn243-0001HO-Ar
	for bug-bash@gnu.org; Wed, 30 Aug 2017 08:25:48 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <nsajko@gmail.com>) id 1dn241-0003En-FB
	for bug-bash@gnu.org; Wed, 30 Aug 2017 08:25:46 -0400
Received: from mail-lf0-x234.google.com ([2a00:1450:4010:c07::234]:37862)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <nsajko@gmail.com>) id 1dn241-0003Ee-00
	for bug-bash@gnu.org; Wed, 30 Aug 2017 08:25:45 -0400
Received: by mail-lf0-x234.google.com with SMTP id y128so18238763lfd.4
	for <bug-bash@gnu.org>; Wed, 30 Aug 2017 05:25:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to; 
	bh=8/4uRDvqkrpjV45k9cbLmA2dvdCiyEfgLfNiXVRaQHY=;
	b=kmuVQqGr/Wj2SwS7eyD/jeV9Vne9wuZGqEmHg+uyNAg/hRDVwK3RVMWki9wJMktiLl
	KdOMFRQUDIVgfSV/ez8VpE+AV0VY+6teMQ9KwI562CtZ4+PGXsxxcxnfQuRUZr1LcX7V
	5iOMjMYzYq/lLLZ1n1PeoCLhTxl+RecDCmV1uhUC1/8iHRPfflcx+vzAXy7xajevLfYP
	UmeY5X16uF6NAOES21v+hkwvFnbt8mqhdgS8vooeL0u3r0o8/AXLItQTMq2onFvJG+eU
	ildOO6qdTT/pb6LF4t4Z/vcFZZU2S8PsFZjF5+R1TkQ2octDs5iB4zvjnFoxFbEex9lI
	xP2w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to;
	bh=8/4uRDvqkrpjV45k9cbLmA2dvdCiyEfgLfNiXVRaQHY=;
	b=GZ5GAQu8/i+CatQKY9P3FzHRN85ZXvoM3p9fe3hK/9RBsiFz2wXhs+Xtypu0ZwTIis
	01J5NUZPSoe1QSefHN5ldN9xtKsXablc69oe3wFG0rtMFmAhkWdHj6y+StFMNU/Hn/13
	V/Cy5KOUgPvsRbMsIQl5vvPFxEVtC66+6Q3emj8/MzbJB4LQq/CJvL6XekLXe8PF+Nit
	RT1Fj43fR0IOB82Suy13v9l2drIvXYnWYW9XYbLiJFX5Q7D5hhO/fPQ+REffdSwrwsxq
	SHbQcbFAUOjQ6IM4w4QadCWoGxMaG7g6/rhS3bphnRPmwu7SrcAHrF5U+NZwwXBmc5zw
	oRHQ==
X-Gm-Message-State: AHPjjUikuLS/IVpO+fv+kScj+QBE96AV77qbosjbtyuhAfJsW4CpRGEB
	DN5RJVjKWOB6SidtxtmXYB6c0B0hxg==
X-Google-Smtp-Source: ADKCNb4IbywKNqphlnOJcDN0DqyexGySPKiHLy92gkoKzoh1scdHQ4YhHHbUVdm+X4cPgmvW02q5CyoYxSlzenrC81Q=
X-Received: by 10.25.232.34 with SMTP id f34mr735544lfh.186.1504095943682;
	Wed, 30 Aug 2017 05:25:43 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.25.209.139 with HTTP; Wed, 30 Aug 2017 05:25:42 -0700 (PDT)
In-Reply-To: <CAL+bK4Mx-EBfv7TYDsOn85syUYS3iKLh7n=F+W1yUrkB8Vj4_Q@mail.gmail.com>
References: <CAL+bK4MZOZxwp+FEqWOyvx+-X2jXsE1VmyhNOzKr4CZAELbnPA@mail.gmail.com>
	<a6ef5133-679f-5233-5e80-795ea83a59e1@case.edu>
	<CAL+bK4NLgC3Kixfa+LpCKL-8=w2H8DBq-ypmVBT2F-VNw=VihA@mail.gmail.com>
	<8dfb50fb-8a37-8bf9-d9aa-06042caab0fc@case.edu>
	<CAL+bK4NZwoHO=M3SzxVciWSoaCnELBmECUu2CJg1QbWjG5mmDQ@mail.gmail.com>
	<9ab4e418-be95-37b7-738a-84a8791a240a@case.edu>
	<CAL+bK4PdB8bw8mD8FFrCo9SAaFztB9PtfPTNewcYo5Pdx97PSQ@mail.gmail.com>
	<62d4d174-918f-642a-0d93-7970764d2b45@case.edu>
	<CAL+bK4PyqzWAEMSR-jeUXp4kkc7U_oKPTZfStcCsS2O3P9fB6g@mail.gmail.com>
	<CAL+bK4Mx-EBfv7TYDsOn85syUYS3iKLh7n=F+W1yUrkB8Vj4_Q@mail.gmail.com>
From: Neven Sajko <nsajko@gmail.com>
Date: Wed, 30 Aug 2017 14:25:42 +0200
Message-ID: <CAL+bK4N8DsHkC=Wsnx-f6mg7mcSSpZgLShVdLSpKPKY_ybJX+w@mail.gmail.com>
Subject: Re: bash pollutes namespace it shouldn't touch when emulating sh
To: Chester Ramey <chet.ramey@case.edu>, bug-bash@gnu.org
Content-Type: text/plain; charset="UTF-8"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2a00:1450:4010:c07::234
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 30 Aug 2017 12:25:48 -0000

Another note: it's not even necessary to disable such features in
POSIX mode, just give them least precedence in the command search path
so they wouldn't conflict with executables on the system.


From MAILER-DAEMON Thu Aug 31 11:10:48 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dnR7I-0002JJ-G4
	for mharc-bug-bash@gnu.org; Thu, 31 Aug 2017 11:10:48 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:49349)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Kenneth.Nellis@conduent.com>) id 1dnQgp-0006J5-KD
	for bug-bash@gnu.org; Thu, 31 Aug 2017 10:43:28 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Kenneth.Nellis@conduent.com>) id 1dnQgm-0006ck-Gd
	for bug-bash@gnu.org; Thu, 31 Aug 2017 10:43:27 -0400
Received: from esa3.hc188666.iphmx.com ([216.71.153.17]:44547)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71)
	(envelope-from <Kenneth.Nellis@conduent.com>) id 1dnQgm-0006cU-6I
	for bug-bash@gnu.org; Thu, 31 Aug 2017 10:43:24 -0400
X-IronPort-AV: E=Sophos;i="5.41,453,1498539600"; d="scan'208";a="11496230"
Received: from mail-bl2nam02lp0087.outbound.protection.outlook.com (HELO
	NAM02-BL2-obe.outbound.protection.outlook.com) ([207.46.163.87])
	by ob1.hc188666.iphmx.com with ESMTP/TLS/AES256-SHA256;
	31 Aug 2017 09:43:08 -0500
Received: from BN6PR2001MB1074.namprd20.prod.outlook.com (10.172.110.16) by
	BN6PR2001MB0995.namprd20.prod.outlook.com (10.172.109.141) with
	Microsoft SMTP Server (version=TLS1_2,
	cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10;
	Thu, 31 Aug 2017 14:43:06 +0000
Received: from BN6PR2001MB1074.namprd20.prod.outlook.com ([10.172.110.16]) by
	BN6PR2001MB1074.namprd20.prod.outlook.com ([10.172.110.16]) with
	mapi id 15.20.0013.012; Thu, 31 Aug 2017 14:43:06 +0000
From: "Nellis, Kenneth" <Kenneth.Nellis@conduent.com>
To: "bug-bash@gnu.org" <bug-bash@gnu.org>
Subject: shopt suggestion
Thread-Topic: shopt suggestion
Thread-Index: AdMiZXrDWYQpm2/+T5SZO1ynFYP/rQ==
Date: Thu, 31 Aug 2017 14:43:05 +0000
Message-ID: <BN6PR2001MB10746AF3840566B9C4005942F19D0@BN6PR2001MB1074.namprd20.prod.outlook.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
authentication-results: spf=none (sender IP is )
	smtp.mailfrom=Kenneth.Nellis@conduent.com; 
x-originating-ip: [192.203.187.55]
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; BN6PR2001MB0995;
	20:U10SGnke1aFyi1KBk+VBv558REohHiB6Pukcz4p4NzB+bPFOE68jdhM7SkDGsw/nfRnVaBfntetyVfy72WgaACL2jgAleXEDlySlDc1Indk85O5AMiYLrw0DFvpv9eKyHl3UTegb03fzhBFcUJKzib4N7o0bTnlyhmoNSxPKfssogQ3ipLOND3YialCE6FfFaYg8NV5xzKRrh82GGDJ99MZMyXGau0FhIKBV+i5VNBgxhI4jU+oB5MBmd7mfYNqN
x-ms-exchange-antispam-srfa-diagnostics: SSOS;
x-ms-office365-filtering-correlation-id: e32f70c4-0c27-468d-9182-08d4f07e975a
x-microsoft-antispam: UriScan:; BCL:0; PCL:0;
	RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);
	SRVR:BN6PR2001MB0995; 
x-ms-traffictypediagnostic: BN6PR2001MB0995:
x-exchange-antispam-report-test: UriScan:;
x-microsoft-antispam-prvs: <BN6PR2001MB09954E013EC81F63FDE13942F19D0@BN6PR2001MB0995.namprd20.prod.outlook.com>
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0;
	RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(3002001)(6041248)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(20161123555025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);
	SRVR:BN6PR2001MB0995; BCL:0; PCL:0;
	RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);
	SRVR:BN6PR2001MB0995; 
x-forefront-prvs: 04163EF38A
x-forefront-antispam-report: SFV:NSPM;
	SFS:(10009020)(6009001)(39860400002)(54094003)(189002)(199003)(97736004)(6506006)(86362001)(7696004)(101416001)(2900100001)(3846002)(6116002)(102836003)(3660700001)(3280700002)(6916009)(2906002)(105586002)(2351001)(106356001)(110136004)(53936002)(68736007)(8936002)(3480700004)(81166006)(8676002)(81156014)(5640700003)(9686003)(99286003)(305945005)(7736002)(55016002)(221733001)(478600001)(72206003)(66066001)(14454004)(189998001)(25786009)(33656002)(50986999)(2501003)(77096006)(54356999)(7116003)(5660300001)(6436002)(74316002);
	DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR2001MB0995;
	H:BN6PR2001MB1074.namprd20.prod.outlook.com; FPR:; SPF:None;
	PTR:InfoNoRecords; MX:1; A:1; LANG:en; 
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: conduent.com
X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Aug 2017 14:43:06.0516 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 1aed4588-b8ce-43a8-a775-989538fd30d8
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR2001MB0995
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 216.71.153.17
X-Mailman-Approved-At: Thu, 31 Aug 2017 11:10:46 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 31 Aug 2017 14:43:28 -0000

Frequently, when I invoke a command and use globbing to specify a list=20
of files, I want a temporary change in globbing options=20
(e.g. shopt -s dotglob) to be in effect for the one-time command.

At the keyboard, it is inconvenient to type (e.g.):=20
shopt -s dotglob; mycmd; shopt -u dotglob

I could write a wrapper function/script to minimize the typing:=20
tempglob dotglob 'mycmd'
but I'd still have to escape mycmd so that globbing would be expanded=20
only within the function/script.

But, I wonder if shopt might not itself accept a command to execute=20
with one-time shopt options in effect. It could follow the precedent=20
of the env command or the shell's feature to execute a command with=20
a temporary environment variable setting, e.g.: VAR=3DVALUE mycmd
Then we could have something like: shopt -s dotglob -c mycmd

--Ken Nellis


From MAILER-DAEMON Thu Aug 31 13:03:11 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dnSs3-0002uk-23
	for mharc-bug-bash@gnu.org; Thu, 31 Aug 2017 13:03:11 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:59842)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <martijn@inlv.org>) id 1dnSs1-0002ue-Ip
	for bug-bash@gnu.org; Thu, 31 Aug 2017 13:03:10 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <martijn@inlv.org>) id 1dnSry-0003IH-D2
	for bug-bash@gnu.org; Thu, 31 Aug 2017 13:03:09 -0400
Received: from kahlil.inlv.org ([37.59.109.123]:55560)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <martijn@inlv.org>) id 1dnSry-00038O-4U
	for bug-bash@gnu.org; Thu, 31 Aug 2017 13:03:06 -0400
Received: from breedzicht.local (inlv.demon.nl [212.238.240.159])
	(authenticated bits=0)
	by kahlil.inlv.org (8.14.9/8.14.4) with ESMTP id v7VH2rwF007450
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO)
	for <bug-bash@gnu.org>; Thu, 31 Aug 2017 19:02:53 +0200
Subject: Re: shopt suggestion
To: bug-bash@gnu.org
References: <BN6PR2001MB10746AF3840566B9C4005942F19D0@BN6PR2001MB1074.namprd20.prod.outlook.com>
From: Martijn Dekker <martijn@inlv.org>
Message-ID: <271c4871-292b-28e5-5111-01105ee7ca0c@inlv.org>
Date: Thu, 31 Aug 2017 19:03:30 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0)
	Gecko/20100101 Thunderbird/52.1.1
MIME-Version: 1.0
In-Reply-To: <BN6PR2001MB10746AF3840566B9C4005942F19D0@BN6PR2001MB1074.namprd20.prod.outlook.com>
Content-Type: text/plain; charset=utf-8
Content-Language: nl
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From: 37.59.109.123
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 31 Aug 2017 17:03:10 -0000

Op 31-08-17 om 16:43 schreef Nellis, Kenneth:
> At the keyboard, it is inconvenient to type (e.g.): 
> shopt -s dotglob; mycmd; shopt -u dotglob

Try with a subshell. All it takes is a couple of parentheses.

(shopt -s dotglob; mycmd)

> But, I wonder if shopt might not itself accept a command to execute 
> with one-time shopt options in effect.

The shopt command would have the same problem as your hypothetical
wrapper function: globbing is resolved before the command is even invoked.

- M.


