From MAILER-DAEMON Fri Jun 01 05:28:26 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SaO9i-0008Hf-G1
	for mharc-bug-bash@gnu.org; Fri, 01 Jun 2012 05:28:26 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37090)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <frederic.defferrard@gmail.com>) id 1SaNbq-0006xo-Qt
	for bug-bash@gnu.org; Fri, 01 Jun 2012 04:53:31 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <frederic.defferrard@gmail.com>) id 1SaNbo-0008FB-Te
	for bug-bash@gnu.org; Fri, 01 Jun 2012 04:53:26 -0400
Received: from mail-wi0-f171.google.com ([209.85.212.171]:60986)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <frederic.defferrard@gmail.com>) id 1SaNbo-0008En-L6
	for bug-bash@gnu.org; Fri, 01 Jun 2012 04:53:24 -0400
Received: by wibhm14 with SMTP id hm14so287123wib.12
	for <bug-bash@gnu.org>; Fri, 01 Jun 2012 01:53:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:date:message-id:subject:from:to:content-type
	:content-transfer-encoding;
	bh=yxmjzl5J+mT32l2XFC2Jn7yS1xji5yxYubc1EAYZBgk=;
	b=BfqQV7PZWszHdPDjQORkSkC0Y+clJiNra1/dGH+hRWty/HXdYSY657wl6d2+SotHN6
	OeM8AeEzThVN6wok0SNHzYk5IqWp35UFeAoqb2XKJvo8MlziUqlBNohcLshROm4TIuV6
	739WpkFWftquyRLEYeL53sq6fjLR5obyjJTerdEAVzlicVoxBov5+Gyx3WQ6UmH8uw5H
	ODu1Fv2iMoaB9RauXAX8BBEhuzJNbwbu+wOFRxj1Yk+qoVuQIyEPYJwsfWKPHOVQu7vZ
	m7yn0cThdMXDdgTk80tl8eViETOvEhb/3SmOWt0UspTZty4L/C10HUnbfKbvdyneGj+d
	Zarg==
MIME-Version: 1.0
Received: by 10.216.206.164 with SMTP id l36mr1586251weo.154.1338540802094;
	Fri, 01 Jun 2012 01:53:22 -0700 (PDT)
Received: by 10.194.63.73 with HTTP; Fri, 1 Jun 2012 01:53:22 -0700 (PDT)
Date: Fri, 1 Jun 2012 10:53:22 +0200
Message-ID: <CABqawBwp3dY9Rb+mmdyOs89z1gFbu6bo4VhWYTTqWCuR29rYng@mail.gmail.com>
Subject: SH bahaviour to not fork a subshell after " | while read "
From: freD <frederic.defferrard@gmail.com>
To: bug-bash@gnu.org
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.212.171
X-Mailman-Approved-At: Fri, 01 Jun 2012 05:28:24 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 01 Jun 2012 08:53:32 -0000

Configuration Information [Automatically generated, do not change]:
Machine: powerpc
OS: aix5.1
Compiler: xlc
Compilation CFLAGS:=A0 -DPROGRAM=3D'bash' -DCONF_HOSTTYPE=3D'powerpc'
-DCONF_OSTYPE=3D'aix5.1' -DCONF_MACHTYPE=3D'powerpc-ibm-aix
5.1' -DCONF_VENDOR=3D'ibm' -DLOCALEDIR=3D'/opt/freeware/share/locale'
-DPACKAGE=3D'bash' -DSHELL -DHAVE_CONFIG_H=A0 -I.=A0 -I. -I
./include -I./lib=A0 -I/opt/freeware/include -O2
uname output: AIX tsm 1 6 00C530EB4C00
Machine Type: powerpc-ibm-aix5.1

Bash Version: 3.0
Patch Level: 16
Release Status: release

Description:

In bash mode, variable are lost after a while loop:

bash-3.00# T=3Dtoto ; du | while read a ; do   T=3D$a ; done ; echo $T
toto

I can keep then a little using parenthesis:

bash-3.00# T=3Dtoto ; du | (while read a ; do =A0 T=3D$a ; done ; echo $T) =
; echo $T
1489648 .
toto

Repeat-By:

bash-3.00# T=3Dtoto ; du | while read a ; do   T=3D$a ; done ; echo $T
toto

Fix:
May be starting in "sh" mode and/or posix mode should behave like a
real bourne shell

bash-3.00# /usr/bin/sh
# T=3Dtoto ; du | while read a ; do   T=3D$a ; done ; echo $T
1489632 .
# exit
bash-3.00#



~


From MAILER-DAEMON Fri Jun 01 05:39:53 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SaOKm-00041N-Vv
	for mharc-bug-bash@gnu.org; Fri, 01 Jun 2012 05:39:52 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38334)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SaOKh-00040H-8t
	for bug-bash@gnu.org; Fri, 01 Jun 2012 05:39:51 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SaOKa-0002m1-UF
	for bug-bash@gnu.org; Fri, 01 Jun 2012 05:39:46 -0400
Received: from mail-wi0-f169.google.com ([209.85.212.169]:37749)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SaOKa-0002lZ-IG
	for bug-bash@gnu.org; Fri, 01 Jun 2012 05:39:40 -0400
Received: by wibhn14 with SMTP id hn14so359695wib.0
	for <bug-bash@gnu.org>; Fri, 01 Jun 2012 02:39:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=HOSfKpeakV0cDW230xbyWyuqFRZhZXmkPhecEBcNizs=;
	b=tlPXRPrdiYGguqK+jhFbWX0HYltjEwhmAdneB+MJN2hJff8sBCDuX3WqedLv8apmaT
	Ey+g+UOW7nvF8Tl7Md/seemZLelCwJU+KZYVr2BFV/F7cZBXlEwyaGpDSouLGpF8krn5
	rVLcRoxuQzybgV6Pbf8GCxmLUUUqrm8I0EmKvhxzGr5zAFsxF1+dLXaa1PsuAhcmb4JJ
	DznWGRJPK+n9WaxxEef8v5pGl2HkVxmbHZBX46dhmlgzm4ykL02EgLnnA3eh/ONLNFAB
	y1Gbmb7HnPJ7xjOgV9OxQvNldl34AxEkTP7fivGK/6gNVEEFyCTk08o98O8I0quBjG6e
	nszg==
Received: by 10.216.196.166 with SMTP id r38mr1652615wen.161.1338543578007;
	Fri, 01 Jun 2012 02:39:38 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.194.54.135 with HTTP; Fri, 1 Jun 2012 02:39:17 -0700 (PDT)
In-Reply-To: <CABqawBwp3dY9Rb+mmdyOs89z1gFbu6bo4VhWYTTqWCuR29rYng@mail.gmail.com>
References: <CABqawBwp3dY9Rb+mmdyOs89z1gFbu6bo4VhWYTTqWCuR29rYng@mail.gmail.com>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Fri, 1 Jun 2012 12:39:17 +0300
Message-ID: <CAPSX3sSvm27iadn6kW+JdfhqLv_MiskkaLmxP3yGs6GyGYXQXg@mail.gmail.com>
Subject: Re: SH bahaviour to not fork a subshell after " | while read "
To: freD <frederic.defferrard@gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.212.169
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 01 Jun 2012 09:39:51 -0000

On Fri, Jun 1, 2012 at 11:53 AM, freD <frederic.defferrard@gmail.com> wrote=
:
> Configuration Information [Automatically generated, do not change]:
> Machine: powerpc
> OS: aix5.1
> Compiler: xlc
> Compilation CFLAGS:=A0 -DPROGRAM=3D'bash' -DCONF_HOSTTYPE=3D'powerpc'
> -DCONF_OSTYPE=3D'aix5.1' -DCONF_MACHTYPE=3D'powerpc-ibm-aix
> 5.1' -DCONF_VENDOR=3D'ibm' -DLOCALEDIR=3D'/opt/freeware/share/locale'
> -DPACKAGE=3D'bash' -DSHELL -DHAVE_CONFIG_H=A0 -I.=A0 -I. -I
> ./include -I./lib=A0 -I/opt/freeware/include -O2
> uname output: AIX tsm 1 6 00C530EB4C00
> Machine Type: powerpc-ibm-aix5.1
>
> Bash Version: 3.0
> Patch Level: 16
> Release Status: release
>
> Description:
>
> In bash mode, variable are lost after a while loop:
>
> bash-3.00# T=3Dtoto ; du | while read a ; do =A0 T=3D$a ; done ; echo $T
> toto
>
> I can keep then a little using parenthesis:
>
> bash-3.00# T=3Dtoto ; du | (while read a ; do =A0 T=3D$a ; done ; echo $T=
) ; echo $T
> 1489648 .
> toto
>
> Repeat-By:
>
> bash-3.00# T=3Dtoto ; du | while read a ; do =A0 T=3D$a ; done ; echo $T
> toto
>
> Fix:
> May be starting in "sh" mode and/or posix mode should behave like a
> real bourne shell
>
> bash-3.00# /usr/bin/sh
> # T=3Dtoto ; du | while read a ; do =A0 T=3D$a ; done ; echo $T
> 1489632 .
> # exit
> bash-3.00#
>
>

You use a relatively old bash.
In the newer bash you can get this beahviour using "shopt -s lastpipe"

Note that this behaviour is not mandated by posix and that a least one
"real bourne shell", which is not posix acts like bash

Eg with the heirloom bourne shell:
$ ./sh
$ T=3Dtoto ; du | while read a ; do   T=3D$a ; done ; echo $T
toto

I think only ksh93 and zsh behaves like that by default. dash, pdksh,
mksh all put the last part of the pipe in a subshell.


From MAILER-DAEMON Fri Jun 01 08:05:19 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SaQbX-0004zC-Pp
	for mharc-bug-bash@gnu.org; Fri, 01 Jun 2012 08:05:19 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46212)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SaQbS-0004yk-2y
	for bug-bash@gnu.org; Fri, 01 Jun 2012 08:05:18 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SaQbF-0005Xq-D5
	for bug-bash@gnu.org; Fri, 01 Jun 2012 08:05:13 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:51279
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SaQbF-0005VN-67
	for bug-bash@gnu.org; Fri, 01 Jun 2012 08:05:01 -0400
Received: (qmail 23818 invoked from network); 1 Jun 2012 12:04:35 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Fri, 01 Jun 2012 08:04:35 -0400
Received: (qmail 14859 invoked by uid 563); 1 Jun 2012 12:04:35 -0000
Date: Fri, 1 Jun 2012 08:04:35 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: freD <frederic.defferrard@gmail.com>
Subject: Re: SH bahaviour to not fork a subshell after " | while read "
Message-ID: <20120601120435.GL1506@eeg.ccf.org>
References: <CABqawBwp3dY9Rb+mmdyOs89z1gFbu6bo4VhWYTTqWCuR29rYng@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CABqawBwp3dY9Rb+mmdyOs89z1gFbu6bo4VhWYTTqWCuR29rYng@mail.gmail.com>
User-Agent: Mutt/1.4.2.3i
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older,
	2)
X-Received-From: 139.137.100.1
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 01 Jun 2012 12:05:18 -0000

On Fri, Jun 01, 2012 at 10:53:22AM +0200, freD wrote:
> bash-3.00# T=toto ; du | while read a ; do   T=$a ; done ; echo $T
> toto

http://mywiki.wooledge.org/BashFAQ/024

Quick answer:     while read ... done < <(some command)
Portable version: mkfifo fifo; some command > fifo & ...


From MAILER-DAEMON Fri Jun 01 08:18:51 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SaQod-0005oT-FN
	for mharc-bug-bash@gnu.org; Fri, 01 Jun 2012 08:18:51 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57469)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SaQoa-0005o8-K6
	for bug-bash@gnu.org; Fri, 01 Jun 2012 08:18:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SaQoU-0000ES-84
	for bug-bash@gnu.org; Fri, 01 Jun 2012 08:18:48 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:35464)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SaQoU-0000EH-3F
	for bug-bash@gnu.org; Fri, 01 Jun 2012 08:18:42 -0400
Received: from mpv6.tis.cwru.edu (EHLO mpv6.cwru.edu) ([129.22.104.221])
	by mpv1.tis.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id BZG10341 (AUTH cpr);
	Fri, 01 Jun 2012 08:18:40 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id AYC19569 (AUTH cpr);
	Fri, 01 Jun 2012 08:18:40 -0400 (EDT)
Message-ID: <4FC8B320.5080605@case.edu>
Date: Fri, 01 Jun 2012 08:18:40 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: freD <frederic.defferrard@gmail.com>
Subject: Re: SH bahaviour to not fork a subshell after " | while read "
References: <CABqawBwp3dY9Rb+mmdyOs89z1gFbu6bo4VhWYTTqWCuR29rYng@mail.gmail.com>
In-Reply-To: <CABqawBwp3dY9Rb+mmdyOs89z1gFbu6bo4VhWYTTqWCuR29rYng@mail.gmail.com>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 01 Jun 2012 12:18:50 -0000

On 6/1/12 4:53 AM, freD wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: powerpc
> OS: aix5.1
> Compiler: xlc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='powerpc'
> -DCONF_OSTYPE='aix5.1' -DCONF_MACHTYPE='powerpc-ibm-aix
> 5.1' -DCONF_VENDOR='ibm' -DLOCALEDIR='/opt/freeware/share/locale'
> -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H  -I.  -I. -I
> ./include -I./lib  -I/opt/freeware/include -O2
> uname output: AIX tsm 1 6 00C530EB4C00
> Machine Type: powerpc-ibm-aix5.1
> 
> Bash Version: 3.0
> Patch Level: 16
> Release Status: release
> 
> Description:
> 
> In bash mode, variable are lost after a while loop:
> 
> bash-3.00# T=toto ; du | while read a ; do   T=$a ; done ; echo $T
> toto

Upgrade.  Current versions of bash have a shell option that will allow
you to do this.  And bash-3.0 is seven years old.


> Fix:
> May be starting in "sh" mode and/or posix mode should behave like a
> real bourne shell

That's funny.  `Real' Bourne shells don't do this.  The only reason sh on
your particular system does it is because AIX uses ksh as sh.


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


From MAILER-DAEMON Fri Jun 01 09:11:31 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SaRda-0007xm-Vi
	for mharc-bug-bash@gnu.org; Fri, 01 Jun 2012 09:11:30 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42568)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <frederic.defferrard@gmail.com>) id 1SaRdU-0007x9-SH
	for bug-bash@gnu.org; Fri, 01 Jun 2012 09:11:30 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <frederic.defferrard@gmail.com>) id 1SaRdM-00059w-7a
	for bug-bash@gnu.org; Fri, 01 Jun 2012 09:11:24 -0400
Received: from mail-wi0-f177.google.com ([209.85.212.177]:57874)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <frederic.defferrard@gmail.com>) id 1SaRdL-00058w-VK
	for bug-bash@gnu.org; Fri, 01 Jun 2012 09:11:16 -0400
Received: by wibhm14 with SMTP id hm14so436212wib.12
	for <bug-bash@gnu.org>; Fri, 01 Jun 2012 06:11:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type:content-transfer-encoding;
	bh=wQjfpAVqb60OiT0ftGqK8O9SIzlLrYseKsVW+AFhNlg=;
	b=p+MnWpf9l4sNx48i0VVrsQjkOszgpelgAsPMXSCnw4ln1GKNp7ilI9JZ0yx+lRTngN
	gBDZ7cFFiayq4VIud+H2yyxp4LhVEruhXxTxBX+j7/506RmkRpevs70qFB/SoEL9dVgz
	7EbcRgYVWFM076BMoLpvqR8BOtFvYV7h5xBTHAM96JkexCI2qnSzcS1Ew9cGL/qqFwDr
	Bo0KYUo5I2CiRI3oQLoYsieETunGhkPligKaO2MFxxmdbBM+Pz24jPoxbtCdbxOrqST6
	qv8vl9+3hdBAqpYRccGrtOGbHdrFILV9Cq7Xx4nK/6px5oxtxi8lctNyqJef2qw5MTzH
	EecQ==
MIME-Version: 1.0
Received: by 10.216.145.13 with SMTP id o13mr2075216wej.95.1338556274010; Fri,
	01 Jun 2012 06:11:14 -0700 (PDT)
Received: by 10.194.63.73 with HTTP; Fri, 1 Jun 2012 06:11:13 -0700 (PDT)
In-Reply-To: <20120601120435.GL1506@eeg.ccf.org>
References: <CABqawBwp3dY9Rb+mmdyOs89z1gFbu6bo4VhWYTTqWCuR29rYng@mail.gmail.com>
	<20120601120435.GL1506@eeg.ccf.org>
Date: Fri, 1 Jun 2012 15:11:13 +0200
Message-ID: <CABqawBxvmG6qC6EaTf2iyCcg-SiesjsRbof33vYOCbGjZ0LoXA@mail.gmail.com>
Subject: Re: SH bahaviour to not fork a subshell after " | while read "
From: freD <frederic.defferrard@gmail.com>
To: Greg Wooledge <wooledg@eeg.ccf.org>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.212.177
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 01 Jun 2012 13:11:30 -0000

Thanks !


2012/6/1 Greg Wooledge <wooledg@eeg.ccf.org>:
> On Fri, Jun 01, 2012 at 10:53:22AM +0200, freD wrote:
>> bash-3.00# T=3Dtoto ; du | while read a ; do =A0 T=3D$a ; done ; echo $T
>> toto
>
> http://mywiki.wooledge.org/BashFAQ/024
>
> Quick answer: =A0 =A0 while read ... done < <(some command)
> Portable version: mkfifo fifo; some command > fifo & ...


From MAILER-DAEMON Fri Jun 01 20:16:02 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sac0g-0006TA-JB
	for mharc-bug-bash@gnu.org; Fri, 01 Jun 2012 20:16:02 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33373)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1SabR1-0002AB-Pa
	for Bug-bash@gnu.org; Fri, 01 Jun 2012 19:39:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1SabR0-0003ve-3R
	for Bug-bash@gnu.org; Fri, 01 Jun 2012 19:39:11 -0400
Received: from sam.nabble.com ([216.139.236.26]:46229)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1SabQz-0003vU-V3
	for Bug-bash@gnu.org; Fri, 01 Jun 2012 19:39:10 -0400
Received: from telerig.nabble.com ([192.168.236.162])
	by sam.nabble.com with esmtp (Exim 4.72)
	(envelope-from <bounces@nabble.com>) id 1SabQy-0001QB-BV
	for Bug-bash@gnu.org; Fri, 01 Jun 2012 16:39:08 -0700
Message-ID: <33947830.post@talk.nabble.com>
Date: Fri, 1 Jun 2012 16:39:08 -0700 (PDT)
From: rac8006 <rac8006@aol.com>
To: Bug-bash@gnu.org
Subject: bash build
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Nabble-From: rac8006@aol.com
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 216.139.236.26
X-Mailman-Approved-At: Fri, 01 Jun 2012 20:16:01 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 01 Jun 2012 23:39:13 -0000


What is the proper way to add popd pushd dirs etc to bash.  When I currently
build bash these
are missing.  I also get an error libintl_ngettext undefined reference.  I
can get around this error
by adding -lintl to the link.  Just don't know how to get the Makefile to
add -lintl.

Thanks for your help

RAC
-- 
View this message in context: http://old.nabble.com/bash-build-tp33947830p33947830.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.



From MAILER-DAEMON Sat Jun 02 10:20:15 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SapBf-0007UZ-HJ
	for mharc-bug-bash@gnu.org; Sat, 02 Jun 2012 10:20:15 -0400
Received: from eggs.gnu.org ([208.118.235.92]:54497)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dearvoid@gmail.com>) id 1SapBc-0007Ty-K9
	for Bug-bash@gnu.org; Sat, 02 Jun 2012 10:20:14 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dearvoid@gmail.com>) id 1SapBa-0006mz-LT
	for Bug-bash@gnu.org; Sat, 02 Jun 2012 10:20:12 -0400
Received: from mail-ob0-f169.google.com ([209.85.214.169]:52966)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dearvoid@gmail.com>) id 1SapBa-0006mA-Cr
	for Bug-bash@gnu.org; Sat, 02 Jun 2012 10:20:10 -0400
Received: by obbwd18 with SMTP id wd18so5467036obb.0
	for <Bug-bash@gnu.org>; Sat, 02 Jun 2012 07:20:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=eg8ucZC3c8ZTduh9nbxqdhYidvp1Bcg8H+QywRAwvfI=;
	b=YdgbVrVn/vWAiCssySNl0DdV72Zw0utIPVugUO9DaAzquXoRoTN/xqAYmxqwP3/KdX
	JX2WgqwVJYr3PYGk2PtXe4e/x+ftR1CqJUtqWUCkNhq9RIV4N8IT8ItpACtbvNsjyYk1
	tyHXBOlzpiSguX2xMn0DnTC8WTnhUn2qNdcLitZV+3TaVPKLUJPtcInpzWb17vBLeTW0
	dyh3mewbyLw9Ezcmw3jCx38+RGP7nGw9Zf1xy6vj8115UIPkN+Q4fABZybsXNsrYmdg8
	hoah0CF+ByB3LHvB2V6h+lLOtS0+z2sFXueVQYw3WGsmnOM5rZRAXtTgVZsuMMHQ4SpR
	jwUw==
Received: by 10.182.145.40 with SMTP id sr8mr6548951obb.42.1338646807788; Sat,
	02 Jun 2012 07:20:07 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.182.134.34 with HTTP; Sat, 2 Jun 2012 07:19:37 -0700 (PDT)
In-Reply-To: <33947830.post@talk.nabble.com>
References: <33947830.post@talk.nabble.com>
From: Clark WANG <dearvoid@gmail.com>
Date: Sat, 2 Jun 2012 22:19:37 +0800
Message-ID: <CADv8-ohyAcn5veR5j4z2Tnt38WppUkQ7s6bOtqcYXLUr4Z5GZQ@mail.gmail.com>
Subject: Re: bash build
To: rac8006 <rac8006@aol.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.214.169
Cc: Bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 02 Jun 2012 14:20:14 -0000

On Sat, Jun 2, 2012 at 7:39 AM, rac8006 <rac8006@aol.com> wrote:
>
> What is the proper way to add popd pushd dirs etc to bash. =C2=A0When I c=
urrently
> build bash these

By default those commands should be enabled. I never added special
options when buidling Bash. Not sure if it's system dependent. But
from the "configure --help" output I found this:

  --enable-directory-stack    enable builtins pushd/popd/dirs

You can try if that helps. :)

> are missing. =C2=A0I also get an error libintl_ngettext undefined referen=
ce. =C2=A0I
> can get around this error
> by adding -lintl to the link. =C2=A0Just don't know how to get the Makefi=
le to
> add -lintl.
>
> Thanks for your help
>
> RAC
> --
> View this message in context: http://old.nabble.com/bash-build-tp33947830=
p33947830.html
> Sent from the Gnu - Bash mailing list archive at Nabble.com.
>
>


From MAILER-DAEMON Sat Jun 02 13:15:25 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SarvB-0006MO-9s
	for mharc-bug-bash@gnu.org; Sat, 02 Jun 2012 13:15:25 -0400
Received: from eggs.gnu.org ([208.118.235.92]:43624)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mikel@mikelward.com>) id 1Sarv8-0006LZ-Rs
	for bug-bash@gnu.org; Sat, 02 Jun 2012 13:15:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <mikel@mikelward.com>) id 1Sarv7-00025h-48
	for bug-bash@gnu.org; Sat, 02 Jun 2012 13:15:22 -0400
Received: from mail-bk0-f41.google.com ([209.85.214.41]:43746)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mikel@mikelward.com>) id 1Sarv6-00025M-Mc
	for bug-bash@gnu.org; Sat, 02 Jun 2012 13:15:21 -0400
Received: by bkcjm19 with SMTP id jm19so3204433bkc.0
	for <bug-bash@gnu.org>; Sat, 02 Jun 2012 10:15:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=mikelward.com; s=google;
	h=mime-version:x-originating-ip:date:message-id:subject:from:to
	:content-type; bh=p2DZtJnipCTolcIUns+MMSriTgYwI3KjcojgZtMSWnc=;
	b=XONV5Y6IuI8pn31Il6SpDc81uiypyDkVPPSHcNjG1iCovDOJ4musRfCzztH/C8y4hz
	3rrhabC42C0/2ZLAlViJQ2muW5EWPXrOhGgw+LT4yKeOtQRH24ly7UGZ+Q62UaC01zYo
	gmbRPlSz1MMCBf2SM4DjEMu+IYbb518RT7TIw=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=google.com; s=20120113;
	h=mime-version:x-originating-ip:date:message-id:subject:from:to
	:content-type:x-gm-message-state;
	bh=p2DZtJnipCTolcIUns+MMSriTgYwI3KjcojgZtMSWnc=;
	b=gqqNkLUPGQoqu/1nGzrZHB41BwhJ7DrWv43xZqG2zPmUChmC/CjBm/qXnONF6abQfU
	y1Tnw86W6+FHQWHiwxCmDDIRh6Q7i3iBmcT8eYWNU3OAcxwEpoUBx+nAVhnpOalIdBbL
	aBOg/2fyZQ6RTJDeZDFxAkZa5AZtvmG6WudfJPn+RK0IQeLvvauLYC2bQYs2/Jo6CoeA
	dKk94Gymo3mUiK+jrdf0RdB7IKaakeInyv62oN6rpsyQqeghZiv9w+no05xlg1ig8Phr
	hgu/Amn4hFWF/R3Dspf+hjz50wdxEWTh/v5hBq4He/ScAOnrhM8feyb09bxZhBedYPTt
	xQyg==
MIME-Version: 1.0
Received: by 10.204.133.199 with SMTP id g7mr4024343bkt.47.1338657316995; Sat,
	02 Jun 2012 10:15:16 -0700 (PDT)
Received: by 10.205.139.6 with HTTP; Sat, 2 Jun 2012 10:15:16 -0700 (PDT)
X-Originating-IP: [50.78.104.166]
Date: Sat, 2 Jun 2012 10:15:16 -0700
Message-ID: <CACVmpreVwVTGcUAC7+7sP6nHOSbYHeW33RR6D2g7+O76B99sdA@mail.gmail.com>
Subject: .bashrc is sourced even for non-interactive shells (when run from
	sshd)
From: Mikel Ward <mikel@mikelward.com>
To: bug-bash@gnu.org
Content-Type: text/plain; charset=UTF-8
X-Gm-Message-State: ALoCoQnE9DYS+XMYyoZvj8mDPahPGiFTzB/tI9Pl6aNDdxgo0U6Kfs6oi+bthdYfc+8vIdeu0hH5
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.214.41
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 02 Jun 2012 17:15:24 -0000

bash sources .bashrc even for some non-interactive shells.

For example with

    echo \$- is $-

in ~/.bashrc, and shell set to /bin/bash (bash 4.2.28)

    ssh -n -T localhost true

produces the output

    $- is hBc

I assume this is caused by this code in shell.c

     if (run_by_ssh || isnetconn (fileno (stdin)))

The man page says

       When an interactive shell that is not a login shell is started,
bash reads and executes commands from ~/.bashrc,

but makes no mention of the special handling for ssh and rsh.

This seems to have been the case since at least bash 2.02.

I'd argue this is a misfeature, but I guess that ship has sailed.  Can
the man page at least be updated?

Thanks


From MAILER-DAEMON Sat Jun 02 13:20:02 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sarze-0007C5-8D
	for mharc-bug-bash@gnu.org; Sat, 02 Jun 2012 13:20:02 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58705)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Sarzb-0007BY-4x
	for bug-bash@gnu.org; Sat, 02 Jun 2012 13:20:00 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SarzY-0002yJ-MA
	for bug-bash@gnu.org; Sat, 02 Jun 2012 13:19:58 -0400
Received: from mail-wg0-f49.google.com ([74.125.82.49]:34202)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SarzY-0002y3-Cj
	for bug-bash@gnu.org; Sat, 02 Jun 2012 13:19:56 -0400
Received: by wgbds1 with SMTP id ds1so2134034wgb.30
	for <bug-bash@gnu.org>; Sat, 02 Jun 2012 10:19:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=A2ShGlz5Uj/dmHnDSzvlkwMaWCFKqLluGdr0weorvBY=;
	b=DYAgZVLuGzd6gjXexAhQiw7a+Kl3XU4WbASLZI7XOnqqzdo/LXTDvLLawlxyj1wb/1
	w0TuGcUCWRc/kSb3Ysp7ZftS+KQiwrp8Hntj5TQ5g2LfZUEDubdELHISM77e36we3cvc
	qV6P/o3B0GLeRAcCq/Zp8Mn67wooi6Bvv93ay0MKkhE+BIN2TerJUpNcoTI1B3fsiJTa
	q4CxdcoWWx76P3VIEYbPgLOPxq6hh7PS+0KJrxkr6m6ZX8HN/bB454g0/jvoxWlH6W7T
	SqOTAvnxh2+aCc5J1ygJeewOqfa1QALXAC0IitS5myAnBY4IYPEyWjB8OlazRCKHL3mf
	kYpQ==
Received: by 10.216.196.166 with SMTP id r38mr5545365wen.161.1338657593884;
	Sat, 02 Jun 2012 10:19:53 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.194.54.135 with HTTP; Sat, 2 Jun 2012 10:19:33 -0700 (PDT)
In-Reply-To: <CACVmpreVwVTGcUAC7+7sP6nHOSbYHeW33RR6D2g7+O76B99sdA@mail.gmail.com>
References: <CACVmpreVwVTGcUAC7+7sP6nHOSbYHeW33RR6D2g7+O76B99sdA@mail.gmail.com>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Sat, 2 Jun 2012 20:19:33 +0300
Message-ID: <CAPSX3sR99tojv90Dhofx+3HHWozUr8k391ZisrB_9gsc8N7dMQ@mail.gmail.com>
Subject: Re: .bashrc is sourced even for non-interactive shells (when run from
	sshd)
To: Mikel Ward <mikel@mikelward.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.82.49
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 02 Jun 2012 17:20:00 -0000

On Sat, Jun 2, 2012 at 8:15 PM, Mikel Ward <mikel@mikelward.com> wrote:
> bash sources .bashrc even for some non-interactive shells.
>
> For example with
>
> =A0 =A0echo \$- is $-
>
> in ~/.bashrc, and shell set to /bin/bash (bash 4.2.28)
>
> =A0 =A0ssh -n -T localhost true
>
> produces the output
>
> =A0 =A0$- is hBc
>
> I assume this is caused by this code in shell.c
>
> =A0 =A0 if (run_by_ssh || isnetconn (fileno (stdin)))
>
> The man page says
>
> =A0 =A0 =A0 When an interactive shell that is not a login shell is starte=
d,
> bash reads and executes commands from ~/.bashrc,
>
> but makes no mention of the special handling for ssh and rsh.
>
> This seems to have been the case since at least bash 2.02.
>
> I'd argue this is a misfeature, but I guess that ship has sailed. =A0Can
> the man page at least be updated?
>
> Thanks
>
>From http://mywiki.wooledge.org/DotFiles:

"Remote non login non interactive shells"
Bash has a special compile time option that will cause it to source
the .bashrc file on non-login, non-interactive ssh sessions. This
feature is only enabled by certain OS vendors (mostly Linux
distributions). It is not enabled in a default upstream Bash build,
and (empirically) not on OpenBSD either.

If this feature is enabled on your system, Bash detects that
SSH_CLIENT or SSH_CLIENT2 is in the environment and in this case
source .bashrc. eg suppose you have var=3Dfoo in your remote .bashrc and
you do: ssh remotehost echo \$var it will print foo.

This shell is non-interactive so you can test $- or $PS1, if you don't
want things to be executed this way in your .bashrc.

Without this option bash will test if stdin is connected to a socket
and will also source .bashrc in this case BUT this test fails if you
use a recent openssh server (>5.0) which means that you will probably
only see this on older systems.

Note that a test on SHLVL is also done, so if you do: ssh remotehost
bash -c echo then the first bash will source .bashrc but not the
second one (the explicit bash on the command line that runs echo).

The behaviour of the bash patched to source a system level bashrc by
some vendors is left as an exercise.


From MAILER-DAEMON Sat Jun 02 13:20:05 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sarzh-0007KU-Cv
	for mharc-bug-bash@gnu.org; Sat, 02 Jun 2012 13:20:05 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58723)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mikel@mikelward.com>) id 1Sarze-0007Cq-OY
	for bug-bash@gnu.org; Sat, 02 Jun 2012 13:20:03 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <mikel@mikelward.com>) id 1Sarzb-0002yp-7P
	for bug-bash@gnu.org; Sat, 02 Jun 2012 13:20:02 -0400
Received: from mail-bk0-f41.google.com ([209.85.214.41]:61674)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mikel@mikelward.com>) id 1Sarza-0002yV-Uh
	for bug-bash@gnu.org; Sat, 02 Jun 2012 13:19:59 -0400
Received: by bkcjm19 with SMTP id jm19so3206231bkc.0
	for <bug-bash@gnu.org>; Sat, 02 Jun 2012 10:19:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=mikelward.com; s=google;
	h=mime-version:x-originating-ip:in-reply-to:references:date
	:message-id:subject:from:to:content-type:content-transfer-encoding;
	bh=Nd8qNE4QTmGmlKDzndJbzDtW7hRhOldUb9qThKH5K4s=;
	b=HXxk0geGu77NaZxEjVUy27AoP89jfc9DHTGQh+useGU1YYyCl4o1sNnDy47Net03Q3
	N1xklCBj2WarJdgdczhVStZKy07PoPR9lOsuWhCPsMccoOE7jbDo7zLXWasvrh+V51Ni
	FcqLvNDRUk689xESkfibYKX1Fr2WS33qijUMQ=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=google.com; s=20120113;
	h=mime-version:x-originating-ip:in-reply-to:references:date
	:message-id:subject:from:to:content-type:content-transfer-encoding
	:x-gm-message-state;
	bh=Nd8qNE4QTmGmlKDzndJbzDtW7hRhOldUb9qThKH5K4s=;
	b=jY/OyG5/2+P2yiGe2uI2oHp5v2AlJTGRNouRwdyXjoFU3o97dmULfKlSf2PN7k6hvZ
	YoxIWzsMvkY7EGSdqyp/DsOSh2H7BNbkduKfHgaRMUafXfQ8m4V8nxswu3RehptjgIst
	eMhEJ4s269aVdQm2mREeqCZf4SQ86Qq8l7SMq+j3G9B1uinfeJhbcH8pL6UjPj8+jKn3
	KL+33zJQhe/4HG1GsXxbisSXOwynZeNqsf8NAVNzDpppvePmzBJ3/Ube7Hfi5bHnU3Ko
	3fXYfH8gUjqoqWTsIrQcrTr0GvR7YgDSrDFUX5bqH/JrRYvW8OjEJNIg7A3Nd/tJDYPk
	E3bw==
MIME-Version: 1.0
Received: by 10.204.130.89 with SMTP id r25mr3874126bks.48.1338657597374; Sat,
	02 Jun 2012 10:19:57 -0700 (PDT)
Received: by 10.205.139.6 with HTTP; Sat, 2 Jun 2012 10:19:57 -0700 (PDT)
X-Originating-IP: [50.78.104.166]
In-Reply-To: <CACVmpreVwVTGcUAC7+7sP6nHOSbYHeW33RR6D2g7+O76B99sdA@mail.gmail.com>
References: <CACVmpreVwVTGcUAC7+7sP6nHOSbYHeW33RR6D2g7+O76B99sdA@mail.gmail.com>
Date: Sat, 2 Jun 2012 10:19:57 -0700
Message-ID: <CACVmprdJSVst-Z=WiQL0PHvJ2uNww7iUO86i=B+-7EuuCnkg=Q@mail.gmail.com>
Subject: Re: .bashrc is sourced even for non-interactive shells (when run from
	sshd)
From: Mikel Ward <mikel@mikelward.com>
To: bug-bash@gnu.org
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Gm-Message-State: ALoCoQnyMtezTDxL/DHSuSS8dv5a1SMbFADQi4HL7Lz8Y8Mpg2lRqNWmiEdlPXewZktNsP/NLpYY
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.214.41
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 02 Jun 2012 17:20:04 -0000

Apologies.  It's mentioned a few paragraphs further down.

Can I suggest a change?

How about instead of:

       When an interactive shell that is not a login shell is started

something like:

       When a shell is started that is not a login shell, but is
either an interactive shell or a network shell

On Sat, Jun 2, 2012 at 10:15 AM, Mikel Ward <mikel@mikelward.com> wrote:
> bash sources .bashrc even for some non-interactive shells.
>
> For example with
>
> =C2=A0 =C2=A0echo \$- is $-
>
> in ~/.bashrc, and shell set to /bin/bash (bash 4.2.28)
>
> =C2=A0 =C2=A0ssh -n -T localhost true
>
> produces the output
>
> =C2=A0 =C2=A0$- is hBc
>
> I assume this is caused by this code in shell.c
>
> =C2=A0 =C2=A0 if (run_by_ssh || isnetconn (fileno (stdin)))
>
> The man page says
>
> =C2=A0 =C2=A0 =C2=A0 When an interactive shell that is not a login shell =
is started,
> bash reads and executes commands from ~/.bashrc,
>
> but makes no mention of the special handling for ssh and rsh.
>
> This seems to have been the case since at least bash 2.02.
>
> I'd argue this is a misfeature, but I guess that ship has sailed. =C2=A0C=
an
> the man page at least be updated?
>
> Thanks


From MAILER-DAEMON Sat Jun 02 13:24:15 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sas3j-0007d9-Rk
	for mharc-bug-bash@gnu.org; Sat, 02 Jun 2012 13:24:15 -0400
Received: from eggs.gnu.org ([208.118.235.92]:59218)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mikel@mikelward.com>) id 1Sas3h-0007d2-Lv
	for bug-bash@gnu.org; Sat, 02 Jun 2012 13:24:14 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <mikel@mikelward.com>) id 1Sas3g-0004GY-1c
	for bug-bash@gnu.org; Sat, 02 Jun 2012 13:24:13 -0400
Received: from mail-bk0-f41.google.com ([209.85.214.41]:62987)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mikel@mikelward.com>) id 1Sas3f-0004G6-OZ
	for bug-bash@gnu.org; Sat, 02 Jun 2012 13:24:11 -0400
Received: by bkcjm19 with SMTP id jm19so3208019bkc.0
	for <bug-bash@gnu.org>; Sat, 02 Jun 2012 10:24:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=mikelward.com; s=google;
	h=mime-version:x-originating-ip:in-reply-to:references:date
	:message-id:subject:from:to:cc:content-type;
	bh=wQPfPgmPZE8b1MZdA47iJWA2/7jxJluWaNEDOkIgwhU=;
	b=TMipClSXmK42eWd4Fjb+Xy/xIcwmL4fAuWLUj9cCTEYfOBesZSf+d7/3NkrNsxxHtI
	c1v2mzjwZMU/UxdzmAgWfTbOwK1t4AsBFq02kTdTsdiwRSyrpIhmxyDsQFKtwnZF/I3+
	rWYVjO2hZFYVbFfil/qPoICRSQ75fBaUf81NI=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=google.com; s=20120113;
	h=mime-version:x-originating-ip:in-reply-to:references:date
	:message-id:subject:from:to:cc:content-type:x-gm-message-state;
	bh=wQPfPgmPZE8b1MZdA47iJWA2/7jxJluWaNEDOkIgwhU=;
	b=YNxrw5IvqTFAArDu9hm+YlzxLZ+BSSFe4qi1vDw33xKtr5Ei2J6I56y2o+JaEQHeub
	J4RlkMgPi5Usm1eouuNDAgqauMH+sG3NcOomq4hCQMJcT3RYsTstWVxyxnfNjgel3L9p
	lWoEg1OHvPXTHgonlcxLKorZMFytQL3SVEjrcVvuEfx32v4CLDyubR/NxT0et4yMluzp
	uyMVlMTECt2aPXrbFrIdJXBfW1Us6D6yoqaBbSUSRKHBJKnSqriSNIyOkrRhOenYiIna
	Nuww2kk+1HEh/JK/HF6hJpx7rUPIez4dTLJQy3hZwfGZRsNG4SOlNIQloxvBonGhXTY2
	QeNg==
MIME-Version: 1.0
Received: by 10.204.151.81 with SMTP id b17mr3902786bkw.52.1338657850123; Sat,
	02 Jun 2012 10:24:10 -0700 (PDT)
Received: by 10.205.139.6 with HTTP; Sat, 2 Jun 2012 10:24:10 -0700 (PDT)
X-Originating-IP: [50.78.104.166]
In-Reply-To: <CAPSX3sR99tojv90Dhofx+3HHWozUr8k391ZisrB_9gsc8N7dMQ@mail.gmail.com>
References: <CACVmpreVwVTGcUAC7+7sP6nHOSbYHeW33RR6D2g7+O76B99sdA@mail.gmail.com>
	<CAPSX3sR99tojv90Dhofx+3HHWozUr8k391ZisrB_9gsc8N7dMQ@mail.gmail.com>
Date: Sat, 2 Jun 2012 10:24:10 -0700
Message-ID: <CACVmprfbg8F7K_+S-K9dvOTgAps9JUr+gac=Oe6ZAAGkfY62OA@mail.gmail.com>
Subject: Re: .bashrc is sourced even for non-interactive shells (when run from
	sshd)
From: Mikel Ward <mikel@mikelward.com>
To: Pierre Gaston <pierre.gaston@gmail.com>
Content-Type: text/plain; charset=UTF-8
X-Gm-Message-State: ALoCoQm17OiVvkhqXobOrRgK528uVdy/updpGtGCWEY2GHsFtZL+SVjFGy3nM65eJnoFI+42H9GH
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.214.41
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 02 Jun 2012 17:24:15 -0000

On Sat, Jun 2, 2012 at 10:19 AM, Pierre Gaston <pierre.gaston@gmail.com> wrote:
> On Sat, Jun 2, 2012 at 8:15 PM, Mikel Ward <mikel@mikelward.com> wrote:
>> bash sources .bashrc even for some non-interactive shells.
...
> "Remote non login non interactive shells"
> Bash has a special compile time option that will cause it to source
> the .bashrc file on non-login, non-interactive ssh sessions.

IIUC, it was once a compile time option, but it's now hard-coded.  The
isnetconn test doesn't seem to be toggled by any macro.

      if ((run_by_ssh || isnetconn (fileno (stdin))) && shell_level < 2)


From MAILER-DAEMON Sat Jun 02 13:29:45 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sas93-00085o-I6
	for mharc-bug-bash@gnu.org; Sat, 02 Jun 2012 13:29:45 -0400
Received: from eggs.gnu.org ([208.118.235.92]:34432)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Sas91-00085E-Kn
	for bug-bash@gnu.org; Sat, 02 Jun 2012 13:29:44 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Sas8z-0005lS-Us
	for bug-bash@gnu.org; Sat, 02 Jun 2012 13:29:43 -0400
Received: from mail-we0-f169.google.com ([74.125.82.169]:34750)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Sas8z-0005l2-L5
	for bug-bash@gnu.org; Sat, 02 Jun 2012 13:29:41 -0400
Received: by wefh52 with SMTP id h52so2516201wef.0
	for <bug-bash@gnu.org>; Sat, 02 Jun 2012 10:29:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=6FQXkZuyrUS3xm/qnn6Tbc3VsfvSHC+tQxEJNYwsJkg=;
	b=KthUxhtFyaDVOFvWIECKbu+k22xb+DO6O/BSlqZ4wmvntVD4z3E+5k+oVinvY6uFek
	CmeMj1xmFoJX0qfcQhO99xb1YG0DsPQr00zQAOYwc9HSGg0t26EzG/j2lgmVt1NEWFkV
	cMXlpyZQLbXiAq/ipVpcvz7ip9J5sP8YRylwGacnHs3BHiu+yz+Xl6IzYk7fe8EBAXLD
	cFq5BJuR3m64oSDEKz3yz2RfqAw2fuPFoh8PiyLyZuFi/UEQhKLCxLUogy7G7/t1w6rC
	SHsQoVA6S+gzkHN6f8bS+vhyBbySOBzGmwgUylbLeCLQd5IH7jIjoj1Tuxkspirg1mqn
	rmVQ==
Received: by 10.216.206.159 with SMTP id l31mr5463333weo.2.1338658179538; Sat,
	02 Jun 2012 10:29:39 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.194.54.135 with HTTP; Sat, 2 Jun 2012 10:29:19 -0700 (PDT)
In-Reply-To: <CACVmprfbg8F7K_+S-K9dvOTgAps9JUr+gac=Oe6ZAAGkfY62OA@mail.gmail.com>
References: <CACVmpreVwVTGcUAC7+7sP6nHOSbYHeW33RR6D2g7+O76B99sdA@mail.gmail.com>
	<CAPSX3sR99tojv90Dhofx+3HHWozUr8k391ZisrB_9gsc8N7dMQ@mail.gmail.com>
	<CACVmprfbg8F7K_+S-K9dvOTgAps9JUr+gac=Oe6ZAAGkfY62OA@mail.gmail.com>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Sat, 2 Jun 2012 20:29:19 +0300
Message-ID: <CAPSX3sTMTt1t--5MZEzipJ9VamZ=R7EjxrghT7o=834dLm6YWA@mail.gmail.com>
Subject: Re: .bashrc is sourced even for non-interactive shells (when run from
	sshd)
To: Mikel Ward <mikel@mikelward.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.82.169
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 02 Jun 2012 17:29:44 -0000

On Sat, Jun 2, 2012 at 8:24 PM, Mikel Ward <mikel@mikelward.com> wrote:
> On Sat, Jun 2, 2012 at 10:19 AM, Pierre Gaston <pierre.gaston@gmail.com> =
wrote:
>> On Sat, Jun 2, 2012 at 8:15 PM, Mikel Ward <mikel@mikelward.com> wrote:
>>> bash sources .bashrc even for some non-interactive shells.
> ...
>> "Remote non login non interactive shells"
>> Bash has a special compile time option that will cause it to source
>> the .bashrc file on non-login, non-interactive ssh sessions.
>
> IIUC, it was once a compile time option, but it's now hard-coded. =A0The
> isnetconn test doesn't seem to be toggled by any macro.
>
> =A0 =A0 =A0if ((run_by_ssh || isnetconn (fileno (stdin))) && shell_level =
< 2)
but  run_by_ssh is:

#ifdef SSH_SOURCE_BASHRC
      run_by_ssh =3D (find_variable ("SSH_CLIENT") !=3D (SHELL_VAR *)0) ||
                   (find_variable ("SSH2_CLIENT") !=3D (SHELL_VAR *)0);
#else
      run_by_ssh =3D 0;
#endif


From MAILER-DAEMON Sat Jun 02 13:56:00 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SasYS-0003Pl-QI
	for mharc-bug-bash@gnu.org; Sat, 02 Jun 2012 13:56:00 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35113)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1SasYP-0003Pe-TA
	for Bug-bash@gnu.org; Sat, 02 Jun 2012 13:55:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1SasYO-0003De-4G
	for Bug-bash@gnu.org; Sat, 02 Jun 2012 13:55:57 -0400
Received: from sam.nabble.com ([216.139.236.26]:50504)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1SasYN-0003Da-Vt
	for Bug-bash@gnu.org; Sat, 02 Jun 2012 13:55:56 -0400
Received: from telerig.nabble.com ([192.168.236.162])
	by sam.nabble.com with esmtp (Exim 4.72)
	(envelope-from <bounces@nabble.com>) id 1SasYM-0001Wp-4j
	for Bug-bash@gnu.org; Sat, 02 Jun 2012 10:55:54 -0700
Message-ID: <33950439.post@talk.nabble.com>
Date: Sat, 2 Jun 2012 10:55:54 -0700 (PDT)
From: rac8006 <rac8006@aol.com>
To: Bug-bash@gnu.org
Subject: link problem undefined reference tgoto BC & UP
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Nabble-From: rac8006@aol.com
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 216.139.236.26
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 02 Jun 2012 17:55:59 -0000


Why can't I get a clean compile of bash4.1?  I was building until I did a
configure --enable_progcomp
Now it fails with  the three missing symbols tgoto , BC and UP.  I've
searched this site with no answers.
Searched the web found references to -ltinfo.  But I don't have that
library.
What do I need to do to get a clean build?

RAC
-- 
View this message in context: http://old.nabble.com/link-problem-undefined-reference-tgoto-BC---UP-tp33950439p33950439.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.



From MAILER-DAEMON Sat Jun 02 14:00:58 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SasdG-0003yP-LW
	for mharc-bug-bash@gnu.org; Sat, 02 Jun 2012 14:00:58 -0400
Received: from eggs.gnu.org ([208.118.235.92]:59057)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SasdE-0003xw-7M
	for Bug-bash@gnu.org; Sat, 02 Jun 2012 14:00:57 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SasdC-0004N0-IA
	for Bug-bash@gnu.org; Sat, 02 Jun 2012 14:00:55 -0400
Received: from mail-wg0-f49.google.com ([74.125.82.49]:60589)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SasdC-0004Mr-7s
	for Bug-bash@gnu.org; Sat, 02 Jun 2012 14:00:54 -0400
Received: by wgbds1 with SMTP id ds1so2147624wgb.30
	for <Bug-bash@gnu.org>; Sat, 02 Jun 2012 11:00:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=TPD3xYtbfaulFxuJMd8+C3KnXV4KnGo11wj5jsBPz5E=;
	b=XfDUZpIwk3sJuqs+Kkni91GUK9iH/97G4WIZWL5VepW9JoBDDG5Ya2c59ZA7bYs8zQ
	T5uvkBarcJnbLI3sGJ8xRx5IVWLiHPC/k8csKsSCkk/zDPhdYt3KcLgIDvY2545+k/50
	6lH27uEsRq/ifXuZFniPEr8eOukXGWHyGEb12/3XbtbrcvFmyOgmYb2GXUDhYl9LKbkH
	BiZ4sOGxpagqs2YxPDo6kkKAzBqLAJSkO0uj7LuHDECpXxveSAJNuftm+JF3elt/E9tG
	dpkztE82A+dxe27v16q3mP28TcGcSdhugMHvuoEEm3iD/hVaOY6CLOIFdUOiPmUz04EC
	iu7w==
Received: by 10.216.211.209 with SMTP id w59mr5575922weo.160.1338660052103;
	Sat, 02 Jun 2012 11:00:52 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.194.54.135 with HTTP; Sat, 2 Jun 2012 11:00:31 -0700 (PDT)
In-Reply-To: <33950439.post@talk.nabble.com>
References: <33950439.post@talk.nabble.com>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Sat, 2 Jun 2012 21:00:31 +0300
Message-ID: <CAPSX3sQWAPOmtsdMZWGOr=9k=z53CB1he50CjCBx=0fsLOJjrA@mail.gmail.com>
Subject: Re: link problem undefined reference tgoto BC & UP
To: rac8006 <rac8006@aol.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.82.49
Cc: Bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 02 Jun 2012 18:00:57 -0000

On Sat, Jun 2, 2012 at 8:55 PM, rac8006 <rac8006@aol.com> wrote:
>
> Why can't I get a clean compile of bash4.1? =A0I was building until I did=
 a
> configure --enable_progcomp
> Now it fails with =A0the three missing symbols tgoto , BC and UP. =A0I've
> searched this site with no answers.
> Searched the web found references to -ltinfo. =A0But I don't have that
> library.
> What do I need to do to get a clean build?

Hard to tell with so little and so imprecise information


From MAILER-DAEMON Sat Jun 02 15:30:08 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sau1Y-00076L-Fe
	for mharc-bug-bash@gnu.org; Sat, 02 Jun 2012 15:30:08 -0400
Received: from eggs.gnu.org ([208.118.235.92]:39829)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1Sau1W-00074W-Be
	for Bug-bash@gnu.org; Sat, 02 Jun 2012 15:30:07 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1Sau1U-0000zp-IZ
	for Bug-bash@gnu.org; Sat, 02 Jun 2012 15:30:05 -0400
Received: from sam.nabble.com ([216.139.236.26]:36145)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1Sau1U-0000xS-Du
	for Bug-bash@gnu.org; Sat, 02 Jun 2012 15:30:04 -0400
Received: from telerig.nabble.com ([192.168.236.162])
	by sam.nabble.com with esmtp (Exim 4.72)
	(envelope-from <bounces@nabble.com>) id 1Sau1T-0005o0-4y
	for Bug-bash@gnu.org; Sat, 02 Jun 2012 12:30:03 -0700
Message-ID: <33950742.post@talk.nabble.com>
Date: Sat, 2 Jun 2012 12:30:03 -0700 (PDT)
From: rac8006 <rac8006@aol.com>
To: Bug-bash@gnu.org
Subject: Re: link problem undefined reference tgoto BC & UP
In-Reply-To: <CAPSX3sQWAPOmtsdMZWGOr=9k=z53CB1he50CjCBx=0fsLOJjrA@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Nabble-From: rac8006@aol.com
References: <33950439.post@talk.nabble.com>
	<CAPSX3sQWAPOmtsdMZWGOr=9k=z53CB1he50CjCBx=0fsLOJjrA@mail.gmail.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 216.139.236.26
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 02 Jun 2012 19:30:07 -0000


I think I fixed my problem.  I compiled the ncurses library from the source
code for the DNS-323 NAS.
I used it to link bash.

RAC

Pierre Gaston wrote:
>=20
> On Sat, Jun 2, 2012 at 8:55 PM, rac8006 <rac8006@aol.com> wrote:
>>
>> Why can't I get a clean compile of bash4.1? =C2=A0I was building until I=
 did a
>> configure --enable_progcomp
>> Now it fails with =C2=A0the three missing symbols tgoto , BC and UP. =C2=
=A0I've
>> searched this site with no answers.
>> Searched the web found references to -ltinfo. =C2=A0But I don't have tha=
t
>> library.
>> What do I need to do to get a clean build?
>=20
> Hard to tell with so little and so imprecise information
>=20
>=20
>=20

--=20
View this message in context: http://old.nabble.com/link-problem-undefined-=
reference-tgoto-BC---UP-tp33950439p33950742.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.



From MAILER-DAEMON Sat Jun 02 20:05:48 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SayKK-0005Vf-AN
	for mharc-bug-bash@gnu.org; Sat, 02 Jun 2012 20:05:48 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57817)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SayKH-0005Uz-De
	for bug-bash@gnu.org; Sat, 02 Jun 2012 20:05:46 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SayKF-0002E8-Bp
	for bug-bash@gnu.org; Sat, 02 Jun 2012 20:05:44 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:42058
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SayKF-0002DV-0r
	for bug-bash@gnu.org; Sat, 02 Jun 2012 20:05:43 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.5/8.14.4/SuSE Linux 0.8) with ESMTP id
	q5305Z5O000557; Sat, 2 Jun 2012 17:05:37 -0700
Message-ID: <4FCAAA4F.7030007@tlinx.org>
Date: Sat, 02 Jun 2012 17:05:35 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: Pierre Gaston <pierre.gaston@gmail.com>
Subject: Re: .bashrc is sourced even for non-interactive shells (when run
	from	sshd)
References: <CACVmpreVwVTGcUAC7+7sP6nHOSbYHeW33RR6D2g7+O76B99sdA@mail.gmail.com>	<CAPSX3sR99tojv90Dhofx+3HHWozUr8k391ZisrB_9gsc8N7dMQ@mail.gmail.com>	<CACVmprfbg8F7K_+S-K9dvOTgAps9JUr+gac=Oe6ZAAGkfY62OA@mail.gmail.com>
	<CAPSX3sTMTt1t--5MZEzipJ9VamZ=R7EjxrghT7o=834dLm6YWA@mail.gmail.com>
In-Reply-To: <CAPSX3sTMTt1t--5MZEzipJ9VamZ=R7EjxrghT7o=834dLm6YWA@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by Ishtar.sc.tlinx.org id
	q5305Z5O000557
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Cc: Mikel Ward <mikel@mikelward.com>, bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 03 Jun 2012 00:05:46 -0000



Pierre Gaston wrote:

> On Sat, Jun 2, 2012 at 8:24 PM, Mikel Ward <mikel@mikelward.com> wrote:
>> On Sat, Jun 2, 2012 at 10:19 AM, Pierre Gaston <pierre.gaston@gmail.co=
m> wrote:
>>> On Sat, Jun 2, 2012 at 8:15 PM, Mikel Ward <mikel@mikelward.com> wrot=
e:
>>>> bash sources .bashrc even for some non-interactive shells.
>> ...
>>> "Remote non login non interactive shells"
>>> Bash has a special compile time option that will cause it to source
>>> the .bashrc file on non-login, non-interactive ssh sessions.
>> IIUC, it was once a compile time option, but it's now hard-coded. =EF=BF=
=BDThe
>> isnetconn test doesn't seem to be toggled by any macro.
>>
>> =EF=BF=BD =EF=BF=BD =EF=BF=BDif ((run_by_ssh || isnetconn (fileno (std=
in))) && shell_level < 2)
> but  run_by_ssh is:
>=20
> #ifdef SSH_SOURCE_BASHRC
>       run_by_ssh =3D (find_variable ("SSH_CLIENT") !=3D (SHELL_VAR *)0)=
 ||
>                    (find_variable ("SSH2_CLIENT") !=3D (SHELL_VAR *)0);
> #else
>       run_by_ssh =3D 0;
> #endif
>=20


I would say that's broken -- bash can detect if it is
hooked up to a terminal for input, or not, but chooses not to.

prelude:

ans=3D("is "{not,}" a tty")
alias sub=3Dfunction
sub echoAns { echo ${ans[$?=3D=3D0]}; }
alias }{=3Delse {=3Dthen }=3Dfi ?=3Dif

4 basic cases...

1)
Ishtar:...> if ssh  ishtar isatty 0 2>/dev/null; { echoAns; }{ echoAns; }
.bashrc STDIN: is not a tty ( $-=3DhBc )
is not a tty


2)
Ishtar:...> if ssh -T ishtar isatty 0 2>/dev/null; { echoAns; }{ echoAns;=
 }
.bashrc STDIN: is not a tty ( $-=3DhBc )
is not a tty


3)
Ishtar:...> if ssh -tn ishtar isatty 0 2>/dev/null; { echoAns; }{ echoAns=
; }
.bashrc STDIN: is not a tty ( $-=3DhBc )
is not a tty


4)
Ishtar:...> if ssh -t ishtar isatty 0 2>/dev/null; { echoAns; }{ echoAns;=
 }
.bashrc STDIN: is a tty ( $-=3DhBc )
is a tty

While it is arguable whether or not 1 & 2 are 'interactive' (they are but=
 not in=20
a character oriented way), #4, by:
        --rcfile file
               Execute commands from file instead of the standard persona=
l ini-
               tialization file ~/.bashrc if  the  shell  is  interactive=
  (see
               INVOCATION below).
-----------Under invocation:
        An interactive shell is one started without  non-option  argument=
s  and
        without the -c option whose standard input and error are both con=
nected
        to terminals .....

   ***(as determined by isatty(3)),***

        or one started with  the  -i
        option.   PS1 is set and $- includes i if bash is interactive, al=
lowing
        a shell script or a startup file to test this state.


By using the isatty test, none of 1-3 should be calling bashrc.
You can note that the "-i" switch isn't specified at any point.

Minimally I would claim #4 to be a bug, and from the manual, #1 and #2 ar=
e as
well.  (-n redirects STDIN from /dev/null -- a definite "non-winner for=20
interactivity).








From MAILER-DAEMON Sat Jun 02 23:49:07 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sb1oR-0000nf-Rw
	for mharc-bug-bash@gnu.org; Sat, 02 Jun 2012 23:49:07 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60598)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Sb1oP-0000nV-4d
	for bug-bash@gnu.org; Sat, 02 Jun 2012 23:49:06 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Sb1oM-0006yw-Vv
	for bug-bash@gnu.org; Sat, 02 Jun 2012 23:49:04 -0400
Received: from mail-ee0-f41.google.com ([74.125.83.41]:35362)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Sb1oM-0006yh-MQ
	for bug-bash@gnu.org; Sat, 02 Jun 2012 23:49:02 -0400
Received: by eekb47 with SMTP id b47so1296466eek.0
	for <bug-bash@gnu.org>; Sat, 02 Jun 2012 20:49:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=vTMawfcPCeEz4wSTQomehnV9i9rPQjjY82Aovcvnkuw=;
	b=snYT8UQhMDBU/wB3sOikebAVF5UrpsGfr24u2dOAS16EIoZA9/8I2tfCHXkfcwSd2s
	OfRyFUU1ZLbUXnHQ31VQr/q3gWXN6wLWP4+PQkElJ3tr2QJ0EFUL8uPml/FKD/IO5D1o
	5XoSOKzFXaLOmizlWRy9Hjx9KenQeZamdD7EzDjrQo2nqsM78XpgShXpbxvyWzO2BkBP
	tUyDfU5JXJOaP6JgLfMaX/Rr0s/wM/we81g21rnC+0vPvo7L6Reju/xx/i5dC1hNh9Er
	8BO87wOgrVZM43MOe+/x94GvDtFf+Qi1AyCuJCfG3NKFuc/dSCkV42iLhN3wKdz5Luj7
	cusQ==
Received: by 10.14.37.199 with SMTP id y47mr3617830eea.111.1338695340225; Sat,
	02 Jun 2012 20:49:00 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.14.124.73 with HTTP; Sat, 2 Jun 2012 20:48:40 -0700 (PDT)
In-Reply-To: <4FCAAA4F.7030007@tlinx.org>
References: <CACVmpreVwVTGcUAC7+7sP6nHOSbYHeW33RR6D2g7+O76B99sdA@mail.gmail.com>
	<CAPSX3sR99tojv90Dhofx+3HHWozUr8k391ZisrB_9gsc8N7dMQ@mail.gmail.com>
	<CACVmprfbg8F7K_+S-K9dvOTgAps9JUr+gac=Oe6ZAAGkfY62OA@mail.gmail.com>
	<CAPSX3sTMTt1t--5MZEzipJ9VamZ=R7EjxrghT7o=834dLm6YWA@mail.gmail.com>
	<4FCAAA4F.7030007@tlinx.org>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Sun, 3 Jun 2012 06:48:40 +0300
Message-ID: <CAPSX3sToK38rfLRO76RtO=cui84zOOT8ABrN1gKz=hMVVDy3NA@mail.gmail.com>
Subject: Re: .bashrc is sourced even for non-interactive shells (when run from
	sshd)
To: Linda Walsh <bash@tlinx.org>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.83.41
Cc: Mikel Ward <mikel@mikelward.com>, bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 03 Jun 2012 03:49:06 -0000

On Sun, Jun 3, 2012 at 3:05 AM, Linda Walsh <bash@tlinx.org> wrote:
>
>
> Pierre Gaston wrote:
>
>> On Sat, Jun 2, 2012 at 8:24 PM, Mikel Ward <mikel@mikelward.com> wrote:
>>>
>>> On Sat, Jun 2, 2012 at 10:19 AM, Pierre Gaston <pierre.gaston@gmail.com=
>
>>> wrote:
>>>>
>>>> On Sat, Jun 2, 2012 at 8:15 PM, Mikel Ward <mikel@mikelward.com> wrote=
:
>>>>>
>>>>> bash sources .bashrc even for some non-interactive shells.
>>>
>>> ...
>>>>
>>>> "Remote non login non interactive shells"
>>>> Bash has a special compile time option that will cause it to source
>>>> the .bashrc file on non-login, non-interactive ssh sessions.
>>>
>>> IIUC, it was once a compile time option, but it's now hard-coded. =EF=
=BF=BDThe
>>> isnetconn test doesn't seem to be toggled by any macro.
>>>
>>> =EF=BF=BD =EF=BF=BD =EF=BF=BDif ((run_by_ssh || isnetconn (fileno (stdi=
n))) && shell_level < 2)
>>
>> but =C2=A0run_by_ssh is:
>>
>> #ifdef SSH_SOURCE_BASHRC
>> =C2=A0 =C2=A0 =C2=A0run_by_ssh =3D (find_variable ("SSH_CLIENT") !=3D (S=
HELL_VAR *)0) ||
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (find_var=
iable ("SSH2_CLIENT") !=3D (SHELL_VAR *)0);
>> #else
>> =C2=A0 =C2=A0 =C2=A0run_by_ssh =3D 0;
>> #endif
>>
>
>
> I would say that's broken -- bash can detect if it is
> hooked up to a terminal for input, or not, but chooses not to.
>
> prelude:
>
> ans=3D("is "{not,}" a tty")
> alias sub=3Dfunction
> sub echoAns { echo ${ans[$?=3D=3D0]}; }
> alias }{=3Delse {=3Dthen }=3Dfi ?=3Dif
>
> 4 basic cases...
>
> 1)
> Ishtar:...> if ssh =C2=A0ishtar isatty 0 2>/dev/null; { echoAns; }{ echoA=
ns; }
> .bashrc STDIN: is not a tty ( $-=3DhBc )
> is not a tty
>
>
> 2)
> Ishtar:...> if ssh -T ishtar isatty 0 2>/dev/null; { echoAns; }{ echoAns;=
 }
> .bashrc STDIN: is not a tty ( $-=3DhBc )
> is not a tty
>
>
> 3)
> Ishtar:...> if ssh -tn ishtar isatty 0 2>/dev/null; { echoAns; }{ echoAns=
; }
> .bashrc STDIN: is not a tty ( $-=3DhBc )
> is not a tty
>
>
> 4)
> Ishtar:...> if ssh -t ishtar isatty 0 2>/dev/null; { echoAns; }{ echoAns;=
 }
> .bashrc STDIN: is a tty ( $-=3DhBc )
> is a tty
>
> While it is arguable whether or not 1 & 2 are 'interactive' (they are but
> not in a character oriented way), #4, by:
> =C2=A0 =C2=A0 =C2=A0 --rcfile file
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Execute commands from fil=
e instead of the standard personal
> ini-
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0tialization file ~/.bashr=
c if =C2=A0the =C2=A0shell =C2=A0is =C2=A0interactive
> =C2=A0(see
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0INVOCATION below).
> -----------Under invocation:
> =C2=A0 =C2=A0 =C2=A0 An interactive shell is one started without =C2=A0no=
n-option =C2=A0arguments
> =C2=A0and
> =C2=A0 =C2=A0 =C2=A0 without the -c option whose standard input and error=
 are both
> connected
> =C2=A0 =C2=A0 =C2=A0 to terminals .....
>
> =C2=A0***(as determined by isatty(3)),***
>
> =C2=A0 =C2=A0 =C2=A0 or one started with =C2=A0the =C2=A0-i
> =C2=A0 =C2=A0 =C2=A0 option. =C2=A0 PS1 is set and $- includes i if bash =
is interactive,
> allowing
> =C2=A0 =C2=A0 =C2=A0 a shell script or a startup file to test this state.
>
>
> By using the isatty test, none of 1-3 should be calling bashrc.
> You can note that the "-i" switch isn't specified at any point.
>
> Minimally I would claim #4 to be a bug, and from the manual, #1 and #2 ar=
e
> as
> well. =C2=A0(-n redirects STDIN from /dev/null -- a definite "non-winner =
for
> interactivity).

In all your examples the shell will be called like: bash -c  'isatty 0
2'. If you use a bash compiled with the above option you can add 'ps
-p$$ -ocmd' at the top of your .bashrc to verify it.

They are all non-interactive because they are called with -c,
disregarding if they are connected to a terminal or not.


From MAILER-DAEMON Sun Jun 03 00:20:58 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sb2JG-000338-KK
	for mharc-bug-bash@gnu.org; Sun, 03 Jun 2012 00:20:58 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46592)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wb8tyw@gmail.com>) id 1Say6s-0004ei-3M
	for bug-bash@gnu.org; Sat, 02 Jun 2012 19:51:55 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wb8tyw@gmail.com>) id 1Say6q-0007Q6-G4
	for bug-bash@gnu.org; Sat, 02 Jun 2012 19:51:53 -0400
Received: from mail-ob0-f169.google.com ([209.85.214.169]:63718)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wb8tyw@gmail.com>) id 1Say6q-0007Q2-7d
	for bug-bash@gnu.org; Sat, 02 Jun 2012 19:51:52 -0400
Received: by obbwd18 with SMTP id wd18so6160113obb.0
	for <bug-bash@gnu.org>; Sat, 02 Jun 2012 16:51:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=message-id:date:from:user-agent:mime-version:to:subject
	:content-type:content-transfer-encoding;
	bh=7S6l6chwN/kP5Nk9zS1f4MOJCbMY9LjX2SFn+5JSrp0=;
	b=iGUZUpVtrIa+HIsvLa1eISdMBMpIfts2oqoBo3auiSDzRS0YGHkuZj4zgWpaN3zKqw
	f36PcLQT01nRAZg8heXpOxgFaGs4yzUD73qECIs6jS/4I7kBjsaBImd5id5bIYhdg4cC
	TSdXPYu8QpxnprP3Ce+muB0xcCeicCkWxHGlJyk050XCr7TZZRyEVEx5viw9dtVc2YR/
	D142fKSJAc0GhS4IVtA/OMMy508n7U+biaiHoUTxXoXl4EcYYkCER/ltKGYyE+t9bUI6
	0LMeehuZ1h0LawLMdJcumHf5nGN3Ya6asjGOwJ2MKWn9LbKEJoLD/7Xljzs5YUTrHdMR
	cb+g==
Received: by 10.43.106.147 with SMTP id du19mr4616943icc.56.1338681109221;
	Sat, 02 Jun 2012 16:51:49 -0700 (PDT)
Received: from [192.168.0.101] (173-19-202-206.client.mchsi.com.
	[173.19.202.206])
	by mx.google.com with ESMTPS id k6sm2697199igz.9.2012.06.02.16.51.48
	(version=TLSv1/SSLv3 cipher=OTHER);
	Sat, 02 Jun 2012 16:51:48 -0700 (PDT)
Message-ID: <4FCAA6EE.2090303@gmail.com>
Date: Sat, 02 Jun 2012 18:51:10 -0500
From: John Malmberg <wb8tyw@gmail.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:10.0) Gecko/20120129 Thunderbird/10.0
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: lib/sh/mktime.c VMS specific code is not needed.
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.214.169
X-Mailman-Approved-At: Sun, 03 Jun 2012 00:20:57 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 02 Jun 2012 23:51:55 -0000

The lib/sh/mktime.c module has a VMS specific include of <sys/types.h> 
to pick up time_t.

On VMS, the time_t type is defined in the <time.h> module.

So this VMS specific include can be removed.

Regards,
-John


From MAILER-DAEMON Sun Jun 03 04:02:27 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sb5lb-00037U-UE
	for mharc-bug-bash@gnu.org; Sun, 03 Jun 2012 04:02:27 -0400
Received: from eggs.gnu.org ([208.118.235.92]:56487)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Sb5lZ-00036y-9T
	for bug-bash@gnu.org; Sun, 03 Jun 2012 04:02:26 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Sb5lX-0000wS-Kf
	for bug-bash@gnu.org; Sun, 03 Jun 2012 04:02:24 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:53069
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Sb5lX-0000wI-Ad
	for bug-bash@gnu.org; Sun, 03 Jun 2012 04:02:23 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.5/8.14.4/SuSE Linux 0.8) with ESMTP id
	q5382Gsx011363; Sun, 3 Jun 2012 01:02:18 -0700
Message-ID: <4FCB1A09.3030306@tlinx.org>
Date: Sun, 03 Jun 2012 01:02:17 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: Pierre Gaston <pierre.gaston@gmail.com>, bug-bash <bug-bash@gnu.org>
Subject: Re: .bashrc is sourced even for non-interactive shells (when run from
	sshd)
References: <CACVmpreVwVTGcUAC7+7sP6nHOSbYHeW33RR6D2g7+O76B99sdA@mail.gmail.com>
	<CAPSX3sR99tojv90Dhofx+3HHWozUr8k391ZisrB_9gsc8N7dMQ@mail.gmail.com>
	<CACVmprfbg8F7K_+S-K9dvOTgAps9JUr+gac=Oe6ZAAGkfY62OA@mail.gmail.com>
	<CAPSX3sTMTt1t--5MZEzipJ9VamZ=R7EjxrghT7o=834dLm6YWA@mail.gmail.com>
	<4FCAAA4F.7030007@tlinx.org>
	<CAPSX3sToK38rfLRO76RtO=cui84zOOT8ABrN1gKz=hMVVDy3NA@mail.gmail.com>
In-Reply-To: <CAPSX3sToK38rfLRO76RtO=cui84zOOT8ABrN1gKz=hMVVDy3NA@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 03 Jun 2012 08:02:26 -0000



Pierre Gaston wrote:
> In all your examples the shell will be called like: bash -c  'isatty 0
> 2'. If you use a bash compiled with the above option you can add 'ps
> -p$$ -ocmd' at the top of your .bashrc to verify it.
> 
> They are all non-interactive because they are called with -c,
> disregarding if they are connected to a terminal or not.
===
I see what you mean...

Wouldn't that '*doubly*' mean the .bashrc shouldn't be called?






From MAILER-DAEMON Sun Jun 03 04:26:25 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sb68n-0004uB-NL
	for mharc-bug-bash@gnu.org; Sun, 03 Jun 2012 04:26:25 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49781)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Sb68k-0004tR-4e
	for bug-bash@gnu.org; Sun, 03 Jun 2012 04:26:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Sb68h-00069O-9w
	for bug-bash@gnu.org; Sun, 03 Jun 2012 04:26:21 -0400
Received: from mail-wg0-f41.google.com ([74.125.82.41]:46032)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Sb68h-000676-13
	for bug-bash@gnu.org; Sun, 03 Jun 2012 04:26:19 -0400
Received: by wgbds1 with SMTP id ds1so1543354wgb.0
	for <bug-bash@gnu.org>; Sun, 03 Jun 2012 01:26:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=VW3sfLpi7+sPmrm9ThPp0Zf78Pd7R3gTbKyXFMaSu00=;
	b=WmJrT2s9zPdmPytcASTdmIMn9W2Bkk+SIpCLWRCHGIVukWiOIopyAnR9oHck82asSk
	XnIgDu3xT3mt+uD7voKJg6FEvfS+t8EI45TAWATNVs98n3OYPrqJBWZHSqBNdt9t9UXH
	ZEMQX8gkU3s2iFu0HGV1hePZDchTUJ0oQ4mOTwvZBP9A2GHEEjws7PaL147++Po5R+dE
	ytqks10O8R6/SBjOCULFdOUhKGmBw28W8V9D+jf7kjmwPitqNlkgfEGsyNRwAB543q+h
	QqnH22RD34M/Gc2JUudhfqjLkl/utSV4JmAwjotdX/vm9m0VrYK/SAymkfw7wPQAK+kr
	0vQA==
Received: by 10.216.206.159 with SMTP id l31mr7123851weo.2.1338711976965; Sun,
	03 Jun 2012 01:26:16 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.194.54.135 with HTTP; Sun, 3 Jun 2012 01:25:56 -0700 (PDT)
In-Reply-To: <4FCB1A09.3030306@tlinx.org>
References: <CACVmpreVwVTGcUAC7+7sP6nHOSbYHeW33RR6D2g7+O76B99sdA@mail.gmail.com>
	<CAPSX3sR99tojv90Dhofx+3HHWozUr8k391ZisrB_9gsc8N7dMQ@mail.gmail.com>
	<CACVmprfbg8F7K_+S-K9dvOTgAps9JUr+gac=Oe6ZAAGkfY62OA@mail.gmail.com>
	<CAPSX3sTMTt1t--5MZEzipJ9VamZ=R7EjxrghT7o=834dLm6YWA@mail.gmail.com>
	<4FCAAA4F.7030007@tlinx.org>
	<CAPSX3sToK38rfLRO76RtO=cui84zOOT8ABrN1gKz=hMVVDy3NA@mail.gmail.com>
	<4FCB1A09.3030306@tlinx.org>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Sun, 3 Jun 2012 11:25:56 +0300
Message-ID: <CAPSX3sTRPkiVKmhCBnfFCLUYBcxU604VTjS6yMpFubPi94UaQw@mail.gmail.com>
Subject: Re: .bashrc is sourced even for non-interactive shells (when run from
	sshd)
To: Linda Walsh <bash@tlinx.org>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.82.41
Cc: bug-bash <bug-bash@gnu.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 03 Jun 2012 08:26:23 -0000

On Sun, Jun 3, 2012 at 11:02 AM, Linda Walsh <bash@tlinx.org> wrote:
>
>
> Pierre Gaston wrote:
>>
>> In all your examples the shell will be called like: bash -c =A0'isatty 0
>> 2'. If you use a bash compiled with the above option you can add 'ps
>> -p$$ -ocmd' at the top of your .bashrc to verify it.
>>
>> They are all non-interactive because they are called with -c,
>> disregarding if they are connected to a terminal or not.
>
> =3D=3D=3D
> I see what you mean...
>
> Wouldn't that '*doubly*' mean the .bashrc shouldn't be called?
>

That's precisely the subject of this thread.

I thought I was not documented (before 4 it was a bit less obvious
to find the relevant bit) that's why I gave the link, but it is in
fact documented.
Eg in the bash 4 manual:

	Bash attempts  to determine  when it is  being run  with its
	standard input  connected to  a network connection,  as when
	executed by  the remote shell  daemon, usually rshd,  or the
	secure shell  daemon sshd.  If  bash determines it  is being
	run  in this fashion,  it reads  and executes  commands from
	~/.bashrc  and  ~/.bashrc,  if  these files  exist  and  are
	readable.

If I'm not mistaken this feature is inherited from csh. I can
guess some people are using it since there is this workaround
testing for the SSH variables to make it work with openssh>5.

You can see some people having troubles with that because .bashrc
is also sourced if you use less obvious non-interactive shells,
like when you use "scp"

That's why you can find things like:

[ -z "$PS1" ] && return

in the default .bashrc of debian.


From MAILER-DAEMON Sun Jun 03 08:23:23 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sb9q7-0007y0-TF
	for mharc-bug-bash@gnu.org; Sun, 03 Jun 2012 08:23:23 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41538)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <baldiniebaldini@gmail.com>) id 1Sb9q5-0007xt-IA
	for bug-bash@gnu.org; Sun, 03 Jun 2012 08:23:22 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <baldiniebaldini@gmail.com>) id 1Sb9q3-0000of-T8
	for bug-bash@gnu.org; Sun, 03 Jun 2012 08:23:21 -0400
Received: from mail-we0-f169.google.com ([74.125.82.169]:60507)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <baldiniebaldini@gmail.com>) id 1Sb9q3-0000oQ-Kv
	for bug-bash@gnu.org; Sun, 03 Jun 2012 08:23:19 -0400
Received: by wefh52 with SMTP id h52so2859454wef.0
	for <bug-bash@gnu.org>; Sun, 03 Jun 2012 05:23:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=message-id:date:from:reply-to:user-agent:mime-version:to:subject
	:content-type:content-transfer-encoding;
	bh=rBurfZ+Veg4tI3MYks+PTDJDhSs4zbSS4zseeosWHcM=;
	b=LZ37l8JH2Hi6WhTRNS4Au05qWiqZmHbOU9BoHICmCS6+yUIVyNGhKRg+un+5vPdTEq
	e/KDm42+8tNAerds7F8gyKdsUY1w+Yk0puj9J8vsxrdx6650uUE0W7mfVzEEZrJmCFoz
	eoD8ugT5s7XQRCUlndJeIzvPi25T6QP/sBmLlpkgYgrUwrK72O+gz6OoRHF+zGqwnGnZ
	aXz+zZ/pE19avnUhYQN9Jf3KSBTJxhYHMCtrJtDN+WVtC6EG4uZEY4LlUhEtbo+ndD8L
	PIxJIC154FUIR+tvUZNcEFxgXtJPKHb3IYhdC7gsnrN2C4GCGggvrbo0BJqJbGpv2J1K
	RZEg==
Received: by 10.216.145.153 with SMTP id p25mr8043205wej.112.1338726188903;
	Sun, 03 Jun 2012 05:23:08 -0700 (PDT)
Received: from [192.168.1.11]
	(host152-245-dynamic.12-79-r.retail.telecomitalia.it.
	[79.12.245.152])
	by mx.google.com with ESMTPS id d10sm19804955wiy.3.2012.06.03.05.23.06
	(version=TLSv1/SSLv3 cipher=OTHER);
	Sun, 03 Jun 2012 05:23:07 -0700 (PDT)
Message-ID: <4FCB5687.8000703@gmail.com>
Date: Sun, 03 Jun 2012 14:20:23 +0200
From: Davide Baldini <baldiniebaldini@gmail.com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
	rv:1.9.1.16) Gecko/20111110 Icedove/3.0.11
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Redirect a backgrounded process' stdout toward COPROC's stdin
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.82.169
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: Davide Baldini <baldiniebaldini@gmail.com>
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, 03 Jun 2012 12:23:22 -0000

Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -O2 -march='i486' (plus the flags added by Makefile)
uname output: Linux debianBunker 2.6.26-2-686 #1 SMP Wed Sep 21 04:35:47
UTC 2011 i686 GNU/Linux
Machine Type: i486-pc-linux-gnu

Bash Version: 4.2.0(5)-release
Patch Level: 5
Release Status: release

Description:
In the following test script I run an elementary coprocess to which the
echo built-in, run in background, attaches its standard-output:

    #!/bin/bash
    # TEST 1
    coproc /bin/sleep 100
    echo >&${COPROC[1]} &

The script always fails, for no apparent reason, giving the output:

    ./test.sh: line 4: ${COPROC[1]}: Bad file descriptor

I wonder if the correct syntax should be rather this one (ampersand
moved before redirection):

    #!/bin/bash
    # TEST 2
    coproc /bin/sleep 100
    echo & >&${COPROC[1]}

This second example seems to work since it reports no errors during
execution, but with this syntax, the redirection is not performed in
practice; in fact, consider this other test:

    #!/bin/bash
    # TEST 3
    /bin/echo abc & >xfile

Test 3 creates the file xfile, but does not write anything into it.
Curiously, trying again to position the ampersand after the redirection
make the echo work fine:

    #!/bin/bash
    # TEST 4
    /bin/echo abc >xfile &

Test 4 creates the file xfile with inside the string abc.

What's wrong with the coproc? And what's the correct position for the
ampersand, before redirection, or after?


From MAILER-DAEMON Sun Jun 03 11:01:36 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SbCJE-0005Yr-E4
	for mharc-bug-bash@gnu.org; Sun, 03 Jun 2012 11:01:36 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48054)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <geir.hauge@gmail.com>) id 1SbCJB-0005Xg-SC
	for bug-bash@gnu.org; Sun, 03 Jun 2012 11:01:35 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <geir.hauge@gmail.com>) id 1SbCJ9-0002P6-P2
	for bug-bash@gnu.org; Sun, 03 Jun 2012 11:01:33 -0400
Received: from mail-qa0-f48.google.com ([209.85.216.48]:39801)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <geir.hauge@gmail.com>) id 1SbCJ9-0002Oc-IK
	for bug-bash@gnu.org; Sun, 03 Jun 2012 11:01:31 -0400
Received: by qady23 with SMTP id y23so1323493qad.14
	for <bug-bash@gnu.org>; Sun, 03 Jun 2012 08:01:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type:content-transfer-encoding;
	bh=Sw+6ppZNHFiTMMWbdjPyLDHiRQhWQm4YmvCsOtAbxRc=;
	b=gD6i7j4mKl7fNV6gEYpxh/Ui3fC+bclLX2aYwD2esNLYFK+nXNSIRUkwij4ekHHNCT
	UIvR0OxHel/UWlj79ZlK/hv2AQJe/Kq1l+CjNLo3NdqAGb100CpvwU4XYLKtyeWH0L/i
	daApk1XWTWl+wwLhKboYtgA5RKekflEVv8Kx7usDdIMRlq3ZB6/eMNZKBdZkTEdsFF96
	coYSku8JOfcDlRmdALn49XY+5FVxMkYrXDLPmJEdbfzrM5rALP3xCM9U7cvWOzUdqUrG
	LiyFGd95sbDqJaN1/z//t5nrmoQ4YVbM1vREUVKdZ/3aI2fEnhfL7tutD7lz7wQmyD5I
	tymw==
MIME-Version: 1.0
Received: by 10.224.110.70 with SMTP id m6mr10761620qap.69.1338735689070; Sun,
	03 Jun 2012 08:01:29 -0700 (PDT)
Received: by 10.229.220.16 with HTTP; Sun, 3 Jun 2012 08:01:29 -0700 (PDT)
In-Reply-To: <4FCB5687.8000703@gmail.com>
References: <4FCB5687.8000703@gmail.com>
Date: Sun, 3 Jun 2012 17:01:29 +0200
Message-ID: <CAO-BiTJQdPtVFyR2yc4gAJ9JsHRLz8+CxbBLp511fkwc1cHirg@mail.gmail.com>
Subject: Re: Redirect a backgrounded process' stdout toward COPROC's stdin
From: Geir Hauge <geir.hauge@gmail.com>
To: bug-bash@gnu.org
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.216.48
Cc: Davide Baldini <baldiniebaldini@gmail.com>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 03 Jun 2012 15:01:35 -0000

2012/6/3 Davide Baldini <baldiniebaldini@gmail.com>:
> Description:
> In the following test script I run an elementary coprocess to which the
> echo built-in, run in background, attaches its standard-output:
>
> =A0 =A0#!/bin/bash
> =A0 =A0# TEST 1
> =A0 =A0coproc /bin/sleep 100
> =A0 =A0echo >&${COPROC[1]} &
>
> The script always fails, for no apparent reason, giving the output:
>
> =A0 =A0./test.sh: line 4: ${COPROC[1]}: Bad file descriptor

The coproc fds are only available in the same shell. The subshell
created with & cannot use them.


> I wonder if the correct syntax should be rather this one (ampersand
> moved before redirection):
>
> =A0 =A0#!/bin/bash
> =A0 =A0# TEST 2
> =A0 =A0coproc /bin/sleep 100
> =A0 =A0echo & >&${COPROC[1]}

This is equivalent to

echo &
>&${COPROC[1]}

& ends the command, so the redirection is not applied to the echo.


See http://wiki.bash-hackers.org/syntax/keywords/coproc

--=20
Geir Hauge


From MAILER-DAEMON Sun Jun 03 12:25:19 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SbDcF-0003jO-Ib
	for mharc-bug-bash@gnu.org; Sun, 03 Jun 2012 12:25:19 -0400
Received: from eggs.gnu.org ([208.118.235.92]:50959)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <baldiniebaldini@gmail.com>) id 1SbDcD-0003jI-Ax
	for bug-bash@gnu.org; Sun, 03 Jun 2012 12:25:18 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <baldiniebaldini@gmail.com>) id 1SbDcB-0002Jv-Fe
	for bug-bash@gnu.org; Sun, 03 Jun 2012 12:25:16 -0400
Received: from mail-we0-f169.google.com ([74.125.82.169]:55873)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <baldiniebaldini@gmail.com>) id 1SbDcB-0002Jp-5p
	for bug-bash@gnu.org; Sun, 03 Jun 2012 12:25:15 -0400
Received: by wefh52 with SMTP id h52so2955982wef.0
	for <bug-bash@gnu.org>; Sun, 03 Jun 2012 09:25:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=message-id:date:from:user-agent:mime-version:to:subject:references
	:in-reply-to:content-type:content-transfer-encoding;
	bh=WmD0Ca5l7lDffcoQWuvgeVZ8VDeL/KPMrLF9zdgj3/E=;
	b=v1mf6eVmUuKQDqnTJGZq2usyYnuVVAlQEeGnw/kJn6Byj4cAWMrzSXaPWx2yhv3jTS
	Wj4MyrfNyM+vOfCRBFy2tG2X05ybpVOWuQp5+SfMibBWKUBf3k2biD2Obd14s1Dlu8/x
	RU+eNDKQtIBaib/NMO29XYrrr6x2TfIp7gkNtzlz5JOJ9BA3e2BJYo2PWL45TpLIq/I7
	mtJjFPGOFn+GMTMjbUtr0kYw9pR/iE23Zv0qUU6AmV+cXsPXQimdTMH4+OdVJdDtNb9h
	0AzRC54iBKL9jxQNDbHFPAZ9qL1SCEDvlUEMc/0ywD93rK8P/ZMpOzeLgIPxHeQWvez1
	9CVQ==
Received: by 10.216.198.14 with SMTP id u14mr2709163wen.12.1338740713155;
	Sun, 03 Jun 2012 09:25:13 -0700 (PDT)
Received: from [192.168.1.11]
	(host152-245-dynamic.12-79-r.retail.telecomitalia.it.
	[79.12.245.152])
	by mx.google.com with ESMTPS id d10sm21974876wiy.3.2012.06.03.09.25.10
	(version=TLSv1/SSLv3 cipher=OTHER);
	Sun, 03 Jun 2012 09:25:12 -0700 (PDT)
Message-ID: <4FCB8F44.7070406@gmail.com>
Date: Sun, 03 Jun 2012 18:22:28 +0200
From: Davide Baldini <baldiniebaldini@gmail.com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
	rv:1.9.1.16) Gecko/20111110 Icedove/3.0.11
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Re: Redirect a backgrounded process' stdout toward COPROC's stdin
References: <4FCB5687.8000703@gmail.com>
	<CAO-BiTJQdPtVFyR2yc4gAJ9JsHRLz8+CxbBLp511fkwc1cHirg@mail.gmail.com>
In-Reply-To: <CAO-BiTJQdPtVFyR2yc4gAJ9JsHRLz8+CxbBLp511fkwc1cHirg@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.82.169
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 03 Jun 2012 16:25:18 -0000

On 06/03/12 17:01, Geir Hauge wrote:
> 2012/6/3 Davide Baldini <baldiniebaldini@gmail.com>:
>> Description:
>> In the following test script I run an elementary coprocess to which the
>> echo built-in, run in background, attaches its standard-output:
>>
>>    #!/bin/bash
>>    # TEST 1
>>    coproc /bin/sleep 100
>>    echo >&${COPROC[1]} &
>>
>> The script always fails, for no apparent reason, giving the output:
>>
>>    ./test.sh: line 4: ${COPROC[1]}: Bad file descriptor
> 
> The coproc fds are only available in the same shell. The subshell
> created with & cannot use them.
> 
> 
>> I wonder if the correct syntax should be rather this one (ampersand
>> moved before redirection):
>>
>>    #!/bin/bash
>>    # TEST 2
>>    coproc /bin/sleep 100
>>    echo & >&${COPROC[1]}
> 
> This is equivalent to
> 
> echo &
>> &${COPROC[1]}
> 
> & ends the command, so the redirection is not applied to the echo.
> 
> 
> See http://wiki.bash-hackers.org/syntax/keywords/coproc
> 

Thank you Geir, I really appreciated you help and the useful
bash-hackers.org link. Definitely, the GNU Bash manual would need some
deeper details on these niche features.


From MAILER-DAEMON Sun Jun 03 20:23:15 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SbL4l-0004rq-5z
	for mharc-bug-bash@gnu.org; Sun, 03 Jun 2012 20:23:15 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48063)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <alkisg@gmail.com>) id 1SbHdJ-0004AM-Ge
	for bug-bash@gnu.org; Sun, 03 Jun 2012 16:42:42 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <alkisg@gmail.com>) id 1SbHdH-0007Or-UM
	for bug-bash@gnu.org; Sun, 03 Jun 2012 16:42:41 -0400
Received: from mail-bk0-f41.google.com ([209.85.214.41]:51856)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <alkisg@gmail.com>) id 1SbHdH-0007On-LF
	for bug-bash@gnu.org; Sun, 03 Jun 2012 16:42:39 -0400
Received: by bkcjm19 with SMTP id jm19so3754564bkc.0
	for <bug-bash@gnu.org>; Sun, 03 Jun 2012 13:42:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=message-id:date:from:user-agent:mime-version:to:subject
	:content-type:content-transfer-encoding;
	bh=KTGeexE0hvf32LFkMhwilOZwAArZC98XoTgJsRWJh5g=;
	b=UkW5ZuUlq8wxvwFj1gdzCI8Aktr9jwvGCHPQMMnn2nfHObAousmtsjiFMpaxx8X/rT
	9xfExn6/qkn5dVi/A5x1bnrwQWIH4Q5NcyFT0u8CglMxzxVJdHJT2gQxvA6DXH72idhO
	jY5PYGNNotjXSGMa/Sw96XcXGPzRYLRhs1EEQG2RqAwm23skdJtWAfoiXXlpHRR0nU5v
	tlGw9FCSmFhoQM+ED5F21zRhvGLQnYYcm5eVfEna6muQUfsaSH3TgrrxYg2XoDEySm0H
	HSpoSoZAcJzf6WnnImvQZNfxKE4pKrIw5WISyBhu8keby/80KczP5NhIvhOGVrG5chzs
	4ITg==
Received: by 10.204.129.87 with SMTP id n23mr5081249bks.19.1338756156778;
	Sun, 03 Jun 2012 13:42:36 -0700 (PDT)
Received: from [10.160.31.10] (ppp089210151026.dsl.hol.gr. [89.210.151.26])
	by mx.google.com with ESMTPS id h18sm8156038bkh.8.2012.06.03.13.42.35
	(version=SSLv3 cipher=OTHER); Sun, 03 Jun 2012 13:42:35 -0700 (PDT)
Message-ID: <4FCBCC39.90503@gmail.com>
Date: Sun, 03 Jun 2012 23:42:33 +0300
From: Alkis Georgopoulos <alkisg@gmail.com>
User-Agent: Mozilla/5.0 (X11; Linux i686;
	rv:12.0) Gecko/20120430 Thunderbird/12.0.1
MIME-Version: 1.0
To: bug-bash@gnu.org, bash@packages.debian.org
Subject: bash -D doesn't parse $"translatable messages" inside heredocs
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.214.41
X-Mailman-Approved-At: Sun, 03 Jun 2012 20:23:13 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 03 Jun 2012 20:42:42 -0000

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/$
uname output: Linux alkis 3.2.0-24-generic-pae #39-Ubuntu SMP Mon May 21 
18:54:21 UTC 2012 i686 i686 i386 GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 4.2
Patch Level: 24
Release Status: release

Description:
bash -D doesn't parse $"translatable messages" inside heredocs.
Heredocs are nice for usage() functions and other cases,
it'd be nice for bash -D to support them.

Repeat-By:
Create the following script:

#!/bin/bash
cat <<EOF
$"message1"
$(echo $"message2")
EOF

Run bash -D script, it produces no output.

Please CC me as I'm not in the list. Thank you.


From MAILER-DAEMON Mon Jun 04 08:29:01 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SbWP7-0006WE-MV
	for mharc-bug-bash@gnu.org; Mon, 04 Jun 2012 08:29:01 -0400
Received: from eggs.gnu.org ([208.118.235.92]:55626)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SbWP4-0006VU-On
	for bug-bash@gnu.org; Mon, 04 Jun 2012 08:28:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SbWP3-0007bD-3e
	for bug-bash@gnu.org; Mon, 04 Jun 2012 08:28:58 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:52534
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SbWP2-0007Ws-To
	for bug-bash@gnu.org; Mon, 04 Jun 2012 08:28:57 -0400
Received: (qmail 20268 invoked from network); 4 Jun 2012 12:28:29 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Mon, 04 Jun 2012 08:28:29 -0400
Received: (qmail 18741 invoked by uid 563); 4 Jun 2012 12:28:28 -0000
Date: Mon, 4 Jun 2012 08:28:28 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: rac8006 <rac8006@aol.com>
Subject: Re: bash build
Message-ID: <20120604122828.GM1506@eeg.ccf.org>
References: <33947830.post@talk.nabble.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <33947830.post@talk.nabble.com>
User-Agent: Mutt/1.4.2.3i
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older,
	2)
X-Received-From: 139.137.100.1
Cc: Bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 04 Jun 2012 12:29:00 -0000

On Fri, Jun 01, 2012 at 04:39:08PM -0700, rac8006 wrote:
> 
> What is the proper way to add popd pushd dirs etc to bash.  When I currently
> build bash these
> are missing.  I also get an error libintl_ngettext undefined reference.  I
> can get around this error
> by adding -lintl to the link.  Just don't know how to get the Makefile to
> add -lintl.

You'll need to give details about your build platform and which
./configure options you used, if any.  Both of these things that you
mention should work by default using ./configure on any reasonable
Unix-like platform.


From MAILER-DAEMON Mon Jun 04 09:05:44 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SbWye-0005Ao-Uh
	for mharc-bug-bash@gnu.org; Mon, 04 Jun 2012 09:05:44 -0400
Received: from eggs.gnu.org ([208.118.235.92]:36071)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SbWyY-00059h-P4
	for bug-bash@gnu.org; Mon, 04 Jun 2012 09:05:43 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SbWyR-0007eC-CT
	for bug-bash@gnu.org; Mon, 04 Jun 2012 09:05:38 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:9256)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SbWyR-0007ds-7W
	for bug-bash@gnu.org; Mon, 04 Jun 2012 09:05:31 -0400
Received: from mpv5.tis.CWRU.Edu (EHLO mpv5.cwru.edu) ([129.22.105.51])
	by mpv1.tis.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id BZJ03508; Mon, 04 Jun 2012 09:05:29 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id AYE80626 (AUTH cpr);
	Mon, 04 Jun 2012 09:05:29 -0400 (EDT)
Message-ID: <4FCCB298.6090709@case.edu>
Date: Mon, 04 Jun 2012 09:05:28 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: John Malmberg <wb8tyw@gmail.com>
Subject: Re: lib/sh/mktime.c VMS specific code is not needed.
References: <4FCAA6EE.2090303@gmail.com>
In-Reply-To: <4FCAA6EE.2090303@gmail.com>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 04 Jun 2012 13:05:43 -0000

On 6/2/12 7:51 PM, John Malmberg wrote:
> The lib/sh/mktime.c module has a VMS specific include of <sys/types.h> to
> pick up time_t.

No, it doesn't.  VMS systems include <stddef.h>.

> On VMS, the time_t type is defined in the <time.h> module.
> 
> So this VMS specific include can be removed.

So there is nothing in <stddef.h> that VMS requires for <time.h>?  That is
the reason for that code block.


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


From MAILER-DAEMON Mon Jun 04 09:10:43 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SbX3T-0007SM-B6
	for mharc-bug-bash@gnu.org; Mon, 04 Jun 2012 09:10:43 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38379)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1SbX3Q-0007RC-CR
	for Bug-bash@gnu.org; Mon, 04 Jun 2012 09:10:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1SbX3K-0000wX-Hb
	for Bug-bash@gnu.org; Mon, 04 Jun 2012 09:10:39 -0400
Received: from sam.nabble.com ([216.139.236.26]:33661)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1SbX3K-0000vq-Cd
	for Bug-bash@gnu.org; Mon, 04 Jun 2012 09:10:34 -0400
Received: from telerig.nabble.com ([192.168.236.162])
	by sam.nabble.com with esmtp (Exim 4.72)
	(envelope-from <bounces@nabble.com>) id 1SbX3I-0006tU-DZ
	for Bug-bash@gnu.org; Mon, 04 Jun 2012 06:10:32 -0700
Message-ID: <33957745.post@talk.nabble.com>
Date: Mon, 4 Jun 2012 06:10:32 -0700 (PDT)
From: rac8006 <rac8006@aol.com>
To: Bug-bash@gnu.org
Subject: Re: bash build
In-Reply-To: <20120604122828.GM1506@eeg.ccf.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Nabble-From: rac8006@aol.com
References: <33947830.post@talk.nabble.com> <20120604122828.GM1506@eeg.ccf.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 216.139.236.26
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 04 Jun 2012 13:10:41 -0000


I've found out How to build bash without errors.  I needed to compile ncurses
and make the library available.  My system is a dns-323 NAS.  

Thanks for the response.

RAC

Greg Wooledge wrote:
> 
> On Fri, Jun 01, 2012 at 04:39:08PM -0700, rac8006 wrote:
>> 
>> What is the proper way to add popd pushd dirs etc to bash.  When I
>> currently
>> build bash these
>> are missing.  I also get an error libintl_ngettext undefined reference. 
>> I
>> can get around this error
>> by adding -lintl to the link.  Just don't know how to get the Makefile to
>> add -lintl.
> 
> You'll need to give details about your build platform and which
> ./configure options you used, if any.  Both of these things that you
> mention should work by default using ./configure on any reasonable
> Unix-like platform.
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/bash-build-tp33947830p33957745.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.



From MAILER-DAEMON Mon Jun 04 09:13:11 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SbX5r-000825-O7
	for mharc-bug-bash@gnu.org; Mon, 04 Jun 2012 09:13:11 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38855)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SbX5k-000809-TJ
	for bug-bash@gnu.org; Mon, 04 Jun 2012 09:13:10 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SbX5e-0001iT-He
	for bug-bash@gnu.org; Mon, 04 Jun 2012 09:13:04 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:33241)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SbX5e-0001iJ-Cx
	for bug-bash@gnu.org; Mon, 04 Jun 2012 09:12:58 -0400
Received: from mpv5.cwru.edu (mpv5.tis.CWRU.Edu [129.22.105.51])
	by mpv2.tis.cwru.edu (MOS 4.3.3-GA) with ESMTP id BLL84996;
	Mon, 4 Jun 2012 09:12:56 -0400
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id AYE81715 (AUTH cpr);
	Mon, 04 Jun 2012 09:12:56 -0400 (EDT)
Message-ID: <4FCCB458.2020105@case.edu>
Date: Mon, 04 Jun 2012 09:12:56 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Davide Baldini <baldiniebaldini@gmail.com>
Subject: Re: Redirect a backgrounded process' stdout toward COPROC's stdin
References: <4FCB5687.8000703@gmail.com>
In-Reply-To: <4FCB5687.8000703@gmail.com>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv2.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.37
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 04 Jun 2012 13:13:11 -0000

On 6/3/12 8:20 AM, Davide Baldini wrote:
> Machine: i486
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS: -O2 -march='i486' (plus the flags added by Makefile)
> uname output: Linux debianBunker 2.6.26-2-686 #1 SMP Wed Sep 21 04:35:47
> UTC 2011 i686 GNU/Linux
> Machine Type: i486-pc-linux-gnu
> 
> Bash Version: 4.2.0(5)-release
> Patch Level: 5
> Release Status: release
> 
> Description:
> In the following test script I run an elementary coprocess to which the
> echo built-in, run in background, attaches its standard-output:
> 
>     #!/bin/bash
>     # TEST 1
>     coproc /bin/sleep 100
>     echo >&${COPROC[1]} &
> 
> The script always fails, for no apparent reason, giving the output:
> 
>     ./test.sh: line 4: ${COPROC[1]}: Bad file descriptor

Coproc file descriptors are not available to subshells.  They're
implemented using pipes, and leaving pipe file descriptors open in
subshells causes processes to hang and not terminate properly, which
results in very hard-to-track-down-and-reproduce bugs.

Chet

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


From MAILER-DAEMON Mon Jun 04 09:55:50 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SbXl8-0003XP-05
	for mharc-bug-bash@gnu.org; Mon, 04 Jun 2012 09:55:50 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58132)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SbXky-0003X6-Ez
	for bug-bash@gnu.org; Mon, 04 Jun 2012 09:55:48 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SbXko-0000hv-IP
	for bug-bash@gnu.org; Mon, 04 Jun 2012 09:55:40 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:60491)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SbXko-0000hC-DU
	for bug-bash@gnu.org; Mon, 04 Jun 2012 09:55:30 -0400
Received: from mpv6.tis.cwru.edu (EHLO mpv6.cwru.edu) ([129.22.104.221])
	by mpv1.tis.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id BZJ11183 (AUTH cpr);
	Mon, 04 Jun 2012 09:55:28 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id AYH00129 (AUTH cpr);
	Mon, 04 Jun 2012 09:55:27 -0400 (EDT)
Message-ID: <4FCCBE4F.8000907@case.edu>
Date: Mon, 04 Jun 2012 09:55:27 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Pierre Gaston <pierre.gaston@gmail.com>
Subject: Re: .bashrc is sourced even for non-interactive shells (when run
	from sshd)
References: <CACVmpreVwVTGcUAC7+7sP6nHOSbYHeW33RR6D2g7+O76B99sdA@mail.gmail.com>
	<CAPSX3sR99tojv90Dhofx+3HHWozUr8k391ZisrB_9gsc8N7dMQ@mail.gmail.com>
	<CACVmprfbg8F7K_+S-K9dvOTgAps9JUr+gac=Oe6ZAAGkfY62OA@mail.gmail.com>
	<CAPSX3sTMTt1t--5MZEzipJ9VamZ=R7EjxrghT7o=834dLm6YWA@mail.gmail.com>
	<4FCAAA4F.7030007@tlinx.org>
	<CAPSX3sToK38rfLRO76RtO=cui84zOOT8ABrN1gKz=hMVVDy3NA@mail.gmail.com>
	<4FCB1A09.3030306@tlinx.org>
	<CAPSX3sTRPkiVKmhCBnfFCLUYBcxU604VTjS6yMpFubPi94UaQw@mail.gmail.com>
In-Reply-To: <CAPSX3sTRPkiVKmhCBnfFCLUYBcxU604VTjS6yMpFubPi94UaQw@mail.gmail.com>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: Linda Walsh <bash@tlinx.org>, bug-bash <bug-bash@gnu.org>,
	chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 04 Jun 2012 13:55:48 -0000

On 6/3/12 4:25 AM, Pierre Gaston wrote:

> I thought I was not documented (before 4 it was a bit less obvious
> to find the relevant bit) that's why I gave the link, but it is in
> fact documented.
> Eg in the bash 4 manual:
> 
> 	Bash attempts  to determine  when it is  being run  with its
> 	standard input  connected to  a network connection,  as when
> 	executed by  the remote shell  daemon, usually rshd,  or the
> 	secure shell  daemon sshd.  If  bash determines it  is being
> 	run  in this fashion,  it reads  and executes  commands from
> 	~/.bashrc  and  ~/.bashrc,  if  these files  exist  and  are
> 	readable.
> 
> If I'm not mistaken this feature is inherited from csh. I can
> guess some people are using it since there is this workaround
> testing for the SSH variables to make it work with openssh>5.

That's not exactly it, but the idea is right.  isnetconn() (previously
issock()) has been around since bash-1.13.  If I had to guess, I'd say
late August 1992 or 1993.  It wasn't inherited from csh.  The original
requests were along the lines of having something to set the remote
environment when running rsh or rcp. As you can see, this long predates
ssh.

As ssh became more popular, there were different ways to accomplish the
same thing (e.g., put BASH_ENV=startup-file into ~/.ssh/environment), but
there were still requests to leave the feature in bash.  It's still there
today.

Chet

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


From MAILER-DAEMON Mon Jun 04 11:44:54 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SbZSg-000104-Qq
	for mharc-bug-bash@gnu.org; Mon, 04 Jun 2012 11:44:54 -0400
Received: from eggs.gnu.org ([208.118.235.92]:54781)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <steveo@syslang.net>) id 1SbZSd-0000zp-DI
	for bug-bash@gnu.org; Mon, 04 Jun 2012 11:44:54 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <steveo@syslang.net>) id 1SbZSY-0007Em-IU
	for bug-bash@gnu.org; Mon, 04 Jun 2012 11:44:50 -0400
Received: from saturn.syslang.net ([207.172.210.41]:51979)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <steveo@syslang.net>) id 1SbZSY-0007Dh-Di
	for bug-bash@gnu.org; Mon, 04 Jun 2012 11:44:46 -0400
Received: from [IPv6:::1] (localhost [127.0.0.1])
	by saturn.syslang.net (8.14.5/8.14.5) with ESMTP id q54Fig8u029454
	for <bug-bash@gnu.org>; Mon, 4 Jun 2012 11:44:42 -0400
Message-ID: <4FCCD7EA.2060509@syslang.net>
Date: Mon, 04 Jun 2012 11:44:42 -0400
From: "Steven W. Orr" <steveo@syslang.net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US;
	rv:1.9.2.28) Gecko/20120306 Thunderbird/3.1.20
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Re: .bashrc is sourced even for non-interactive shells (when run
	from sshd)
References: <CACVmpreVwVTGcUAC7+7sP6nHOSbYHeW33RR6D2g7+O76B99sdA@mail.gmail.com>	<CAPSX3sR99tojv90Dhofx+3HHWozUr8k391ZisrB_9gsc8N7dMQ@mail.gmail.com>	<CACVmprfbg8F7K_+S-K9dvOTgAps9JUr+gac=Oe6ZAAGkfY62OA@mail.gmail.com>	<CAPSX3sTMTt1t--5MZEzipJ9VamZ=R7EjxrghT7o=834dLm6YWA@mail.gmail.com>	<4FCAAA4F.7030007@tlinx.org>	<CAPSX3sToK38rfLRO76RtO=cui84zOOT8ABrN1gKz=hMVVDy3NA@mail.gmail.com>	<4FCB1A09.3030306@tlinx.org>	<CAPSX3sTRPkiVKmhCBnfFCLUYBcxU604VTjS6yMpFubPi94UaQw@mail.gmail.com>
	<4FCCBE4F.8000907@case.edu>
In-Reply-To: <4FCCBE4F.8000907@case.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 207.172.210.41
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 04 Jun 2012 15:44:54 -0000

On 6/4/2012 9:55 AM, Chet Ramey wrote:

>
> That's not exactly it, but the idea is right.  isnetconn() (previously
> issock()) has been around since bash-1.13.  If I had to guess, I'd say
> late August 1992 or 1993.  It wasn't inherited from csh.  The original
> requests were along the lines of having something to set the remote
> environment when running rsh or rcp. As you can see, this long predates
> ssh.
>
> As ssh became more popular, there were different ways to accomplish the
> same thing (e.g., put BASH_ENV=startup-file into ~/.ssh/environment), but
> there were still requests to leave the feature in bash.  It's still there
> today.

I guess I'm just looking for confirmation that what I'm doing is correct. I've 
been going to some lengths to ensure that the environment that I get for a 
non-interactive script gets at least the minimal environment that I expect. I 
do this by expecting my .bashrc to always get pulled in and to see if PS1 is 
set. If PS1 is *not* set then I pull in a common script that sets my 
environment the same as if I had set it in my .bash_profile .

Does this sound correct?

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net


From MAILER-DAEMON Mon Jun 04 12:42:12 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SbaM7-0005Q8-Vg
	for mharc-bug-bash@gnu.org; Mon, 04 Jun 2012 12:42:11 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57867)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dave_br@gmx.com>) id 1SbaM0-0005PN-FV
	for bug-bash@gnu.org; Mon, 04 Jun 2012 12:42:10 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dave_br@gmx.com>) id 1SbaLu-0007iC-8Y
	for bug-bash@gnu.org; Mon, 04 Jun 2012 12:42:04 -0400
Received: from mail1.bemta3.messagelabs.com ([195.245.230.34]:17372)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dave_br@gmx.com>) id 1SbaLu-0007hJ-1T
	for bug-bash@gnu.org; Mon, 04 Jun 2012 12:41:58 -0400
Received: from [85.158.137.35:35689] by server-3.bemta-3.messagelabs.com id
	44/6D-15793-355ECCF4; Mon, 04 Jun 2012 16:41:55 +0000
X-Env-Sender: dave_br@gmx.com
X-Msg-Ref: server-5.tower-134.messagelabs.com!1338828115!25840296!1
X-Originating-IP: [88.87.214.78]
X-StarScan-Version: 6.5.10; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15628 invoked from network); 4 Jun 2012 16:41:55 -0000
Received: from unknown (HELO imaps.oficinas.atrapalo.com) (88.87.214.78)
	by server-5.tower-134.messagelabs.com with SMTP;
	4 Jun 2012 16:41:55 -0000
Received: from beaker (pc-0511-005.oficinas.atrapalo.com [10.15.14.5])
	by imaps.oficinas.atrapalo.com (Postfix) with SMTP id 69781EC04B
	for <bug-bash@gnu.org>; Mon,  4 Jun 2012 18:41:54 +0200 (CEST)
Received: by beaker (sSMTP sendmail emulation); Mon, 04 Jun 2012 18:42:20 +0200
Date: Mon, 04 Jun 2012 18:42:20 +0200
From: "Davide Brini" <dave_br@gmx.com>
To: bug-bash@gnu.org
Subject: Incorrect mangling of multiline array assignment in history
Message-Id: <20120604164154.69781EC04B@imaps.oficinas.atrapalo.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 195.245.230.34
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 04 Jun 2012 16:42:10 -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   -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -DDEFAULT_PATH_VALUE='/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin' -DSTANDARD_UTILS_PATH='/usr/bin:/bin:/usr/sbin:/sbin' -DSYS_BASHRC='/etc/bash.bashrc' -DSYS_BASH_LOGOUT='/etc/bash.bash_logout'
uname output: Linux beaker 3.3.7-1-ARCH #1 SMP PREEMPT Tue May 22 00:26:26 CEST 2012 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

Bash Version: 4.2
Patch Level: 29
Release Status: release

Description:
	To insert them in the history, bash converts multiline commands into a single line, normally replacing newlines with semicolons. However, if the multiline command happens to be an array assignment, adding the semicolon isn't always correct.

Repeat-By:

I'm not sure exactly when it happens, however this seems to more or less trigger it regularly:

$ xxx=(a b c d
> )

(we hit enter after the "d", to complete the assignment on the next line. ">" is the PS2 prompt)

$ declare -p xxx
declare -a xxx='([0]="a" [1]="b" [2]="c" [3]="d")'

Now hit up arrow twice to recall the array assignment and we get this:

$ xxx=(a b c d; )
-bash: syntax error near unexpected token `;'

Fix:
        No idea!


From MAILER-DAEMON Mon Jun 04 18:40:30 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sbfws-0006lE-Lr
	for mharc-bug-bash@gnu.org; Mon, 04 Jun 2012 18:40:30 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33228)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wb8tyw@qsl.net>) id 1Sbfwq-0006l2-6T
	for bug-bash@gnu.org; Mon, 04 Jun 2012 18:40:29 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wb8tyw@qsl.net>) id 1Sbfwo-0002T2-Iv
	for bug-bash@gnu.org; Mon, 04 Jun 2012 18:40:27 -0400
Received: from eisner.encompasserve.org ([67.53.90.116]:52496
	helo=Encompasserve.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wb8tyw@qsl.net>) id 1Sbfwo-0002Sf-Eg
	for bug-bash@gnu.org; Mon, 04 Jun 2012 18:40:26 -0400
Received: from CONVERSION-DAEMON.Encompasserve.org by Encompasserve.org
	(PMDF V6.5-x7 #36614) id <01OGAOE1BD800067ZS@Encompasserve.org> for
	bug-bash@gnu.org; Mon, 04 Jun 2012 17:40:22 -0500 (CDT)
Received: from [192.168.0.101]
	(173-19-202-206.client.mchsi.com [173.19.202.206])
	by Encompasserve.org (PMDF V6.5-x7 #36614)
	with ESMTPSA id <01OGAOE0T01U005J7V@Encompasserve.org>; Mon,
	04 Jun 2012 17:40:22 -0500 (CDT)
Date: Mon, 04 Jun 2012 17:39:43 -0500
From: "John E. Malmberg" <wb8tyw@qsl.net>
Subject: Re: lib/sh/mktime.c VMS specific code is not needed.
In-reply-to: <4FCCB298.6090709@case.edu>
To: chet.ramey@case.edu
Message-id: <4FCD392F.1050904@qsl.net>
MIME-version: 1.0
Content-type: text/plain; format=flowed; charset=ISO-8859-1
Content-transfer-encoding: 7BIT
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20120129
	Thunderbird/10.0
References: <4FCAA6EE.2090303@gmail.com> <4FCCB298.6090709@case.edu>
X-detected-operating-system: by eggs.gnu.org: OpenVMS 7.2 (Multinet 4.3-4.4
	stack)
X-Received-From: 67.53.90.116
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 04 Jun 2012 22:40:29 -0000

On 6/4/2012 8:05 AM, Chet Ramey wrote:
> On 6/2/12 7:51 PM, John Malmberg wrote:
>> The lib/sh/mktime.c module has a VMS specific include of<sys/types.h>  to
>> pick up time_t.
>
> No, it doesn't.  VMS systems include<stddef.h>.

I see I read it wrong.

>> On VMS, the time_t type is defined in the<time.h>  module.
>>
>> So this VMS specific include can be removed.
>
> So there is nothing in<stddef.h>  that VMS requires for<time.h>?  That is
> the reason for that code block.

That is correct.  On VMS, <time.h> will pull in everything that it needs.

I also posted on May 12th, that VMS specific code in lib/glob/ndir.h was 
obsolete and would not work on current versions of VMS.  That header 
file is also not used when building bash on VMS, so it can just be 
removed.  I did not see any responses to that.

Regards,
-John


From MAILER-DAEMON Mon Jun 04 20:49:55 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sbhy7-0005dl-0D
	for mharc-bug-bash@gnu.org; Mon, 04 Jun 2012 20:49:55 -0400
Received: from eggs.gnu.org ([208.118.235.92]:40305)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sbhy4-0005df-SW
	for bug-bash@gnu.org; Mon, 04 Jun 2012 20:49:54 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sbhy2-0000Ip-Tw
	for bug-bash@gnu.org; Mon, 04 Jun 2012 20:49:52 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:39644)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sbhy2-0000Ij-P5
	for bug-bash@gnu.org; Mon, 04 Jun 2012 20:49:50 -0400
Received: from mpv8.tis.cwru.edu (EHLO mpv8.case.edu) ([129.22.105.116])
	by mpv1.tis.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id BZJ76129 (AUTH cpr);
	Mon, 04 Jun 2012 20:49:48 -0400 (EDT)
Received: from h191.11.172.72.dynamic.ip.windstream.net (EHLO z4.local)
	([72.172.11.191]) by mpv8.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id UIB14600 (AUTH cpr);
	Mon, 04 Jun 2012 20:49:48 -0400 (EDT)
Message-ID: <4FCD57A9.70209@case.edu>
Date: Mon, 04 Jun 2012 20:49:45 -0400
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: "John E. Malmberg" <wb8tyw@qsl.net>
Subject: Re: lib/sh/mktime.c VMS specific code is not needed.
References: <4FCAA6EE.2090303@gmail.com> <4FCCB298.6090709@case.edu>
	<4FCD392F.1050904@qsl.net>
In-Reply-To: <4FCD392F.1050904@qsl.net>
X-Enigmail-Version: 1.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 05 Jun 2012 00:49:54 -0000

On 6/4/12 6:39 PM, John E. Malmberg wrote:

>> So there is nothing in<stddef.h>  that VMS requires for<time.h>?  That is
>> the reason for that code block.
> 
> That is correct.  On VMS, <time.h> will pull in everything that it needs.

Thanks.

> I also posted on May 12th, that VMS specific code in lib/glob/ndir.h was
> obsolete and would not work on current versions of VMS.  That header file
> is also not used when building bash on VMS, so it can just be removed.  I
> did not see any responses to that.

That file hasn't changed in more than 20 years.  If it's not used or needed
on VMS, I don't see any reason to change it now.

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


From MAILER-DAEMON Tue Jun 05 00:14:23 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sbl9z-00008O-IA
	for mharc-bug-bash@gnu.org; Tue, 05 Jun 2012 00:14:23 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52904)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <scotty.mcmillan@gmail.com>) id 1Sbl9x-00008H-2u
	for bug-bash@gnu.org; Tue, 05 Jun 2012 00:14:22 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <scotty.mcmillan@gmail.com>) id 1Sbl9u-0003Wn-SS
	for bug-bash@gnu.org; Tue, 05 Jun 2012 00:14:20 -0400
Received: from mail-pz0-f41.google.com ([209.85.210.41]:57180)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <scotty.mcmillan@gmail.com>) id 1Sbl9u-0003Vk-Gw
	for bug-bash@gnu.org; Tue, 05 Jun 2012 00:14:18 -0400
Received: by dakp5 with SMTP id p5so7026431dak.0
	for <bug-bash@gnu.org>; Mon, 04 Jun 2012 21:14:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:date:message-id:subject:from:to:content-type;
	bh=MCUuSa0QFIKPryfy/UYCvUWztPI+ft445Oh/6kMaip0=;
	b=V+Kvjf9y2T+I4HYQ5pSKoN0/J2a0/8RdN/5CqFaz+BF1yt/dVLwxp+BmDWntrdcRcu
	pjSO3XVsLcHD6WBxiehTKgXZJTgO/QS3ONUIXZlOARpnsdpIoNjy/sCk9FxNWtTLtlKw
	eYC8eC0gS+TZ50EDKJYZsWKpZLR+Kr1qePEpm0sIr0FEr17gs/wJGqJx8m9OXwom8Pt+
	9J1TGjEIwMQNnM6c5xsJiDmO/DnyMzDcleu6JrTLoLMjKdjX7ZtlB7M/5XrkI785ebVo
	MjKe4wD1bRqOO/lj7tV13wM4hRZGLD36IAveZJGcJgQXLv/RlMs80PZaASzexZjOVjDa
	u0Bg==
MIME-Version: 1.0
Received: by 10.68.242.7 with SMTP id wm7mr46002375pbc.98.1338869655148; Mon,
	04 Jun 2012 21:14:15 -0700 (PDT)
Received: by 10.68.49.130 with HTTP; Mon, 4 Jun 2012 21:14:14 -0700 (PDT)
Date: Tue, 5 Jun 2012 14:14:14 +1000
Message-ID: <CAPS0J2Hmxh9GOEYRBA3v_uzUiawEd=GcYLEg6mzcXaWO7FpC6Q@mail.gmail.com>
Subject: Brace expansion infinite loop, memory corruption, and other bugs.
From: Scott McMillan <scotty.mcmillan@gmail.com>
To: bug-bash@gnu.org
Content-Type: multipart/mixed; boundary=047d7b339cd13217a504c1b1e21a
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.210.41
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 05 Jun 2012 04:14:22 -0000

--047d7b339cd13217a504c1b1e21a
Content-Type: text/plain; charset=ISO-8859-1

A week or so ago I submitted a bug report using the bashbug command
that involved some
overflow issues with braces.c on OpenSUSE12.1 X86_64. Browsing the
patches, I got
the impression that braces.c hasn't been modified since the original
4.2 release, so the
same bugs should exist in the most recent version.

I also submitted potential fixes for the issues. I noticed that the
code in the patch I
submitted was forgetting to set errno = 0 before calling strtoimax.
Therefore I thought I
might as well send a slightly updated patch, which is a bit neater and
at least doesn't have
that particular bug in it.

Regards,
Scott.

----------------------------------PREVIOUS MESSAGE FOR
REFERENCE------------------------------------
From: scotty.mcmillan@gmail.com <Scott McMillan>
To: bug-bash@gnu.org
Subject: Brace expansion infinite loop, memory corruption, and other bugs.

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc -I/home/abuild/rpmbuild/BUILD/bash-4.2
-L/home/abuild/rpmbuild/BUILD/bash-4.2/../readline-6.2
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-suse-linux-gnu'
-DCONF_VENDOR='suse' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -fmessage-length=0 -O2 -Wall
-D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables
-fasynchronous-unwind-tables -g  -D_GNU_SOURCE -DRECYCLES_PIDS -Wall -g
-std=gnu89 -Wuninitialized -Wextra -Wno-unprototyped-calls -Wno-switch-enum
-Wno-unused-variable -Wno-unused-parameter -ftree-loop-linear -pipe
-fprofile-use
uname output: Linux wks-smcmillan 3.1.10-1.9-desktop #1 SMP PREEMPT Thu Apr 5
18:48:38 UTC 2012 (4a97ec8) x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-suse-linux-gnu

Bash Version: 4.2
Patch Level: 10
Release Status: release

Description:
    The errors are all to do with brace expansion in braces.c.
    1) echo {9223372036854775806..9223372036854775807} was getting an
      infinite loop (or crash with memory corruption or seg fault). The
      error was in the mkseq function, because the increment of n done
      before checking the loop termination condition was susceptible to
      incidences of undefined signed integer overflow. This is fixed in the
      patch below.
    2) The rhs value and any user-specified increment value were always
      clamped to the valid range while the sequence would refuse to expand
      if lhs was out of range. This is because strtoimax clamps on
      under/overflow and sets errno, but errno was only getting checked
      for lhs (inside the legal_number function). expand_seqterm has been
      changed in the patch below so that errno is checked after using
      strtoimax to read the rhs and incr values. This gives more correct
      and consistent behaviour.
    3) The incr value was an int but was getting read using strtoimax, so
      values beyond the range of an int were getting truncated. incr has
      been changed to intmax_t in the patch below to fix this problem.
    4) -incr in mkseq must be valid since the sign is switched depending on
      the order of start and end. There was potential undefined behaviour
      where it was equal to INTMAX_MIN. expand_seqterm now guarantees -incr
      will be valid in the patch below.
    5) echo {0..9223372036854775807} was getting a segmentation fault due
      to overflow calculating the result size in mkseq. This is because the
      result size calculated in mkseq is an int (necessarily, since
      strvec_create takes an int as an argument), and because the wrong
      absolute value function was getting used (abs instead of imaxabs).
      After applying the patch below, expand_seqterm makes extra guarantees
      on the end and start values passed to mkseq such that no overflow
      will occur during the calculation and the result will not overflow
      int. This means that the example input given would fail to expand.
      Input such as {0..2147483645} will likely give an out of memory
      error, which is preferable to segmentation faults or corrupted memory.

Repeat-By:
    1) echo {9223372036854775806..9223372036854775807}
    2) echo {9223372036854775806..9223372036854775808} (note second value
      is more than INTMAX_MAX, but the output before applying the patch
      is as if it were equal to INTMAX_MAX).
    3) echo {0..10..9223372036854775807}.
    4) Self-evident from code, -INTMAX_MIN is not valid.
    5) echo {0..9223372036854775807}

Fix:
    A patch to apply to braces.c to fix the issues mentioned above has been
    pasted in below. The fixes are:
    1) Check for overflow before incrementing in the loop in mkseq.
    2) Check errno after strtoimax when reading the rhs and incr values
      in expand_seqterm.
    3) incr in expand_seqterm and mkseq is now intmax_t.
    4) expand_seqterm verifies that -incr is not undefined.
    5) code uses imaxabs for intmax_t values and expand_seqterm verifies
      the start and end values won't result in a range that overflows
      INT_MAX.

<old patch removed>

--047d7b339cd13217a504c1b1e21a
Content-Type: application/octet-stream; name="braces.c.patch"
Content-Disposition: attachment; filename="braces.c.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_h32gdvuc0

KioqIGJyYWNlcy5jCQkyMDEyLTA1LTI5IDEzOjAyOjQ2LjEzODAwODU5MiArMTAwMAotLS0gYmFz
aC00LjItcGF0Y2hlZC9icmFjZXMuYwkyMDEyLTA2LTA1IDEzOjQ1OjI5LjU1NTY5NDkzMyArMTAw
MAoqKioqKioqKioqKioqKioKKioqIDMxLDM2ICoqKioKLS0tIDMxLDM3IC0tLS0KICAjICBpbmNs
dWRlIDx1bmlzdGQuaD4KICAjZW5kaWYKICAKKyAjaW5jbHVkZSA8ZXJybm8uaD4KICAjaW5jbHVk
ZSAiYmFzaGFuc2kuaCIKICAKICAjaWYgZGVmaW5lZCAoU0hFTEwpCioqKioqKioqKioqKioqKgoq
KiogNjMsNjkgKioqKgogIHN0YXRpYyBpbnQgYnJhY2VfZ29iYmxlciBfX1AoKGNoYXIgKiwgc2l6
ZV90LCBpbnQgKiwgaW50KSk7CiAgc3RhdGljIGNoYXIgKipleHBhbmRfYW1ibGUgX19QKChjaGFy
ICosIHNpemVfdCwgaW50KSk7CiAgc3RhdGljIGNoYXIgKipleHBhbmRfc2VxdGVybSBfX1AoKGNo
YXIgKiwgc2l6ZV90KSk7CiEgc3RhdGljIGNoYXIgKipta3NlcSBfX1AoKGludG1heF90LCBpbnRt
YXhfdCwgaW50LCBpbnQsIGludCkpOwogIHN0YXRpYyBjaGFyICoqYXJyYXlfY29uY2F0IF9fUCgo
Y2hhciAqKiwgY2hhciAqKikpOwogICNlbHNlCiAgc3RhdGljIGludCBicmFjZV9nb2JibGVyICgp
OwotLS0gNjQsNzAgLS0tLQogIHN0YXRpYyBpbnQgYnJhY2VfZ29iYmxlciBfX1AoKGNoYXIgKiwg
c2l6ZV90LCBpbnQgKiwgaW50KSk7CiAgc3RhdGljIGNoYXIgKipleHBhbmRfYW1ibGUgX19QKChj
aGFyICosIHNpemVfdCwgaW50KSk7CiAgc3RhdGljIGNoYXIgKipleHBhbmRfc2VxdGVybSBfX1Ao
KGNoYXIgKiwgc2l6ZV90KSk7CiEgc3RhdGljIGNoYXIgKipta3NlcSBfX1AoKGludG1heF90LCBp
bnRtYXhfdCwgaW50bWF4X3QsIGludCwgaW50KSk7CiAgc3RhdGljIGNoYXIgKiphcnJheV9jb25j
YXQgX19QKChjaGFyICoqLCBjaGFyICoqKSk7CiAgI2Vsc2UKICBzdGF0aWMgaW50IGJyYWNlX2dv
YmJsZXIgKCk7CioqKioqKioqKioqKioqKgoqKiogMzA1LDMzMCAqKioqCiAgI2RlZmluZSBTVF9D
SEFSCTIKICAjZGVmaW5lIFNUX1pJTlQJMwogIAogIHN0YXRpYyBjaGFyICoqCiAgbWtzZXEgKHN0
YXJ0LCBlbmQsIGluY3IsIHR5cGUsIHdpZHRoKQohICAgICAgaW50bWF4X3Qgc3RhcnQsIGVuZDsK
ISAgICAgIGludCBpbmNyLCB0eXBlLCB3aWR0aDsKICB7CiAgICBpbnRtYXhfdCBuOwogICAgaW50
IGk7CiAgICBjaGFyICoqcmVzdWx0LCAqdDsKICAKLSAgIGkgPSBhYnMgKGVuZCAtIHN0YXJ0KSAr
IDE7Ci0gICByZXN1bHQgPSBzdHJ2ZWNfY3JlYXRlIChpICsgMSk7Ci0gCiAgICBpZiAoaW5jciA9
PSAwKQogICAgICBpbmNyID0gMTsKICAgIAogICAgaWYgKHN0YXJ0ID4gZW5kICYmIGluY3IgPiAw
KQogICAgICBpbmNyID0gLWluY3I7CiAgICBlbHNlIGlmIChzdGFydCA8IGVuZCAmJiBpbmNyIDwg
MCkKICAgICAgaW5jciA9IC1pbmNyOwohIAogICAgLyogTWFrZSBzdXJlIHdlIGdvIHRocm91Z2gg
dGhlIGxvb3AgYXQgbGVhc3Qgb25jZSwgc28gezMuLjN9IHByaW50cyBgMycgKi8KICAgIGkgPSAw
OwogICAgbiA9IHN0YXJ0OwotLS0gMzA2LDM3NyAtLS0tCiAgI2RlZmluZSBTVF9DSEFSCTIKICAj
ZGVmaW5lIFNUX1pJTlQJMwogIAorIC8qIFJldHVybnMgdHJ1ZSBpZiBsaHMgKyByaHMgd291bGQg
dW5kZXIvb3ZlcmZsb3cgb3V0c2lkZSBvZiBbbWludmFsLCBtYXh2YWxdLiovCisgc3RhdGljIGlu
dAorIGFkZHdpbGxvdmVyZmxvdyhsaHMsIHJocywgbWludmFsLCBtYXh2YWwpCisgICAgICAgaW50
bWF4X3QgbGhzLCByaHMsIG1pbnZhbCwgbWF4dmFsOworIHsKKyAgIHJldHVybgorICAgICAoKChs
aHMgPiAwKSAmJiAocmhzID4gKG1heHZhbCAtIGxocykpKQorICAgICB8fAorICAgICAoKGxocyA8
IDApICYmIChyaHMgPCAobWludmFsIC0gbGhzKSkpKTsKKyB9CisgCisgLyogUmV0dXJucyB0cnVl
IGlmIGxocyAtIHJocyB3b3VsZCB1bmRlci9vdmVyZmxvdyBvdXRzaWRlIG9mIFttaW52YWwsIG1h
eHZhbF0uKi8KKyBzdGF0aWMgaW50Cisgc3VidHJhY3R3aWxsb3ZlcmZsb3cobGhzLCByaHMsIG1p
bnZhbCwgbWF4dmFsKQorICAgICAgIGludG1heF90IGxocywgcmhzLCBtaW52YWwsIG1heHZhbDsK
KyB7CisgICByZXR1cm4KKyAgICAgKCgocmhzID4gMCkgJiYgKGxocyA8IChtaW52YWwgKyByaHMp
KSkKKyAgICAgfHwKKyAgICAgKChyaHMgPCAwKSAmJiAobGhzID4gKG1heHZhbCArIHJocykpKSk7
CisgfQorIAorIC8qIFdpbGwgcmV0dXJuIE5VTEwgb24gZXJyb3IuICovCiAgc3RhdGljIGNoYXIg
KioKICBta3NlcSAoc3RhcnQsIGVuZCwgaW5jciwgdHlwZSwgd2lkdGgpCiEgICAgICBpbnRtYXhf
dCBzdGFydCwgZW5kLCBpbmNyOwohICAgICAgaW50IHR5cGUsIHdpZHRoOwogIHsKICAgIGludG1h
eF90IG47CiAgICBpbnQgaTsKICAgIGNoYXIgKipyZXN1bHQsICp0OwogIAogICAgaWYgKGluY3Ig
PT0gMCkKICAgICAgaW5jciA9IDE7CiAgICAKICAgIGlmIChzdGFydCA+IGVuZCAmJiBpbmNyID4g
MCkKKyAgIHsKICAgICAgaW5jciA9IC1pbmNyOworICAgfQogICAgZWxzZSBpZiAoc3RhcnQgPCBl
bmQgJiYgaW5jciA8IDApCisgICB7CisgICAgIC8qIE1ha2Ugc3VyZSBub3QgZXZhbHVhdGluZyAt
SU5UTUFYX01JTi4gKi8KKyAgICAgaWYgKGluY3IgPT0gSU5UTUFYX01JTikKKyAgICAgeworICAg
ICAgIHJldHVybiAoKGNoYXIgKiopTlVMTCk7CisgICAgIH0KKyAgICAgCiAgICAgIGluY3IgPSAt
aW5jcjsKISAgIH0KISAgIAohICAgLyogc3RydmVjX2NyZWF0ZSBhcmd1bWVudCBpcyBhbiBpbnQs
IHNvIG11c3QgbWFrZSBzdXJlIHRoYXQgdGhlIG51bWJlciBvZgohICAgZWxlbWVudHMgaW4gdGhl
IHNlcXVlbmNlIChpbWF4YWJzKGVuZCAtIHN0YXJ0KSArIDEpLCArIDEgZm9yIGEgTlVMTAohICAg
dGVybWluYXRvciwgZG9lcyBub3Qgb3ZlcmZsb3cgaW50LiAqLwohICAgaWYgKHN1YnRyYWN0d2ls
bG92ZXJmbG93KGVuZCwgc3RhcnQsIElOVE1BWF9NSU4gKyAxICsgMiwgSU5UTUFYX01BWCAtIDIp
CiEgICAgIHx8CiEgICAgICgoaW1heGFicyhlbmQgLSBzdGFydCkgKyAyKSA+IElOVF9NQVgpKQoh
ICAgewohICAgICByZXR1cm4gKChjaGFyICoqKU5VTEwpOwohICAgfQohICAgCiEgICBpID0gaW1h
eGFicyhlbmQgLSBzdGFydCkgKyAxICsgMTsKISAgIAohICAgLyogTm90ZTogcG90ZW50aWFsbHkg
YWxsb2NhdGluZyBhIGxvdCBtb3JlIG1lbW9yeSB0aGFuIHJlcXVpcmVkIGlmCiEgICAgaW5jciA+
IDEuICovCiEgICByZXN1bHQgPSBzdHJ2ZWNfY3JlYXRlIChpKTsKISAgIAogICAgLyogTWFrZSBz
dXJlIHdlIGdvIHRocm91Z2ggdGhlIGxvb3AgYXQgbGVhc3Qgb25jZSwgc28gezMuLjN9IHByaW50
cyBgMycgKi8KICAgIGkgPSAwOwogICAgbiA9IHN0YXJ0OwoqKioqKioqKioqKioqKioKKioqIDM0
OSwzNTQgKioqKgotLS0gMzk2LDQwOSAtLS0tCiAgCSAgdFsxXSA9ICdcMCc7CiAgCSAgcmVzdWx0
W2krK10gPSB0OwogIAl9CisgICAgICAgCisgICAgICAgLyogQ2FuJ3QgaW5jcmVtZW50IG4gd2l0
aCBpbmNyIGJlZm9yZSBsb29wIHRlcm1pbmF0aW9uIGNoZWNrLCBkdWUgdG8gdGhlCisgICAgICAg
IHBvc3NpYmlsaXR5IG9mIHVuZGVmaW5lZCBzaWduZWQgaW50ZWdlciBvdmVyZmxvdy4gKi8KKyAg
ICAgICBpZiAoYWRkd2lsbG92ZXJmbG93KG4sIGluY3IsIElOVE1BWF9NSU4sIElOVE1BWF9NQVgp
KQorICAgICAgIHsKKyAJYnJlYWs7CisgICAgICAgfQorICAgICAgIAogICAgICAgIG4gKz0gaW5j
cjsKICAgICAgICBpZiAoKGluY3IgPCAwICYmIG4gPCBlbmQpIHx8IChpbmNyID4gMCAmJiBuID4g
ZW5kKSkKICAJYnJlYWs7CioqKioqKioqKioqKioqKgoqKiogMzY1LDM3MiAqKioqCiAgICAgICBz
aXplX3QgdGxlbjsKICB7CiAgICBjaGFyICp0LCAqbGhzLCAqcmhzOwohICAgaW50IGksIGxoc190
LCByaHNfdCwgaW5jciwgbGhzX2wsIHJoc19sLCB3aWR0aDsKISAgIGludG1heF90IGxoc192LCBy
aHNfdjsKICAgIGludG1heF90IHRsLCB0cjsKICAgIGNoYXIgKipyZXN1bHQsICplcCwgKm9lcDsK
ICAKLS0tIDQyMCw0MjcgLS0tLQogICAgICAgc2l6ZV90IHRsZW47CiAgewogICAgY2hhciAqdCwg
KmxocywgKnJoczsKISAgIGludCBpLCBsaHNfdCwgcmhzX3QsIGxoc19sLCByaHNfbCwgd2lkdGg7
CiEgICBpbnRtYXhfdCBsaHNfdiwgcmhzX3YsIGluY3I7CiAgICBpbnRtYXhfdCB0bCwgdHI7CiAg
ICBjaGFyICoqcmVzdWx0LCAqZXAsICpvZXA7CiAgCioqKioqKioqKioqKioqKgoqKiogMzk2LDQw
NCAqKioqCiAgICBpZiAoSVNESUdJVCAocmhzWzBdKSB8fCAoKHJoc1swXSA9PSAnKycgfHwgcmhz
WzBdID09ICctJykgJiYgSVNESUdJVCAocmhzWzFdKSkpCiAgICAgIHsKICAgICAgICByaHNfdCA9
IFNUX0lOVDsKICAgICAgICB0ciA9IHN0cnRvaW1heCAocmhzLCAmZXAsIDEwKTsKISAgICAgICBp
ZiAoZXAgJiYgKmVwICE9IDAgJiYgKmVwICE9ICcuJykKISAJcmhzX3QgPSBTVF9CQUQ7CQkJLyog
aW52YWxpZCAqLwogICAgICB9CiAgICBlbHNlIGlmIChJU0FMUEhBIChyaHNbMF0pICYmIChyaHNb
MV0gPT0gMCB8fCByaHNbMV0gPT0gJy4nKSkKICAgICAgewotLS0gNDUxLDQ2MCAtLS0tCiAgICBp
ZiAoSVNESUdJVCAocmhzWzBdKSB8fCAoKHJoc1swXSA9PSAnKycgfHwgcmhzWzBdID09ICctJykg
JiYgSVNESUdJVCAocmhzWzFdKSkpCiAgICAgIHsKICAgICAgICByaHNfdCA9IFNUX0lOVDsKKyAg
ICAgICBlcnJubyA9IDA7CiAgICAgICAgdHIgPSBzdHJ0b2ltYXggKHJocywgJmVwLCAxMCk7CiEg
ICAgICAgaWYgKGVycm5vIHx8IGVwICYmICplcCAhPSAwICYmICplcCAhPSAnLicpCiEgCXJoc190
ID0gU1RfQkFEOwkJCS8qIGludmFsaWQgb3Igb3ZlcmZsb3cgKi8KICAgICAgfQogICAgZWxzZSBp
ZiAoSVNBTFBIQSAocmhzWzBdKSAmJiAocmhzWzFdID09IDAgfHwgcmhzWzFdID09ICcuJykpCiAg
ICAgIHsKKioqKioqKioqKioqKioqCioqKiA0MTUsNDI0ICoqKioKICAgIGlmIChyaHNfdCAhPSBT
VF9CQUQpCiAgICAgIHsKICAgICAgICBvZXAgPSBlcDsKICAgICAgICBpZiAoZXAgJiYgKmVwID09
ICcuJyAmJiBlcFsxXSA9PSAnLicgJiYgZXBbMl0pCiAgCWluY3IgPSBzdHJ0b2ltYXggKGVwICsg
MiwgJmVwLCAxMCk7CiEgICAgICAgaWYgKCplcCAhPSAwKQohIAlyaHNfdCA9IFNUX0JBRDsJCQkv
KiBpbnZhbGlkIGluY3IgKi8KICAgICAgICB0bGVuIC09IGVwIC0gb2VwOwogICAgICB9CiAgCi0t
LSA0NzEsNDgxIC0tLS0KICAgIGlmIChyaHNfdCAhPSBTVF9CQUQpCiAgICAgIHsKICAgICAgICBv
ZXAgPSBlcDsKKyAgICAgICBlcnJubyA9IDA7CiAgICAgICAgaWYgKGVwICYmICplcCA9PSAnLicg
JiYgZXBbMV0gPT0gJy4nICYmIGVwWzJdKQogIAlpbmNyID0gc3RydG9pbWF4IChlcCArIDIsICZl
cCwgMTApOwohICAgICAgIGlmIChlcnJubyB8fCAqZXAgIT0gMCkKISAJcmhzX3QgPSBTVF9CQUQ7
CQkJLyogaW52YWxpZCBvciBvdmVyZmxvdyAqLwogICAgICAgIHRsZW4gLT0gZXAgLSBvZXA7CiAg
ICAgIH0KICAK
--047d7b339cd13217a504c1b1e21a--


From MAILER-DAEMON Tue Jun 05 08:36:43 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sbt07-0003Jl-IA
	for mharc-bug-bash@gnu.org; Tue, 05 Jun 2012 08:36:43 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60110)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sbt00-0003I6-IU
	for bug-bash@gnu.org; Tue, 05 Jun 2012 08:36:42 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sbszy-00050Z-FZ
	for bug-bash@gnu.org; Tue, 05 Jun 2012 08:36:36 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:37532)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sbszy-000503-Ar
	for bug-bash@gnu.org; Tue, 05 Jun 2012 08:36:34 -0400
Received: from mpv5.tis.CWRU.Edu (EHLO mpv5.cwru.edu) ([129.22.105.51])
	by mpv1.tis.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id BZK24293; Tue, 05 Jun 2012 08:36:32 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id AYF82180 (AUTH cpr);
	Tue, 05 Jun 2012 08:36:32 -0400 (EDT)
Message-ID: <4FCDFD4F.8040307@case.edu>
Date: Tue, 05 Jun 2012 08:36:31 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Scott McMillan <scotty.mcmillan@gmail.com>
Subject: Re: Brace expansion infinite loop, memory corruption, and other bugs.
References: <CAPS0J2Hmxh9GOEYRBA3v_uzUiawEd=GcYLEg6mzcXaWO7FpC6Q@mail.gmail.com>
In-Reply-To: <CAPS0J2Hmxh9GOEYRBA3v_uzUiawEd=GcYLEg6mzcXaWO7FpC6Q@mail.gmail.com>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 05 Jun 2012 12:36:42 -0000

On 6/5/12 12:14 AM, Scott McMillan wrote:
> A week or so ago I submitted a bug report using the bashbug command
> that involved some
> overflow issues with braces.c on OpenSUSE12.1 X86_64. Browsing the
> patches, I got
> the impression that braces.c hasn't been modified since the original
> 4.2 release, so the
> same bugs should exist in the most recent version.

Thanks for the report.  I'll take a look at your patches.  Your original
report did not hit the mailing list.

Chet

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


From MAILER-DAEMON Wed Jun 06 08:24:38 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ScFHy-0001hM-9S
	for mharc-bug-bash@gnu.org; Wed, 06 Jun 2012 08:24:38 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37735)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1ScFHr-0001go-TQ
	for bug-bash@gnu.org; Wed, 06 Jun 2012 08:24:37 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1ScFHl-0005JY-Nv
	for bug-bash@gnu.org; Wed, 06 Jun 2012 08:24:31 -0400
Received: from plane.gmane.org ([80.91.229.3]:35846)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1ScFHl-0005JJ-HN
	for bug-bash@gnu.org; Wed, 06 Jun 2012 08:24:25 -0400
Received: from list by plane.gmane.org with local (Exim 4.69)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1ScFHi-00005f-Oi
	for bug-bash@gnu.org; Wed, 06 Jun 2012 14:24:22 +0200
Received: from 173-19-202-206.client.mchsi.com ([173.19.202.206])
	by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
	id 1AlnuQ-0007hv-00
	for <bug-bash@gnu.org>; Wed, 06 Jun 2012 14:24:22 +0200
Received: from wb8tyw by 173-19-202-206.client.mchsi.com with local (Gmexim
	0.1 (Debian)) id 1AlnuQ-0007hv-00
	for <bug-bash@gnu.org>; Wed, 06 Jun 2012 14:24:22 +0200
X-Injected-Via-Gmane: http://gmane.org/
To: bug-bash@gnu.org
From: "John E. Malmberg" <wb8tyw@qsl.net>
Subject: VMS port - Advice wanted for not having a fork() call.
Date: Wed, 06 Jun 2012 07:22:35 -0500
Lines: 26
Message-ID: <jqni5d$a1q$1@dough.gmane.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: usenet@dough.gmane.org
X-Gmane-NNTP-Posting-Host: 173-19-202-206.client.mchsi.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:10.0) Gecko/20120129 Thunderbird/10.0
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 80.91.229.3
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 06 Jun 2012 12:24:37 -0000

The existing port of Bash for VMS claims to be 1.4.8, which as near as I 
can tell must be based on 1.4.7, as I do not see a 1.4.8 in the download 
section.

What they did to work around that VMS does not have a fork() call, is to:

     Make a copy of several global variables and structures.
     Set the global variables to point to the copy.
     set a stack local structure to point to the original values.

And then at a later point where the child processes has exited:
     Set the global variables to point to the original structures
     Dispose of the copy.

Since then, the structure of Bash and the global variables has changed a 
bit.

So what I am trying to find is where in Bash 4.2 that I should be 
putting the save/restore, what variables need to be 
copied/saved/restored, and what the best routines to do that.

And where I can just set a flag to avoid the fork() operation all together.

Regards,
-John




From MAILER-DAEMON Wed Jun 06 22:56:14 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ScStS-0008Gz-Sd
	for mharc-bug-bash@gnu.org; Wed, 06 Jun 2012 22:56:14 -0400
Received: from eggs.gnu.org ([208.118.235.92]:43741)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1ScStQ-0008G0-1b
	for bug-bash@gnu.org; Wed, 06 Jun 2012 22:56:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1ScStO-0001sk-AG
	for bug-bash@gnu.org; Wed, 06 Jun 2012 22:56:11 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:38533
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1ScStO-0001p5-0Q
	for bug-bash@gnu.org; Wed, 06 Jun 2012 22:56:10 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.5/8.14.4/SuSE Linux 0.8) with ESMTP id
	q572txcZ021492; Wed, 6 Jun 2012 19:56:02 -0700
Message-ID: <4FD01840.9010800@tlinx.org>
Date: Wed, 06 Jun 2012 19:56:00 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: Davide Brini <dave_br@gmx.com>, bug-bash <bug-bash@gnu.org>
Subject: Re: Incorrect mangling of multiline array assignment in history
References: <20120604164154.69781EC04B@imaps.oficinas.atrapalo.com>
In-Reply-To: <20120604164154.69781EC04B@imaps.oficinas.atrapalo.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 07 Jun 2012 02:56:13 -0000



Davide Brini wrote:

> Fix:
>         No idea!
> 

Work-around:

try setting
shopt -s lithist



From MAILER-DAEMON Wed Jun 06 23:08:05 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ScT4v-0002Kj-9K
	for mharc-bug-bash@gnu.org; Wed, 06 Jun 2012 23:08:05 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60811)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1ScT4s-0002Kc-Px
	for bug-bash@gnu.org; Wed, 06 Jun 2012 23:08:04 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1ScT4r-0004BK-1d
	for bug-bash@gnu.org; Wed, 06 Jun 2012 23:08:02 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:38631
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1ScT4q-0004BB-NN
	for bug-bash@gnu.org; Wed, 06 Jun 2012 23:08:00 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.5/8.14.4/SuSE Linux 0.8) with ESMTP id
	q5737r5V022372; Wed, 6 Jun 2012 20:07:55 -0700
Message-ID: <4FD01B09.7060805@tlinx.org>
Date: Wed, 06 Jun 2012 20:07:53 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: bug-bash <bug-bash@gnu.org>
Subject: Indirect access to variables,
	including arrays (was Re: Compare 2 arrays.)
References: <CALtf9+qvO2BDHriAvi28q=kKr2j3b6KJbKLoBhs3D615y+8dLA@mail.gmail.com>	<CAFyvKism-6PyxPO8FoaUFs=F5WZ83bY+7qn0tkr2ru8tfr6dXQ@mail.gmail.com>
	<20120530123349.GI1506@eeg.ccf.org>
In-Reply-To: <20120530123349.GI1506@eeg.ccf.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Cc: Greg Wooledge <wooledg@eeg.ccf.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 07 Jun 2012 03:08:04 -0000



Greg Wooledge wrote:
> The only Bourne-family shell that can manipulate arrays whose names are
> passed to a function is ksh93, with its "nameref" command.  Bash has
> nothing analogous to that yet.
=============

I don't understand.

Are you saying that ${!nameofvar} isnt' supported?


I need a function to test to see if a word was already in
an array (no I haven't made it space/bracket...whatever proof...just a bit
more work)
But it uses indirect access to an array passed in and seem to
work fine.

So I am unclear as to what you are referring to?
I used named vars instead of $1/$2...but it's likely a similar
approach, and it's done w/o a loop (put the array in to an
assoc array, and then test to see if the element exists in the
assoc array)...

#!/bin/bash

# ex: _in "expr" <name of array>
#			_in file.c @
#			returns shell true/false (0/1)

function _in {
   local exp=${1:?};
	local arr=${2:?};
	read d t rest < <(typeset -p "$arr")
	if [[ ${t//[^a]/} != a ]]; then
		echo "var ${!arr} is not an array"
		return 1
	fi
	local -A _Assoc_
	local str=$( printf "declare -A _Assoc_=(";printf '[%s]=1 ' $(eval "echo 
\${$arr[@]}") ; printf ")")
	eval "$str"
	((${_Assoc_[$exp]}))
}


declare -a foo1=(one two three buckle the tree)
for w in how does the tree get buckled on one; do
	_in $w foo1 && echo $w
done
----
> _in.shh
the
tree
one


From MAILER-DAEMON Thu Jun 07 01:59:27 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ScVkl-0004Sf-ER
	for mharc-bug-bash@gnu.org; Thu, 07 Jun 2012 01:59:27 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52119)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1ScVki-0004Rf-Fr
	for bug-bash@gnu.org; Thu, 07 Jun 2012 01:59:25 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1ScVkg-0002Wy-Qa
	for bug-bash@gnu.org; Thu, 07 Jun 2012 01:59:24 -0400
Received: from mail-ee0-f41.google.com ([74.125.83.41]:45144)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1ScVkg-0002Wo-Hk
	for bug-bash@gnu.org; Thu, 07 Jun 2012 01:59:22 -0400
Received: by eekb47 with SMTP id b47so69209eek.0
	for <bug-bash@gnu.org>; Wed, 06 Jun 2012 22:59:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=AGa9vJCxRg3b38AAeAbl426sWmc+u8KC3Lzq9hD/8dc=;
	b=nGIU84+aSpgivq7vQbtoUdaWff9xVzaCzQ/AnGRgWBwL0zhUPnEyNmjSoSieDF048Z
	7OfbwGcHZqLS/RevGCJvbMpRjFqlOHOAIUWYydZYrcpx79UCeo9wHZs1Tyk1YMhcJOkQ
	FVWSRqIUgAilmD32WDyfWQHsSW0crPi/+pZ1iXOPEF9xBLjziY1EFnkNiSBaIOrdmiBb
	o0kvvQgVQE4cP+Ht2HaLoGuu6act3K1DH02MeMLuDSu5YtFxhjYe9QH50rw1vPTuYoUA
	dQhWcD9pzDAAT+HJwPV21brTF8ozr2teChdj2VxrSIfyMn733s4uxY5WOIIMlXZCAw+X
	E2Lg==
Received: by 10.14.119.202 with SMTP id n50mr432951eeh.33.1339048759476; Wed,
	06 Jun 2012 22:59:19 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.194.54.135 with HTTP; Wed, 6 Jun 2012 22:58:59 -0700 (PDT)
In-Reply-To: <4FD01B09.7060805@tlinx.org>
References: <CALtf9+qvO2BDHriAvi28q=kKr2j3b6KJbKLoBhs3D615y+8dLA@mail.gmail.com>
	<CAFyvKism-6PyxPO8FoaUFs=F5WZ83bY+7qn0tkr2ru8tfr6dXQ@mail.gmail.com>
	<20120530123349.GI1506@eeg.ccf.org> <4FD01B09.7060805@tlinx.org>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Thu, 7 Jun 2012 08:58:59 +0300
Message-ID: <CAPSX3sRLwtwPcHTH9gLnOpwTmqveBT_M2vLk0keGhvBcGmC-wA@mail.gmail.com>
Subject: Re: Indirect access to variables,
	including arrays (was Re: Compare 2 arrays.)
To: Linda Walsh <bash@tlinx.org>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.83.41
Cc: Greg Wooledge <wooledg@eeg.ccf.org>, bug-bash <bug-bash@gnu.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 07 Jun 2012 05:59:25 -0000

On Thu, Jun 7, 2012 at 6:07 AM, Linda Walsh <bash@tlinx.org> wrote:
>
>
> Greg Wooledge wrote:
>>
>> The only Bourne-family shell that can manipulate arrays whose names are
>> passed to a function is ksh93, with its "nameref" command. =A0Bash has
>> nothing analogous to that yet.
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> I don't understand.
>
> Are you saying that ${!nameofvar} isnt' supported?

in ksh93 you can do:

$ function foo { nameref locarr=3D$1;echo ${locarr[0]};locarr[0]=3Dnewfoo; =
}
$ array=3D(foo bar baz)
$ foo array
foo
$ echo ${array[0]}
newfoo

There is nothing that easy in bash.


From MAILER-DAEMON Thu Jun 07 03:02:28 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ScWjk-0001IM-87
	for mharc-bug-bash@gnu.org; Thu, 07 Jun 2012 03:02:28 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44400)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1ScWjd-0001IF-0j
	for bug-bash@gnu.org; Thu, 07 Jun 2012 03:02:26 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1ScWjW-0006gf-Pt
	for bug-bash@gnu.org; Thu, 07 Jun 2012 03:02:20 -0400
Received: from mail-wg0-f49.google.com ([74.125.82.49]:34120)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1ScWjW-0006gX-H8
	for bug-bash@gnu.org; Thu, 07 Jun 2012 03:02:14 -0400
Received: by wgbds1 with SMTP id ds1so153432wgb.30
	for <bug-bash@gnu.org>; Thu, 07 Jun 2012 00:02:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type;
	bh=y9lOeFqaLr2BJgZBL4xO3KcWOm5HBXRCTxTKWjDwY/0=;
	b=bgF+tQ30mcHQgAaD6zA4MamvVWsImsXxvvZcbDSPp+Yh/l6tlwuQQXORqCxQ1sGFqM
	Xtfr+hS1HXCwFBOpjQ23VjFw1PapLwogHnb2+b8W1TJ63qzVR3CeEGNgQglHaEnLJt1o
	1wpn9m9pWo/B820BUPtDfeFnIual/d/rsf4mw8zq6ik7/TUB7Cw55ZPNnYrDfiFU5Nk3
	0CDTcKMHP075EVxAvMevqkI7VdrGESKNQPJitdr9Gs5+bC/CdhEoFT7OJ3izg7U6Vf5k
	VDqEWqV5u56rJ9CZRsfTHapqWO6Tsu7AXt23u53iQ7j0FgjEshwsgIArK11KOXJfS6yR
	CHUg==
Received: by 10.216.194.138 with SMTP id m10mr75015wen.177.1339052532230; Thu,
	07 Jun 2012 00:02:12 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.194.54.135 with HTTP; Thu, 7 Jun 2012 00:01:51 -0700 (PDT)
In-Reply-To: <4FD01B09.7060805@tlinx.org>
References: <CALtf9+qvO2BDHriAvi28q=kKr2j3b6KJbKLoBhs3D615y+8dLA@mail.gmail.com>
	<CAFyvKism-6PyxPO8FoaUFs=F5WZ83bY+7qn0tkr2ru8tfr6dXQ@mail.gmail.com>
	<20120530123349.GI1506@eeg.ccf.org> <4FD01B09.7060805@tlinx.org>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Thu, 7 Jun 2012 10:01:51 +0300
Message-ID: <CAPSX3sSQzQOeAuG3pweRbtTkab8FWghZLSxMJjwL7Xsbvum9Bw@mail.gmail.com>
Subject: Re: Indirect access to variables,
	including arrays (was Re: Compare 2 arrays.)
To: Linda Walsh <bash@tlinx.org>
Content-Type: text/plain; charset=ISO-8859-1
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.82.49
Cc: bug-bash <bug-bash@gnu.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 07 Jun 2012 07:02:26 -0000

On Thu, Jun 7, 2012 at 6:07 AM, Linda Walsh <bash@tlinx.org> wrote:
>(no I haven't made it space/bracket...whatever proof...just a bit
> more work)

It's not just "a bit more work", there are many workarounds but it's not
really possible to make a really robust generic solution for assignment,
and in the end it just not as simple and pretty as nameref.

Fwiw here is a robust and simple solution for in_:

_in () {
  local e t
  t="${2:?}[@]";
  for e in "${!t}"; do [[ $1 = "$e" ]] && return 0;done
  return 1;
}


From MAILER-DAEMON Thu Jun 07 05:27:56 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ScZ0W-0006zS-SY
	for mharc-bug-bash@gnu.org; Thu, 07 Jun 2012 05:27:56 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49862)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1ScZ0U-0006yn-CD
	for bug-bash@gnu.org; Thu, 07 Jun 2012 05:27:55 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1ScZ0S-0003S3-Dx
	for bug-bash@gnu.org; Thu, 07 Jun 2012 05:27:53 -0400
Received: from mail-yw0-f41.google.com ([209.85.213.41]:59817)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1ScZ0S-0003Rv-6z
	for bug-bash@gnu.org; Thu, 07 Jun 2012 05:27:52 -0400
Received: by yhr47 with SMTP id 47so273537yhr.0
	for <bug-bash@gnu.org>; Thu, 07 Jun 2012 02:27:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=from:to:cc:subject:date:message-id:user-agent:in-reply-to
	:references:mime-version:content-transfer-encoding:content-type;
	bh=yFhdBLNJCcSyhSEGafEEWwr7p7+KXF03WzhTuQUpaME=;
	b=z2Hf4u0IW5ebbDi2j5ff+Dp/josE4l00LfBvbZnfVA1guuHG6ikZrTY+qCEzTTEwnu
	we/TCZYbkW4RDrtxl8FH00UGUt6lk64hnV/uKSPM8KQ0n/Vg3YbzEeNM79f0v/xvXQac
	lsIi2LaoGAlAmFhKVK9UMy0wAL7+FW3yV2yP56SwuuuXj7FpWE9x+kzSdthmIRZqOCt6
	tLC8kcW+8iQq8jAiIe+sDD6RRhR0tqe/H8hDukod5heAhGUGulrWJSLHlVg+LX1w/pLh
	75nWxw2ypwRW1zEQwt/Evozyf/p3loJxED4rYwtc82EBZQFoIvcLllRD7D4CxwyMCVAQ
	vxHw==
Received: by 10.50.181.232 with SMTP id dz8mr9360788igc.72.1339061268976;
	Thu, 07 Jun 2012 02:27:48 -0700 (PDT)
Received: from smorgbox.localnet (65-128-149-98.mpls.qwest.net.
	[65.128.149.98])
	by mx.google.com with ESMTPS id ey7sm69508igb.2.2012.06.07.02.27.47
	(version=SSLv3 cipher=OTHER); Thu, 07 Jun 2012 02:27:47 -0700 (PDT)
From: Dan Douglas <ormaaj@gmail.com>
To: bug-bash@gnu.org
Subject: Re: Indirect access to variables,
	including arrays (was Re: Compare 2 arrays.)
Date: Thu, 07 Jun 2012 04:27:38 -0500
Message-ID: <1910158.9GU53JOqKe@smorgbox>
User-Agent: KMail/4.8.3 (Linux/3.4.1-pf+; KDE/4.8.3; x86_64; ; )
In-Reply-To: <CAPSX3sSQzQOeAuG3pweRbtTkab8FWghZLSxMJjwL7Xsbvum9Bw@mail.gmail.com>
References: <CALtf9+qvO2BDHriAvi28q=kKr2j3b6KJbKLoBhs3D615y+8dLA@mail.gmail.com>
	<4FD01B09.7060805@tlinx.org>
	<CAPSX3sSQzQOeAuG3pweRbtTkab8FWghZLSxMJjwL7Xsbvum9Bw@mail.gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="utf-8"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.213.41
Cc: Linda Walsh <bash@tlinx.org>, Pierre Gaston <pierre.gaston@gmail.com>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 07 Jun 2012 09:27:56 -0000

On Thursday, June 07, 2012 10:01:51 AM Pierre Gaston wrote:
> On Thu, Jun 7, 2012 at 6:07 AM, Linda Walsh <bash@tlinx.org> wrote:
> >(no I haven't made it space/bracket...whatever proof...just a bit
> > more work)
> 
> It's not just "a bit more work", there are many workarounds but it's not
> really possible to make a really robust generic solution for assignment,
> and in the end it just not as simple and pretty as nameref.
> 
> Fwiw here is a robust and simple solution for in_:
> 
> _in () {
>   local e t
>   t="${2:?}[@]";
>   for e in "${!t}"; do [[ $1 = "$e" ]] && return 0;done
>   return 1;
> }
> 

Not robust due to the name conflicts with "e" or "t". There's also no good way 
to generate a list of locals without parsing "local" output (i'd rather live 
with the conflicts). I usually store indirect references in the positional 
parameters for that reason. Proper encapsulation is impossible.

Also, the standard behavior of ${var:?} is nearly useless unless you want to 
either create fatal errors or put the whole function into a subshell. I wish 
there were a way to modify that expansion to something nonstandard but useful. 
For associative arrays (where a null parameter is the only invalid key), the 
best solution is to explicitly check for null parameters and bail out of the 
function. There's no convenient way to do that other than looping.

I used a convoluted solution in this "multidimensional array" example: 
http://wiki.bash-hackers.org/syntax/arrays#indirection

I'm not very happy with it and will probably change the ${x+${y[z]+...}} 
hieroglyphics to something readable as soon as I can think of whatever sucks 
the least.

Granted, these are atypical issues. I care about this more than most due to 
Gentoo being stuck with Bash and eclasses being among the few valid reasons to 
care about large safe extensible libraries written for a shell.
-- 
Dan Douglas


From MAILER-DAEMON Thu Jun 07 08:29:21 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Scbq5-00074L-7u
	for mharc-bug-bash@gnu.org; Thu, 07 Jun 2012 08:29:21 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33712)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Scbq2-00073t-OQ
	for bug-bash@gnu.org; Thu, 07 Jun 2012 08:29:20 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Scbq0-0000O9-UA
	for bug-bash@gnu.org; Thu, 07 Jun 2012 08:29:18 -0400
Received: from mail-wi0-f177.google.com ([209.85.212.177]:50710)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Scbq0-0000Nx-LZ
	for bug-bash@gnu.org; Thu, 07 Jun 2012 08:29:16 -0400
Received: by wibhm14 with SMTP id hm14so116235wib.12
	for <bug-bash@gnu.org>; Thu, 07 Jun 2012 05:29:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=oyywTOgIj0/GuLVcmzXrsiX7mwPbtB5+D0DxC1MLMpQ=;
	b=FE/++sIntI4JSc5kK7WsNry+wfqUvBF/uEaVOGdKN7kT0p1g46pP9xDbveS1eF2QI7
	S75MbDdFkIKdMcbFd/LMZ2h3eErpub+beLeEvkQ0i5gyEqUOSJVja2FYX8ltAw3MOIx6
	KHcODwnZ+kYEWkUoh8ZBHyNa2Bb+TlWDPONn/TNV6pQj9dci//qUbQVerSNg4xZAmWFX
	lP0x3F6dqwD3N5AVgJbsnxDHZ+hLv3B1m3+vN6FHx4LxeQoL9T6qehcR0C+sMjLetrSG
	HgddIoIIoSsKcvNo57XKWKzq/s9hOlTNqJD8eyk9L/TgNIIcjEjHBylgSVEu1xiEKeCm
	HYCQ==
Received: by 10.216.208.87 with SMTP id p65mr755332weo.162.1339072154412; Thu,
	07 Jun 2012 05:29:14 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.194.54.135 with HTTP; Thu, 7 Jun 2012 05:28:53 -0700 (PDT)
In-Reply-To: <1910158.9GU53JOqKe@smorgbox>
References: <CALtf9+qvO2BDHriAvi28q=kKr2j3b6KJbKLoBhs3D615y+8dLA@mail.gmail.com>
	<4FD01B09.7060805@tlinx.org>
	<CAPSX3sSQzQOeAuG3pweRbtTkab8FWghZLSxMJjwL7Xsbvum9Bw@mail.gmail.com>
	<1910158.9GU53JOqKe@smorgbox>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Thu, 7 Jun 2012 15:28:53 +0300
Message-ID: <CAPSX3sQMXC7TL90_PdDPFmB1MxDB8bXB6G2pzDERtq9yZHCt-w@mail.gmail.com>
Subject: Re: Indirect access to variables,
	including arrays (was Re: Compare 2 arrays.)
To: Dan Douglas <ormaaj@gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.212.177
Cc: Linda Walsh <bash@tlinx.org>, bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 07 Jun 2012 12:29:20 -0000

On Thu, Jun 7, 2012 at 12:27 PM, Dan Douglas <ormaaj@gmail.com> wrote:
> On Thursday, June 07, 2012 10:01:51 AM Pierre Gaston wrote:
>> On Thu, Jun 7, 2012 at 6:07 AM, Linda Walsh <bash@tlinx.org> wrote:
>> >(no I haven't made it space/bracket...whatever proof...just a bit
>> > more work)
>>
>> It's not just "a bit more work", there are many workarounds but it's not
>> really possible to make a really robust generic solution for assignment,
>> and in the end it just not as simple and pretty as nameref.
>>
>> Fwiw here is a robust and simple solution for in_:
>>
>> _in () {
>> =A0 local e t
>> =A0 t=3D"${2:?}[@]";
>> =A0 for e in "${!t}"; do [[ $1 =3D "$e" ]] && return 0;done
>> =A0 return 1;
>> }
>>
>
> Not robust due to the name conflicts with "e" or "t". There's also no goo=
d way
> to generate a list of locals without parsing "local" output (i'd rather l=
ive
> with the conflicts). I usually store indirect references in the positiona=
l
> parameters for that reason. Proper encapsulation is impossible.

Ah true, thanks for the reminder that also kinda prove my first point.


From MAILER-DAEMON Thu Jun 07 12:54:40 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Scfyq-0001Dv-5v
	for mharc-bug-bash@gnu.org; Thu, 07 Jun 2012 12:54:40 -0400
Received: from eggs.gnu.org ([208.118.235.92]:53253)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Scfyk-0001DN-Ki
	for bug-bash@gnu.org; Thu, 07 Jun 2012 12:54:39 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Scfyg-0005rB-Qe
	for bug-bash@gnu.org; Thu, 07 Jun 2012 12:54:34 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:44690)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Scfyg-0005qo-Lu
	for bug-bash@gnu.org; Thu, 07 Jun 2012 12:54:30 -0400
Received: from mpv8.tis.cwru.edu (EHLO mpv8.case.edu) ([129.22.105.116])
	by mpv1.tis.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id BZN13299 (AUTH cpr);
	Thu, 07 Jun 2012 12:54:29 -0400 (EDT)
Received: from h191.11.172.72.dynamic.ip.windstream.net (EHLO z4.local)
	([72.172.11.191]) by mpv8.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id UIP24299 (AUTH cpr);
	Thu, 07 Jun 2012 12:54:28 -0400 (EDT)
Message-ID: <4FD0DCC4.9010103@case.edu>
Date: Thu, 07 Jun 2012 12:54:28 -0400
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6;
	rv:13.0) Gecko/20120601 Thunderbird/13.0
MIME-Version: 1.0
To: Davide Brini <dave_br@gmx.com>
Subject: Re: Incorrect mangling of multiline array assignment in history
References: <20120604164154.69781EC04B@imaps.oficinas.atrapalo.com>
In-Reply-To: <20120604164154.69781EC04B@imaps.oficinas.atrapalo.com>
X-Enigmail-Version: 1.4.2
Content-Type: multipart/mixed; boundary="------------050601070603030109020209"
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 07 Jun 2012 16:54:39 -0000

This is a multi-part message in MIME format.
--------------050601070603030109020209
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On 6/4/12 12:42 PM, Davide Brini wrote:

> Bash Version: 4.2
> Patch Level: 29
> Release Status: release
> 
> Description:
> 	To insert them in the history, bash converts multiline commands into a single line, normally replacing newlines with semicolons. However, if the multiline command happens to be an array assignment, adding the semicolon isn't always correct.
> 
> Repeat-By:
> 
> I'm not sure exactly when it happens, however this seems to more or less trigger it regularly:
> 
> $ xxx=(a b c d
>> )

It can, but it depends on the shell's state and the command before the
assignment statement.  The attached patch makes doing the right thing
explicit rather than relying on shell state.  It seems to work for me;
please try it and let me know.

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



--------------050601070603030109020209
Content-Type: text/x-patch;
 name="compassign-history.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="compassign-history.patch"

*** ../bash-4.2-patched/parse.y	2011-11-21 18:03:36.000000000 -0500
--- parse.y	2012-06-07 12:48:47.000000000 -0400
***************
*** 4900,4905 ****
--- 4916,4924 ----
        return (current_command_line_count == 2 ? "\n" : "");
      }
  
+   if (parser_state & PST_COMPASSIGN)
+     return (" ");
+ 
    /* First, handle some special cases. */
    /*(*/
    /* If we just read `()', assume it's a function definition, and don't

--------------050601070603030109020209--



From MAILER-DAEMON Thu Jun 07 13:05:01 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Scg8r-0003pi-7k
	for mharc-bug-bash@gnu.org; Thu, 07 Jun 2012 13:05:01 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38098)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Scg8o-0003pE-CE
	for bug-bash@gnu.org; Thu, 07 Jun 2012 13:04:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Scg8m-0007zE-Il
	for bug-bash@gnu.org; Thu, 07 Jun 2012 13:04:57 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:8437)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Scg8m-0007z9-Dw
	for bug-bash@gnu.org; Thu, 07 Jun 2012 13:04:56 -0400
Received: from mpv8.case.edu (mpv8.tis.CWRU.Edu [129.22.105.116])
	by mpv2.tis.cwru.edu (MOS 4.3.3-GA) with ESMTP id BLP81130;
	Thu, 7 Jun 2012 13:04:54 -0400
Received: from h191.11.172.72.dynamic.ip.windstream.net (EHLO z4.local)
	([72.172.11.191]) by mpv8.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id UIP29283 (AUTH cpr);
	Thu, 07 Jun 2012 13:04:54 -0400 (EDT)
Message-ID: <4FD0DF35.1070707@case.edu>
Date: Thu, 07 Jun 2012 13:04:53 -0400
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6;
	rv:13.0) Gecko/20120601 Thunderbird/13.0
MIME-Version: 1.0
To: "John E. Malmberg" <wb8tyw@qsl.net>
Subject: Re: VMS port - Advice wanted for not having a fork() call.
References: <jqni5d$a1q$1@dough.gmane.org>
In-Reply-To: <jqni5d$a1q$1@dough.gmane.org>
X-Enigmail-Version: 1.4.2
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv2.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.37
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 07 Jun 2012 17:04:59 -0000

On 6/6/12 8:22 AM, John E. Malmberg wrote:
> The existing port of Bash for VMS claims to be 1.4.8, which as near as I
> can tell must be based on 1.4.7, as I do not see a 1.4.8 in the download
> section.
> 
> What they did to work around that VMS does not have a fork() call, is to:
> 
>     Make a copy of several global variables and structures.
>     Set the global variables to point to the copy.
>     set a stack local structure to point to the original values.
> 
> And then at a later point where the child processes has exited:
>     Set the global variables to point to the original structures
>     Dispose of the copy.
> 
> Since then, the structure of Bash and the global variables has changed a bit.
> 
> So what I am trying to find is where in Bash 4.2 that I should be putting
> the save/restore, what variables need to be copied/saved/restored, and what
> the best routines to do that.

Their approach was to define `shell state', and save and restore it.
That's not a bad approach, but the semantics of fork require that you save
and restore everything that a child shell could possibly touch or modify,
since the definition of fork() requires that the child process not be able
to modify anything in its parent's address sapce.  That's pretty daunting.

It might be worth spending some time to figure out how VMS creates
processes and whether or not one of those primitives could be adapted to
create a fork() function.

> And where I can just set a flag to avoid the fork() operation all together.

You can't.

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




From MAILER-DAEMON Thu Jun 07 17:15:06 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sck2r-0008UA-W0
	for mharc-bug-bash@gnu.org; Thu, 07 Jun 2012 17:15:05 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58792)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bill@ycc.com>) id 1Sck2p-0008Rg-4Z
	for bug-bash@gnu.org; Thu, 07 Jun 2012 17:15:04 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bill@ycc.com>) id 1Sck2n-0001AV-8x
	for bug-bash@gnu.org; Thu, 07 Jun 2012 17:15:02 -0400
Received: from mail-lpp01m010-f41.google.com ([209.85.215.41]:63101)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <bill@ycc.com>)
	id 1Sck2n-0001A2-1T
	for bug-bash@gnu.org; Thu, 07 Jun 2012 17:15:01 -0400
Received: by lahi5 with SMTP id i5so932982lah.0
	for <bug-bash@gnu.org>; Thu, 07 Jun 2012 14:14:57 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=google.com; s=20120113;
	h=mime-version:x-originating-ip:in-reply-to:references:date
	:message-id:subject:from:cc:content-type:x-gm-message-state;
	bh=p8fqEJhFugaYzsnFiAwTxWO2w+/gWZS4bz6sQeZOtNw=;
	b=BrVJQGdVI5TqEnKGTcDx4U1JfysoIbz4vBr9Oyolhj/fOOIcqm0tYYFHfdqbHNUbLe
	BlOu9azlPwWKHeGKkxnwy6i3qwXdmo00YjasWFufrelfleiM5QPR27hFsxKCjiLZ91V3
	stvzz6hfHBcgharE+L3HJnK+Wnn7duDmjX5dGpgvnMkKU+uSMkewlZrc0hSMsiPSRGkU
	y/nLJLyCoEZiYy4RqXmPGtMY6b/QrbSCXe04yxlHS3ATuADC6qpLvI0uTfjNIvJ6EMuP
	ljUdBj/vFliOpNpXMWATVznuV4BF7JbjzLC2wcq7b+UO+qgHpmPtLi14YqsOd4gDr0Wg
	TuhA==
MIME-Version: 1.0
Received: by 10.112.42.34 with SMTP id k2mt2743854lbl.0.1339103697528; Thu, 07
	Jun 2012 14:14:57 -0700 (PDT)
Received: by 10.112.22.1 with HTTP; Thu, 7 Jun 2012 14:14:57 -0700 (PDT)
X-Originating-IP: [186.2.136.161]
In-Reply-To: <CAPSX3sSQzQOeAuG3pweRbtTkab8FWghZLSxMJjwL7Xsbvum9Bw@mail.gmail.com>
References: <CALtf9+qvO2BDHriAvi28q=kKr2j3b6KJbKLoBhs3D615y+8dLA@mail.gmail.com>
	<CAFyvKism-6PyxPO8FoaUFs=F5WZ83bY+7qn0tkr2ru8tfr6dXQ@mail.gmail.com>
	<20120530123349.GI1506@eeg.ccf.org> <4FD01B09.7060805@tlinx.org>
	<CAPSX3sSQzQOeAuG3pweRbtTkab8FWghZLSxMJjwL7Xsbvum9Bw@mail.gmail.com>
Date: Thu, 7 Jun 2012 15:14:57 -0600
Message-ID: <CAFyvKit0st+xVq0v1jzNj6xBSr4RDai5d=TQTgeH8SB=4wM0sQ@mail.gmail.com>
Subject: Re: Indirect access to variables,
	including arrays (was Re: Compare 2 arrays.)
From: Bill Gradwohl <bill@ycc.com>
X-Gm-Message-State: ALoCoQkqKOpEmj7aKfjh71r3WezVIKS+Po10FJWc5UONON8dkp9wSCj5l0jNKipL6z2IYE4q9ddu
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.215.41
Content-Type: text/plain; charset=ISO-8859-1
X-Content-Filtered-By: Mailman/MimeDel 2.1.14
Cc: Linda Walsh <bash@tlinx.org>, bug-bash <bug-bash@gnu.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 07 Jun 2012 21:15:04 -0000

On Thu, Jun 7, 2012 at 1:01 AM, Pierre Gaston <pierre.gaston@gmail.com>wrote:

> Fwiw here is a robust and simple solution for in_:
>
> _in () {
>  local e t
>  t="${2:?}[@]";
>  for e in "${!t}"; do [[ $1 = "$e" ]] && return 0;done
>  return 1;
> }
>
>
The following won't have a name space collision with the 'e' variable and I
got rid of 't'.

_in () {
   if [ "$2" != 'e' ]; then
      set -- "$1" "${2:?}[@]"
      local e
      for e in "${!2}"; do
         [[ $1 == "$e" ]] && return 0
      done
   else
      set -- "$1" "${2:?}[@]"
      local _e
      for _e in "${!2}"; do
         [[ $1 == "$_e" ]] && return 0
      done
   fi

   return 1
}

array=(a b c abc d e f)
_in abc array  && echo Yes || echo No

array=(a b c abxc d e f)
_in abc array  && echo Yes || echo No

e=(a b c abc d e f)
_in abc e  && echo Yes || echo No

e=(a b c abxc d e f)
_in abc e  && echo Yes || echo No


-- 
Bill Gradwohl

From MAILER-DAEMON Thu Jun 07 17:23:03 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SckAZ-000134-LH
	for mharc-bug-bash@gnu.org; Thu, 07 Jun 2012 17:23:03 -0400
Received: from eggs.gnu.org ([208.118.235.92]:50604)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SckAW-00012q-Ul
	for bug-bash@gnu.org; Thu, 07 Jun 2012 17:23:02 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SckAU-0002zN-Qp
	for bug-bash@gnu.org; Thu, 07 Jun 2012 17:23:00 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:57618
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SckAU-0002z4-GS
	for bug-bash@gnu.org; Thu, 07 Jun 2012 17:22:58 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.5/8.14.4/SuSE Linux 0.8) with ESMTP id
	q57LMqdn024239; Thu, 7 Jun 2012 14:22:54 -0700
Message-ID: <4FD11BAC.6040801@tlinx.org>
Date: Thu, 07 Jun 2012 14:22:52 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: Chet Ramey <chet.ramey@case.edu>
Subject: Re: Red-Hat Bug 825751 - bash-completion fails on
	environment	variables
References: <jq05rk$nd7$1@dough.gmane.org>
	<CADv8-ogH00a8Us2C91B5KY+ZPOYevgvtGOQf86skzyBTw7rMag@mail.gmail.com>
In-Reply-To: <CADv8-ogH00a8Us2C91B5KY+ZPOYevgvtGOQf86skzyBTw7rMag@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 07 Jun 2012 21:23:02 -0000



Clark WANG wrote:
> On Mon, May 28, 2012 at 11:32 PM, John E. Malmberg <wb8tyw@qsl.net> wrote:
>> Actual results:
>> ls \$HOME/
> 
> Already discussed for quite a few times. :) For example:
> 
> http://lists.gnu.org/archive/html/bug-bash/2011-12/msg00079.html
> (patched attached)
> http://lists.gnu.org/archive/html/bug-bash/2011-12/msg00035.html
-----
In reading the messages quoted above, I'm not sure some people
understand the severity of the bug.

This isn't a matter of preference... its a real bug.

Ex:
$ ls $HOME/bin<TAB><RETURN>
"ls: cannot access $HOME/bin: No such file or directory"

It's not about expansion or non-expansion during the editing phase--
that would be a matter of preference, it's that when you hit enter,
it doesn't expand the variables -- which I can't see being useful for
anyone.

Note -- this is the same type of problem as Bash not correcting
the case of path components.

Bash isn't correcting the lines anymore so that final
expansions match real paths...


When I originally heard this discussion, I thought -- it's a matter
of preference, though I think I prefer expansion, I could see times
when it might be a hassle (if the var was a REAL long expansion,
it might overflow the line)...but having it not work at all...

That's not useful for anyone.




From MAILER-DAEMON Thu Jun 07 17:33:52 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SckL2-00020B-TS
	for mharc-bug-bash@gnu.org; Thu, 07 Jun 2012 17:33:52 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52268)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SckL0-0001z0-JT
	for bug-bash@gnu.org; Thu, 07 Jun 2012 17:33:51 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SckKy-0004yA-L5
	for bug-bash@gnu.org; Thu, 07 Jun 2012 17:33:50 -0400
Received: from mx1.redhat.com ([209.132.183.28]:38275)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SckKy-0004y1-CM
	for bug-bash@gnu.org; Thu, 07 Jun 2012 17:33:48 -0400
Received: from int-mx01.intmail.prod.int.phx2.redhat.com
	(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q57LXi1Q003108
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Thu, 7 Jun 2012 17:33:44 -0400
Received: from [10.3.113.60] (ovpn-113-60.phx2.redhat.com [10.3.113.60])
	by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
	id q57LXh0H011300; Thu, 7 Jun 2012 17:33:44 -0400
Message-ID: <4FD11E36.9010304@redhat.com>
Date: Thu, 07 Jun 2012 15:33:42 -0600
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:12.0) Gecko/20120430 Thunderbird/12.0.1
MIME-Version: 1.0
To: Linda Walsh <bash@tlinx.org>
Subject: Re: Red-Hat Bug 825751 - bash-completion fails on
	environment	variables
References: <jq05rk$nd7$1@dough.gmane.org>
	<CADv8-ogH00a8Us2C91B5KY+ZPOYevgvtGOQf86skzyBTw7rMag@mail.gmail.com>
	<4FD11BAC.6040801@tlinx.org>
In-Reply-To: <4FD11BAC.6040801@tlinx.org>
X-Enigmail-Version: 1.4.2
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="------------enigAB40E92C7515AA3A459CAB1D"
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.132.183.28
Cc: bug-bash@gnu.org, Chet Ramey <chet.ramey@case.edu>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 07 Jun 2012 21:33:52 -0000

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigAB40E92C7515AA3A459CAB1D
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 06/07/2012 03:22 PM, Linda Walsh wrote:

> This isn't a matter of preference... its a real bug.
>=20
> Ex:
> $ ls $HOME/bin<TAB><RETURN>
> "ls: cannot access $HOME/bin: No such file or directory"

Yes, we know.  Ergo patch 29:

https://lists.gnu.org/archive/html/bug-bash/2012-05/msg00148.html

--=20
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJP0R43AAoJEKeha0olJ0NqZ6MIAK8RHEu77E3PAoePppFPlRrK
RinJhHKW6EG39aZAZxjOtRIZy/gMaP5EU5cxh5e4UhOpkzpAeHS/ros7KOKyq0Zz
2FzukM7mbtETEOXgq5hrLkA9ajPTmw5GHKKpJ8IdEk2AH7sNxykV45AzL42Y8cbO
OBpSWhrSluoaPhIK7O5V09O8z3ZYmXZbgmXNZpxleiB28lS/wjCSdsn/GlgTdQUL
tvVdj5pCux0HyqveAO728jtqBSICfwgrjbHK06bq2VYeQziQd/F8tM0p6iSaTWFm
J7U0qWjDaNM4WSR8H3xWgBEtN7f7L7AwbSUUObZ0iDfWo8o6umMkFkErKqTvv5I=
=yREn
-----END PGP SIGNATURE-----

--------------enigAB40E92C7515AA3A459CAB1D--


From MAILER-DAEMON Thu Jun 07 18:14:49 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sckyf-0008NB-LT
	for mharc-bug-bash@gnu.org; Thu, 07 Jun 2012 18:14:49 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35983)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Sckyc-0008N4-Pa
	for bug-bash@gnu.org; Thu, 07 Jun 2012 18:14:47 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Sckyb-0004RJ-7a
	for bug-bash@gnu.org; Thu, 07 Jun 2012 18:14:46 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:58446
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Sckya-0004RF-Te
	for bug-bash@gnu.org; Thu, 07 Jun 2012 18:14:45 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.5/8.14.4/SuSE Linux 0.8) with ESMTP id
	q57MEd6L001079; Thu, 7 Jun 2012 15:14:41 -0700
Message-ID: <4FD127CF.9040401@tlinx.org>
Date: Thu, 07 Jun 2012 15:14:39 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: Eric Blake <eblake@redhat.com>, bug-bash <bug-bash@gnu.org>
Subject: Re: Red-Hat Bug 825751 - bash-completion fails
	on	environment	variables
References: <jq05rk$nd7$1@dough.gmane.org>	<CADv8-ogH00a8Us2C91B5KY+ZPOYevgvtGOQf86skzyBTw7rMag@mail.gmail.com>	<4FD11BAC.6040801@tlinx.org>
	<4FD11E36.9010304@redhat.com>
In-Reply-To: <4FD11E36.9010304@redhat.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 07 Jun 2012 22:14:48 -0000



Eric Blake wrote:
> On 06/07/2012 03:22 PM, Linda Walsh wrote:
> 
>> This isn't a matter of preference... its a real bug.
>>
>> Ex:
>> $ ls $HOME/bin<TAB><RETURN>
>> "ls: cannot access $HOME/bin: No such file or directory"
> 
> Yes, we know.  Ergo patch 29:
----
	According to the the referred to discussion on this
issue, this was first claimed to be a problem in Feb 2011 --
um... 16 months ago...

	Good to see you had a full grasp of the problem
and that it only took you 16 months to come up with a patch...




From MAILER-DAEMON Fri Jun 08 06:33:13 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ScwVF-0002Xo-9v
	for mharc-bug-bash@gnu.org; Fri, 08 Jun 2012 06:33:13 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38829)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1ScwVC-0002WF-JS
	for bug-bash@gnu.org; Fri, 08 Jun 2012 06:33:11 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1ScwV3-00058w-II
	for bug-bash@gnu.org; Fri, 08 Jun 2012 06:33:10 -0400
Received: from mx1.redhat.com ([209.132.183.28]:63083)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1ScwV3-00058c-Ad
	for bug-bash@gnu.org; Fri, 08 Jun 2012 06:33:01 -0400
Received: from int-mx11.intmail.prod.int.phx2.redhat.com
	(int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q58AWxEX019426
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
	for <bug-bash@gnu.org>; Fri, 8 Jun 2012 06:32:59 -0400
Received: from dhcp-25-98.brq.redhat.com (dhcp-25-98.brq.redhat.com
	[10.34.25.98])
	by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id q58AWwqa017871
	for <bug-bash@gnu.org>; Fri, 8 Jun 2012 06:32:59 -0400
Message-ID: <4FD1D4DA.5040103@redhat.com>
Date: Fri, 08 Jun 2012 12:32:58 +0200
From: Roman Rakus <rrakus@redhat.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:12.0) Gecko/20120430 Thunderbird/12.0.1
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Re: Red-Hat Bug 825751 - bash-completion fails on
	environment	variables
References: <jq05rk$nd7$1@dough.gmane.org>
	<CADv8-ogH00a8Us2C91B5KY+ZPOYevgvtGOQf86skzyBTw7rMag@mail.gmail.com>
	<4FD11BAC.6040801@tlinx.org>
In-Reply-To: <4FD11BAC.6040801@tlinx.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.132.183.28
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 08 Jun 2012 10:33:12 -0000

On 06/07/2012 11:22 PM, Linda Walsh wrote:
> In reading the messages quoted above, I'm not sure some people
> understand the severity of the bug.
I do not.
And many people don't understand expansions, quoting, completions and 
many other...
>
> This isn't a matter of preference... its a real bug.
>
> Ex:
> $ ls $HOME/bin<TAB><RETURN>
> "ls: cannot access $HOME/bin: No such file or directory"
quoting and completion
>
> It's not about expansion or non-expansion during the editing phase--
> that would be a matter of preference, it's that when you hit enter,
> it doesn't expand the variables -- which I can't see being useful for
> anyone.
>
> Note -- this is the same type of problem as Bash not correcting
> the case of path components.
Why would bash do that?
>
> Bash isn't correcting the lines anymore so that final
> expansions match real paths...
>
>
> When I originally heard this discussion, I thought -- it's a matter
> of preference, though I think I prefer expansion, I could see times
> when it might be a hassle (if the var was a REAL long expansion,
> it might overflow the line)...but having it not work at all...
>
> That's not useful for anyone.
>
>
And to be complete, there is a bug also in bash-completion package, 
which need to be fixed.
Many people uses bash-completion, even they don't know it.

RR


From MAILER-DAEMON Fri Jun 08 06:45:17 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Scwgv-00065k-J2
	for mharc-bug-bash@gnu.org; Fri, 08 Jun 2012 06:45:17 -0400
Received: from eggs.gnu.org ([208.118.235.92]:45093)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dave_br@gmx.com>) id 1Scwgs-000650-6T
	for bug-bash@gnu.org; Fri, 08 Jun 2012 06:45:15 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dave_br@gmx.com>) id 1Scwgq-0007W9-7w
	for bug-bash@gnu.org; Fri, 08 Jun 2012 06:45:13 -0400
Received: from mailout-us.gmx.com ([74.208.5.67]:37011
	helo=mailout-us.mail.com) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <dave_br@gmx.com>) id 1Scwgp-0007Vz-WD
	for bug-bash@gnu.org; Fri, 08 Jun 2012 06:45:12 -0400
Received: (qmail invoked by alias); 08 Jun 2012 10:45:09 -0000
Received: from unknown (EHLO zoot.sax) [88.87.214.78]
	by mail.gmx.com (mp-us008) with SMTP; 08 Jun 2012 06:45:09 -0400
X-Authenticated: #48875277
X-Provags-ID: V01U2FsdGVkX18r6Axx2JYrBOLMxJhRI3GSYSSny2yqI15PNeKrwA
	drmT0yIWSqHpzm
Date: Fri, 8 Jun 2012 12:45:32 +0200
From: Davide Brini <dave_br@gmx.com>
To: chet.ramey@case.edu
Subject: Re: Incorrect mangling of multiline array assignment in history
In-Reply-To: <4FD0DCC4.9010103@case.edu>
References: <20120604164154.69781EC04B@imaps.oficinas.atrapalo.com>
	<4FD0DCC4.9010103@case.edu>
X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.10; x86_64-unknown-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Y-GMX-Trusted: 0
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
Message-ID: <E1Scwgp-0007Vz-WD@eggs.gnu.org>
X-Received-From: 74.208.5.67
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 08 Jun 2012 10:45:15 -0000

On Thu, 07 Jun 2012 12:54:28 -0400, Chet Ramey <chet.ramey@case.edu> wrote:

> On 6/4/12 12:42 PM, Davide Brini wrote:
> 
> > Bash Version: 4.2
> > Patch Level: 29
> > Release Status: release
> > 
> > Description:
> > 	To insert them in the history, bash converts multiline commands
> > into a single line, normally replacing newlines with semicolons.
> > However, if the multiline command happens to be an array assignment,
> > adding the semicolon isn't always correct.
> > 
> > Repeat-By:
> > 
> > I'm not sure exactly when it happens, however this seems to more or
> > less trigger it regularly:
> > 
> > $ xxx=(a b c d
> >> )
> 
> It can, but it depends on the shell's state and the command before the
> assignment statement.

Yes, I noticed that sometimes it worked, but I couldn't understand exactly
why.

> The attached patch makes doing the right thing explicit rather than
> relying on shell state.  It seems to work for me; please try it and let
> me know.

I did a few tests and wasn't able to reproduce it, so I'd say it solves the
issue. Thanks!

-- 
D.


From MAILER-DAEMON Fri Jun 08 07:55:10 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ScxmY-0004By-OH
	for mharc-bug-bash@gnu.org; Fri, 08 Jun 2012 07:55:10 -0400
Path: usenet.stanford.edu!postnews.google.com!f8g2000pbf.googlegroups.com!not-for-mail
From: Ellen Schloss <ellenrschloss@gmail.com>
Newsgroups: gnu.bash.bug
Subject: Dating for Online Singles Local Women Looking for Men
Date: Fri, 8 Jun 2012 04:53:22 -0700 (PDT)
Organization: http://groups.google.com
Lines: 3
Message-ID: <4da03c13-4115-4462-a3eb-18414a459127@f8g2000pbf.googlegroups.com>
NNTP-Posting-Host: 122.169.35.169
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: posting.google.com 1339156402 26226 127.0.0.1 (8 Jun 2012 11:53:22
	GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 8 Jun 2012 11:53:22 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: f8g2000pbf.googlegroups.com; posting-host=122.169.35.169;
	posting-account=3uZY6goAAADEdhZX6u1r-FDiO8PQNoFc
User-Agent: G2/1.0
X-HTTP-Via: 1.1 ISA-7
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.0.8)
	Gecko/2009032609 Firefox/3.0.8,gzip(gfe)
Xref: usenet.stanford.edu gnu.bash.bug:24793
To: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 08 Jun 2012 11:55:09 -0000

Make Affairs, Search Local Men. Meet Dating Partner. Find Single and
Married Women. Start Discreet Sex affair. Find Local Wife. Live Adult
Chat with Girls. Join http://au.adultxdating.com

From MAILER-DAEMON Fri Jun 08 11:42:14 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sd1KI-0007VJ-8g
	for mharc-bug-bash@gnu.org; Fri, 08 Jun 2012 11:42:14 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37498)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sd1KB-0007UJ-EB
	for bug-bash@gnu.org; Fri, 08 Jun 2012 11:42:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sd1K5-0006pi-0I
	for bug-bash@gnu.org; Fri, 08 Jun 2012 11:42:06 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:12690)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sd1K4-0006p8-Qc
	for bug-bash@gnu.org; Fri, 08 Jun 2012 11:42:00 -0400
Received: from mpv8.tis.CWRU.Edu (EHLO mpv8.case.edu) ([129.22.105.116])
	by mpv1.tis.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id BZO24819; Fri, 08 Jun 2012 11:41:57 -0400 (EDT)
Received: from h191.11.172.72.dynamic.ip.windstream.net (EHLO z4.local)
	([72.172.11.191]) by mpv8.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id UIT91636 (AUTH cpr);
	Fri, 08 Jun 2012 11:41:57 -0400 (EDT)
Message-ID: <4FD21D46.9050503@case.edu>
Date: Fri, 08 Jun 2012 11:41:58 -0400
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6;
	rv:13.0) Gecko/20120601 Thunderbird/13.0
MIME-Version: 1.0
To: Linda Walsh <bash@tlinx.org>
Subject: Re: req for fix: Completion: inconsistent case correction and '/'
	appending(for dirs)
References: <4FC7CCE2.60500@tlinx.org>
In-Reply-To: <4FC7CCE2.60500@tlinx.org>
X-Enigmail-Version: 1.4.2
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash <bug-bash@gnu.org>, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 08 Jun 2012 15:42:13 -0000

On 5/31/12 3:56 PM, Linda Walsh wrote:
> if I type in a path:
> 
> (1st example)
>> ls -d /share/doc/new<tab>, bash displays:
> 
> ls /share/doc/New\ Folder
> 
> Pressing 'Enter' gets:
> 
> ls: cannot access /share/doc/New Folder: No such file or directory
> 
> vs.
> 
> (2nd example)
>> ls /share/do<tab>
> ls /share/Doc/n<tab>
> ls /share/Doc/New\ Folder/  (<enter>)
> /share/Doc/New Folder//

Let me fill in some of the missing pieces so this makes sense to everyone.
I'll make some assumptions because you don't say anything about the version
of bash you're using.

You have enabled the `dirspell' shell option, which causes the directory
rewrite part of completion to perform spelling correction like the cd
builtin.

You don't have the `direxpand' shell option enabled, which would have
replaced the directory name with the corrected version.

You have readline's completion-ignore-case option enabled, which causes
readline's builtin filename completion to perform case-insensitive
comparisons and change case according to what it reads from the file
system.

The dirspell and direxpand options should really be set together, for just
the reason you uncovered.  It's probably worth it for bash to inhibit
spelling correction unless direxpand is set.

The slash gets appended because you set the `mark-directories' readline
variable, and readline was able to detect that the pathname was a
directory.  `ls -d' appends a slash unconditionally.

Setting `direxpand' will make things behave as you'd like.

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




From MAILER-DAEMON Fri Jun 08 12:37:37 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sd2Bs-0006ja-RD
	for mharc-bug-bash@gnu.org; Fri, 08 Jun 2012 12:37:36 -0400
Received: from eggs.gnu.org ([208.118.235.92]:45937)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Sd2Bp-0006XG-6e
	for bug-bash@gnu.org; Fri, 08 Jun 2012 12:37:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Sd2Bj-0001l7-ND
	for bug-bash@gnu.org; Fri, 08 Jun 2012 12:37:32 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:53704
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Sd2Bj-0001kq-Ci
	for bug-bash@gnu.org; Fri, 08 Jun 2012 12:37:27 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.5/8.14.4/SuSE Linux 0.8) with ESMTP id
	q58GbJt3007738; Fri, 8 Jun 2012 09:37:21 -0700
Message-ID: <4FD22A3F.10003@tlinx.org>
Date: Fri, 08 Jun 2012 09:37:19 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: req for fix: Completion: inconsistent case correction and '/'
	appending(for dirs)
References: <4FC7CCE2.60500@tlinx.org> <4FD21D46.9050503@case.edu>
In-Reply-To: <4FD21D46.9050503@case.edu>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Cc: bug-bash <bug-bash@gnu.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 08 Jun 2012 16:37:35 -0000



Chet Ramey wrote:
> On 5/31/12 3:56 PM, Linda Walsh wrote:
>> if I type in a path:
>>
>> (1st example)
>>> ls -d /share/doc/new<tab>, bash displays:
>> ls /share/doc/New\ Folder
>>
>> Pressing 'Enter' gets:
>>
>> ls: cannot access /share/doc/New Folder: No such file or directory
>>
>> vs.
>>
>> (2nd example)
>>> ls /share/do<tab>
>> ls /share/Doc/n<tab>
>> ls /share/Doc/New\ Folder/  (<enter>)
>> /share/Doc/New Folder//
> 
> Let me fill in some of the missing pieces so this makes sense to everyone.
> I'll make some assumptions because you don't say anything about the version
> of bash you're using.
----
	Sorry,
  bash --version
GNU bash, version 4.2.10(1)-release (x86_64-suse-linux-gnu)
Copyright (C) 2011 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.


> 
> You have enabled the `dirspell' shell option, which causes the directory
> rewrite part of completion to perform spelling correction like the cd
> builtin.
> 
> You don't have the `direxpand' shell option enabled, which would have
> replaced the directory name with the corrected version.
> shopt
autocd          on
cdable_vars     on
cdspell         on
checkhash       on
checkjobs       off
checkwinsize    on
cmdhist         on
compat31        off
compat32        off
compat40        off
compat41        off
dirspell        on
dotglob         on
execfail        off
expand_aliases  on
extdebug        off
extglob         on
extquote        on
failglob        off
force_fignore   on
globstar        on
gnu_errfmt      off
histappend      on
histreedit      on
histverify      on
hostcomplete    on
huponexit       off
interactive_comments    on
lastpipe        off
lithist         on
login_shell     on
mailwarn        off
no_empty_cmd_completion on
nocaseglob      on
nocasematch     on
nullglob        off
progcomp        on
promptvars      on
restricted_shell        off
shift_verbose   off
sourcepath      on
xpg_echo        on

-----
I've never seen a direxpand...  where do I set it?
---
Is there a similar command to list out my inputrc commands? (other than dumping 
the .inputrc? (it's sorta messy, but I don't see a direxpand there either)...

Shouldn't I see a direxpand option above and see it set to off?

Thanks,
linda


From MAILER-DAEMON Fri Jun 08 16:54:53 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sd6Cr-0003Tp-7p
	for mharc-bug-bash@gnu.org; Fri, 08 Jun 2012 16:54:53 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41674)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <schweikh@schweikhardt.net>) id 1Sd2OQ-0007By-3F
	for bug-bash@gnu.org; Fri, 08 Jun 2012 12:50:35 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <schweikh@schweikhardt.net>) id 1Sd2OL-0004Jk-Av
	for bug-bash@gnu.org; Fri, 08 Jun 2012 12:50:33 -0400
Received: from rs2.shuttle.de ([194.95.249.4]:36348)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <schweikh@schweikhardt.net>) id 1Sd2OL-0004JA-4H
	for bug-bash@gnu.org; Fri, 08 Jun 2012 12:50:29 -0400
Received: by rs2.shuttle.de (Postfix, from userid 10)
	id E9F7A5806B; Fri,  8 Jun 2012 18:50:24 +0200 (CEST)
Received: from hal9000.schweikhardt.net (localhost [127.0.0.1])
	by hal9000.schweikhardt.net (8.14.5/8.14.5) with ESMTP id
	q58Gnnr5043089
	for <bug-bash@gnu.org>; Fri, 8 Jun 2012 18:49:49 +0200 (CEST)
	(envelope-from schweikh@hal9000.schweikhardt.net)
Received: (from schweikh@localhost)
	by hal9000.schweikhardt.net (8.14.5/8.14.5/Submit) id q58GnnBF043088;
	Fri, 8 Jun 2012 18:49:49 +0200 (CEST) (envelope-from schweikh)
Date: Fri, 8 Jun 2012 18:49:49 +0200 (CEST)
Message-Id: <201206081649.q58GnnBF043088@hal9000.schweikhardt.net>
From: Jens Schweikhardt <schweikh@schweikhardt.net>
To: bug-bash@gnu.org
Subject: Man page buglet: coproc is missing in the list of reserved words
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 194.95.249.4
X-Mailman-Approved-At: Fri, 08 Jun 2012 16:54:51 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 08 Jun 2012 16:50:35 -0000

Configuration Information [Automatically generated, do not change]:
Machine: amd64
OS: freebsd10.0
Compiler: cc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='amd64' -DCONF_OSTYPE='freebsd10.0' -DCONF_MACHTYPE='amd64-portbld-freebsd10.0' -DCONF_VENDOR='portbld' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' -DSHELL  -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -I/usr/local/include -O2 -pipe -fno-strict-aliasing
uname output: FreeBSD hal9000.schweikhardt.net 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r236718: Thu Jun  7 20:19:27 CEST 2012     toor@hal9000.schweikhardt.net:/usr/obj/home/root/FreeBSD/head/src/sys/HAL9000  amd64
Machine Type: amd64-portbld-freebsd10.0

Bash Version: 4.2
Patch Level: 28
Release Status: release

Description:
	'coproc' is missing from the list of reserved words

Repeat-By:
	man bash

[...]
RESERVED WORDS
       Reserved words are words that have a special meaning to the shell.  The
       following words are recognized as reserved when unquoted and either the
       first word of a simple command (see SHELL GRAMMAR below) or  the  third
       word of a case or for command:

       !  case  do done elif else esac fi for function if in select then until
       while { } time [[ ]]

[...]
       A coprocess is a shell command preceded by the coproc reserved word.

Fix:
	Augment list of reserved words with coproc.


From MAILER-DAEMON Fri Jun 08 18:03:25 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sd7HB-0002kC-QD
	for mharc-bug-bash@gnu.org; Fri, 08 Jun 2012 18:03:25 -0400
Received: from eggs.gnu.org ([208.118.235.92]:32780)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sd7H9-0002k3-H5
	for bug-bash@gnu.org; Fri, 08 Jun 2012 18:03:25 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sd7H7-0005Om-KT
	for bug-bash@gnu.org; Fri, 08 Jun 2012 18:03:23 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:27641)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sd7H7-0005OT-E0
	for bug-bash@gnu.org; Fri, 08 Jun 2012 18:03:21 -0400
Received: from mpv7.case.edu (mpv7.tis.cwru.edu [129.22.104.170])
	by mpv2.tis.cwru.edu (MOS 4.3.3-GA) with ESMTP id BLR30366;
	Fri, 8 Jun 2012 18:03:18 -0400
Received: from h191.11.172.72.dynamic.ip.windstream.net (EHLO z4.local)
	([72.172.11.191]) by mpv7.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id UCG41478 (AUTH cpr);
	Fri, 08 Jun 2012 18:03:18 -0400 (EDT)
Message-ID: <4FD276A5.9030604@case.edu>
Date: Fri, 08 Jun 2012 18:03:17 -0400
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6;
	rv:13.0) Gecko/20120601 Thunderbird/13.0
MIME-Version: 1.0
To: Jens Schweikhardt <schweikh@schweikhardt.net>
Subject: Re: Man page buglet: coproc is missing in the list of reserved words
References: <201206081649.q58GnnBF043088@hal9000.schweikhardt.net>
In-Reply-To: <201206081649.q58GnnBF043088@hal9000.schweikhardt.net>
X-Enigmail-Version: 1.4.2
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv2.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.37
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 08 Jun 2012 22:03:25 -0000

On 6/8/12 12:49 PM, Jens Schweikhardt wrote:

> Bash Version: 4.2
> Patch Level: 28
> Release Status: release
> 
> Description:
> 	'coproc' is missing from the list of reserved words

Thanks for the report.  Good catch.

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




From MAILER-DAEMON Fri Jun 08 21:01:13 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SdA3F-0007Y5-9v
	for mharc-bug-bash@gnu.org; Fri, 08 Jun 2012 21:01:13 -0400
Received: from eggs.gnu.org ([208.118.235.92]:43444)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SdA3C-0007W2-NZ
	for bug-bash@gnu.org; Fri, 08 Jun 2012 21:01:11 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SdA3A-0005MS-Tc
	for bug-bash@gnu.org; Fri, 08 Jun 2012 21:01:10 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:34077
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SdA3A-0005MM-J3
	for bug-bash@gnu.org; Fri, 08 Jun 2012 21:01:08 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.5/8.14.4/SuSE Linux 0.8) with ESMTP id
	q59113fv015877 for <bug-bash@gnu.org>; Fri, 8 Jun 2012 18:01:05 -0700
Message-ID: <4FD2A04F.6090805@tlinx.org>
Date: Fri, 08 Jun 2012 18:01:03 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: bug-bash <bug-bash@gnu.org>
Subject: Unhelpful behaviors in 4.2.10(1)
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 09 Jun 2012 01:01:12 -0000

File1:
sdf:
Ishtar:/tmp> more sdf
#!/bin/bash

_prgpth="${0:?}"; _prg="${_prgpth##*}"; _prgdr="${_prgpth%/$_prg}"
[[ -z $_prgdr || $_prg == $_prgdr ]] && $_prgdr="$PWD"
export PATH="$_prgdr/lib:$_prgdr:$PATH"
shopt -s expand_aliases extglob sourcepath ; set -o pipefail

. backtrace.shh

. sdf2
--------------------------------
file2: sdf2
#!/bin/bash


[[ $# -ge 2 ]] && echo weird

--------------------------------
running:
Ishtar:/tmp> sdf
  Error executing "[[ $# -ge 2 ]]" in "main"
     at "./sdf", line "4" (level=0)
---


So why am I getting a backtrace (and how do I make it put out the right 
file)?
I thought rather than something just dying -- it would be nice to know 
how it got there... so...backtrace... but the line it is complaining about
is in "sdf2" --- and WTF?... how is testing a number an error that would 
cause a
exception?

(if this was running under -e, I presume that if statements that are 
false now fail?... )...I thought complex statements were not supposed to 
fail

POSIX really F-U'ed on this one... go back to bash 2's "simple 
statements"...
having conditional statements fail is going overboard...
I mean it's an explicit check to avoid an error condition...so, of course,
such checks are now errors?!?!?!....ARG *hitting head against wall....***

file:
backtrace.shh:

>  more /home/law/bin/lib/backtrace.shh
#!/bin/bash
function backtrace {
 
  declare -i level=0
  while {
      local cmd=$BASH_COMMAND
      local fn=${FUNCNAME[level+1]:-}
      local src=${BASH_SOURCE[level+1]:-}
      local ln=${BASH_LINENO[level]:-}
    }; do
      [[ -n $fn && -n $src && -n $ln  ]] && {
        echo "  Error executing \"$cmd\" in \"$fn\""
        echo "     at \"$src\", line \"$ln\" (level=$level)"
        level+=1
        continue;
      }
      exit 1
    done
}

trap backtrace ERR
set -T



From MAILER-DAEMON Sat Jun 09 00:00:44 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SdCqy-0007Uk-6h
	for mharc-bug-bash@gnu.org; Sat, 09 Jun 2012 00:00:44 -0400
Received: from eggs.gnu.org ([208.118.235.92]:36260)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SdCqv-0007Tp-FN
	for bug-bash@gnu.org; Sat, 09 Jun 2012 00:00:42 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SdCqs-0005bP-BB
	for bug-bash@gnu.org; Sat, 09 Jun 2012 00:00:41 -0400
Received: from mail-ee0-f41.google.com ([74.125.83.41]:59378)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SdCqs-0005bD-1a
	for bug-bash@gnu.org; Sat, 09 Jun 2012 00:00:38 -0400
Received: by eekb47 with SMTP id b47so1574700eek.0
	for <bug-bash@gnu.org>; Fri, 08 Jun 2012 21:00:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=ODkrVOpkI+TdG2dp6lje0HuWL6SuFrgne4KSjBqODVc=;
	b=Pc2I4XHLSJbPP4M6/o1dZFI17BubNkWtGSAVg9Aosm1J86T8QYc1I6uuI6c7HSBqg2
	zwOBI86sST3C5emaeyfF+mhsep2qPj/yoh0d0Sf8aXSHDF6tPJ+lcl4zzB4ovUDYYUq5
	SkFpAYq1ZMlWSNmeI9BRB5GykdvEMKib4G5Yt/vlncGHg6+NBT0Twhdy/nqvLuqeUwPp
	OzdymH97m/0g8UdxKBsS5FUnvKvht6X37GhAhFA8LkrbyWJl1p3YkOIbkkB2XFjJ4YCt
	2GQUc1esYoZyZTDTrieMxtA+zjlprsjat5D5qX6Vd6frfyg/P7HaygktnfVA/X6WfnF+
	n2OQ==
Received: by 10.14.95.199 with SMTP id p47mr4316662eef.22.1339214435272; Fri,
	08 Jun 2012 21:00:35 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.14.124.73 with HTTP; Fri, 8 Jun 2012 21:00:15 -0700 (PDT)
In-Reply-To: <4FD2A04F.6090805@tlinx.org>
References: <4FD2A04F.6090805@tlinx.org>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Sat, 9 Jun 2012 07:00:15 +0300
Message-ID: <CAPSX3sSiBc0c03scoHHP5iBrX-u=ewCcZNWd7jg50k7nEvTizg@mail.gmail.com>
Subject: Re: Unhelpful behaviors in 4.2.10(1)
To: Linda Walsh <bash@tlinx.org>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.83.41
Cc: bug-bash <bug-bash@gnu.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 09 Jun 2012 04:00:42 -0000

On Sat, Jun 9, 2012 at 4:01 AM, Linda Walsh <bash@tlinx.org> wrote:
> File1:
> sdf:
> Ishtar:/tmp> more sdf
> #!/bin/bash
>
> _prgpth=3D"${0:?}"; _prg=3D"${_prgpth##*}"; _prgdr=3D"${_prgpth%/$_prg}"
> [[ -z $_prgdr || $_prg =3D=3D $_prgdr ]] && $_prgdr=3D"$PWD"
> export PATH=3D"$_prgdr/lib:$_prgdr:$PATH"
> shopt -s expand_aliases extglob sourcepath ; set -o pipefail
>
> . backtrace.shh
>
> . sdf2
> --------------------------------
> file2: sdf2
> #!/bin/bash
>
>
> [[ $# -ge 2 ]] && echo weird
>
> --------------------------------
> running:
> Ishtar:/tmp> sdf
> =A0Error executing "[[ $# -ge 2 ]]" in "main"
> =A0 =A0at "./sdf", line "4" (level=3D0)
> ---
>
>
> So why am I getting a backtrace (and how do I make it put out the right
> file)?
> I thought rather than something just dying -- it would be nice to know ho=
w
> it got there... so...backtrace... but the line it is complaining about
> is in "sdf2" --- and WTF?... how is testing a number an error that would
> cause a
> exception?
>
> (if this was running under -e, I presume that if statements that are fals=
e
> now fail?... )...I thought complex statements were not supposed to fail
>
> POSIX really F-U'ed on this one... go back to bash 2's "simple
> statements"...
> having conditional statements fail is going overboard...
> I mean it's an explicit check to avoid an error condition...so, of course=
,
> such checks are now errors?!?!?!....ARG *hitting head against wall....***
>
> file:
> backtrace.shh:
>
>> =A0more /home/law/bin/lib/backtrace.shh
>
> #!/bin/bash
> function backtrace {
>
> =A0declare -i level=3D0
> =A0while {
> =A0 =A0 local cmd=3D$BASH_COMMAND
> =A0 =A0 local fn=3D${FUNCNAME[level+1]:-}
> =A0 =A0 local src=3D${BASH_SOURCE[level+1]:-}
> =A0 =A0 local ln=3D${BASH_LINENO[level]:-}
> =A0 }; do
> =A0 =A0 [[ -n $fn && -n $src && -n $ln =A0]] && {
> =A0 =A0 =A0 echo " =A0Error executing \"$cmd\" in \"$fn\""
> =A0 =A0 =A0 echo " =A0 =A0 at \"$src\", line \"$ln\" (level=3D$level)"
> =A0 =A0 =A0 level+=3D1
> =A0 =A0 =A0 continue;
> =A0 =A0 }
> =A0 =A0 exit 1
> =A0 done
> }
>
> trap backtrace ERR
> set -T
>

To sum up ". sdf2"  is returning 1
Bash considers . to be a simple command even though what's really
executed is [[ $# -ge 2 ]] && echo hello.

The same thing happens with a function, eg you'll probably get the
same result with:
foo () { false && echo foo; }

It kinda make sense to me.

For what it's worth in bash 2.05b.0(1)-release:

echo '[[ $# -ge 2 ]] && echo foo' > sdf2;
( set -e; . ./sdf2;echo bar)

prints nothing...so I guess it's not that new


From MAILER-DAEMON Sat Jun 09 03:06:03 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SdFkJ-0005Bh-FN
	for mharc-bug-bash@gnu.org; Sat, 09 Jun 2012 03:06:03 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35415)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SdFkH-0005Bb-Rh
	for bug-bash@gnu.org; Sat, 09 Jun 2012 03:06:03 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SdFkG-0005fW-AL
	for bug-bash@gnu.org; Sat, 09 Jun 2012 03:06:01 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:40166
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SdFkG-0005fF-06
	for bug-bash@gnu.org; Sat, 09 Jun 2012 03:06:00 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.5/8.14.4/SuSE Linux 0.8) with ESMTP id
	q5975r3q014202; Sat, 9 Jun 2012 00:05:55 -0700
Message-ID: <4FD2F5D1.3050604@tlinx.org>
Date: Sat, 09 Jun 2012 00:05:53 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: Pierre Gaston <pierre.gaston@gmail.com>
Subject: Re: Unhelpful behaviors in 4.2.10(1)
References: <4FD2A04F.6090805@tlinx.org>
	<CAPSX3sSiBc0c03scoHHP5iBrX-u=ewCcZNWd7jg50k7nEvTizg@mail.gmail.com>
In-Reply-To: <CAPSX3sSiBc0c03scoHHP5iBrX-u=ewCcZNWd7jg50k7nEvTizg@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Cc: bug-bash <bug-bash@gnu.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 09 Jun 2012 07:06:03 -0000



Pierre Gaston wrote:
>
>> trap backtrace ERR
>> set -T
>>
> 
> To sum up ". sdf2"  is returning 1
> Bash considers . to be a simple command even though what's really
> executed is [[ $# -ge 2 ]] && echo hello.
---
	Right.... It's NOT a simple command.

	I am trapping on ERR, not 'anything' that is not zero.

Of all the stupid definitions... you have 256 useful values to return, and some
idiots decide 255 of them should be reserved for fatal errors (even when they are
not errors)...

	Is this even fixable?



From MAILER-DAEMON Sat Jun 09 07:32:46 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SdJuQ-00086w-7Q
	for mharc-bug-bash@gnu.org; Sat, 09 Jun 2012 07:32:46 -0400
Received: from eggs.gnu.org ([208.118.235.92]:56799)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SdJuO-00086T-1P
	for bug-bash@gnu.org; Sat, 09 Jun 2012 07:32:45 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SdJuM-0002mk-9p
	for bug-bash@gnu.org; Sat, 09 Jun 2012 07:32:43 -0400
Received: from mail-wg0-f49.google.com ([74.125.82.49]:37872)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SdJuM-0002mf-0k
	for bug-bash@gnu.org; Sat, 09 Jun 2012 07:32:42 -0400
Received: by wgbds1 with SMTP id ds1so1206540wgb.30
	for <bug-bash@gnu.org>; Sat, 09 Jun 2012 04:32:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=CXWbaw86SanSKeu3IOc/7W90A5BNRyk0rPQ4xttBAYM=;
	b=lhzuDlwAYuezxlzqY9tqmGAL+VacYQ5V6iQW/btLt50irCwueuc+awKtiJ37pnZ0AH
	jJnwr1czmpnI7GQ2epjvuctxibc7YlPuBZ7TREhDI3gu+crPym/o17aQ1dlmHz9fGEXb
	Vx14qs4XLnskbezuOSaCdVn1dpUFjvj5Krb+DWTemxJkSMn5Kd+HD/G1+0/dRyuLBWj6
	aqSakUjakkcorVrIlNtbl7A/yzyFJSpyv6uJQ6/98FU6gjuXAro8H1h/YSjltQfcnnFa
	7LHZ7st26xVdbZSE4T5HnVffTsRQVbYHkDlfgdpj730UwDvVCTYiUEEXMqeMNboo9rWM
	As6g==
Received: by 10.180.80.74 with SMTP id p10mr7450866wix.10.1339241559849; Sat,
	09 Jun 2012 04:32:39 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.194.54.135 with HTTP; Sat, 9 Jun 2012 04:32:19 -0700 (PDT)
In-Reply-To: <4FD2F5D1.3050604@tlinx.org>
References: <4FD2A04F.6090805@tlinx.org>
	<CAPSX3sSiBc0c03scoHHP5iBrX-u=ewCcZNWd7jg50k7nEvTizg@mail.gmail.com>
	<4FD2F5D1.3050604@tlinx.org>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Sat, 9 Jun 2012 14:32:19 +0300
Message-ID: <CAPSX3sSNsMjod+ZpdWEeoPjc=fA-QRdxMk7q9asa_NB3LHCxRA@mail.gmail.com>
Subject: Re: Unhelpful behaviors in 4.2.10(1)
To: Linda Walsh <bash@tlinx.org>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.82.49
Cc: bug-bash <bug-bash@gnu.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 09 Jun 2012 11:32:45 -0000

On Sat, Jun 9, 2012 at 10:05 AM, Linda Walsh <bash@tlinx.org> wrote:
>
>
> Pierre Gaston wrote:
>>
>>
>>> trap backtrace ERR
>>> set -T
>>>
>>
>> To sum up ". sdf2" =A0is returning 1
>> Bash considers . to be a simple command even though what's really
>> executed is [[ $# -ge 2 ]] && echo hello.
>
> ---
> =A0 =A0 =A0 =A0Right.... It's NOT a simple command.
>
> =A0 =A0 =A0 =A0I am trapping on ERR, not 'anything' that is not zero.
>
> Of all the stupid definitions... you have 256 useful values to return, an=
d
> some
> idiots decide 255 of them should be reserved for fatal errors (even when
> they are
> not errors)...
>
> =A0 =A0 =A0 =A0Is this even fixable?

Sorry if I was unclear but it is the  "." command that causes the
error. If you add "return 0" at the end of sdf2, you will see no
trace.
I would probably consider it a bug if "." was returning 1 without
triggering an error.

Now you could consider a bug to get the "[[ $# -ge 2 ]]" instead of
"." in BASH_COMMAND, though I guess some people might, on the
contrary, find it useful.


From MAILER-DAEMON Sat Jun 09 12:54:53 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SdOw9-0006t6-0X
	for mharc-bug-bash@gnu.org; Sat, 09 Jun 2012 12:54:53 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38586)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SdOw6-0006sa-2U
	for bug-bash@gnu.org; Sat, 09 Jun 2012 12:54:51 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SdOw4-0003CA-4I
	for bug-bash@gnu.org; Sat, 09 Jun 2012 12:54:49 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:33443)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SdOw3-0003Bv-VR
	for bug-bash@gnu.org; Sat, 09 Jun 2012 12:54:48 -0400
Received: from mpv8.tis.CWRU.Edu (EHLO mpv8.case.edu) ([129.22.105.116])
	by mpv1.tis.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id BZP32143; Sat, 09 Jun 2012 12:54:45 -0400 (EDT)
Received: from h191.11.172.72.dynamic.ip.windstream.net (EHLO z4.local)
	([72.172.11.191]) by mpv8.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id UIX95972 (AUTH cpr);
	Sat, 09 Jun 2012 12:54:45 -0400 (EDT)
Message-ID: <4FD37FD4.4020707@case.edu>
Date: Sat, 09 Jun 2012 12:54:44 -0400
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6;
	rv:13.0) Gecko/20120601 Thunderbird/13.0
MIME-Version: 1.0
To: Linda Walsh <bash@tlinx.org>
Subject: Re: Unhelpful behaviors in 4.2.10(1)
References: <4FD2A04F.6090805@tlinx.org>
	<CAPSX3sSiBc0c03scoHHP5iBrX-u=ewCcZNWd7jg50k7nEvTizg@mail.gmail.com>
	<4FD2F5D1.3050604@tlinx.org>
In-Reply-To: <4FD2F5D1.3050604@tlinx.org>
X-Enigmail-Version: 1.4.2
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: chet.ramey@case.edu, Pierre Gaston <pierre.gaston@gmail.com>,
	bug-bash <bug-bash@gnu.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 09 Jun 2012 16:54:51 -0000

On 6/9/12 3:05 AM, Linda Walsh wrote:
> 

>> To sum up ". sdf2"  is returning 1
>> Bash considers . to be a simple command even though what's really
>> executed is [[ $# -ge 2 ]] && echo hello.
> ---
>     Right.... It's NOT a simple command.

To be clear: `.' is a shell builtin, with its own semantics and exit status:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_18

Like any other builtin, it's a simple command when executed as one.
And like any other builtin, if it returns a non-zero exit status when
errexit is enabled, the shell will exit.

Chet

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




From MAILER-DAEMON Sat Jun 09 18:09:53 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SdTqz-0001Qg-Md
	for mharc-bug-bash@gnu.org; Sat, 09 Jun 2012 18:09:53 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42623)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SdTqw-0001Qa-Ob
	for bug-bash@gnu.org; Sat, 09 Jun 2012 18:09:52 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SdTqu-0007U0-O2
	for bug-bash@gnu.org; Sat, 09 Jun 2012 18:09:50 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:54350
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SdTqu-0007Td-Dk
	for bug-bash@gnu.org; Sat, 09 Jun 2012 18:09:48 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.5/8.14.4/SuSE Linux 0.8) with ESMTP id
	q59M9eSE005640; Sat, 9 Jun 2012 15:09:42 -0700
Message-ID: <4FD3C9A4.6010807@tlinx.org>
Date: Sat, 09 Jun 2012 15:09:40 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: Unhelpful behaviors in 4.2.10(1)
References: <4FD2A04F.6090805@tlinx.org>
	<CAPSX3sSiBc0c03scoHHP5iBrX-u=ewCcZNWd7jg50k7nEvTizg@mail.gmail.com>
	<4FD2F5D1.3050604@tlinx.org> <4FD37FD4.4020707@case.edu>
In-Reply-To: <4FD37FD4.4020707@case.edu>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Cc: bug-bash <bug-bash@gnu.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 09 Jun 2012 22:09:52 -0000



Chet Ramey wrote:
> On 6/9/12 3:05 AM, Linda Walsh wrote:
> 
>>> To sum up ". sdf2"  is returning 1
>>> Bash considers . to be a simple command even though what's really
>>> executed is [[ $# -ge 2 ]] && echo hello.
>> ---
>>     Right.... It's NOT a simple command.
> 
> To be clear: `.' is a shell builtin, with its own semantics and exit status:
> 
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_18
> 
> Like any other builtin, it's a simple command when executed as one.
> And like any other builtin, if it returns a non-zero exit status when
> errexit is enabled, the shell will exit.
------------

That's fine -- if the error message points at the included file as "not returning a
'true' value.

It doesn't.  It points to a conditional in the previous file.


Perl issues a "FAIL" if you don't return true from including a module and people
always make sure to add a '1' at the end of their module.

If bash wants to require similar, then have it report WHY it is failing -- not 
pointing at
a statement in the previous file that looks like it is doing what it is supposed 
to be
doing.

Though -- for consistency,  why doesn't the filename point to the statement 
shown that possesses
the line number that is given?


That's also a bit misleading.


Half my problems in perl would just "go away", if it gave read error messages 
that pointed to the
real problem rather than perfectly valid statements 50-100 lines away (if they 
are even in the same
file)....



From MAILER-DAEMON Mon Jun 11 03:59:57 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SdzXZ-0002Mi-DQ
	for mharc-bug-bash@gnu.org; Mon, 11 Jun 2012 03:59:57 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37755)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <johnemb@gmail.com>) id 1SdzXW-0002Gi-Ki
	for bug-bash@gnu.org; Mon, 11 Jun 2012 03:59:55 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <johnemb@gmail.com>) id 1SdzXT-0006Ue-R0
	for bug-bash@gnu.org; Mon, 11 Jun 2012 03:59:54 -0400
Received: from mail-lb0-f169.google.com ([209.85.217.169]:43975)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <johnemb@gmail.com>) id 1SdzXT-0006UN-Da
	for bug-bash@gnu.org; Mon, 11 Jun 2012 03:59:51 -0400
Received: by lbjn8 with SMTP id n8so3368167lbj.0
	for <bug-bash@gnu.org>; Mon, 11 Jun 2012 00:59:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=message-id:date:from:user-agent:mime-version:to:cc:subject
	:references:content-type:content-transfer-encoding;
	bh=SCuQktWlcnd70rqumdIi81JR7BEq/9bNf6icWHEo0pc=;
	b=ofhuUVd56gr1yNbJIL94GA1gUx9Gak9tdUJKe+TehO5ISygiOC5y8QbrU39q8jxdVm
	joQ4fw1Ck6ebqFD05ubd0ljDYOuAMu5rxPJ7Y+W5Nz4olTAaU9R7QR/6yRz/+3mNBwc3
	yT9Hn/hDi1UEL2pHWK3CNMsPMdMlJq+sCozkXvey2G1YXmk2l0PQeRzEeoWhhqNEGfZ1
	uu6qA4l5WaatHXrfVnI9x3/43S12P1dOiWKItEFGRbCDYgPUNK5kDAS1VsFazUVYD8Ty
	L98jL1IfEtD+0TKjsF4zw5tuhUv7DPvej292FAFCz/SBKpVNdiqU1TasH9+DsqCHZZaJ
	ddyw==
Received: by 10.112.86.132 with SMTP id p4mr2760532lbz.22.1339401588195;
	Mon, 11 Jun 2012 00:59:48 -0700 (PDT)
Received: from [10.0.0.3] (49.202.189.109.customer.cdi.no. [109.189.202.49])
	by mx.google.com with ESMTPS id gv8sm23290841lab.14.2012.06.11.00.59.47
	(version=SSLv3 cipher=OTHER); Mon, 11 Jun 2012 00:59:47 -0700 (PDT)
Message-ID: <4FD5A56E.4020606@gmail.com>
Date: Mon, 11 Jun 2012 09:59:42 +0200
From: John Embretsen <johnemb@gmail.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:12.0) Gecko/20120430 Thunderbird/12.0.1
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: bash tab variable expansion question?
References: 4D6ADBC0.2000906@case.edu
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.217.169
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 11 Jun 2012 07:59:56 -0000

On 27 Feb 2011 18:18:24 -0500, Chet Ramey wrote:
 >> On Sat, Feb 26, 2011 at 10:49 PM, gnu.bash.bug <address@hidden>wrote:
 >> A workaround is fine but is the 4.2 behavior bug or not?
 >
 >It's a more-or-less unintended consequence of the requested change Eric
 >Blake referred to earlier in the thread.

http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00275.html

(...)

 > The question is how to tell readline that the `$' should be quoted
 > under some circumstances but not others.  There's no hard-and-fast
 > rule that works all the time, though I suppose a call to stat(2)
 > before quoting would solve part of the problem.  I will have to give
 > it more thought.
 >
 > Chet

Any updates on this issue?

The workarounds for $PWD and $OLDPWD is not enough, and the "workaround" 
of going back on the command line and removing escape characters is not 
acceptable in my humble opinion.

I often use environment variable-based tab completion to navigate to the 
correct directory on my system, but with bash 4.2 this is no longer an 
option. For example,

with CODE=/path/to/dir and /path/to/dir/ containing test1/ and test2/,

cd $CODE/test<TAB><TAB> should give a list of $CODE/test1 $CODE/test2 
when those directories exist, not "cd \$CODE/test".

If there is no fix in sight for this issue, can someone point me to a 
guide for downgrading bash in recent popular Linux distros?


thanks,

-- 
John


From MAILER-DAEMON Mon Jun 11 04:10:31 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sdzhm-0005l0-V4
	for mharc-bug-bash@gnu.org; Mon, 11 Jun 2012 04:10:30 -0400
Received: from eggs.gnu.org ([208.118.235.92]:34735)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Sdzhh-0005kI-Dt
	for bug-bash@gnu.org; Mon, 11 Jun 2012 04:10:30 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Sdzhf-0000JH-Du
	for bug-bash@gnu.org; Mon, 11 Jun 2012 04:10:24 -0400
Received: from mail-wg0-f41.google.com ([74.125.82.41]:59966)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Sdzhf-0000J6-5G
	for bug-bash@gnu.org; Mon, 11 Jun 2012 04:10:23 -0400
Received: by wgbds1 with SMTP id ds1so2911384wgb.0
	for <bug-bash@gnu.org>; Mon, 11 Jun 2012 01:10:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=E9uNz7GP0uwMgVNhmCOwi/2O8STneCpgOnpE6x8C8sA=;
	b=tzB1eOKbehpy4J63IhR6t7gCdO7Hb5z8/r+AA1e5chP1DhtmTF/QpyPWTs6yx+7KkL
	H+WyeATkAE6sBHTGM+o+tX5WRlyWHtW2ONXtpOo1FoIU6rcDfzdDUyZ7wCHTOb2mFZyc
	ljVHzSA/M2k98ybBQ2vzY1byho9LOXLoWE4dhGHqFk95fKqXafCxhOVEJ67vkz2JUy0g
	UlQosd1L2+G7GTYHVZF9/2gQHnWljFFyjOxi7ctUfZ3TSqw3Tp/taK9mwUa8E5ist1X5
	RJpco7vxtuHPpJVSX6pnCNzYAkFtMJXUAUAOlqcNL+rFxV8h05wev3YQgTwxctuGBouK
	xgow==
Received: by 10.180.93.196 with SMTP id cw4mr18670679wib.11.1339402220598;
	Mon, 11 Jun 2012 01:10:20 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.194.54.135 with HTTP; Mon, 11 Jun 2012 01:10:00 -0700 (PDT)
In-Reply-To: <4FD5A56E.4020606@gmail.com>
References: <4FD5A56E.4020606@gmail.com>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Mon, 11 Jun 2012 11:10:00 +0300
Message-ID: <CAPSX3sT49B5w4cBJcg5LDYiD5mm=XjGVTrrDXCkaU+aKxGsPMg@mail.gmail.com>
Subject: Re: bash tab variable expansion question?
To: John Embretsen <johnemb@gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.82.41
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 11 Jun 2012 08:10:30 -0000

On Mon, Jun 11, 2012 at 10:59 AM, John Embretsen <johnemb@gmail.com> wrote:
> On 27 Feb 2011 18:18:24 -0500, Chet Ramey wrote:
>>> On Sat, Feb 26, 2011 at 10:49 PM, gnu.bash.bug <address@hidden>wrote:
>>> A workaround is fine but is the 4.2 behavior bug or not?
>>
>>It's a more-or-less unintended consequence of the requested change Eric
>>Blake referred to earlier in the thread.
>
> http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00275.html
>
> (...)
>
>> The question is how to tell readline that the `$' should be quoted
>> under some circumstances but not others. =A0There's no hard-and-fast
>> rule that works all the time, though I suppose a call to stat(2)
>> before quoting would solve part of the problem. =A0I will have to give
>> it more thought.
>>
>> Chet
>
> Any updates on this issue?
>
> The workarounds for $PWD and $OLDPWD is not enough, and the "workaround" =
of
> going back on the command line and removing escape characters is not
> acceptable in my humble opinion.
>
> I often use environment variable-based tab completion to navigate to the
> correct directory on my system, but with bash 4.2 this is no longer an
> option. For example,
>
> with CODE=3D/path/to/dir and /path/to/dir/ containing test1/ and test2/,
>
> cd $CODE/test<TAB><TAB> should give a list of $CODE/test1 $CODE/test2 whe=
n
> those directories exist, not "cd \$CODE/test".
>
> If there is no fix in sight for this issue, can someone point me to a gui=
de
> for downgrading bash in recent popular Linux distros?
>
>
> thanks,
>
> --
> John
>

There have been many updates on this. There have been a "fix"
available for some time now on this list .

It is now available as an official patch
ftp://ftp.gnu.org/gnu/bash/bash-4.2-patches/bash42-029


From MAILER-DAEMON Mon Jun 11 05:07:29 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Se0av-0000zl-CO
	for mharc-bug-bash@gnu.org; Mon, 11 Jun 2012 05:07:29 -0400
Received: from eggs.gnu.org ([208.118.235.92]:34156)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <johnemb@gmail.com>) id 1Se0ao-0000yR-7h
	for bug-bash@gnu.org; Mon, 11 Jun 2012 05:07:28 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <johnemb@gmail.com>) id 1Se0ah-0005lx-Vl
	for bug-bash@gnu.org; Mon, 11 Jun 2012 05:07:21 -0400
Received: from mail-lb0-f169.google.com ([209.85.217.169]:58364)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <johnemb@gmail.com>) id 1Se0ah-0005lZ-Ks
	for bug-bash@gnu.org; Mon, 11 Jun 2012 05:07:15 -0400
Received: by lbjn8 with SMTP id n8so3413106lbj.0
	for <bug-bash@gnu.org>; Mon, 11 Jun 2012 02:07:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=message-id:date:from:user-agent:mime-version:to:cc:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	bh=4KoF+6efOkHwM8nYqbV3nKlemVMBtUR7lI1x+QxBtPE=;
	b=kcpeqKKzhTj47uHJUow+Ux48GP2nRFh0o49xlA3AHhRQX8Iw76s8FZpcsUmAM+g2KB
	usgkJrbu4TxMww7NEce8DEskRDxNp0r++W6haCfbxkfaXGjVOdJSmDbc5yaLeKQF6wdL
	mdpLf77xNtncAbIxIHQjva270DvUCPN+UadAMIO2PpJEEuRcHjsKqUx53kOi0wxGCuii
	PwIXkfQrV8mocny9UliZYRSHMGqRAbQgcdpIsJg/Cv6R01zrbYX43WqJz1zj+K7qWJ1U
	EwpHefFp/qOHL5omZoWSmhZ5ZbGsie9U73523Jwk2LnFKkRTUIq7cwZ/Ehdg/DIy5M5s
	kqEw==
Received: by 10.112.83.136 with SMTP id q8mr2829691lby.60.1339405632972;
	Mon, 11 Jun 2012 02:07:12 -0700 (PDT)
Received: from [10.0.0.3] (49.202.189.109.customer.cdi.no. [109.189.202.49])
	by mx.google.com with ESMTPS id fv16sm23545944lab.9.2012.06.11.02.07.12
	(version=SSLv3 cipher=OTHER); Mon, 11 Jun 2012 02:07:12 -0700 (PDT)
Message-ID: <4FD5B53A.20108@gmail.com>
Date: Mon, 11 Jun 2012 11:07:06 +0200
From: John Embretsen <johnemb@gmail.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:12.0) Gecko/20120430 Thunderbird/12.0.1
MIME-Version: 1.0
To: Pierre Gaston <pierre.gaston@gmail.com>
Subject: Re: bash tab variable expansion question?
References: <4FD5A56E.4020606@gmail.com>
	<CAPSX3sT49B5w4cBJcg5LDYiD5mm=XjGVTrrDXCkaU+aKxGsPMg@mail.gmail.com>
In-Reply-To: <CAPSX3sT49B5w4cBJcg5LDYiD5mm=XjGVTrrDXCkaU+aKxGsPMg@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.217.169
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 11 Jun 2012 09:07:28 -0000

On 06/11/2012 10:10 AM, Pierre Gaston wrote:
> On Mon, Jun 11, 2012 at 10:59 AM, John Embretsen<johnemb@gmail.com>  wrote:
>> On 27 Feb 2011 18:18:24 -0500, Chet Ramey wrote:
>>>> On Sat, Feb 26, 2011 at 10:49 PM, gnu.bash.bug<address@hidden>wrote:
>>>> A workaround is fine but is the 4.2 behavior bug or not?
>>>
>>> It's a more-or-less unintended consequence of the requested change Eric
>>> Blake referred to earlier in the thread.
>>
>> http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00275.html
>>
>> (...)
>>
>>> The question is how to tell readline that the `$' should be quoted
>>> under some circumstances but not others.  There's no hard-and-fast
>>> rule that works all the time, though I suppose a call to stat(2)
>>> before quoting would solve part of the problem.  I will have to give
>>> it more thought.
>>>
>>> Chet
>>
>> Any updates on this issue?

(...)

>
> There have been many updates on this. There have been a "fix"
> available for some time now on this list .
>
> It is now available as an official patch
> ftp://ftp.gnu.org/gnu/bash/bash-4.2-patches/bash42-029

Thank you. For someone like me who is not active in this project it 
seems it is not very easy to keep track of bugs, patches and releases. 
Is there an issue number/bug number of some sort for this particular 
issue that I could use for this purpose?

I hope the patch works well enough and that it will end up in Linux 
distros shortly.


-- 
John


From MAILER-DAEMON Mon Jun 11 05:10:46 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Se0e6-0001QG-RI
	for mharc-bug-bash@gnu.org; Mon, 11 Jun 2012 05:10:46 -0400
Received: from eggs.gnu.org ([208.118.235.92]:56772)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1Se0e1-0001PH-78
	for bug-bash@gnu.org; Mon, 11 Jun 2012 05:10:42 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1Se0dr-0006Td-IR
	for bug-bash@gnu.org; Mon, 11 Jun 2012 05:10:40 -0400
Received: from mx1.redhat.com ([209.132.183.28]:13572)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1Se0dr-0006TR-Ab
	for bug-bash@gnu.org; Mon, 11 Jun 2012 05:10:31 -0400
Received: from int-mx01.intmail.prod.int.phx2.redhat.com
	(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q5B9ATe1030180
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
	for <bug-bash@gnu.org>; Mon, 11 Jun 2012 05:10:29 -0400
Received: from [10.36.5.61] (vpn1-5-61.ams2.redhat.com [10.36.5.61])
	by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
	id q5B9ARJg001364
	for <bug-bash@gnu.org>; Mon, 11 Jun 2012 05:10:28 -0400
Message-ID: <4FD5B603.3070600@redhat.com>
Date: Mon, 11 Jun 2012 11:10:27 +0200
From: Roman Rakus <rrakus@redhat.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:11.0) Gecko/20120329 Thunderbird/11.0.1
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Re: bash tab variable expansion question?
References: <4FD5A56E.4020606@gmail.com>
	<CAPSX3sT49B5w4cBJcg5LDYiD5mm=XjGVTrrDXCkaU+aKxGsPMg@mail.gmail.com>
	<4FD5B53A.20108@gmail.com>
In-Reply-To: <4FD5B53A.20108@gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.132.183.28
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 11 Jun 2012 09:10:43 -0000

On 06/11/2012 11:07 AM, John Embretsen wrote:
> On 06/11/2012 10:10 AM, Pierre Gaston wrote:
>> On Mon, Jun 11, 2012 at 10:59 AM, John Embretsen<johnemb@gmail.com>  
>> wrote:
>>> On 27 Feb 2011 18:18:24 -0500, Chet Ramey wrote:
>>>>> On Sat, Feb 26, 2011 at 10:49 PM, gnu.bash.bug<address@hidden>wrote:
>>>>> A workaround is fine but is the 4.2 behavior bug or not?
>>>>
>>>> It's a more-or-less unintended consequence of the requested change 
>>>> Eric
>>>> Blake referred to earlier in the thread.
>>>
>>> http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00275.html
>>>
>>> (...)
>>>
>>>> The question is how to tell readline that the `$' should be quoted
>>>> under some circumstances but not others.  There's no hard-and-fast
>>>> rule that works all the time, though I suppose a call to stat(2)
>>>> before quoting would solve part of the problem.  I will have to give
>>>> it more thought.
>>>>
>>>> Chet
>>>
>>> Any updates on this issue?
>
> (...)
>
>>
>> There have been many updates on this. There have been a "fix"
>> available for some time now on this list .
>>
>> It is now available as an official patch
>> ftp://ftp.gnu.org/gnu/bash/bash-4.2-patches/bash42-029
>
> Thank you. For someone like me who is not active in this project it 
> seems it is not very easy to keep track of bugs, patches and releases. 
> Is there an issue number/bug number of some sort for this particular 
> issue that I could use for this purpose?
There isn't any tracker for (upstream) bash. At least I don't know about 
any.
>
> I hope the patch works well enough and that it will end up in Linux 
> distros shortly.
>
>
Fedora already has it. But there is also (the same?) bug in 
bash-completion, which is reported upstream.

RR


From MAILER-DAEMON Wed Jun 13 18:05:49 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SevhF-0003Lh-89
	for mharc-bug-bash@gnu.org; Wed, 13 Jun 2012 18:05:49 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46725)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SevhC-0003LW-Ph
	for bug-bash@gnu.org; Wed, 13 Jun 2012 18:05:48 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SevhA-0008OI-Ua
	for bug-bash@gnu.org; Wed, 13 Jun 2012 18:05:46 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:42942
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SevhA-0008O3-Hd
	for bug-bash@gnu.org; Wed, 13 Jun 2012 18:05:44 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.5/8.14.4/SuSE Linux 0.8) with ESMTP id
	q5DM5c3O010587
	for <bug-bash@gnu.org>; Wed, 13 Jun 2012 15:05:40 -0700
Message-ID: <4FD90EB2.7020305@tlinx.org>
Date: Wed, 13 Jun 2012 15:05:38 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: bug-bash <bug-bash@gnu.org>, bug-bash <bug-bash@gnu.org>
Subject: Re: bash giving wrong message for indicated failure (was Re:
	Unhelpful behaviors in 4.2.10(1))
References: <4FD2A04F.6090805@tlinx.org>	<CAPSX3sSiBc0c03scoHHP5iBrX-u=ewCcZNWd7jg50k7nEvTizg@mail.gmail.com>	<4FD2F5D1.3050604@tlinx.org>
	<4FD37FD4.4020707@case.edu> <4FD3C9A4.6010807@tlinx.org>
In-Reply-To: <4FD3C9A4.6010807@tlinx.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 13 Jun 2012 22:05:48 -0000

Reference original problem:
========================================================================
> ----- Begin File1 (sdf) ----------------
> #!/bin/bash
> 
> _prgpth="${0:?}"; _prg="${_prgpth##*}"; _prgdr="${_prgpth%/$_prg}"
> [[ -z $_prgdr || $_prg == $_prgdr ]] && $_prgdr="$PWD"
> export PATH="$_prgdr/lib:$_prgdr:$PATH"
> shopt -s expand_aliases extglob sourcepath ; set -o pipefail
> 
> . backtrace.shh
> 
> . sdf2
> ------- End File1 (sdf) ----------------
> ------- Begin File2 (sdf2) -------------
> #!/bin/bash
> 
> 
> [[ $# -ge 2 ]] && echo weird
> 
> ------- End File2 (sdf2) ----------------
> 
> Execution output:
> ----------------
> $ sdf
>  Error executing "[[ $# -ge 2 ]]" in "main"	<<<- wrong statement
>     at "./sdf", line "4" (level=0)            <<<- wrong file & line #
> ---
========================================================================

Linda Walsh wrote:
> Chet Ramey wrote:

>> To be clear: `.' is a shell builtin, with its own semantics and exit 
>> status:
>>
>> Like any other builtin, it's a simple command when executed as one.
>> And like any other builtin, if it returns a non-zero exit status when
>> errexit is enabled, the shell will exit.
> ------------
> 
> That's fine -- if the error message points at the included file as "not 
> returning a > 'true' value.
> 
> It doesn't.  It points to a conditional in the previous file.
========================================================================


   Is something that can be fixed?

   It really would be helpful for error messages to point at the actual problem and
give a reason for the error leading the user to a correct solution for their
code.

    I.e. as it stands, the above _looks_ like it doesn't like the conditional,
so I'd be inclined to rewrite the conditional as a negative, just to get
around a "BASH problem" (in this case, the fact that it points to the wrong
statement is really the problem).  Unfortunately, this wouldn't lead to
any greater understanding of the issue for the user nor give them the essential
information that "." and "source" are treated like commands and are not "simply"
"include" statements -- which is how I /tended/ to think of them (even though they
are more akin to an 'eval' of the included contents, sorta, though I wouldn't
be sure about that being entirely accurate either.  ;-/

   But having the error point to the "." or "source" and say the command didn't 
return
a 0 status, would be very clear.



From MAILER-DAEMON Thu Jun 14 08:43:36 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sf9Oi-0005yf-Kl
	for mharc-bug-bash@gnu.org; Thu, 14 Jun 2012 08:43:36 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46719)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sf9Ob-0005yY-F3
	for bug-bash@gnu.org; Thu, 14 Jun 2012 08:43:35 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sf9OV-00084K-7u
	for bug-bash@gnu.org; Thu, 14 Jun 2012 08:43:29 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:57541)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sf9OV-00083i-2x
	for bug-bash@gnu.org; Thu, 14 Jun 2012 08:43:23 -0400
Received: from mpv5.tis.cwru.edu (EHLO mpv5.cwru.edu) ([129.22.105.51])
	by mpv1.tis.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id BZU58608; Thu, 14 Jun 2012 08:43:20 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (HELO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with SMTP id AYS02176; Thu, 14 Jun 2012 08:43:20 -0400 (EDT)
Date: Thu, 14 Jun 2012 08:35:01 -0400
From: Chet Ramey <chet.ramey@case.edu>
Sender: Chet Ramey <chet@caleb.ins.cwru.edu>
To: bash@tlinx.org
Subject: Re: bash giving wrong message for indicated failure (was
	Re:	Unhelpful behaviors in 4.2.10(1))
References: <4FD2A04F.6090805@tlinx.org>	<CAPSX3sSiBc0c03scoHHP5iBrX-u=ewCcZNWd7jg50k7nEvTizg@mail.gmail.com>	<4FD2F5D1.3050604@tlinx.org>	<4FD37FD4.4020707@case.edu>
	<4FD3C9A4.6010807@tlinx.org> <4FD90EB2.7020305@tlinx.org>
In-Reply-To: Message from bash@tlinx.org of Wed,
	13 Jun 2012 15:05:38 -0700 (id <4FD90EB2.7020305@tlinx.org>)
Message-ID: <120614123501.AA03936.SM@caleb.ins.cwru.edu>
Read-Receipt-To: chet.ramey@case.edu
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet@po.cwru.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 14 Jun 2012 12:43:35 -0000

> > That's fine -- if the error message points at the included file as "not 
> > returning a > 'true' value.
> > 
> > It doesn't.  It points to a conditional in the previous file.

Note that the error message wasn't generated by bash: you generated it
yourself based on $BASH_COMMAND and the various LINENO variables.  That
implies where information needs to be saved and restored around calls
to eval/./source.

That can be fixed, and will be for the next bash release.

Chet

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


From MAILER-DAEMON Thu Jun 14 14:40:24 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SfExz-0007kD-Tt
	for mharc-bug-bash@gnu.org; Thu, 14 Jun 2012 14:40:23 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37789)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SfExx-0007c0-71
	for bug-bash@gnu.org; Thu, 14 Jun 2012 14:40:22 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SfExv-0005GI-B9
	for bug-bash@gnu.org; Thu, 14 Jun 2012 14:40:20 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:59546
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SfExv-0005G1-0o
	for bug-bash@gnu.org; Thu, 14 Jun 2012 14:40:19 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.5/8.14.4/SuSE Linux 0.8) with ESMTP id
	q5EIeCMr030640; Thu, 14 Jun 2012 11:40:14 -0700
Message-ID: <4FDA300C.1040608@tlinx.org>
Date: Thu, 14 Jun 2012 11:40:12 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: bash giving wrong message for indicated failure (was
	Re:	Unhelpful behaviors in 4.2.10(1))
References: <4FD2A04F.6090805@tlinx.org>	<CAPSX3sSiBc0c03scoHHP5iBrX-u=ewCcZNWd7jg50k7nEvTizg@mail.gmail.com>	<4FD2F5D1.3050604@tlinx.org>	<4FD37FD4.4020707@case.edu>
	<4FD3C9A4.6010807@tlinx.org> <4FD90EB2.7020305@tlinx.org>
	<120614123501.AA03936.SM@caleb.ins.cwru.edu>
In-Reply-To: <120614123501.AA03936.SM@caleb.ins.cwru.edu>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Cc: bug-bash@gnu.org, chet@po.cwru.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 14 Jun 2012 18:40:22 -0000



Chet Ramey wrote:
>>> That's fine -- if the error message points at the included file as "not 
>>> returning a > 'true' value.
>>>
>>> It doesn't.  It points to a conditional in the previous file.
> 
> Note that the error message wasn't generated by bash: you generated it
> yourself based on $BASH_COMMAND and the various LINENO variables.  That
> implies where information needs to be saved and restored around calls
> to eval/./source.
> 
> That can be fixed, and will be for the next bash release.
-----

Erp....details!.... ;-)

Maybe the error message could be included with bash?
It's a nice feature to have builtin...(if it works correctly)...


From MAILER-DAEMON Mon Jun 18 14:15:41 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SggUH-0001vr-DG
	for mharc-bug-bash@gnu.org; Mon, 18 Jun 2012 14:15:41 -0400
Received: from eggs.gnu.org ([208.118.235.92]:43251)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jdevera@jacobodevera.com>) id 1SgbsK-0002Y4-2X
	for bug-bash@gnu.org; Mon, 18 Jun 2012 09:20:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jdevera@jacobodevera.com>) id 1SgbsC-0001d4-Ef
	for bug-bash@gnu.org; Mon, 18 Jun 2012 09:20:11 -0400
Received: from mail-qa0-f41.google.com ([209.85.216.41]:52439)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jdevera@jacobodevera.com>) id 1SgbsC-0001ZN-Ag
	for bug-bash@gnu.org; Mon, 18 Jun 2012 09:20:04 -0400
Received: by qabg27 with SMTP id g27so1293355qab.14
	for <bug-bash@gnu.org>; Mon, 18 Jun 2012 06:20:01 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=google.com; s=20120113;
	h=mime-version:sender:from:date:x-google-sender-auth:message-id
	:subject:to:content-type:x-gm-message-state;
	bh=cWAt8wx6+8LZgbbVaSr4NheVqC12pc36uGhIsVBD0O8=;
	b=T4CeW924+QsNTvUTVOmQMZSvw/ohISNZnqHNZdmc7pSenzRAHxDyl03RRDftrQNK5k
	3qS6zGUuPGbR1AHtU2swQsjpJUjrWePJJbU8RRyfEO+vKJPV0nWKHAAF4lUTOqXRtY8j
	jvz+KCEYbjO9iE3sV6e+0hd/Jjsmzs9abwtkWHTqn6EpHMVbJkZH2shO+CcWis5pnNc7
	7Pzu1VCZZM8slPok3C7iiY6pginDobpkv0g+mq3zePzR8myRSGQegJYtNGfNWh97cX9b
	JyxmVQe2y5RBWxwpdo8cZ4nU7kOn0NYrN+cwhDV9bq6E/g4qNnoF+4Ht8/wq4cU3zxDw
	cv5Q==
Received: by 10.224.116.203 with SMTP id n11mr27083242qaq.61.1340025601847;
	Mon, 18 Jun 2012 06:20:01 -0700 (PDT)
MIME-Version: 1.0
Sender: jdevera@jacobodevera.com
Received: by 10.229.103.144 with HTTP; Mon, 18 Jun 2012 06:19:41 -0700 (PDT)
From: Jacobo de Vera <devel@jacobodevera.com>
Date: Mon, 18 Jun 2012 14:19:41 +0100
X-Google-Sender-Auth: CDNhLfwF7vs86ajJCDf6Df5qX1c
Message-ID: <CAOqX-RWjQ960B6kz3Dymfcn=VB=BAH6pJnEbu6QKwWYetCA31A@mail.gmail.com>
Subject: Arrays declared global in function and initialised in same line are
	not visible outside of function
To: bug-bash@gnu.org, bash@packages.debian.org
Content-Type: text/plain; charset=UTF-8
X-Gm-Message-State: ALoCoQkOjKTBfRhCzd8it7GwTo4WT8XXdEnzd2ZnYmZl7f9WTMMGET4I+Q+0M4w0aeOjUCHEDzpt
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.216.41
X-Mailman-Approved-At: Mon, 18 Jun 2012 14:15:38 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 18 Jun 2012 13:20:13 -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../bash -I../bash/include
-I../bash/lib  -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector
--param=ssp-buffer-size=4 -Wformat -Wformat-security
-Werror=format-security -Wall
uname output: Linux kalgan 3.2.0-24-generic #39-Ubuntu SMP Mon May 21
16:52:17 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.2
Patch Level: 24
Release Status: release

Description:

See the following script:
    aa()
    {
        declare -gA arr1=(['key1']='value1')
        declare -gA arr2
        declare -ga arr3=(valuea valueb)
        declare -ga arr4
        arr4[1]=valuea
        arr4[2]=valueb
        arr2[key2]=value2
        echo "Inside aa"
        echo "Arr1: ${arr1[key1]}"
        echo "Arr2: ${arr2[key2]}"
        echo "Arr3: ${arr3[@]}"
        echo "Arr4: ${arr4[@]}"
    }

    bb()
    {
        echo "Inside bb"
        echo "Arr1: ${arr1[key1]}"
        echo "Arr2: ${arr2[key2]}"
        echo "Arr3: ${arr3[@]}"
        echo "Arr4: ${arr4[@]}"
    }

    aa
    bb

    echo "Global scope"
    echo "Arr1: ${arr1[key1]}"
    echo "Arr2: ${arr2[key2]}"
    echo "Arr3: ${arr3[@]}"
    echo "Arr4: ${arr4[@]}"

Arrays arr1 and arr3, initialised on the same line as declared, are
not visible outside the function where they are declared, whereas
arrays modified in separate statements are.

Since same line is the only way to initialise readonly arrays, this
means there is no way to have readonly global arrays created from
function.

Repeat-By:
    See function in description


From MAILER-DAEMON Mon Jun 18 14:36:14 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SggoA-0003AM-R9
	for mharc-bug-bash@gnu.org; Mon, 18 Jun 2012 14:36:14 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33233)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Sggo8-0003A1-Aw
	for bug-bash@gnu.org; Mon, 18 Jun 2012 14:36:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Sggo4-00030c-AY
	for bug-bash@gnu.org; Mon, 18 Jun 2012 14:36:11 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:59581
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Sggo4-0002xJ-4G
	for bug-bash@gnu.org; Mon, 18 Jun 2012 14:36:08 -0400
Received: (qmail 22169 invoked from network); 18 Jun 2012 18:35:42 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Mon, 18 Jun 2012 14:35:42 -0400
Received: (qmail 8703 invoked by uid 563); 18 Jun 2012 18:35:41 -0000
Date: Mon, 18 Jun 2012 14:35:41 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Jacobo de Vera <devel@jacobodevera.com>
Subject: Re: Arrays declared global in function and initialised in same line
	are not visible outside of function
Message-ID: <20120618183541.GA8239@eeg.ccf.org>
References: <CAOqX-RWjQ960B6kz3Dymfcn=VB=BAH6pJnEbu6QKwWYetCA31A@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAOqX-RWjQ960B6kz3Dymfcn=VB=BAH6pJnEbu6QKwWYetCA31A@mail.gmail.com>
User-Agent: Mutt/1.4.2.3i
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older,
	2)
X-Received-From: 139.137.100.1
Cc: bug-bash@gnu.org, bash@packages.debian.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 18 Jun 2012 18:36:13 -0000

On Mon, Jun 18, 2012 at 02:19:41PM +0100, Jacobo de Vera wrote:

> Subject: Re: Arrays declared global in function and initialised in same line are not visible outside of function

I can't reproduce that problem:

imadev:~$ unset a; f() { declare -ga a=(1 2); }; f; declare -p a
declare -a a='([0]="1" [1]="2")'

> Since same line is the only way to initialise readonly arrays, this
> means there is no way to have readonly global arrays created from
> function.

I also can't reproduce it with readonly:

imadev:~$ bash-4.2 -c 'unset a; f() { declare -rga a=(1 2); }; f; declare -p a'
declare -ar a='([0]="1" [1]="2")'


> See the following script:
>     aa()
>     {
>         declare -gA arr1=(['key1']='value1')
>         declare -ga arr3=(valuea valueb)
>     }
> 
>     bb()
>     {
>         echo "Inside bb"
>         echo "Arr1: ${arr1[key1]}"
>         echo "Arr3: ${arr3[@]}"
>     }
> 
>     aa
>     bb

> Arrays arr1 and arr3, initialised on the same line as declared, are
> not visible outside the function where they are declared, whereas
> arrays modified in separate statements are.

I can't reproduce it that way either:

imadev:~$ f() { declare -ga a=(1 2); }; g() { declare -p a; }; f; g
declare -a a='([0]="1" [1]="2")'


From MAILER-DAEMON Mon Jun 18 15:34:14 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SghiI-0003KC-6C
	for mharc-bug-bash@gnu.org; Mon, 18 Jun 2012 15:34:14 -0400
Received: from eggs.gnu.org ([208.118.235.92]:53853)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SghiF-0003Ix-4m
	for bug-bash@gnu.org; Mon, 18 Jun 2012 15:34:12 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SghiD-0003Az-FP
	for bug-bash@gnu.org; Mon, 18 Jun 2012 15:34:10 -0400
Received: from mail-we0-f169.google.com ([74.125.82.169]:59419)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SghiD-0003A7-1l
	for bug-bash@gnu.org; Mon, 18 Jun 2012 15:34:09 -0400
Received: by wefh52 with SMTP id h52so4986261wef.0
	for <bug-bash@gnu.org>; Mon, 18 Jun 2012 12:34:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type;
	bh=h4fEK3YSHRDrJmPwlnYVHVqAr9qPIeZmh0yTIzLNkaE=;
	b=T6U7/FPEfh8oQAX82FxsVE/h4REdJI6s6KV+IW8o5K0fQylAQlaPnBIKm1Sa78KCER
	MEzNbfV1FHglGFXfGb5kC3v82I8gYfpnqNZJEN5pLc9ODNuVvE2eKtJTqoQRcOux2qSt
	qROtekvZQgNNKUQkOBXXfsCiH1VLTIJDuCn/YSaz2atp1nkc4ke60LGiVex7I72NiimV
	s0fpW9GXDX8N4tSLmc9jRxuLe6Byv0yvctnSLUe87rCjWPbaBHztFTCLSOc4AXPIHO/5
	MvIpWXGIMbr3JNSx+l0NQebQ8YROZfejrGS6ovxNw4wSsARcI374Ed++fEB8Ca9wo3SV
	VWnA==
Received: by 10.216.194.138 with SMTP id m10mr8266915wen.177.1340048046477;
	Mon, 18 Jun 2012 12:34:06 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.194.54.135 with HTTP; Mon, 18 Jun 2012 12:33:46 -0700 (PDT)
In-Reply-To: <20120618183541.GA8239@eeg.ccf.org>
References: <CAOqX-RWjQ960B6kz3Dymfcn=VB=BAH6pJnEbu6QKwWYetCA31A@mail.gmail.com>
	<20120618183541.GA8239@eeg.ccf.org>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Mon, 18 Jun 2012 22:33:46 +0300
Message-ID: <CAPSX3sTcaL2O-4E_Zr2zxRVmvDNPtXahBf_nF+HAGJDj6KA7Wg@mail.gmail.com>
Subject: Re: Arrays declared global in function and initialised in same line
	are not visible outside of function
To: Greg Wooledge <wooledg@eeg.ccf.org>
Content-Type: text/plain; charset=ISO-8859-1
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.82.169
Cc: Jacobo de Vera <devel@jacobodevera.com>, bug-bash@gnu.org,
	bash@packages.debian.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 18 Jun 2012 19:34:12 -0000

On Mon, Jun 18, 2012 at 9:35 PM, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
> On Mon, Jun 18, 2012 at 02:19:41PM +0100, Jacobo de Vera wrote:
>
>> Subject: Re: Arrays declared global in function and initialised in same line are not visible outside of function
>
> I can't reproduce that problem:

Probably because you have this
ftp://ftp.gnu.org/gnu/bash/bash-4.2-patches/bash42-025
applied


From MAILER-DAEMON Wed Jun 20 03:16:35 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ShF9X-00088Q-HR
	for mharc-bug-bash@gnu.org; Wed, 20 Jun 2012 03:16:35 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44393)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1ShF9R-00087t-Qz
	for bug-bash@gnu.org; Wed, 20 Jun 2012 03:16:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1ShF9M-00082K-Rz
	for bug-bash@gnu.org; Wed, 20 Jun 2012 03:16:29 -0400
Received: from mail-yx0-f169.google.com ([209.85.213.169]:54417)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1ShF9M-00081o-L3
	for bug-bash@gnu.org; Wed, 20 Jun 2012 03:16:24 -0400
Received: by yenr5 with SMTP id r5so5629036yen.0
	for <bug-bash@gnu.org>; Wed, 20 Jun 2012 00:16:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=from:to:subject:date:message-id:user-agent:mime-version
	:content-type:content-transfer-encoding;
	bh=V/1MLvrwkiq8G4XF24YjVUdf43BCzwIiIULMjzixDa4=;
	b=zKbn+p0u+ikH3sWKsUapkcISTJCKQ7nA3NH0gzHwgt3CqzufaCtSCFeCnO6zn+2nqX
	1M53Vak6yLPNkw9ttWoANeoE5BK7SJTkgfxsZCx6BH+m6+BIqewio0HUlp8uRMj9ydLj
	ZY9oW+u68Wv2D6BP3BqATVAMDcsLodTQjXPDZ/zk7f+J7f4dvWlOSs2xxDCzmWa7nGPc
	nFlFeI8OPLGEPeqXJyjjVW5c/W8tSuT68FYpwW8XpzoctYFulRl6LC6hRwfw5g+fnWBd
	SaxnV3xBnOBPXHnbROGspCfMO+TtSQIKk8/vvf/YH8vafKWDFc1sMmlyIxB8Sy2zyISZ
	tPXA==
Received: by 10.50.173.69 with SMTP id bi5mr3568017igc.38.1340176207982;
	Wed, 20 Jun 2012 00:10:07 -0700 (PDT)
Received: from smorgbox.localnet (65-128-139-72.mpls.qwest.net.
	[65.128.139.72])
	by mx.google.com with ESMTPS id z7sm14500877igb.3.2012.06.20.00.10.06
	(version=SSLv3 cipher=OTHER); Wed, 20 Jun 2012 00:10:07 -0700 (PDT)
From: Dan Douglas <ormaaj@gmail.com>
To: bug-bash@gnu.org
Subject: mapfile -n seeks ahead an extra line
Date: Wed, 20 Jun 2012 02:09:53 -0500
Message-ID: <2766482.Ksm3GrSoYi@smorgbox>
User-Agent: KMail/4.8.3 (Linux/3.4.2-pf+; KDE/4.8.3; x86_64; ; )
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart1565982.BaKXSFEyDF";
	micalg="pgp-sha1"; protocol="application/pgp-signature"
Content-Transfer-Encoding: 7Bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.213.169
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 20 Jun 2012 07:16:34 -0000


--nextPart1565982.BaKXSFEyDF
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="utf-8"

From: Dan Douglas
To: bug-bash@gnu.org
Subject: mapfile -n seeks ahead an extra line

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: x86_64-pc-linux-gnu-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./include -I. -I./include -I./lib  -DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' -DSTANDARD_UTILS_PATH='/bin:/usr/bin:/sbin:/usr/sbin' -DSYS_BASHRC='/etc/bash/bashrc' -DSYS_BASH_LOGOUT='/etc/bash/bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS -DSSH_SOURCE_BASHRC -march=native -Ofast -mmmx -pipe -floop-interchange -floop-strip-mine -floop-block -ggdb
uname output: Linux smorgbox 3.4.2-pf+ #62 SMP PREEMPT Mon Jun 11 16:24:00 CDT 2012 x86_64 Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz GenuineIntel GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.2
Patch Level: 29
Release Status: release

Description:
    mapfile -n eats a line too many, discarding the last.

Repeat-By:
    $ printf '%s\n' {a..f} | { mapfile -tn 2 a; mapfile -t b; declare -p a b; }
    declare -a a='([0]="a" [1]="b")'
    declare -a b='([0]="d" [1]="e" [2]="f")'
--nextPart1565982.BaKXSFEyDF
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iEYEABECAAYFAk/hd0cACgkQMmyDamdg+Mx61gCfWlHwxaGfETR9VPxMQWTvBW6l
GIMAmQHey7xPmQnOMlnL+gwEKmYfKqFx
=MUcM
-----END PGP SIGNATURE-----

--nextPart1565982.BaKXSFEyDF--



From MAILER-DAEMON Wed Jun 20 10:04:44 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ShLWW-0005Fc-1j
	for mharc-bug-bash@gnu.org; Wed, 20 Jun 2012 10:04:44 -0400
Received: from eggs.gnu.org ([208.118.235.92]:56066)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1ShLWL-0005Ds-IE
	for bug-bash@gnu.org; Wed, 20 Jun 2012 10:04:42 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1ShLWF-0000CD-9Y
	for bug-bash@gnu.org; Wed, 20 Jun 2012 10:04:33 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:10168)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1ShLWF-0000Bs-4X
	for bug-bash@gnu.org; Wed, 20 Jun 2012 10:04:27 -0400
Received: from mpv6.cwru.edu (mpv6.tis.CWRU.Edu [129.22.104.221])
	by mpv2.tis.cwru.edu (MOS 4.3.3-GA) with ESMTP id BMD26370;
	Wed, 20 Jun 2012 10:04:25 -0400
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id AZP40150 (AUTH cpr);
	Wed, 20 Jun 2012 10:04:24 -0400 (EDT)
Message-ID: <4FE1D868.30802@case.edu>
Date: Wed, 20 Jun 2012 10:04:24 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120601 Thunderbird/13.0
MIME-Version: 1.0
To: Dan Douglas <ormaaj@gmail.com>
Subject: Re: mapfile -n seeks ahead an extra line
References: <2766482.Ksm3GrSoYi@smorgbox>
In-Reply-To: <2766482.Ksm3GrSoYi@smorgbox>
X-Enigmail-Version: 1.4.2
Content-Type: multipart/mixed; boundary="------------000105080201060101080201"
X-Junkmail-Whitelist: YES (by domain whitelist at mpv2.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.37
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 20 Jun 2012 14:04:43 -0000

This is a multi-part message in MIME format.
--------------000105080201060101080201
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 6/20/12 3:09 AM, Dan Douglas wrote:

> Bash Version: 4.2
> Patch Level: 29
> Release Status: release
> 
> Description:
>     mapfile -n eats a line too many, discarding the last.

Thanks for the report.  Try the attached patch; it appears to fix the
issue.

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


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk/h2GgACgkQu1hp8GTqdKt7gACfa1mSIDbIr403Dm0eSveLwiuv
L1gAn3rIGbLo/V+Eqh6FShzCQ7T2S4dG
=wh/y
-----END PGP SIGNATURE-----

--------------000105080201060101080201
Content-Type: application/x-patch;
 name="mapfile-lines.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="mapfile-lines.patch"

KioqIC4uL2Jhc2gtNC4yLXBhdGNoZWQvYnVpbHRpbnMvbWFwZmlsZS5kZWYJMjAxMC0wNS0y
OSAyMjowOTo0Ny4wMDAwMDAwMDAgLTA0MDAKLS0tIGJ1aWx0aW5zL21hcGZpbGUuZGVmCTIw
MTItMDYtMjAgMDk6NDg6MzMuMDAwMDAwMDAwIC0wNDAwCioqKioqKioqKioqKioqKgoqKiog
MTk2LDIwNiAqKioqCiAgICBpbnRlcnJ1cHRfaW1tZWRpYXRlbHkrKzsKICAgIGZvciAoYXJy
YXlfaW5kZXggPSBvcmlnaW4sIGxpbmVfY291bnQgPSAxOyAKISAgICAgICAgemdldGxpbmUg
KGZkLCAmbGluZSwgJmxpbmVfbGVuZ3RoLCB1bmJ1ZmZlcmVkX3JlYWQpICE9IC0xOwohICAg
ICAgICBhcnJheV9pbmRleCsrLCBsaW5lX2NvdW50KyspIAogICAgICB7Ci0gICAgICAgLyog
SGF2ZSB3ZSBleGNlZWRlZCAjIG9mIGxpbmVzIHRvIHN0b3JlPyAqLwotICAgICAgIGlmIChs
aW5lX2NvdW50X2dvYWwgIT0gMCAmJiBsaW5lX2NvdW50ID4gbGluZV9jb3VudF9nb2FsKSAK
LSAJYnJlYWs7Ci0gCiAgICAgICAgLyogUmVtb3ZlIHRyYWlsaW5nIG5ld2xpbmVzPyAqLwog
ICAgICAgIGlmIChmbGFncyAmIE1BUEZfQ0hPUCkKLS0tIDE5NiwyMDIgLS0tLQogICAgaW50
ZXJydXB0X2ltbWVkaWF0ZWx5Kys7CiAgICBmb3IgKGFycmF5X2luZGV4ID0gb3JpZ2luLCBs
aW5lX2NvdW50ID0gMTsgCiEgIAl6Z2V0bGluZSAoZmQsICZsaW5lLCAmbGluZV9sZW5ndGgs
IHVuYnVmZmVyZWRfcmVhZCkgIT0gLTE7CiEgCWFycmF5X2luZGV4KyspIAogICAgICB7CiAg
ICAgICAgLyogUmVtb3ZlIHRyYWlsaW5nIG5ld2xpbmVzPyAqLwogICAgICAgIGlmIChmbGFn
cyAmIE1BUEZfQ0hPUCkKKioqKioqKioqKioqKioqCioqKiAyMTgsMjIxICoqKioKLS0tIDIx
NCwyMjIgLS0tLQogIAogICAgICAgIGJpbmRfYXJyYXlfZWxlbWVudCAoZW50cnksIGFycmF5
X2luZGV4LCBsaW5lLCAwKTsKKyAKKyAgICAgICAvKiBIYXZlIHdlIGV4Y2VlZGVkICMgb2Yg
bGluZXMgdG8gc3RvcmU/ICovCisgICAgICAgbGluZV9jb3VudCsrOworICAgICAgIGlmIChs
aW5lX2NvdW50X2dvYWwgIT0gMCAmJiBsaW5lX2NvdW50ID4gbGluZV9jb3VudF9nb2FsKSAK
KyAJYnJlYWs7CiAgICAgIH0KICAK
--------------000105080201060101080201--



From MAILER-DAEMON Wed Jun 20 15:18:19 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ShQPz-0003qp-IO
	for mharc-bug-bash@gnu.org; Wed, 20 Jun 2012 15:18:19 -0400
Received: from eggs.gnu.org ([208.118.235.92]:39536)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rob@hoelz.ro>) id 1ShJ4M-0002LN-9S
	for bug-bash@gnu.org; Wed, 20 Jun 2012 07:27:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rob@hoelz.ro>) id 1ShJ4G-0008Cx-6Z
	for bug-bash@gnu.org; Wed, 20 Jun 2012 07:27:29 -0400
Received: from hoelz.ro ([66.228.44.67]:57063 helo=mail.hoelz.ro)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <rob@hoelz.ro>)
	id 1ShJ4G-0008Cf-2v
	for bug-bash@gnu.org; Wed, 20 Jun 2012 07:27:24 -0400
Received: from surfer-30-3-16.surfnet.iacbox
	(ip-80-113-6-162.ip.prioritytelecom.net [80.113.6.162])
	(using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.hoelz.ro (Postfix) with ESMTPSA id ABEE23435C
	for <bug-bash@gnu.org>; Wed, 20 Jun 2012 07:27:21 -0400 (EDT)
Message-ID: <4FE1B392.6060303@hoelz.ro>
Date: Wed, 20 Jun 2012 13:27:14 +0200
From: Rob Hoelz <rob@hoelz.ro>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:12.0) Gecko/20120428 Thunderbird/12.0.1
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Unicode collation for readline completion in bash
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 66.228.44.67
X-Mailman-Approved-At: Wed, 20 Jun 2012 15:18:18 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 20 Jun 2012 11:27:34 -0000

Hello,

I have an idea for a new feature for bash/readline, and I wanted to get
the community's feedback before I go about implementing it.

So, I have a number of files with diacritics in the name, like this:

$ ls
Sigur Ro=CC=81s - Dau=C3=B0alogn.ogg Sigur Ro=CC=81s - E=CC=81g Anda.ogg =
Sigur Ro=CC=81s -
Rembihnu=CC=81tur.ogg Sigur Ro=CC=81s - Varu=CC=81=C3=B0.ogg
Sigur Ro=CC=81s - Ekki Mu=CC=81kk.ogg Sigur Ro=CC=81s - Fjo=CC=88gur Pi=CC=
=81ano=CC=81.ogg Sigur Ro=CC=81s -
Valtari.ogg Sigur Ro=CC=81s - Var=C3=B0eldur.ogg

I'd like diacritics to be ignored when performing tab completion, so if
I type "Sigur Ros - Eg" and hit tab, "Sigur Ro=CC=81s - E=CC=81g Anda.ogg=
" is filled in.

I've done some research, and it seems that this feature has yet to be
implemented. Does anyone know of an implementation for this, and if not,
would
this be acceptable as an addition to bash, or better yet, GNU readline?

Thanks,
Rob Hoelz


From MAILER-DAEMON Wed Jun 20 15:18:22 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ShQQ2-0003y4-Mt
	for mharc-bug-bash@gnu.org; Wed, 20 Jun 2012 15:18:22 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52382)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <svdb@stack.nl>) id 1ShPyz-0008Gz-CQ
	for bug-bash@gnu.org; Wed, 20 Jun 2012 14:50:26 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <svdb@stack.nl>) id 1ShPyu-0002jj-Q4
	for bug-bash@gnu.org; Wed, 20 Jun 2012 14:50:24 -0400
Received: from relay04.stack.nl ([131.155.140.107]:60308 helo=mx1.stack.nl)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <svdb@stack.nl>) id 1ShPyu-0002jS-Jh
	for bug-bash@gnu.org; Wed, 20 Jun 2012 14:50:20 -0400
Received: from toad.stack.nl (toad.stack.nl [IPv6:2001:610:1108:5010::135])
	by mx1.stack.nl (Postfix) with ESMTP id E535E1DD45A
	for <bug-bash@gnu.org>; Wed, 20 Jun 2012 20:50:17 +0200 (CEST)
Received: by toad.stack.nl (Postfix, from userid 1106)
	id DCFF33F5AC; Wed, 20 Jun 2012 20:50:17 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
	by toad.stack.nl (Postfix) with ESMTP id D3C5F3F5A3
	for <bug-bash@gnu.org>; Wed, 20 Jun 2012 20:50:17 +0200 (CEST)
Date: Wed, 20 Jun 2012 20:50:17 +0200 (CEST)
From: Serge van den Boom <svdb@stack.nl>
To: bug-bash@gnu.org
Subject: **/ directory wildcards leak file descriptors and memory
Message-ID: <alpine.BSF.2.00.1206202047230.63078@toad.stack.nl>
User-Agent: Alpine 2.00 (BSF 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 131.155.140.107
X-Mailman-Approved-At: Wed, 20 Jun 2012 15:18:20 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 20 Jun 2012 18:50:26 -0000

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/opt/bash-4.2/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I. -I/opt/readline/include -I. -I./include -I./lib  -I/opt/ncurses/include -g -O2
Machine Type: i686-pc-linux-gnu

Bash Version: 4.2
Patch Level: 29
Release Status: release

Description:
	If you interrupt the evaluation of **/ wildcard expansion, the file
	descriptors which were opened will not be closed.
	Also, memory used will not be released.

Repeat-By:
	ls /**/*.txt
	# Wait 10 seconds, then press CTRL-C.
	ls -la /proc/$$/fd/
	# To see the memory leak, run 'top' while you do this. The memory
	# usage will grow, and will not return to normal values when the
	# operation is interrupted.
	# I have also seen out of memory and out of file descriptors errors
	# after waiting for a long time before interrupting the process.



From MAILER-DAEMON Thu Jun 21 08:44:15 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ShgkB-00010f-Gh
	for mharc-bug-bash@gnu.org; Thu, 21 Jun 2012 08:44:15 -0400
Received: from eggs.gnu.org ([208.118.235.92]:55492)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1Shgk1-00010C-G2
	for bug-bash@gnu.org; Thu, 21 Jun 2012 08:44:14 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1Shgjz-0002bD-LR
	for bug-bash@gnu.org; Thu, 21 Jun 2012 08:44:05 -0400
Received: from plane.gmane.org ([80.91.229.3]:37703)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1Shgjz-0002aq-Ef
	for bug-bash@gnu.org; Thu, 21 Jun 2012 08:44:03 -0400
Received: from list by plane.gmane.org with local (Exim 4.69)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1Shgjw-00086f-1t
	for bug-bash@gnu.org; Thu, 21 Jun 2012 14:44:00 +0200
Received: from 173-19-202-206.client.mchsi.com ([173.19.202.206])
	by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
	id 1AlnuQ-0007hv-00
	for <bug-bash@gnu.org>; Thu, 21 Jun 2012 14:44:00 +0200
Received: from wb8tyw by 173-19-202-206.client.mchsi.com with local (Gmexim
	0.1 (Debian)) id 1AlnuQ-0007hv-00
	for <bug-bash@gnu.org>; Thu, 21 Jun 2012 14:44:00 +0200
X-Injected-Via-Gmane: http://gmane.org/
To: bug-bash@gnu.org
From: "John E. Malmberg" <wb8tyw@qsl.net>
Subject: Bug in patch bash42-018,
	leaves lastpipe_flag unitialized for platforms with out JOB_CONTROL.
Date: Thu, 21 Jun 2012 07:42:08 -0500
Lines: 43
Message-ID: <jrv4u4$v5h$1@dough.gmane.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: usenet@dough.gmane.org
X-Gmane-NNTP-Posting-Host: 173-19-202-206.client.mchsi.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:10.0) Gecko/20120129 Thunderbird/10.0
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 80.91.229.3
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 21 Jun 2012 12:44:15 -0000

Hello Bash-bugs,

The patch bash42-018 to allow execute_cmd.c that is supposed to allow it 
to compile with out JOB_CONTROL defined has a bug in it.

It is leaving the lastpipe_flag uninitialized.  This is a problem 
because later in the module it is tested.

*** ../bash-4.2-patched/execute_cmd.c   2011-02-09 17:32:25.000000000 -0500
--- execute_cmd.c       2011-11-06 15:12:48.000000000 -0500
***************
*** 2197,2200 ****
--- 2315,2319 ----
       cmd->flags |= CMD_IGNORE_RETURN;

+ #if defined (JOB_CONTROL)
     lastpipe_flag = 0;
     begin_unwind_frame ("lastpipe-exec");


The simple fix of moving the "#if defined (JOBCONTROL)" line below the 
"lastpipe_flag = 0;" may not be the ideal patch.

This is because JOB_CONTROL undefined, the entire if block lower below 
"QUIT;" is never executed, as lastpipe_flag is always 0.

Which means that it is kind of useless to have #if defined(JOB_CONTROL) 
blocks inside of it.  If this is the intended logic flow, then the 
entire "if (lastpipe_flag)" block should be conditionally compiled out.

Doing that and leaving the definition of the lastpipe_flag undefined as 
in the original patch will still result in a compiler diagnostic about 
an unused variable.

So that would need an #if defined (JOBCONTROL) needed around the 
declaration.

So what should be the correct patch?  Is there another bug hiding in this?

Regards,
-John
wb8tyw@qsl.network
Personal Opinion Only



From MAILER-DAEMON Thu Jun 21 11:47:19 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ShjbL-0007EB-3A
	for mharc-bug-bash@gnu.org; Thu, 21 Jun 2012 11:47:19 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41673)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <szymon.kalasz@uj.edu.pl>) id 1ShjbI-0007Dy-QR
	for bug-bash@gnu.org; Thu, 21 Jun 2012 11:47:18 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <szymon.kalasz@uj.edu.pl>) id 1ShjbC-00075t-Ug
	for bug-bash@gnu.org; Thu, 21 Jun 2012 11:47:16 -0400
Received: from mail.uj.edu.pl ([149.156.89.147]:63873)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <szymon.kalasz@uj.edu.pl>) id 1ShjbC-00075H-N5
	for bug-bash@gnu.org; Thu, 21 Jun 2012 11:47:10 -0400
MIME-version: 1.0
Content-transfer-encoding: 7BIT
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Received: from mbox.uj.edu.pl ([unknown] [149.156.89.248])
	by mta.uoks.uj.edu.pl
	(Sun Java(tm) System Messaging Server 7u3-12.01 64bit (built Oct 15
	2009)) with ESMTP id <0M5Z009YI56JR360@mta.uoks.uj.edu.pl> for
	bug-bash@gnu.org; Thu, 21 Jun 2012 17:47:07 +0200 (CEST)
Date: Thu, 21 Jun 2012 17:47:07 +0200
From: szymon.kalasz@uj.edu.pl
To: bug-bash@gnu.org
Subject: Use of uninitialized values in mail checking
Message-id: <1f94a8ac7c5ea863db5f0edceed7182b@uj.edu.pl>
X-Sender: szymon.kalasz@uj.edu.pl
User-Agent: Roundcube Webmail/0.5
X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta)
X-Received-From: 149.156.89.147
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 21 Jun 2012 15:47:18 -0000

 Configuration Information:
 Machine: i686
 OS: linux-gnu
 Compiler: gcc
 Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
 -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
 -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/share/locale' 
 -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  
 -g -O2
 uname output: Linux harmony 3.2.4-1-ARCH #1 SMP PREEMPT Sat Feb 4 
 11:21:15 UTC 2012 i686 Intel(R) Core(TM)2 Duo CPU T6400 @ 2.00GHz 
 GenuineIntel GNU/Linux
 Machine Type: i686-pc-linux-gnu

 Bash Version: 4.2
 Patch Level: 29
 Release Status: release


 I found that behavior of bash depends on uninitialized values in 
 memory.
 In function file_mod_date_changed (mailcheck.c), if mailstat returns a 
 non-zero
 value, we are checking condition finfo.st_size == 0, where 
 finfo.st_size is
 uninitialized. In those rare cases when finfo.st_size is zero and
 mailfiles[i]->file_size > 0 we update mailfiles array with some random 
 values
 (while the file may even not exist).

 Consider following scenario:

 I have no specified mailbox path, so it defaults to /var/mail/szymon, 
 which
 does not exist.
 Then I run bash:

 ./bash
 [szymon@harmony bash]$ export MAILCHECK=0
 [szymon@harmony bash]$ mkdir /var/mail/szymon
 You have mail in /var/mail/szymon
 [szymon@harmony bash]$ rm -r /var/mail/szymon
 [szymon@harmony bash]$ mkdir /var/mail/szymon
 [szymon@harmony bash]$
 [szymon@harmony bash]$ rm -r /var/mail/szymon
 [szymon@harmony bash]$
 [szymon@harmony bash]$ mkdir /var/mail/szymon
 [szymon@harmony bash]$
 [szymon@harmony bash]$ exit

 If I modify mailstat to put some specific values into struct stat *st
 (st_size = 0 and st_mtime = 1) when stat() fails, I get the following:

 ./bash
 [szymon@harmony bash]$ export MAILCHECK=0
 [szymon@harmony bash]$ mkdir /var/mail/szymon
 You have mail in /var/mail/szymon
 [szymon@harmony bash]$ rm -r /var/mail/szymon
 [szymon@harmony bash]$ mkdir /var/mail/szymon
 You have mail in /var/mail/szymon
 [szymon@harmony bash]$ rm -r /var/mail/szymon
 [szymon@harmony bash]$ mkdir /var/mail/szymon
 You have mail in /var/mail/szymon
 [szymon@harmony bash]$ rm -r /var/mail/szymon
 [szymon@harmony bash]$ mkdir /var/mail/szymon
 You have mail in /var/mail/szymon
 [szymon@harmony bash]$ rm -r /var/mail/szymon
 [szymon@harmony bash]$ exit

 So behavior of bash depends on these values. valgrind confirms that 
 problem:
 ==13079== Conditional jump or move depends on uninitialised value(s)
 ==13079==    at 0x809B922: check_mail (mailcheck.c:273)
 ==13079==    by 0x806D0E3: yyparse (parse.y:2504)
 ==13079==    by 0x80650AC: parse_command (eval.c:228)
 ==13079==    by 0x806516D: read_command (eval.c:272)
 ==13079==    by 0x80653A5: reader_loop (eval.c:137)
 ==13079==    by 0x40DE482: (below main) (in /lib/libc-2.15.so)
 ==13079==

 It seems to be a minor bug, however, still a bug.

 For my convenience, I've added some debug printfs to mailcheck.c and 
 mailstat.c.
 You can see the output here:
 1. uninitialized: http://szymon.kalasz.student.tcs.uj.edu.pl/b1.txt
 2. st_size = 0, st_mtime = 1: 
 http://szymon.kalasz.student.tcs.uj.edu.pl/b2.txt

 Modified mailcheck.c and mailstat.c are available here:
 http://szymon.kalasz.student.tcs.uj.edu.pl/bash/



 Maybe it is better to UPDATE_MAIL_FILE only when (mail)stat returns 
 zero?

 diff --git a/mailcheck.c b/mailcheck.c
 index bd95f0d..31aa970 100644
 --- a/mailcheck.c
 +++ b/mailcheck.c
 @@ -263,14 +263,15 @@ file_mod_date_changed (i)
    time_t mtime;
    struct stat finfo;
    char *file;
 +  int r;
 
    file = mailfiles[i]->name;
    mtime = mailfiles[i]->mod_time;
 
 -  if ((mailstat (file, &finfo) == 0) && (finfo.st_size > 0))
 +  if (((r = mailstat (file, &finfo)) == 0) && (finfo.st_size > 0))
      return (mtime < finfo.st_mtime);
 
 -  if (finfo.st_size == 0 && mailfiles[i]->file_size > 0)
 +  if (r == 0 && finfo.st_size == 0 && mailfiles[i]->file_size > 0)
      UPDATE_MAIL_FILE (i, finfo);
 
    return (0);


From MAILER-DAEMON Thu Jun 21 14:41:31 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ShmJv-0003eL-RF
	for mharc-bug-bash@gnu.org; Thu, 21 Jun 2012 14:41:31 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52949)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1ShmJs-0003cs-CG
	for bug-bash@gnu.org; Thu, 21 Jun 2012 14:41:29 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1ShmJq-0003NO-0w
	for bug-bash@gnu.org; Thu, 21 Jun 2012 14:41:27 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:4849)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1ShmJp-0003Lr-S9
	for bug-bash@gnu.org; Thu, 21 Jun 2012 14:41:25 -0400
Received: from mpv5.tis.CWRU.Edu (EHLO mpv5.cwru.edu) ([129.22.105.51])
	by mpv1.tis.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id CAC57806; Thu, 21 Jun 2012 14:41:23 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id AYZ58453 (AUTH cpr);
	Thu, 21 Jun 2012 14:41:23 -0400 (EDT)
Message-ID: <4FE36AD2.7010300@case.edu>
Date: Thu, 21 Jun 2012 14:41:22 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120601 Thunderbird/13.0
MIME-Version: 1.0
To: "John E. Malmberg" <wb8tyw@qsl.net>
Subject: Re: Bug in patch bash42-018, leaves lastpipe_flag unitialized for
	platforms with out JOB_CONTROL.
References: <jrv4u4$v5h$1@dough.gmane.org>
In-Reply-To: <jrv4u4$v5h$1@dough.gmane.org>
X-Enigmail-Version: 1.4.2
Content-Type: multipart/mixed; boundary="------------000603020004060107010907"
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 21 Jun 2012 18:41:30 -0000

This is a multi-part message in MIME format.
--------------000603020004060107010907
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: 7bit

On 6/21/12 8:42 AM, John E. Malmberg wrote:
> Hello Bash-bugs,
> 
> The patch bash42-018 to allow execute_cmd.c that is supposed to allow it to
> compile with out JOB_CONTROL defined has a bug in it.
> 
> It is leaving the lastpipe_flag uninitialized.  This is a problem because
> later in the module it is tested.
> 
> *** ../bash-4.2-patched/execute_cmd.c   2011-02-09 17:32:25.000000000 -0500
> --- execute_cmd.c       2011-11-06 15:12:48.000000000 -0500
> ***************
> *** 2197,2200 ****
> --- 2315,2319 ----
>       cmd->flags |= CMD_IGNORE_RETURN;
> 
> + #if defined (JOB_CONTROL)
>     lastpipe_flag = 0;
>     begin_unwind_frame ("lastpipe-exec");
> 
> 
> The simple fix of moving the "#if defined (JOBCONTROL)" line below the
> "lastpipe_flag = 0;" may not be the ideal patch.

Maybe not, but it's enough to get started.  It just relies on the compiler
doing constant propagation and dead code removal to be as efficient as
using the preprocessor to not compile the code in at all.

I've attached the straightforward patch that does this.

The effect of the bug now is that some process may be waited for twice when
using a system without job control.  That's not a big deal.

I'm reluctant to make a more extensive change at this point because this
option makes sense for environments where there isn't job control.  In
fact, it makes more sense there because there isn't the process group issue
to have to worry about.  The code as it reads today only accommodates job
control systems, but that isn't the way it has to stay.

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



--------------000603020004060107010907
Content-Type: application/x-patch;
 name="lastpipe-flag-decl.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="lastpipe-flag-decl.patch"

KioqIC4uL2Jhc2gtNC4yLXBhdGNoZWQvZXhlY3V0ZV9jbWQuYwkyMDEyLTA1LTAyIDE2OjUy
OjQwLjAwMDAwMDAwMCAtMDQwMAotLS0gZXhlY3V0ZV9jbWQuYwkyMDEyLTA2LTIxIDExOjUy
OjE0LjAwMDAwMDAwMCAtMDQwMAoqKioqKioqKioqKioqKioKKioqIDIxOTcsMjIwMiAqKioq
CiAgICAgIGNtZC0+ZmxhZ3MgfD0gQ01EX0lHTk9SRV9SRVRVUk47CiAgCi0gI2lmIGRlZmlu
ZWQgKEpPQl9DT05UUk9MKQogICAgbGFzdHBpcGVfZmxhZyA9IDA7CiAgICBiZWdpbl91bndp
bmRfZnJhbWUgKCJsYXN0cGlwZS1leGVjIik7CiAgICBsc3RkaW4gPSAtMTsKLS0tIDIzMTgs
MjMyMyAtLS0tCiAgICAgIGNtZC0+ZmxhZ3MgfD0gQ01EX0lHTk9SRV9SRVRVUk47CiAgCiAg
ICBsYXN0cGlwZV9mbGFnID0gMDsKKyAjaWYgZGVmaW5lZCAoSk9CX0NPTlRST0wpCiAgICBi
ZWdpbl91bndpbmRfZnJhbWUgKCJsYXN0cGlwZS1leGVjIik7CiAgICBsc3RkaW4gPSAtMTsK

--------------000603020004060107010907--



From MAILER-DAEMON Fri Jun 22 09:20:58 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Si3nG-0003v6-D7
	for mharc-bug-bash@gnu.org; Fri, 22 Jun 2012 09:20:58 -0400
Received: from eggs.gnu.org ([208.118.235.92]:40727)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Si3n8-0003tS-UG
	for bug-bash@gnu.org; Fri, 22 Jun 2012 09:20:56 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Si3n3-0006e4-C7
	for bug-bash@gnu.org; Fri, 22 Jun 2012 09:20:50 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:17222)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Si3n3-0006cK-75
	for bug-bash@gnu.org; Fri, 22 Jun 2012 09:20:45 -0400
Received: from mpv6.cwru.edu (mpv6.tis.cwru.edu [129.22.104.221])
	by mpv2.tis.cwru.edu (MOS 4.3.3-GA) with ESMTP id BMF42901;
	Fri, 22 Jun 2012 09:20:40 -0400
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id AZT15074 (AUTH cpr);
	Fri, 22 Jun 2012 09:20:38 -0400 (EDT)
Message-ID: <4FE47125.1000705@case.edu>
Date: Fri, 22 Jun 2012 09:20:37 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120601 Thunderbird/13.0
MIME-Version: 1.0
To: szymon.kalasz@uj.edu.pl
Subject: Re: Use of uninitialized values in mail checking
References: <1f94a8ac7c5ea863db5f0edceed7182b@uj.edu.pl>
In-Reply-To: <1f94a8ac7c5ea863db5f0edceed7182b@uj.edu.pl>
X-Enigmail-Version: 1.4.2
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv2.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.37
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 22 Jun 2012 13:20:56 -0000

On 6/21/12 11:47 AM, szymon.kalasz@uj.edu.pl wrote:

> Bash Version: 4.2
> Patch Level: 29
> Release Status: release
> 
> 
> I found that behavior of bash depends on uninitialized values in memory.
> In function file_mod_date_changed (mailcheck.c), if mailstat returns a
> non-zero
> value, we are checking condition finfo.st_size == 0, where finfo.st_size is
> uninitialized. In those rare cases when finfo.st_size is zero and
> mailfiles[i]->file_size > 0 we update mailfiles array with some random values
> (while the file may even not exist).

Thanks for the report.  This will be fixed in the next version of bash.

Chet

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




From MAILER-DAEMON Fri Jun 22 09:26:06 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Si3sE-0004au-CX
	for mharc-bug-bash@gnu.org; Fri, 22 Jun 2012 09:26:06 -0400
Received: from eggs.gnu.org ([208.118.235.92]:51544)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Si3s7-0004aC-MJ
	for bug-bash@gnu.org; Fri, 22 Jun 2012 09:26:04 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Si3s2-00085J-Pb
	for bug-bash@gnu.org; Fri, 22 Jun 2012 09:25:59 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:43680)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Si3s2-000856-KP
	for bug-bash@gnu.org; Fri, 22 Jun 2012 09:25:54 -0400
Received: from mpv6.tis.CWRU.Edu (EHLO mpv6.cwru.edu) ([129.22.104.221])
	by mpv1.tis.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id CAD31555; Fri, 22 Jun 2012 09:25:53 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id AZT16034 (AUTH cpr);
	Fri, 22 Jun 2012 09:25:52 -0400 (EDT)
Message-ID: <4FE47260.1000604@case.edu>
Date: Fri, 22 Jun 2012 09:25:52 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120601 Thunderbird/13.0
MIME-Version: 1.0
To: Rob Hoelz <rob@hoelz.ro>
Subject: Re: Unicode collation for readline completion in bash
References: <4FE1B392.6060303@hoelz.ro>
In-Reply-To: <4FE1B392.6060303@hoelz.ro>
X-Enigmail-Version: 1.4.2
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 22 Jun 2012 13:26:05 -0000

On 6/20/12 7:27 AM, Rob Hoelz wrote:

> So, I have a number of files with diacritics in the name, like this:
> 
> $ ls
> Sigur Rós - Dauðalogn.ogg Sigur Rós - Ég Anda.ogg Sigur Rós -
> Rembihnútur.ogg Sigur Rós - Varúð.ogg
> Sigur Rós - Ekki Múkk.ogg Sigur Rós - Fjögur Píanó.ogg Sigur Rós -
> Valtari.ogg Sigur Rós - Varðeldur.ogg
> 
> I'd like diacritics to be ignored when performing tab completion, so if
> I type "Sigur Ros - Eg" and hit tab, "Sigur Rós - Ég Anda.ogg" is filled in.
> 
> I've done some research, and it seems that this feature has yet to be
> implemented. Does anyone know of an implementation for this, and if not,
> would
> this be acceptable as an addition to bash, or better yet, GNU readline?

I would be willing to take a look at such an addition to readline, but I
have no plans to do it myself.

You should be able to get a long way by simply using strcoll(3) to perform
string comparison when comparing filenames against what the user typed,
but that interface is pretty limited, and it's not clear how you would
accommodate case-insensitive or case-mapping comparisons.

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




From MAILER-DAEMON Fri Jun 22 10:28:35 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Si4qh-0008BQ-QB
	for mharc-bug-bash@gnu.org; Fri, 22 Jun 2012 10:28:35 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44112)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Si4qf-0008Ag-IJ
	for bug-bash@gnu.org; Fri, 22 Jun 2012 10:28:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Si4qa-0007F5-Ku
	for bug-bash@gnu.org; Fri, 22 Jun 2012 10:28:33 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:52717)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Si4qa-0007Ex-G7
	for bug-bash@gnu.org; Fri, 22 Jun 2012 10:28:28 -0400
Received: from mpv5.cwru.edu (mpv5.tis.cwru.edu [129.22.105.51])
	by mpv2.tis.cwru.edu (MOS 4.3.3-GA) with ESMTP id BMF49947;
	Fri, 22 Jun 2012 10:28:26 -0400
Received: from caleb.INS.CWRU.Edu (HELO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with SMTP id AZA18647; Fri, 22 Jun 2012 10:28:25 -0400 (EDT)
Date: Fri, 22 Jun 2012 10:27:14 -0400
From: Chet Ramey <chet.ramey@case.edu>
Sender: Chet Ramey <chet@caleb.ins.cwru.edu>
To: scotty.mcmillan@gmail.com
Subject: Re: Brace expansion infinite loop, memory corruption, and other bugs.
References: <CAPS0J2Hmxh9GOEYRBA3v_uzUiawEd=GcYLEg6mzcXaWO7FpC6Q@mail.gmail.com>
	<4FCDFD4F.8040307@case.edu>
In-Reply-To: Message from chet.ramey@case.edu of Tue,
	05 Jun 2012 08:36:31 -0400 (id <4FCDFD4F.8040307@case.edu>)
Message-ID: <120622142714.AA33456.SM@caleb.ins.cwru.edu>
Read-Receipt-To: chet.ramey@case.edu
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Junkmail-Whitelist: YES (by domain whitelist at mpv2.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.37
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 22 Jun 2012 14:28:35 -0000

> On 6/5/12 12:14 AM, Scott McMillan wrote:
> > A week or so ago I submitted a bug report using the bashbug command
> > that involved some
> > overflow issues with braces.c on OpenSUSE12.1 X86_64. Browsing the
> > patches, I got
> > the impression that braces.c hasn't been modified since the original
> > 4.2 release, so the
> > same bugs should exist in the most recent version.
> 
> Thanks for the report.  I'll take a look at your patches.  Your original
> report did not hit the mailing list.

The patches look good, and will be in the next release of bash.  Thanks for
your help.

Chet

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


From MAILER-DAEMON Fri Jun 22 15:41:13 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Si9jF-0003jL-F7
	for mharc-bug-bash@gnu.org; Fri, 22 Jun 2012 15:41:13 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60292)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bill@ycc.com>) id 1Si9jC-0003hZ-D6
	for bug-bash@gnu.org; Fri, 22 Jun 2012 15:41:11 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bill@ycc.com>) id 1Si9jA-0000nO-Oh
	for bug-bash@gnu.org; Fri, 22 Jun 2012 15:41:09 -0400
Received: from mail-lb0-f169.google.com ([209.85.217.169]:35013)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <bill@ycc.com>)
	id 1Si9jA-0000n6-HL
	for bug-bash@gnu.org; Fri, 22 Jun 2012 15:41:08 -0400
Received: by lbjn8 with SMTP id n8so4840164lbj.0
	for <bug-bash@gnu.org>; Fri, 22 Jun 2012 12:41:05 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=google.com; s=20120113;
	h=mime-version:x-originating-ip:date:message-id:subject:from:to
	:content-type:x-gm-message-state;
	bh=Z5lxFPJMimUreDR2AeDDje3onoeWM/RNBYoPANBuXCA=;
	b=kxJJVOi4VannAyT7ftsEn2xdzthb5XOQVAnA9eNuQPFVzOhSyldIu6M1YK0s5oyh1G
	Qsc4Npz9dAjaZPaEBuWWhQUjWePkgugGMKdRgrPjemUFPzlmp/wl7p4MDANpeRpe0Dk2
	p0MbKTa4p4qHej4AvfMWA43qE3gbbcAi6cbOWUgRDDv2Ssclv2MX8bt2IE6d+Zf41/we
	P8I2tyJu8EfzMVExuqJujtOZPhTUQv5no7DtNpB5kMoXhhe0BwOs139mQIShHpAa8tK9
	0xSB22o3gFULfMubSCwpStas7O9Q93owYDHxgem4+dDaCi7z5jHxQJ6yZdtcCm+6TxBg
	aKzw==
MIME-Version: 1.0
Received: by 10.112.101.169 with SMTP id fh9mr2062710lbb.18.1340394065146;
	Fri, 22 Jun 2012 12:41:05 -0700 (PDT)
Received: by 10.112.22.1 with HTTP; Fri, 22 Jun 2012 12:41:05 -0700 (PDT)
X-Originating-IP: [186.2.144.80]
Date: Fri, 22 Jun 2012 13:41:05 -0600
Message-ID: <CAFyvKisRDB8Ld3QKKxCEkH4tT87p3AisSbfpVPpqCPdeXFL3WA@mail.gmail.com>
Subject: cd // produces unexpected results
From: Bill Gradwohl <bill@ycc.com>
To: Bash - Bug <bug-bash@gnu.org>
X-Gm-Message-State: ALoCoQmsKsGLuEZhB3OtVmiBqlFuU7uQ31/b3t4JgKCbP0cjVDL2pO1AaY/KgYf5REzZYZvbybya
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.217.169
Content-Type: text/plain; charset=ISO-8859-1
X-Content-Filtered-By: Mailman/MimeDel 2.1.14
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 22 Jun 2012 19:41:11 -0000

By accident I keyed in :

cd //

and noticed that my prompt included both slashes. Further testing, I think,
reveals a minor issue:

root@billlaptop ~# pwd; cd //; echo PWD=$PWD; cd /root; echo OLDPWD=$OLDPWD
/root
PWD=//
OLDPWD=//

I don't believe PWD and OLDPWD should contain double slashes as they're
supposed to be the canonical path.

-- 
Bill Gradwohl

From MAILER-DAEMON Fri Jun 22 15:48:50 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Si9qb-00051I-WB
	for mharc-bug-bash@gnu.org; Fri, 22 Jun 2012 15:48:49 -0400
Received: from eggs.gnu.org ([208.118.235.92]:39131)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Si9qY-000517-Sb
	for bug-bash@gnu.org; Fri, 22 Jun 2012 15:48:48 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Si9qU-0002GL-BA
	for bug-bash@gnu.org; Fri, 22 Jun 2012 15:48:46 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:3794)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Si9qU-0002FL-6U
	for bug-bash@gnu.org; Fri, 22 Jun 2012 15:48:42 -0400
Received: from mpv6.cwru.edu (mpv6.tis.cwru.edu [129.22.104.221])
	by mpv2.tis.cwru.edu (MOS 4.3.3-GA) with ESMTP id BMF82662;
	Fri, 22 Jun 2012 15:48:39 -0400
Received: from caleb.INS.CWRU.Edu (HELO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with SMTP id AZT85845; Fri, 22 Jun 2012 15:48:39 -0400 (EDT)
Date: Fri, 22 Jun 2012 15:47:02 -0400
From: Chet Ramey <chet.ramey@case.edu>
Sender: Chet Ramey <chet@caleb.ins.cwru.edu>
To: bill@ycc.com
Subject: Re: cd // produces unexpected results
References: <CAFyvKisRDB8Ld3QKKxCEkH4tT87p3AisSbfpVPpqCPdeXFL3WA@mail.gmail.com>
In-Reply-To: Message from bill@ycc.com of Fri, 22 Jun 2012 13:41:05 -0600 (id
	<CAFyvKisRDB8Ld3QKKxCEkH4tT87p3AisSbfpVPpqCPdeXFL3WA@mail.gmail.com>)
Message-ID: <120622194702.AA42099.SM@caleb.ins.cwru.edu>
Read-Receipt-To: chet.ramey@case.edu
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Junkmail-Whitelist: YES (by domain whitelist at mpv2.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.37
Cc: bug-bash@gnu.org, chet@po.cwru.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 22 Jun 2012 19:48:48 -0000

> By accident I keyed in :
> 
> cd //
> 
> and noticed that my prompt included both slashes.

Posix says shells have to leave two leading slashes in a pathname alone.
Three or more can be collapsed to one, but two have to stay unchanged.
This has come up multiple times in the past.

Chet

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


From MAILER-DAEMON Fri Jun 22 17:59:12 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SiBsm-0003rJ-6L
	for mharc-bug-bash@gnu.org; Fri, 22 Jun 2012 17:59:12 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48463)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <stefano.lattarini@gmail.com>) id 1SiBsi-0003qJ-Np
	for bug-bash@gnu.org; Fri, 22 Jun 2012 17:59:09 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <stefano.lattarini@gmail.com>) id 1SiBsg-0007wg-SB
	for bug-bash@gnu.org; Fri, 22 Jun 2012 17:59:08 -0400
Received: from mail-wg0-f49.google.com ([74.125.82.49]:64223)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <stefano.lattarini@gmail.com>) id 1SiBsg-0007wV-J7
	for bug-bash@gnu.org; Fri, 22 Jun 2012 17:59:06 -0400
Received: by wgbds1 with SMTP id ds1so1510056wgb.30
	for <bug-bash@gnu.org>; Fri, 22 Jun 2012 14:59:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=message-id:date:from:mime-version:to:cc:subject:references
	:in-reply-to:content-type:content-transfer-encoding;
	bh=iafA3/iiVglM2bB+ODlY3zVuTJn5AdXehAOlX4ak9xk=;
	b=FAtXdOD1Awk19CYcLtEL4sVNaYAFEJasJKf+v90nZY0YLMPSuNyd1UJ6fZLnZRg/s2
	ZC6KtZRm2PzDp5vhDoKvhKb7CTW9pH03ESlNkAanHC9iov6fFfn9pBt2fKqt8nZjXzlI
	U+ky9boj3U4b65UHxduxqy61nD8CZ4jTwRzsvIxPOCzKsbqGG+DwBgIKHnZ4iA2IsqXy
	6n4i0pjUKDpyE6EklwoZtBB/oZRHbQo5MyB7Szrdxvb0AGI5lBzcbEP4KBVb/0h2KQHT
	QKSDIzWek/CjaoLBpVvQn1wo+ngS8SkVwh707l60Oau98CjXfT5wCvD+mg2bPB6c7Thi
	9S8g==
Received: by 10.216.228.135 with SMTP id f7mr2024449weq.129.1340402344394;
	Fri, 22 Jun 2012 14:59:04 -0700 (PDT)
Received: from [79.24.98.14]
	(host14-98-dynamic.24-79-r.retail.telecomitalia.it. [79.24.98.14])
	by mx.google.com with ESMTPS id db7sm495466wib.6.2012.06.22.14.59.01
	(version=SSLv3 cipher=OTHER); Fri, 22 Jun 2012 14:59:03 -0700 (PDT)
Message-ID: <4FE4EAA1.6080005@gmail.com>
Date: Fri, 22 Jun 2012 23:58:57 +0200
From: Stefano Lattarini <stefano.lattarini@gmail.com>
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: cd // produces unexpected results
References: <CAFyvKisRDB8Ld3QKKxCEkH4tT87p3AisSbfpVPpqCPdeXFL3WA@mail.gmail.com>
	<120622194702.AA42099.SM@caleb.ins.cwru.edu>
In-Reply-To: <120622194702.AA42099.SM@caleb.ins.cwru.edu>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.82.49
Cc: bill@ycc.com, chet@po.cwru.edu, bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 22 Jun 2012 21:59:10 -0000

On 06/22/2012 09:47 PM, Chet Ramey wrote:
>> By accident I keyed in :
>>
>> cd //
>>
>> and noticed that my prompt included both slashes.
> 
> Posix says shells have to leave two leading slashes in a pathname alone.
> Three or more can be collapsed to one, but two have to stay unchanged.
> This has come up multiple times in the past.
> 
A little more info, quoting from the Autoconf manual:

  POSIX lets implementations treat leading // specially, but requires leading
  /// and beyond to be equivalent to /.  Most Unix variants treat // like /.
  However, some treat // as a "super-root" that can provide access to files
  that are not otherwise reachable from /.  The super-root tradition began
  with Apollo Domain/OS, which died out long ago, but unfortunately Cygwin
  has revived it.

HTH,
  Stefano



From MAILER-DAEMON Fri Jun 22 23:37:32 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SiHAB-0006hs-Vf
	for mharc-bug-bash@gnu.org; Fri, 22 Jun 2012 23:37:31 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48683)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SiHA9-0006hl-9j
	for bug-bash@gnu.org; Fri, 22 Jun 2012 23:37:30 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SiHA7-00033p-Hc
	for bug-bash@gnu.org; Fri, 22 Jun 2012 23:37:28 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:54862
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SiHA7-00033k-49
	for bug-bash@gnu.org; Fri, 22 Jun 2012 23:37:27 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.5/8.14.4/SuSE Linux 0.8) with ESMTP id
	q5N3bJ4R029543; Fri, 22 Jun 2012 20:37:22 -0700
Message-ID: <4FE539EF.1090709@tlinx.org>
Date: Fri, 22 Jun 2012 20:37:19 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: Rob Hoelz <rob@hoelz.ro>
Subject: Re: Unicode collation for readline completion in bash
References: <4FE1B392.6060303@hoelz.ro>
In-Reply-To: <4FE1B392.6060303@hoelz.ro>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 23 Jun 2012 03:37:30 -0000



Rob Hoelz wrote:
> Hello,
> 
> I have an idea for a new feature for bash/readline, and I wanted to get
> the community's feedback before I go about implementing it.
---
	Have you looked at the Unicode collation algorithm?
	They have one published with each released.


	You say you want to ignore diacritics...ok... but what order would you put
them in?

	How about upper/lower case?  Unicode has a specified ordering that that most
OS implementations don't follow.  Bash doesn't follow the Unicode ordering 
saying, well
if POSIX doesn't say I have to, then I won't.  POSIX is a mostly provincial 
standard based
on ascii standard C -- with their official locale being called the C-locale 
until recently,
when they realize how provincial it made their standard look.   A standard that only
supports 127 (or less if the anti-invisi-char freaks get their way) chars?

	I would see no problem with implementing a switch that toggles ignoring
diacritics on or off... MS has a similar option in its OS search function -- for
searches, "should" it ignore diacritics or not.


	But I'd also like to see unicode ordering, as it's yet another worldwide
standard that the US isn't participating in (we got POSIX and the antiquated English
measurement system...)...

http://unicode.org/reports/tr10/ - Unicode Collation Algorithm, Unicode 
Technical standard #10


http://unicode.org/charts/uca/  - charts to show you the effect of the algorithm...



Note A-Z occur before a-z... unlike in most implementations of 
en_US.UTF-8...where they
are intermixed...



From MAILER-DAEMON Sat Jun 23 14:39:07 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SiVEh-0002V8-0h
	for mharc-bug-bash@gnu.org; Sat, 23 Jun 2012 14:39:07 -0400
Received: from eggs.gnu.org ([208.118.235.92]:47694)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SiVEe-0002UY-3p
	for bug-bash@gnu.org; Sat, 23 Jun 2012 14:39:05 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SiVEc-0005Nd-5Z
	for bug-bash@gnu.org; Sat, 23 Jun 2012 14:39:03 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:41067)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SiVEc-0005NM-0h
	for bug-bash@gnu.org; Sat, 23 Jun 2012 14:39:02 -0400
Received: from mpv7.tis.CWRU.Edu (EHLO mpv7.case.edu) ([129.22.104.170])
	by mpv1.tis.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id CAE48202; Sat, 23 Jun 2012 14:38:59 -0400 (EDT)
Received: from h58.207.189.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.189.207.58]) by mpv7.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id UEU48733 (AUTH cpr);
	Sat, 23 Jun 2012 14:38:59 -0400 (EDT)
Message-ID: <4FE60D42.8090105@case.edu>
Date: Sat, 23 Jun 2012 14:38:58 -0400
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6;
	rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: bill@ycc.com
Subject: Re: cd // produces unexpected results
References: <CAFyvKisRDB8Ld3QKKxCEkH4tT87p3AisSbfpVPpqCPdeXFL3WA@mail.gmail.com>
	<120622194702.AA42099.SM@caleb.ins.cwru.edu>
	<4FE4EAA1.6080005@gmail.com>
In-Reply-To: <4FE4EAA1.6080005@gmail.com>
X-Enigmail-Version: 1.4.2
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: Stefano Lattarini <stefano.lattarini@gmail.com>, bug-bash@gnu.org,
	chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 23 Jun 2012 18:39:05 -0000

On 6/22/12 5:58 PM, Stefano Lattarini wrote:
> On 06/22/2012 09:47 PM, Chet Ramey wrote:
>>> By accident I keyed in :
>>>
>>> cd //
>>>
>>> and noticed that my prompt included both slashes.
>>
>> Posix says shells have to leave two leading slashes in a pathname alone.
>> Three or more can be collapsed to one, but two have to stay unchanged.
>> This has come up multiple times in the past.
>>
> A little more info, quoting from the Autoconf manual:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cd.html#tag_20_14

Step 8c.


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




From MAILER-DAEMON Sat Jun 23 16:16:40 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SiWl6-0003VI-Lg
	for mharc-bug-bash@gnu.org; Sat, 23 Jun 2012 16:16:40 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41058)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SiWl4-0003V4-AJ
	for bug-bash@gnu.org; Sat, 23 Jun 2012 16:16:39 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SiWl2-0000YW-Es
	for bug-bash@gnu.org; Sat, 23 Jun 2012 16:16:37 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:18393)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SiWl2-0000YS-9u
	for bug-bash@gnu.org; Sat, 23 Jun 2012 16:16:36 -0400
Received: from mpv7.case.edu (mpv7.tis.CWRU.Edu [129.22.104.170])
	by mpv2.tis.cwru.edu (MOS 4.3.3-GA) with ESMTP id BMG58072;
	Sat, 23 Jun 2012 16:16:33 -0400
Received: from h58.207.189.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.189.207.58]) by mpv7.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id UEU70524 (AUTH cpr);
	Sat, 23 Jun 2012 16:16:33 -0400 (EDT)
Message-ID: <4FE62420.40206@case.edu>
Date: Sat, 23 Jun 2012 16:16:32 -0400
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6;
	rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: Serge van den Boom <svdb@stack.nl>
Subject: Re: **/ directory wildcards leak file descriptors and memory
References: <alpine.BSF.2.00.1206202047230.63078@toad.stack.nl>
In-Reply-To: <alpine.BSF.2.00.1206202047230.63078@toad.stack.nl>
X-Enigmail-Version: 1.4.2
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv2.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.37
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
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, 23 Jun 2012 20:16:39 -0000

On 6/20/12 2:50 PM, Serge van den Boom wrote:

> Bash Version: 4.2
> Patch Level: 29
> Release Status: release
> 
> Description:
> 	If you interrupt the evaluation of **/ wildcard expansion, the file
> 	descriptors which were opened will not be closed.
> 	Also, memory used will not be released.

I can't reproduce this:

$ echo $BASH_VERSION
4.2.29(5)-release
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.8 (Tikanga)
$ shopt -s globstar
$ ls -la /proc/self/fd
total 0
dr-x------ 2 chet wheel  0 Jun 23 16:07 ./
dr-xr-xr-x 6 chet wheel  0 Jun 23 16:07 ../
lrwx------ 1 chet wheel 64 Jun 23 16:07 0 -> /dev/pts/0
lrwx------ 1 chet wheel 64 Jun 23 16:07 1 -> /dev/pts/0
lrwx------ 1 chet wheel 64 Jun 23 16:07 2 -> /dev/pts/0
lr-x------ 1 chet wheel 64 Jun 23 16:07 3 -> /proc/28456/fd/
$ date
Sat Jun 23 16:07:34 EDT 2012
$ echo /**/*.txt
[^C here]
$ date
Sat Jun 23 16:08:51 EDT 2012
$ ls -la /proc/self/fd
total 0
dr-x------ 2 chet wheel  0 Jun 23 16:08 ./
dr-xr-xr-x 6 chet wheel  0 Jun 23 16:08 ../
lrwx------ 1 chet wheel 64 Jun 23 16:08 0 -> /dev/pts/0
lrwx------ 1 chet wheel 64 Jun 23 16:08 1 -> /dev/pts/0
lrwx------ 1 chet wheel 64 Jun 23 16:08 2 -> /dev/pts/0
lr-x------ 1 chet wheel 64 Jun 23 16:08 3 -> /proc/28553/fd/

Bash consuming memory is not evidence of a memory leak.  The bash malloc
only returns memory to the kernel under certain circumstances; it usually
acts as a cache between the application (bash) and the kernel.  You need
to run this using a leak-checking tool like valgrind to determine whether
bash has allocated memory to which it no longer retains a handle.

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




From MAILER-DAEMON Sat Jun 23 16:25:36 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SiWtk-000566-0g
	for mharc-bug-bash@gnu.org; Sat, 23 Jun 2012 16:25:36 -0400
Received: from eggs.gnu.org ([208.118.235.92]:45038)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SiWtg-00054e-UH
	for bug-bash@gnu.org; Sat, 23 Jun 2012 16:25:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SiWtf-0002ZV-3L
	for bug-bash@gnu.org; Sat, 23 Jun 2012 16:25:32 -0400
Received: from mail-out.m-online.net ([212.18.0.10]:39061)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SiWte-0002R3-Ss
	for bug-bash@gnu.org; Sat, 23 Jun 2012 16:25:31 -0400
Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net
	[192.168.8.180])
	by mail-out.m-online.net (Postfix) with ESMTP id 3WKSnT0YMSz3hhTn;
	Sat, 23 Jun 2012 22:25:16 +0200 (CEST)
Received: from igel.home (ppp-88-217-109-173.dynamic.mnet-online.de
	[88.217.109.173])
	by mail.mnet-online.de (Postfix) with ESMTPA id 3WKSnc0Dbsz4KK71;
	Sat, 23 Jun 2012 22:25:24 +0200 (CEST)
Received: by igel.home (Postfix, from userid 501)
	id 6F081CA2A5; Sat, 23 Jun 2012 22:25:23 +0200 (CEST)
From: Andreas Schwab <schwab@linux-m68k.org>
To: chet.ramey@case.edu
Subject: Re: **/ directory wildcards leak file descriptors and memory
References: <alpine.BSF.2.00.1206202047230.63078@toad.stack.nl>
	<4FE62420.40206@case.edu>
X-Yow: FEELINGS are cascading over me!!!
Date: Sat, 23 Jun 2012 22:25:23 +0200
In-Reply-To: <4FE62420.40206@case.edu> (Chet Ramey's message of "Sat, 23 Jun
	2012 16:16:32 -0400")
Message-ID: <m2y5nd4vyk.fsf@igel.home>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older,
	4)
X-Received-From: 212.18.0.10
Cc: Serge van den Boom <svdb@stack.nl>, bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 23 Jun 2012 20:25:34 -0000

Chet Ramey <chet.ramey@case.edu> writes:

> $ ls -la /proc/self/fd

You are looking at ls's fds, not bash's.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


From MAILER-DAEMON Sat Jun 23 16:51:25 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SiXIj-00077O-0l
	for mharc-bug-bash@gnu.org; Sat, 23 Jun 2012 16:51:25 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58831)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SiXIg-00076t-6Y
	for bug-bash@gnu.org; Sat, 23 Jun 2012 16:51:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SiXIe-0007XR-Iu
	for bug-bash@gnu.org; Sat, 23 Jun 2012 16:51:21 -0400
Received: from mail-out.m-online.net ([212.18.0.9]:55284)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SiXIe-0007XI-Cb
	for bug-bash@gnu.org; Sat, 23 Jun 2012 16:51:20 -0400
Received: from frontend1.mail.m-online.net (unknown [192.168.8.180])
	by mail-out.m-online.net (Postfix) with ESMTP id 3WKTMX47G8z4KK76;
	Sat, 23 Jun 2012 22:51:20 +0200 (CEST)
Received: from igel.home (ppp-88-217-109-173.dynamic.mnet-online.de
	[88.217.109.173])
	by mail.mnet-online.de (Postfix) with ESMTPA id 3WKTMV4Y4Vz4KK40;
	Sat, 23 Jun 2012 22:51:18 +0200 (CEST)
Received: by igel.home (Postfix, from userid 501)
	id 40F7CCA2A5; Sat, 23 Jun 2012 22:51:18 +0200 (CEST)
From: Andreas Schwab <schwab@linux-m68k.org>
To: chet.ramey@case.edu
Subject: Re: **/ directory wildcards leak file descriptors and memory
References: <alpine.BSF.2.00.1206202047230.63078@toad.stack.nl>
	<4FE62420.40206@case.edu>
X-Yow: After THIS, let's go to PHILADELPHIA and have TRIPLETS!!
Date: Sat, 23 Jun 2012 22:51:18 +0200
In-Reply-To: <4FE62420.40206@case.edu> (Chet Ramey's message of "Sat, 23 Jun
	2012 16:16:32 -0400")
Message-ID: <m2txy14urd.fsf@igel.home>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older,
	4)
X-Received-From: 212.18.0.9
Cc: Serge van den Boom <svdb@stack.nl>, bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 23 Jun 2012 20:51:23 -0000

This patch should fix it.

Andreas.

diff --git a/lib/glob/glob.c b/lib/glob/glob.c
index c77618f..4fb1d16 100644
--- a/lib/glob/glob.c
+++ b/lib/glob/glob.c
@@ -725,8 +725,6 @@ glob_vector (pat, dir, flags)
 	  FREE (tmplink);
 	}
 
-      QUIT;
-
       return ((char **)NULL);
     }
 
@@ -1047,6 +1045,7 @@ glob_filename (pathname, flags)
 	{
 	  if (free_dirname)
 	    free (directory_name);
+	  QUIT;
 	  return (temp_results);
 	}
 
-- 
1.7.11.1

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


From MAILER-DAEMON Sat Jun 23 17:11:48 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SiXcS-0001bi-E4
	for mharc-bug-bash@gnu.org; Sat, 23 Jun 2012 17:11:48 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58101)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1SiXcQ-0001b7-D0
	for bug-bash@gnu.org; Sat, 23 Jun 2012 17:11:47 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1SiXcO-0003TI-MM
	for bug-bash@gnu.org; Sat, 23 Jun 2012 17:11:45 -0400
Received: from joseki.proulx.com ([216.17.153.58]:47280)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1SiXcO-0003T2-En
	for bug-bash@gnu.org; Sat, 23 Jun 2012 17:11:44 -0400
Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119])
	by joseki.proulx.com (Postfix) with ESMTP id DACAE211D9;
	Sat, 23 Jun 2012 15:11:41 -0600 (MDT)
Received: by hysteria.proulx.com (Postfix, from userid 1000)
	id A37792DC55; Sat, 23 Jun 2012 15:11:41 -0600 (MDT)
Date: Sat, 23 Jun 2012 15:11:41 -0600
From: Bob Proulx <bob@proulx.com>
To: bug-bash@gnu.org
Subject: Re: cd // produces unexpected results
Message-ID: <20120623211141.GA21194@hysteria.proulx.com>
Mail-Followup-To: bug-bash@gnu.org, bill@ycc.com
References: <CAFyvKisRDB8Ld3QKKxCEkH4tT87p3AisSbfpVPpqCPdeXFL3WA@mail.gmail.com>
	<120622194702.AA42099.SM@caleb.ins.cwru.edu>
	<4FE4EAA1.6080005@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4FE4EAA1.6080005@gmail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 216.17.153.58
Cc: bill@ycc.com
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 23 Jun 2012 21:11:47 -0000

Stefano Lattarini wrote:
> A little more info, quoting from the Autoconf manual:

And I will respond to the quoted part from the autoconf manual
realizing that Stefano isn't saying it but just passing the message
along. :-)

>   POSIX lets implementations treat leading // specially, but requires leading
>   /// and beyond to be equivalent to /.  Most Unix variants treat // like /.
>   However, some treat // as a "super-root" that can provide access to files
>   that are not otherwise reachable from /.  The super-root tradition began
>   with Apollo Domain/OS, which died out long ago, but unfortunately Cygwin
>   has revived it.

I don't think that should say "unfortunately" there.  Apollo Aegis
started it with an "unfortunate" network model.  But that was Apollo
not Cygwin.  And because of that it was swept into the POSIX standard.
It existed in the wild with Aegis Domain/OS and therefore the Portable
Operating System Interface standard needed to incorporate the behavior
as existing behavior in what was at one time a popular system.  And
then with the passage of time Domain/OS is now no longer seen.
However the standard still exists.

Cygwin had a very similar behavior model that needed to be handled.
Cygwin I think did okay by making use of the existing standard rather
than creating something new.  The alternative would have been a
different, unique, non-standard syntax and that would have been bad.
But they fit within the standard.  Any previously standard conforming
and well behaved script would still be standard conforming and well
behaved.  That being the whole point of the POSIX standard I see this
as a good thing.

Bob


From MAILER-DAEMON Sat Jun 23 17:28:09 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SiXsH-0003rT-6u
	for mharc-bug-bash@gnu.org; Sat, 23 Jun 2012 17:28:09 -0400
Received: from eggs.gnu.org ([208.118.235.92]:34247)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <svdb@stack.nl>) id 1SiXsE-0003rM-Ic
	for bug-bash@gnu.org; Sat, 23 Jun 2012 17:28:08 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <svdb@stack.nl>) id 1SiXsC-0006s1-8H
	for bug-bash@gnu.org; Sat, 23 Jun 2012 17:28:06 -0400
Received: from relay02.stack.nl ([131.155.140.104]:54186 helo=mx1.stack.nl)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <svdb@stack.nl>) id 1SiXsB-0006ro-SF
	for bug-bash@gnu.org; Sat, 23 Jun 2012 17:28:04 -0400
Received: from toad.stack.nl (toad.stack.nl [IPv6:2001:610:1108:5010::135])
	by mx1.stack.nl (Postfix) with ESMTP id C47FF358C63;
	Sat, 23 Jun 2012 23:28:01 +0200 (CEST)
Received: by toad.stack.nl (Postfix, from userid 1106)
	id ADBC33F479; Sat, 23 Jun 2012 23:28:01 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
	by toad.stack.nl (Postfix) with ESMTP id A49D93F435;
	Sat, 23 Jun 2012 23:28:01 +0200 (CEST)
Date: Sat, 23 Jun 2012 23:28:01 +0200 (CEST)
From: Serge van den Boom <svdb@stack.nl>
To: Chet Ramey <chet.ramey@case.edu>
Subject: Re: **/ directory wildcards leak file descriptors and memory
In-Reply-To: <4FE62420.40206@case.edu>
Message-ID: <alpine.BSF.2.00.1206232248450.89951@toad.stack.nl>
References: <alpine.BSF.2.00.1206202047230.63078@toad.stack.nl>
	<4FE62420.40206@case.edu>
User-Agent: Alpine 2.00 (BSF 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 131.155.140.104
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 23 Jun 2012 21:28:08 -0000

On Sat, 23 Jun 2012, Chet Ramey wrote:
> On 6/20/12 2:50 PM, Serge van den Boom wrote:
> > Bash Version: 4.2
> > Patch Level: 29
> > Release Status: release
> > 
> > Description:
> > 	If you interrupt the evaluation of **/ wildcard expansion, the file
> > 	descriptors which were opened will not be closed.
> > 	Also, memory used will not be released.
> 
> I can't reproduce this:
> 
[...]
> 
> Bash consuming memory is not evidence of a memory leak.  The bash malloc
> only returns memory to the kernel under certain circumstances; it usually
> acts as a cache between the application (bash) and the kernel.  You need
> to run this using a leak-checking tool like valgrind to determine whether
> bash has allocated memory to which it no longer retains a handle.

It may be superfluous now, after Andreas' response, but here is some
additional information.

If you leave the wildcard expansion running for longer, the effect is
greater, and out-of-memory errors will be shown when executing a command
afterwards:

$ echo $BASH_VERSION
4.2.29(1)-release

$ echo $$
16346

$ ls /**/*.txt
[after 15 minutes]
^C

$ ls
bash: fork: Cannot allocate memory
bash: fork: Cannot allocate memory
bash: fork: Cannot allocate memory
[... about 300 more of these ...]
bash: fork: Cannot allocate memory
bash: fork: Cannot allocate memory
bash: fork: Cannot allocate memory
bash: cannot make pipe for command substitution: Too many open files

[ In a different shell instance (one which is still usable): ]
$ ls -fl /proc/16346/fd
total 0K
dr-x------ 2 svdb users  0 Jun 23 22:44 ./
dr-x------ 6 svdb users  0 Jun 23 22:44 ../
lrwx------ 1 svdb users 64 Jun 23 23:06 0 -> /dev/pts/1
lrwx------ 1 svdb users 64 Jun 23 23:06 1 -> /dev/pts/1
lrwx------ 1 svdb users 64 Jun 23 23:06 2 -> /dev/pts/1
l-wx------ 1 svdb users 64 Jun 23 23:06 3 -> /mnt/hda7/home/svdb/.fluxbox/log
lr-x------ 1 svdb users 64 Jun 23 23:06 4 -> //
lr-x------ 1 svdb users 64 Jun 23 23:06 5 -> /dev/
lr-x------ 1 svdb users 64 Jun 23 23:06 6 -> /proc/16346/fd/
lr-x------ 1 svdb users 64 Jun 23 23:06 7 -> //
lr-x------ 1 svdb users 64 Jun 23 23:06 8 -> /dev/
lr-x------ 1 svdb users 64 Jun 23 23:06 9 -> /proc/16346/fd/
lr-x------ 1 svdb users 64 Jun 23 23:06 10 -> //
lr-x------ 1 svdb users 64 Jun 23 23:06 11 -> /dev/
lr-x------ 1 svdb users 64 Jun 23 23:06 12 -> /proc/16346/fd/
lr-x------ 1 svdb users 64 Jun 23 23:06 13 -> //
lr-x------ 1 svdb users 64 Jun 23 23:06 14 -> /dev/
lr-x------ 1 svdb users 64 Jun 23 23:06 15 -> /proc/16346/fd/
lr-x------ 1 svdb users 64 Jun 23 23:06 16 -> //
lr-x------ 1 svdb users 64 Jun 23 23:06 17 -> /dev/
lr-x------ 1 svdb users 64 Jun 23 23:06 18 -> /proc/16346/fd/
lr-x------ 1 svdb users 64 Jun 23 23:06 19 -> //
lr-x------ 1 svdb users 64 Jun 23 23:06 20 -> /dev/
lr-x------ 1 svdb users 64 Jun 23 23:06 21 -> /proc/16346/fd/
lr-x------ 1 svdb users 64 Jun 23 23:06 22 -> //
lr-x------ 1 svdb users 64 Jun 23 23:06 23 -> /dev/
lr-x------ 1 svdb users 64 Jun 23 23:06 24 -> /proc/16346/fd/
lr-x------ 1 svdb users 64 Jun 23 23:06 25 -> //
lr-x------ 1 svdb users 64 Jun 23 23:06 26 -> /dev/
lr-x------ 1 svdb users 64 Jun 23 23:06 27 -> /proc/16346/fd/
lr-x------ 1 svdb users 64 Jun 23 23:06 28 -> //
lr-x------ 1 svdb users 64 Jun 23 23:06 29 -> /dev/
lr-x------ 1 svdb users 64 Jun 23 23:06 30 -> /proc/16346/fd/
lr-x------ 1 svdb users 64 Jun 23 23:06 31 -> //
lr-x------ 1 svdb users 64 Jun 23 23:06 32 -> /dev/
lr-x------ 1 svdb users 64 Jun 23 23:06 33 -> /proc/16346/fd/
lr-x------ 1 svdb users 64 Jun 23 23:06 34 -> //
lr-x------ 1 svdb users 64 Jun 23 23:06 35 -> /dev/
lr-x------ 1 svdb users 64 Jun 23 23:06 36 -> /proc/16346/fd/
lr-x------ 1 svdb users 64 Jun 23 23:06 37 -> //
lr-x------ 1 svdb users 64 Jun 23 23:06 38 -> /dev/
lr-x------ 1 svdb users 64 Jun 23 23:06 39 -> /proc/16346/fd/
lr-x------ 1 svdb users 64 Jun 23 23:06 40 -> //
lr-x------ 1 svdb users 64 Jun 23 23:06 41 -> /dev/
lr-x------ 1 svdb users 64 Jun 23 23:06 42 -> /proc/16346/fd/
lr-x------ 1 svdb users 64 Jun 23 23:06 43 -> //
lr-x------ 1 svdb users 64 Jun 23 23:06 44 -> /mnt/
lr-x------ 1 svdb users 64 Jun 23 23:06 45 -> /mnt/hda7/
lr-x------ 1 svdb users 64 Jun 23 23:06 46 -> /mnt/hda7/home/
lr-x------ 1 svdb users 64 Jun 23 23:06 47 -> /mnt/hda7/home/svdb/
lr-x------ 1 svdb users 64 Jun 23 23:06 48 -> /mnt/hda7/home/svdb/c/
lr-x------ 1 svdb users 64 Jun 23 23:06 49 -> /mnt/hda7/home/svdb/c/tests/
lr-x------ 1 svdb users 64 Jun 23 23:06 50 -> /mnt/hda7/home/svdb/c/tests/tar/
lr-x------ 1 svdb users 64 Jun 23 23:06 51 -> /mnt/hda7/home/svdb/c/tests/tar/work/
lr-x------ 1 svdb users 64 Jun 23 23:06 52 -> //
lr-x------ 1 svdb users 64 Jun 23 23:06 53 -> /mnt/
lr-x------ 1 svdb users 64 Jun 23 23:06 54 -> /mnt/hda7/
lr-x------ 1 svdb users 64 Jun 23 23:06 55 -> /mnt/hda7/home/
lr-x------ 1 svdb users 64 Jun 23 23:06 56 -> /mnt/hda7/home/svdb/
lr-x------ 1 svdb users 64 Jun 23 23:06 57 -> /mnt/hda7/home/svdb/c/
lr-x------ 1 svdb users 64 Jun 23 23:06 58 -> /mnt/hda7/home/svdb/c/cheater/
lr-x------ 1 svdb users 64 Jun 23 23:06 59 -> /mnt/hda7/home/svdb/c/cheater/arch/
lr-x------ 1 svdb users 64 Jun 23 23:06 60 -> pipe:[1031416]
l-wx------ 1 svdb users 64 Jun 23 23:06 61 -> pipe:[1031416]
lr-x------ 1 svdb users 64 Jun 23 23:06 62 -> pipe:[1031417]
l-wx------ 1 svdb users 64 Jun 23 23:06 63 -> pipe:[1031417]
lr-x------ 1 svdb users 64 Jun 23 23:06 64 -> pipe:[1031418]
l-wx------ 1 svdb users 64 Jun 23 23:06 65 -> pipe:[1031418]
[...]
lr-x------ 1 svdb users 64 Jun 23 23:06 1019 -> pipe:[1031895]
l-wx------ 1 svdb users 64 Jun 23 23:06 1020 -> pipe:[1031895]
lr-x------ 1 svdb users 64 Jun 23 23:06 1021 -> pipe:[1031896]
l-wx------ 1 svdb users 64 Jun 23 23:06 1022 -> pipe:[1031896]

The file descriptors up to 59 were there after the path name expansion
was interrupted, but I now see that the file descriptors for the pipes
only appeared after I executed 'ls', which might suggest that there is a
second issue.

$ htop
[...]
  PID  PPID USER   PRI  NI  VIRT   RES   SHR S CPU CPU% MEM%   TIME+  Command
16346 16345 svdb    20   0  422M  417M  1488 S   2  0.0 13.8  2:19.19 bash
[...]

Note the 'VIRT' and 'RES' columns.
For a fresh bash, htop shows something like this:
[...]
  PID  PPID USER   PRI  NI  VIRT   RES   SHR S CPU CPU% MEM%   TIME+  Command
17484 17483 svdb    20   0  5404  1736  1312 S   2  0.0  0.1  0:00.02 bash
[...]


Btw, I should add that I compiled with --without-bash-malloc, following
the instructions from
http://www.linuxfromscratch.org/lfs/view/stable/chapter05/bash.html .
I mistakenly thought that my options to 'configure' were included in the
bashbug output. My full 'configure' command line was:
	./configure --prefix=/opt/bash-4.2 --disable-rpath --with-installed-readline=/opt/readline --with-curses --without-bash-malloc
And my readline is version 6.2, with both available patches applied.

Regards,

Serge



From MAILER-DAEMON Mon Jun 25 04:40:11 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sj4qB-0004Av-Le
	for mharc-bug-bash@gnu.org; Mon, 25 Jun 2012 04:40:11 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46394)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <recnh@aauindy.cscaa.dk>) id 1Sj3uI-0000gs-7o
	for bug-bash@gnu.org; Mon, 25 Jun 2012 03:40:27 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <recnh@aauindy.cscaa.dk>) id 1Sj3uC-00011e-Cm
	for bug-bash@gnu.org; Mon, 25 Jun 2012 03:40:21 -0400
Received: from aauindy.cscaa.dk ([130.225.246.10]:46121)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <recnh@aauindy.cscaa.dk>) id 1Sj3uC-0000k8-0u
	for bug-bash@gnu.org; Mon, 25 Jun 2012 03:40:16 -0400
Received: from aauindy.cscaa.dk (localhost.localdomain [127.0.0.1])
	by aauindy.cscaa.dk (8.13.6/8.13.4) with ESMTP id q5P7Il4N013031
	for <bug-bash@gnu.org>; Mon, 25 Jun 2012 09:18:47 +0200
Received: (from recnh@localhost)
	by aauindy.cscaa.dk (8.13.6/8.13.6/Submit) id q5P7Il2k013030
	for bug-bash@gnu.org; Mon, 25 Jun 2012 09:18:47 +0200
Date: Mon, 25 Jun 2012 09:18:47 +0200
From: "Niels Carl W. Hansen" <recnh@aauindy.cscaa.dk>
Message-Id: <201206250718.q5P7Il2k013030@aauindy.cscaa.dk>
To: bug-bash@gnu.org
Subject: regex in bashexpression doesn't work
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older,
	4)
X-Received-From: 130.225.246.10
X-Mailman-Approved-At: Mon, 25 Jun 2012 04:40:09 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 25 Jun 2012 07:40:28 -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-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_GNU_SOURCE -DRECYCLES_PIDS  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fwrapv
uname output: Linux in 2.6.32-220.17.1.el6.x86_64 #1 SMP Wed May 16 00:01:37 BST 2012 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 4.1
Patch Level: 2
Release Status: release

Description:
        [[ 'foobar'  =~ 'o.a' ]] && echo FOUND
        should print  FOUND  but it doesn't.
        This have worked in previeous versions of bash.
        The bash used comes with CentOS 6.2

Repeat-By:
        No privous commands necessary to generate this problem.

Fix:



From MAILER-DAEMON Mon Jun 25 04:50:49 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sj50T-0002vs-Qp
	for mharc-bug-bash@gnu.org; Mon, 25 Jun 2012 04:50:49 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49343)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dearvoid@gmail.com>) id 1Sj50O-0002vf-2o
	for bug-bash@gnu.org; Mon, 25 Jun 2012 04:50:48 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dearvoid@gmail.com>) id 1Sj50H-0000J8-Sp
	for bug-bash@gnu.org; Mon, 25 Jun 2012 04:50:43 -0400
Received: from mail-yw0-f51.google.com ([209.85.213.51]:53411)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dearvoid@gmail.com>) id 1Sj50H-0000H7-M8
	for bug-bash@gnu.org; Mon, 25 Jun 2012 04:50:37 -0400
Received: by yhnn12 with SMTP id n12so2672506yhn.38
	for <bug-bash@gnu.org>; Mon, 25 Jun 2012 01:50:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type;
	bh=yGzpWom6DCkuBgTFg6LxgAaLBlfSoxB7albov8X3i/I=;
	b=qh01TI5lHzlraNNNyROA8JvzmHTXuK+MMvOnXKi2TP83GJppePMNIvwJkXQKSH2mwS
	Uay3vVakH+wKeZUTpipZpzhTHP1YFZO4oy8Lzlyfitm2ceuTGeyGoVfOCrkIzU2wyuad
	SBtKxiIz/biNQXUvzOzLr4OVYalO+7CxREYOjYI5A6xaj5jB3ASJL936wm9BKlvE02xm
	qHac699eGEDLN/ZAjLyi25tl31X3o4PUKY8bDe93EEVAiRztJBEG78sxL8x8RT9LRdeF
	MHYl0S26kIHQXRuWD9Br17VjWk7wRNZW/0x0o2dSWeUaemZfV5Gu5VU/IxfNMTwTUjNk
	RAwA==
Received: by 10.60.1.130 with SMTP id 2mr11265774oem.7.1340614234908; Mon, 25
	Jun 2012 01:50:34 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.182.134.34 with HTTP; Mon, 25 Jun 2012 01:49:54 -0700 (PDT)
In-Reply-To: <201206250718.q5P7Il2k013030@aauindy.cscaa.dk>
References: <201206250718.q5P7Il2k013030@aauindy.cscaa.dk>
From: Clark WANG <dearvoid@gmail.com>
Date: Mon, 25 Jun 2012 16:49:54 +0800
Message-ID: <CADv8-oiCjjZRyXegE+eD3njY4hDRTBSz+jmq8UDwJ2AMjv3KQA@mail.gmail.com>
Subject: Re: regex in bashexpression doesn't work
To: "Niels Carl W. Hansen" <recnh@aauindy.cscaa.dk>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.213.51
Content-Type: text/plain; charset=UTF-8
X-Content-Filtered-By: Mailman/MimeDel 2.1.14
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 25 Jun 2012 08:50:48 -0000

On Mon, Jun 25, 2012 at 3:18 PM, Niels Carl W. Hansen <
recnh@aauindy.cscaa.dk> wrote:

>
> Description:
>        [[ 'foobar'  =~ 'o.a' ]] && echo FOUND
>        should print  FOUND  but it doesn't.
>        This have worked in previeous versions of bash.
>        The bash used comes with CentOS 6.2
>

See E14 in Bash FAQ: http://tiswww.case.edu/php/chet/bash/FAQ


>
> Repeat-By:
>        No privous commands necessary to generate this problem.
>
> Fix:
>
>
>

From MAILER-DAEMON Mon Jun 25 07:03:19 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sj74h-0000ca-BR
	for mharc-bug-bash@gnu.org; Mon, 25 Jun 2012 07:03:19 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35855)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1Sj74e-0000c4-Jc
	for bug-bash@gnu.org; Mon, 25 Jun 2012 07:03:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1Sj74V-0006Xg-NG
	for bug-bash@gnu.org; Mon, 25 Jun 2012 07:03:16 -0400
Received: from mx1.redhat.com ([209.132.183.28]:44155)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1Sj6wj-000506-1W
	for bug-bash@gnu.org; Mon, 25 Jun 2012 06:55:05 -0400
Received: from int-mx11.intmail.prod.int.phx2.redhat.com
	(int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q5PAt2Ck021253
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
	for <bug-bash@gnu.org>; Mon, 25 Jun 2012 06:55:02 -0400
Received: from dhcp-25-98.brq.redhat.com (dhcp-25-98.brq.redhat.com
	[10.34.25.98])
	by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id q5PAt1n1010240
	for <bug-bash@gnu.org>; Mon, 25 Jun 2012 06:55:02 -0400
Message-ID: <4FE84385.1060003@redhat.com>
Date: Mon, 25 Jun 2012 12:55:01 +0200
From: Roman Rakus <rrakus@redhat.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:13.0) Gecko/20120605 Thunderbird/13.0
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Re: regex in bashexpression doesn't work
References: <201206250718.q5P7Il2k013030@aauindy.cscaa.dk>
In-Reply-To: <201206250718.q5P7Il2k013030@aauindy.cscaa.dk>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.132.183.28
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 25 Jun 2012 11:03:17 -0000

On 06/25/2012 09:18 AM, Niels Carl W. Hansen wrote:
> 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-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_GNU_SOURCE -DRECYCLES_PIDS  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fwrapv
> uname output: Linux in 2.6.32-220.17.1.el6.x86_64 #1 SMP Wed May 16 00:01:37 BST 2012 x86_64 x86_64 x86_64 GNU/Linux
> Machine Type: x86_64-redhat-linux-gnu
>
> Bash Version: 4.1
> Patch Level: 2
> Release Status: release
>
> Description:
>          [[ 'foobar'  =~ 'o.a' ]] && echo FOUND
>          should print  FOUND  but it doesn't.
>          This have worked in previeous versions of bash.
>          The bash used comes with CentOS 6.2
>
> Repeat-By:
>          No privous commands necessary to generate this problem.
>
> Fix:
>
>
There is  a bug in previous versions of bash in Fedora, RHEL and CentOS. 
It means, in those distributions, bash versions up to 4.0 treats quoting 
differently than upstream.
If you want to use the same quoting you have to enable compat31 shell 
option.

RR



From MAILER-DAEMON Thu Jun 28 18:34:04 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SkNHo-0000Ql-KR
	for mharc-bug-bash@gnu.org; Thu, 28 Jun 2012 18:34:04 -0400
Received: from eggs.gnu.org ([208.118.235.92]:59032)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rainer.blome@gmx.de>) id 1SkDyX-0004Si-BY
	for bug-bash@gnu.org; Thu, 28 Jun 2012 08:37:37 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rainer.blome@gmx.de>) id 1SkDyO-0007RN-HV
	for bug-bash@gnu.org; Thu, 28 Jun 2012 08:37:32 -0400
Received: from mailout-de.gmx.net ([213.165.64.22]:44328)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <rainer.blome@gmx.de>) id 1SkDyO-00075l-70
	for bug-bash@gnu.org; Thu, 28 Jun 2012 08:37:24 -0400
Received: (qmail 21374 invoked by uid 0); 28 Jun 2012 12:37:20 -0000
Received: from 217.7.72.1 by www018.gmx.net with HTTP;
	Thu, 28 Jun 2012 14:37:17 +0200 (CEST)
Content-Type: text/plain; charset="utf-8"
Date: Thu, 28 Jun 2012 14:37:17 +0200
From: "Rainer Blome" <rainer.blome@gmx.de>
Message-ID: <20120628123717.51530@gmx.net>
MIME-Version: 1.0
Subject: Doc of "set -e" should mention non-locality
To: bug-bash@gnu.org
X-Authenticated: #3213004
X-Flags: 0001
X-Mailer: WWW-Mail 6100 (Global Message Exchange)
X-Priority: 3
X-Provags-ID: V01U2FsdGVkX19fBrAqwIFfQs2ouHyrZfjayStMJgVyLaO+IoQNar
	F1HG7TKm5vluGlgTeaXqprmFGelx+oh4nJuQ== 
Content-Transfer-Encoding: 8bit
X-GMX-UID: qiqeb0V1eSEqV61lWnQhEo1+IGRvb8D3
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 213.165.64.22
X-Mailman-Approved-At: Thu, 28 Jun 2012 18:34:02 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 28 Jun 2012 12:37:37 -0000


Configuration Information [Automatically generated, do not change]:
Machine: i586
OS: linux-gnu
Compiler: gcc -I/usr/src/packages/BUILD/bash-3.2 -L/usr/src/packages/BUILD/bash-3.2/../readline-5.2
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i586' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i586-suse-linux-gnu' -DCONF_VENDOR='suse' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -march=i586 -mtune=i686 -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -D_GNU_SOURCE -DRECYCLES_PIDS -Wall -g -std=gnu89 -Wextra -Wno-unprototyped-calls -Wno-switch-enum -pipe -fPIE -fprofile-use
uname output: Linux spatzenhorst 2.6.27.23-0.1-pae #1 SMP 2009-05-26 17:02:05 -0400 i686 i686 i386 GNU/Linux
Machine Type: i586-suse-linux-gnu

Bash Version: 3.2
Patch Level: 39
Release Status: release

Description:

The implementation of "set -e" does not respect "lexical nesting".
This can be very surprising.  The documentation should explicitly
and clearly explain the behavior.

In a context of "set -e", with function "f() { x; false; y; }",
"f" will run only "x", while "f || true" will also run "y".
This is highly surprising.

The documentation states that "shell does not exit if the command that
fails is part of [a boolean expression]" (paraphrased). The problem
here is the phrase "is part of". At first glance, this appears to mean
"is lexically part of", because the wording refers to a number of
syntactical constructs.  This is the relevant sentence in full:

 The shell does not exit if the command that fails is part of the
 command list immediately following a while or until keyword, part of
 the test in an if statement, part of a && or || list, or if the
 command's return value is being inverted via !.

However, "is part of" apparently does not mean "is lexically part of".
Instead, it means "is executed in the execution context of", as in "is
executed when a preceding stack frame represents".

Repeat-By:

 set -e; f() { echo before; false; echo after; }; f || true; echo rc=$?;

prints:

----
before
after
rc=0
----

while many if not most programmers would expect it to print

----
before
rc=0
----


Fix:

If the effect is intended, clearly document it.
If not, change the implementation.

Note that some other shells, in particular ksh, implement the same
behavior.

-- 
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                                  
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a


From MAILER-DAEMON Fri Jun 29 19:05:12 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SkkFU-0003q0-1U
	for mharc-bug-bash@gnu.org; Fri, 29 Jun 2012 19:05:12 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48956)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SkkEX-0003O6-Uu
	for bug-bash@gnu.org; Fri, 29 Jun 2012 19:05:09 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SkkDv-0003il-4j
	for bug-bash@gnu.org; Fri, 29 Jun 2012 19:04:13 -0400
Received: from mail-yx0-f169.google.com ([209.85.213.169]:65248)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SkkDu-0003i4-Si
	for bug-bash@gnu.org; Fri, 29 Jun 2012 19:03:35 -0400
Received: by yenr5 with SMTP id r5so3830731yen.0
	for <bug-bash@gnu.org>; Fri, 29 Jun 2012 16:03:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=from:to:cc:subject:date:message-id:user-agent:in-reply-to
	:references:mime-version:content-type:content-transfer-encoding;
	bh=k+JRl51hEO9hVxnjZvlwlsPvLMSB9mO20NHX4tPqGro=;
	b=SgVtzzydy8vM2wYBKUieR1eyj8gh8zE3ksjGGZuSp2m8jfT7kY5CFvCaV4pQoISR9v
	RHEy9j/7WJbmnyfDVg4uw7vlejY30OQ06IrJTWndbaaE9FVmiY0DWIwGI74FOWx/zYkc
	GrCkGOhYdmWuDYsM/wZYDP8Qn76yhNeZlooOdxzLkEncmX9wVe40hpl/LL7FWaaCfcKW
	qsjMvmB/AMdEhbwN6IRjzyRjkGvFxUxg5SIHQvKKEsDh2tZFoGVR3QVXnbqfMNdmUsa5
	/EOqgLdPjzbDfdLOChRT8WkaHKjWVwTTLZEJUuHU6ElVEtXlApKcJN1NeQPy/iB5BbwV
	QzPA==
Received: by 10.50.159.227 with SMTP id xf3mr2430593igb.24.1341011012282;
	Fri, 29 Jun 2012 16:03:32 -0700 (PDT)
Received: from smorgbox.localnet (65-128-139-72.mpls.qwest.net.
	[65.128.139.72])
	by mx.google.com with ESMTPS id v17sm6146030igv.7.2012.06.29.16.03.30
	(version=SSLv3 cipher=OTHER); Fri, 29 Jun 2012 16:03:31 -0700 (PDT)
From: Dan Douglas <ormaaj@gmail.com>
To: bug-bash@gnu.org
Subject: Re: Doc of "set -e" should mention non-locality
Date: Fri, 29 Jun 2012 18:03:13 -0500
Message-ID: <3873506.x83VPejgYG@smorgbox>
User-Agent: KMail/4.8.3 (Linux/3.4.2-pf+; KDE/4.8.3; x86_64; ; )
In-Reply-To: <20120628123717.51530@gmx.net>
References: <20120628123717.51530@gmx.net>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart5352540.ja9Cn9xI6O";
	micalg="pgp-sha1"; protocol="application/pgp-signature"
Content-Transfer-Encoding: 7Bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.213.169
Cc: Rainer Blome <rainer.blome@gmx.de>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
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, 29 Jun 2012 23:05:09 -0000


--nextPart5352540.ja9Cn9xI6O
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="utf-8"

On Thursday, June 28, 2012 02:37:17 PM Rainer Blome wrote:
> The implementation of "set -e" does not respect "lexical nesting".
> This can be very surprising.  

None of the "set" options do, nor does the ERR trap. That would make this the 
exception. Here's a workaround (untested).

sete() {
    [[ $- == *e* ]]  && return 1
    trap "$(</dev/stdin)" RETURN
} <<EOF
if [[ $FUNCNAME != \$FUNCNAME ]]; then
    set +e
    trap - RETURN
else
    set -e
fi
EOF

This will "set -e" in only the scope of the caller. It gets a bit more 
complicated if you want to use this RETURN feature more extensively and 
preserve other possible RETURN traps, but most people won't have to worry 
about that.
-- 
Dan Douglas
--nextPart5352540.ja9Cn9xI6O
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iEYEABECAAYFAk/uNDgACgkQMmyDamdg+MxJXwCgsM1vNHkyCBM+Jjvmzztl4cKU
RhQAoJENbNMoJFlztDFnpe8YYyITe7Bx
=H1Ll
-----END PGP SIGNATURE-----

--nextPart5352540.ja9Cn9xI6O--



