From MAILER-DAEMON Sun Jul 01 08:03:09 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SlIrt-0005cT-G9
	for mharc-bug-bash@gnu.org; Sun, 01 Jul 2012 08:03:09 -0400
Received: from eggs.gnu.org ([208.118.235.92]:36630)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jan.schampera@web.de>) id 1SlIrp-0005c3-LI
	for bug-bash@gnu.org; Sun, 01 Jul 2012 08:03:08 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jan.schampera@web.de>) id 1SlIrn-0007Sm-Qi
	for bug-bash@gnu.org; Sun, 01 Jul 2012 08:03:05 -0400
Received: from mx0.linux-mitterteich.de ([88.198.169.86]:47638)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jan.schampera@web.de>) id 1SlIrn-0007S2-Jz
	for bug-bash@gnu.org; Sun, 01 Jul 2012 08:03:03 -0400
Received: from mail.home.thebonsai.de (p54B5B3BB.dip.t-dialin.net
	[84.181.179.187]) (Authenticated sender: jschampera.dnsalias.net)
	by mx0.linux-mitterteich.de (Postfix) with ESMTPA id 62F0B3664DA
	for <bug-bash@gnu.org>; Sun,  1 Jul 2012 14:03:01 +0200 (CEST)
Received: from [192.168.64.202] (imap.home.thebonsai.de [192.168.64.202])
	by mail.home.thebonsai.de (Postfix) with ESMTP id 2CDA51DF5B
	for <bug-bash@gnu.org>; Sun,  1 Jul 2012 14:03:01 +0200 (CEST)
Message-ID: <4FF03C75.8000607@web.de>
Date: Sun, 01 Jul 2012 14:03:01 +0200
From: Jan Schampera <jan.schampera@web.de>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US;
	rv:1.9.1.16) Gecko/20120613 Iceowl/1.0b1 Icedove/3.0.11
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Massive recursion -> SEGV
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 88.198.169.86
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: jan.schampera@web.de
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, 01 Jul 2012 12:03:08 -0000

Hi folks,


a suggestion about recursive function calls (and not only that, of course).

Do you see a way for Bash to pull the emergency break before it runs out 
of stack here (to provide an error to the user, rather than a crash):

--------------------
f1() {
   f1
}

f1
--------------------

Currently it runs into a SEGV, where the number of recurions depends on 
the stack limit.

On a fast search I found no portable way, but there are ways for 
specific platforms, like getrusage() when stack is reported there.

-- 
Be conservative in what you do, be liberal in what you accept from others.
- jbp, master of the net, in RFC793



From MAILER-DAEMON Sun Jul 01 08:37:57 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SlJPZ-0001oh-EG
	for mharc-bug-bash@gnu.org; Sun, 01 Jul 2012 08:37:57 -0400
Received: from eggs.gnu.org ([208.118.235.92]:53922)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1SlJPV-0001no-Pt
	for bug-bash@gnu.org; Sun, 01 Jul 2012 08:37:55 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1SlJPU-00073M-6L
	for bug-bash@gnu.org; Sun, 01 Jul 2012 08:37:53 -0400
Received: from mx1.redhat.com ([209.132.183.28]:21602)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1SlJPT-00073E-Ub
	for bug-bash@gnu.org; Sun, 01 Jul 2012 08:37:52 -0400
Received: from int-mx10.intmail.prod.int.phx2.redhat.com
	(int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q61CbokV008585
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
	for <bug-bash@gnu.org>; Sun, 1 Jul 2012 08:37:50 -0400
Received: from [10.36.7.187] (vpn1-7-187.ams2.redhat.com [10.36.7.187])
	by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id q61CbnKQ009610
	for <bug-bash@gnu.org>; Sun, 1 Jul 2012 08:37:50 -0400
Message-ID: <4FF0449B.6090304@redhat.com>
Date: Sun, 01 Jul 2012 14:37:47 +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: Massive recursion -> SEGV
References: <4FF03C75.8000607@web.de>
In-Reply-To: <4FF03C75.8000607@web.de>
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
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: Sun, 01 Jul 2012 12:37:55 -0000

On 07/01/2012 02:03 PM, Jan Schampera wrote:
> Hi folks,
>
>
> a suggestion about recursive function calls (and not only that, of 
> course).
>
> Do you see a way for Bash to pull the emergency break before it runs 
> out of stack here (to provide an error to the user, rather than a crash):
>
> --------------------
> f1() {
>   f1
> }
>
> f1
> --------------------
>
> Currently it runs into a SEGV, where the number of recurions depends 
> on the stack limit.
>
> On a fast search I found no portable way, but there are ways for 
> specific platforms, like getrusage() when stack is reported there.
>
Look for FUNCNEST variable. In recent release it is available.

RR


From MAILER-DAEMON Sun Jul 01 09:51:37 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SlKYr-0000IT-UP
	for mharc-bug-bash@gnu.org; Sun, 01 Jul 2012 09:51:37 -0400
Received: from eggs.gnu.org ([208.118.235.92]:50953)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jan.schampera@web.de>) id 1SlKYp-0000Hc-Bn
	for bug-bash@gnu.org; Sun, 01 Jul 2012 09:51:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jan.schampera@web.de>) id 1SlKYn-0000Rm-Mo
	for bug-bash@gnu.org; Sun, 01 Jul 2012 09:51:34 -0400
Received: from mx0.linux-mitterteich.de ([88.198.169.86]:48228)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jan.schampera@web.de>) id 1SlKYn-0000RF-Fp
	for bug-bash@gnu.org; Sun, 01 Jul 2012 09:51:33 -0400
Received: from mail.home.thebonsai.de (p54B5B3BB.dip.t-dialin.net
	[84.181.179.187]) (Authenticated sender: jschampera.dnsalias.net)
	by mx0.linux-mitterteich.de (Postfix) with ESMTPA id B366A3664DA;
	Sun,  1 Jul 2012 15:51:31 +0200 (CEST)
Received: from [192.168.64.202] (imap.home.thebonsai.de [192.168.64.202])
	by mail.home.thebonsai.de (Postfix) with ESMTP id 51A881DF5B;
	Sun,  1 Jul 2012 15:51:31 +0200 (CEST)
Message-ID: <4FF055E3.5010207@web.de>
Date: Sun, 01 Jul 2012 15:51:31 +0200
From: Jan Schampera <jan.schampera@web.de>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US;
	rv:1.9.1.16) Gecko/20120613 Iceowl/1.0b1 Icedove/3.0.11
MIME-Version: 1.0
To: Roman Rakus <rrakus@redhat.com>
Subject: Re: Massive recursion -> SEGV
References: <4FF03C75.8000607@web.de> <4FF0449B.6090304@redhat.com>
In-Reply-To: <4FF0449B.6090304@redhat.com>
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 88.198.169.86
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: jan.schampera@web.de
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, 01 Jul 2012 13:51:36 -0000

On 01.07.2012 14:37, Roman Rakus wrote:

> Look for FUNCNEST variable. In recent release it is available.

I more meant the shell interpreter, less the code I can write.

-- 
Be conservative in what you do, be liberal in what you accept from others.
- jbp, master of the net, in RFC793



From MAILER-DAEMON Sun Jul 01 16:58:16 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SlRDk-0006nM-Ux
	for mharc-bug-bash@gnu.org; Sun, 01 Jul 2012 16:58:16 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49176)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1SlRDg-0006n5-88
	for bug-bash@gnu.org; Sun, 01 Jul 2012 16:58:16 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1SlRDb-0007l6-V9
	for bug-bash@gnu.org; Sun, 01 Jul 2012 16:58:11 -0400
Received: from caiajhbdcbbj.dreamhost.com ([208.97.132.119]:39525
	helo=homiemail-a7.g.dreamhost.com)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1SlRDb-0007kr-Gg
	for bug-bash@gnu.org; Sun, 01 Jul 2012 16:58:07 -0400
Received: from homiemail-a7.g.dreamhost.com (localhost [127.0.0.1])
	by homiemail-a7.g.dreamhost.com (Postfix) with ESMTP id 5218B25C063
	for <bug-bash@gnu.org>; Sun,  1 Jul 2012 13:58:04 -0700 (PDT)
DomainKey-Signature: a=rsa-sha1; c=nofws; d=jidanni.org; h=from:to:subject
	:date:message-id:mime-version:content-type; q=dns; s=jidanni.org
	; b=Hwz8OFEwnOpO8guSg739N5kSgznDp1v3X8tP4EURrjd6wm3/+1Pi/k0S7ub9
	L0QSIF448NXC/DUZcEBilyJaeOeBIGbJy5z7efNRonvfOmLdecTIUc8LNNmS0JZ6
	e2XMV2NSfBJDtjFGc53rdoSKq3lkw8++WZKSDubaWtnxD30=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=jidanni.org; h=from:to
	:subject:date:message-id:mime-version:content-type; s=
	jidanni.org; bh=n9MuSW4wumtsa5h12a/gPni7G3Y=; b=VyDt9NlIVTmyTtAx
	RGON6TIU7m4aHmZNV3QNMyhnZsu0g53e5dZEuRseCsaQ0X69we5NShaoHYy0jEj1
	Zje+wRQsRPmp6RT+b143DuzZ73TtnujAfUsevSS5v+b1nZl1weJkaTnwSXOxgWrl
	EbIlWEXol8TKiZ4sXLclqO6giJ0=
Received: from jidanni.org (218-163-18-63.dynamic.hinet.net [218.163.18.63])
	(using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
	(No client certificate requested)
	(Authenticated sender: jidanni@jidanni.org)
	by homiemail-a7.g.dreamhost.com (Postfix) with ESMTPSA id 1174B25C062
	for <bug-bash@gnu.org>; Sun,  1 Jul 2012 13:58:04 -0700 (PDT)
From: jidanni@jidanni.org
To: bug-bash@gnu.org
Subject: Display all 224 possibilities? (y,n,t,?,...)
Date: Mon, 02 Jul 2012 04:57:56 +0800
Message-ID: <87y5n36vxn.fsf@jidanni.org>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 208.97.132.119
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, 01 Jul 2012 20:58:16 -0000

Dudes! I've got a brilliant idea.

Instead of just saying
	Display all 224 possibilities? (y or n)

Why not also offer more, like (y,n,t,?)

Add t where t is by time as in 'ls -t',
and "?" is to explain them all.

While you are at it, why not add even more, all from ls.
l = ls -l
etc.

And what about -rt... how to pack that into one character though?

Ah, add "-" which then can accept more characters until they hit RET.

Yes, another brilliant idea, from yours truly,
http://www.youtube.com/watch?v=lQ57rtIv7kk&list=PL6E40919035151385


From MAILER-DAEMON Mon Jul 02 09:57:23 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Slh7z-0000sp-5c
	for mharc-bug-bash@gnu.org; Mon, 02 Jul 2012 09:57:23 -0400
Received: from eggs.gnu.org ([208.118.235.92]:53621)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1Slh7q-0000mH-O4
	for bug-bash@gnu.org; Mon, 02 Jul 2012 09:57:20 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1Slh7i-0005Yd-JY
	for bug-bash@gnu.org; Mon, 02 Jul 2012 09:57:14 -0400
Received: from mx1.redhat.com ([209.132.183.28]:5528)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1Slh7i-0005Xh-B2
	for bug-bash@gnu.org; Mon, 02 Jul 2012 09:57:06 -0400
Received: from int-mx12.intmail.prod.int.phx2.redhat.com
	(int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q62Dv59b018420
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Mon, 2 Jul 2012 09:57:05 -0400
Received: from [10.3.113.29] (ovpn-113-29.phx2.redhat.com [10.3.113.29])
	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id q62Dv48c014981; Mon, 2 Jul 2012 09:57:04 -0400
Message-ID: <4FF1A8AE.2000705@redhat.com>
Date: Mon, 02 Jul 2012 07:57:02 -0600
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:13.0) Gecko/20120615 Thunderbird/13.0.1
MIME-Version: 1.0
To: jan.schampera@web.de
Subject: Re: Massive recursion -> SEGV
References: <4FF03C75.8000607@web.de> <4FF0449B.6090304@redhat.com>
	<4FF055E3.5010207@web.de>
In-Reply-To: <4FF055E3.5010207@web.de>
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="------------enig86C3BE34C504B20E731D326A"
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.132.183.28
Cc: Roman Rakus <rrakus@redhat.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: Mon, 02 Jul 2012 13:57:20 -0000

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig86C3BE34C504B20E731D326A
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: quoted-printable

On 07/01/2012 07:51 AM, Jan Schampera wrote:
> On 01.07.2012 14:37, Roman Rakus wrote:
>=20
>> Look for FUNCNEST variable. In recent release it is available.
>=20
> I more meant the shell interpreter, less the code I can write.

It would be possible to link bash with libsigsegv to install a graceful
stack overflow handler that allows a nicer exit message on failure;
other GNU projects that have done so include awk and m4.  But short of
introducing arbitrary limits (which goes against GNU philosophy), it is
not possible to detect stack overflow until after it happens, and the
only recovery possible after detecting stack overflow is a graceful
message and exit unless you go to extreme lengths to block signals
around every call to malloc or any other library function that grabs a lo=
ck.

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




--------------enig86C3BE34C504B20E731D326A
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/

iQEcBAEBCAAGBQJP8aivAAoJEKeha0olJ0NqX/AH/0tYdbV2ufkGZ5Vc2Vp6k+2x
KnhxccW+WddnZ5EcUsVYfe+nvVfL+1Cdjqte9BT1Ib2QO5Rok6gpiMtJNZVaKdWE
NvJjyh15Htf8NyUPaAMRMgIkXeoyO/CMEHM3o4AwgRL4FzMo3zIAN6PORwDDM5Cs
qXQl+pB7O8mWsyNDZ1aNUcWlVQu+RRgoeX8GkNF90AoilAKNmHUQ2gTfpExU8Dib
KyzqlPBiLy2kdXLDyEoRniVpAF1O+H7u6y+ozXTkb5UUqU6DeAnr6mnn018l9jA3
aoDoeK8z5ZSzcGFNv8sX6J8oAr3L5ySuyS6ylVyWoeFfOWH5mxh7ahz8+8+muNQ=
=Cf7J
-----END PGP SIGNATURE-----

--------------enig86C3BE34C504B20E731D326A--


From MAILER-DAEMON Mon Jul 02 14:36:16 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SllTs-0007sQ-8v
	for mharc-bug-bash@gnu.org; Mon, 02 Jul 2012 14:36:16 -0400
Received: from eggs.gnu.org ([208.118.235.92]:40189)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jan.schampera@web.de>) id 1SllTp-0007ru-GM
	for bug-bash@gnu.org; Mon, 02 Jul 2012 14:36:14 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jan.schampera@web.de>) id 1SllTl-0003dy-MC
	for bug-bash@gnu.org; Mon, 02 Jul 2012 14:36:13 -0400
Received: from mx0.linux-mitterteich.de ([88.198.169.86]:43933)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jan.schampera@web.de>) id 1SllTl-0003dC-Fk
	for bug-bash@gnu.org; Mon, 02 Jul 2012 14:36:09 -0400
Received: from mail.home.thebonsai.de (p54B5A07F.dip.t-dialin.net
	[84.181.160.127]) (Authenticated sender: jschampera.dnsalias.net)
	by mx0.linux-mitterteich.de (Postfix) with ESMTPA id 020E93664DA;
	Mon,  2 Jul 2012 20:36:07 +0200 (CEST)
Received: from [192.168.64.202] (imap.home.thebonsai.de [192.168.64.202])
	by mail.home.thebonsai.de (Postfix) with ESMTP id B199A1DF5B;
	Mon,  2 Jul 2012 20:36:06 +0200 (CEST)
Message-ID: <4FF1EA16.6090106@web.de>
Date: Mon, 02 Jul 2012 20:36:06 +0200
From: Jan Schampera <jan.schampera@web.de>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US;
	rv:1.9.1.16) Gecko/20120613 Iceowl/1.0b1 Icedove/3.0.11
MIME-Version: 1.0
To: Eric Blake <eblake@redhat.com>
Subject: Re: Massive recursion -> SEGV
References: <4FF03C75.8000607@web.de>
	<4FF0449B.6090304@redhat.com>	<4FF055E3.5010207@web.de>
	<4FF1A8AE.2000705@redhat.com>
In-Reply-To: <4FF1A8AE.2000705@redhat.com>
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 88.198.169.86
Cc: Roman Rakus <rrakus@redhat.com>, bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: jan.schampera@web.de
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, 02 Jul 2012 18:36:14 -0000

On 02.07.2012 15:57, Eric Blake wrote:

>>> Look for FUNCNEST variable. In recent release it is available.
>>
>> I more meant the shell interpreter, less the code I can write.
>
> It would be possible to link bash with libsigsegv to install a graceful
> stack overflow handler that allows a nicer exit message on failure;
> other GNU projects that have done so include awk and m4.  But short of
> introducing arbitrary limits (which goes against GNU philosophy), it is
> not possible to detect stack overflow until after it happens, and the
> only recovery possible after detecting stack overflow is a graceful
> message and exit unless you go to extreme lengths to block signals
> around every call to malloc or any other library function that grabs a lock.
>

Hi Eric,


yes, it's more about helpful messages (not neccesarily a recovery), less 
about limits in Bash or application (script, etc.).

The origin of this all was a "bugreport" to me about the manual lying 
about no limits on recursion - it turned out it was massive recursion 
and little stack - and a resulting SEGV.

I'm interested in people's thoughts there, like is it okay to just crash 
or would a message be better?

libsigsegv - I'll have a look.

Thanks.

-- 
Be conservative in what you do, be liberal in what you accept from others.
- jbp, master of the net, in RFC793



From MAILER-DAEMON Mon Jul 02 14:57:44 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Slloe-0005Ru-AB
	for mharc-bug-bash@gnu.org; Mon, 02 Jul 2012 14:57:44 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52181)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sllob-0005Oa-HP
	for bug-bash@gnu.org; Mon, 02 Jul 2012 14:57:42 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SlloZ-00011d-It
	for bug-bash@gnu.org; Mon, 02 Jul 2012 14:57:41 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:51068)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SlloZ-00011E-E7
	for bug-bash@gnu.org; Mon, 02 Jul 2012 14:57:39 -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 BMP11719;
	Mon, 2 Jul 2012 14:57:36 -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 AZI92514 (AUTH cpr);
	Mon, 02 Jul 2012 14:57:36 -0400 (EDT)
Message-ID: <4FF1EF20.8060409@case.edu>
Date: Mon, 02 Jul 2012 14:57:36 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: jan.schampera@web.de
Subject: Re: Massive recursion -> SEGV
References: <4FF03C75.8000607@web.de>
	<4FF0449B.6090304@redhat.com>	<4FF055E3.5010207@web.de>
	<4FF1A8AE.2000705@redhat.com> <4FF1EA16.6090106@web.de>
In-Reply-To: <4FF1EA16.6090106@web.de>
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: Roman Rakus <rrakus@redhat.com>, Eric Blake <eblake@redhat.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: Mon, 02 Jul 2012 18:57:42 -0000

On 7/2/12 2:36 PM, Jan Schampera wrote:

> The origin of this all was a "bugreport" to me about the manual lying about
> no limits on recursion

That's funny.


-- 
``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 Jul 02 17:03:02 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Slnlu-00080a-BF
	for mharc-bug-bash@gnu.org; Mon, 02 Jul 2012 17:03:02 -0400
Received: from eggs.gnu.org ([208.118.235.92]:36082)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jan.schampera@web.de>) id 1Slnlq-0007zn-VL
	for bug-bash@gnu.org; Mon, 02 Jul 2012 17:03:01 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jan.schampera@web.de>) id 1Slnlo-0002RP-3k
	for bug-bash@gnu.org; Mon, 02 Jul 2012 17:02:58 -0400
Received: from mx0.linux-mitterteich.de ([88.198.169.86]:38521)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jan.schampera@web.de>) id 1Slnln-0002RD-Ta
	for bug-bash@gnu.org; Mon, 02 Jul 2012 17:02:56 -0400
Received: from mail.home.thebonsai.de (p54B5A07F.dip.t-dialin.net
	[84.181.160.127]) (Authenticated sender: jschampera.dnsalias.net)
	by mx0.linux-mitterteich.de (Postfix) with ESMTPA id 55D523664DA;
	Mon,  2 Jul 2012 23:02:54 +0200 (CEST)
Received: from [192.168.64.202] (imap.home.thebonsai.de [192.168.64.202])
	by mail.home.thebonsai.de (Postfix) with ESMTP id 17A541DF5B;
	Mon,  2 Jul 2012 23:02:54 +0200 (CEST)
Message-ID: <4FF20C7E.1090109@web.de>
Date: Mon, 02 Jul 2012 23:02:54 +0200
From: Jan Schampera <jan.schampera@web.de>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US;
	rv:1.9.1.16) Gecko/20120613 Iceowl/1.0b1 Icedove/3.0.11
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: Massive recursion -> SEGV
References: <4FF03C75.8000607@web.de>	<4FF0449B.6090304@redhat.com>	<4FF055E3.5010207@web.de>	<4FF1A8AE.2000705@redhat.com>
	<4FF1EA16.6090106@web.de> <4FF1EF20.8060409@case.edu>
In-Reply-To: <4FF1EF20.8060409@case.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 88.198.169.86
Cc: Roman Rakus <rrakus@redhat.com>, Eric Blake <eblake@redhat.com>,
	bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: jan.schampera@web.de
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, 02 Jul 2012 21:03:01 -0000

On 02.07.2012 20:57, Chet Ramey wrote:
> On 7/2/12 2:36 PM, Jan Schampera wrote:
>
>> The origin of this all was a "bugreport" to me about the manual lying about
>> no limits on recursion
>
> That's funny.

Aye. A bit of confusion.

-- 
Be conservative in what you do, be liberal in what you accept from others.
- jbp, master of the net, in RFC793



From MAILER-DAEMON Wed Jul 04 11:37:43 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SmReB-0001rk-Ie
	for mharc-bug-bash@gnu.org; Wed, 04 Jul 2012 11:37:43 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35450)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rainer.blome@gmx.de>) id 1SmRe8-0001qD-2M
	for bug-bash@gnu.org; Wed, 04 Jul 2012 11:37:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rainer.blome@gmx.de>) id 1SmRe5-0001hz-P6
	for bug-bash@gnu.org; Wed, 04 Jul 2012 11:37:39 -0400
Received: from mailout-de.gmx.net ([213.165.64.22]:39867)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <rainer.blome@gmx.de>) id 1SmRe5-0001hf-FD
	for bug-bash@gnu.org; Wed, 04 Jul 2012 11:37:37 -0400
Received: (qmail 10693 invoked by uid 0); 4 Jul 2012 15:37:33 -0000
Received: from 217.7.72.1 by www060.gmx.net with HTTP;
	Wed, 04 Jul 2012 17:37:25 +0200 (CEST)
Content-Type: text/plain; charset="utf-8"
Date: Wed, 04 Jul 2012 17:37:25 +0200
From: "Rainer Blome" <rainer.blome@gmx.de>
In-Reply-To: <3873506.x83VPejgYG@smorgbox>
Message-ID: <20120704153725.51550@gmx.net>
MIME-Version: 1.0
References: <20120628123717.51530@gmx.net> <3873506.x83VPejgYG@smorgbox>
Subject: Re: Doc of "set -e" should mention non-locality
To: Dan Douglas <ormaaj@gmail.com>, bug-bash@gnu.org
X-Authenticated: #3213004
X-Flags: 0001
X-Mailer: WWW-Mail 6100 (Global Message Exchange)
X-Priority: 3
X-Provags-ID: V01U2FsdGVkX1+KQGEUWDiKmAJUjK/QYt/E2XvlGIUoxC/xVVU7gp
	vDMPI+Ar6xoFNd+QCCHQkkd2RDAY7BwDmWNA== 
Content-Transfer-Encoding: 8bit
X-GMX-UID: bQaGb0d1eSEqMK1lWnQhNR1+IGRvbwAi
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 213.165.64.22
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, 04 Jul 2012 15:37:41 -0000

-------- Original-Nachricht --------
> Datum: Fri, 29 Jun 2012 18:03:13 -0500
> Von: Dan Douglas <ormaaj@gmail.com>
> An: bug-bash@gnu.org
> CC: Rainer Blome <rainer.blome@gmx.de>

Remember that my main suggestion is to clearly document the intended
behavior (see the subject). This could mean to add a generic
paragraph to the documentation of "set" that describes the scope
and extent for all options.  Something like this:

----
In Bash, "set" options act on a global scope per shell process,
they do not respect shell function scope.
The effect of turning on a "set" option starts after the "set -" command completes.
The effect of turning off a "set" option starts after the "set +" command completes.
----

For "set -e", I would add this:
----
Conditional statements such as while and if have the effect of temporarily suppressing the effect of any "set -e"
in effect while the condition is evaluated.
Thus, when a shell function is run as part of the evaluation of a condition,
"set -e" will not be in effect while in the function.
Any use of "set -e" within such a shell function immediately changes
the global flags ($-), but will otherwise
take effect only after the condition is evaluated.
----

> 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 may very well be. Is this documented anywhere?

It can still be surprising, for several reasons:

* The wording in the current documentation is easy to misunderstand.
It is not clear what "part" means.
In other programming languages, "part" often respects lexical nesting.
This makes it easy to make a false assumption.
See my first mail.

* Different POSIX shell implementations are free to behave
differently, because the behavior is not specified exactly.
http://pubs.opengroup.org/onlinepubs/009695399/utilities/set.html
does not mention scoping or extent, except in the section about "-e".
The section does not specify whether the commands that make up
a shell function are considered part of the calling command or not.
At least I did not see anything like that.
In my view, this point is under-specified,
or at least specified not clearly enough.

* Some shell implementations *do* behave differently from Bash
in this regard. At least on AIX, ksh and sh do so.

* The average shell programmer probably seldomly encounters
the difference, because it rarely matters.
Because of this, the issue is not well-known.

> That would make this the exception.

As I said, I suggest to clarify the documentation.

Regards, Rainer


PS: Your suggested "workaround" is, well, hard to understand.
Reminds me of the way people extend FORTH by massaging the stacks.
You have to know exactly what is parsed, substituted and evaluated
when in order to understand this (if it even works, did not try it).
I would not dare use this in production for fear of
receiving a beating from colleagues over hard to maintain code. ;-)

> 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.


From MAILER-DAEMON Wed Jul 04 12:48:46 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SmSkw-0003qR-JZ
	for mharc-bug-bash@gnu.org; Wed, 04 Jul 2012 12:48:46 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60829)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SmSkq-0003pS-8N
	for bug-bash@gnu.org; Wed, 04 Jul 2012 12:48:44 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SmSkj-0003uG-SO
	for bug-bash@gnu.org; Wed, 04 Jul 2012 12:48:39 -0400
Received: from mx1.redhat.com ([209.132.183.28]:47397)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SmSkj-0003u9-JW
	for bug-bash@gnu.org; Wed, 04 Jul 2012 12:48:33 -0400
Received: from int-mx12.intmail.prod.int.phx2.redhat.com
	(int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q64GmMZU016544
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Wed, 4 Jul 2012 12:48:22 -0400
Received: from [10.3.113.17] ([10.3.113.17])
	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id q64GmMGs013972; Wed, 4 Jul 2012 12:48:22 -0400
Message-ID: <4FF4738F.4040706@redhat.com>
Date: Wed, 04 Jul 2012 10:47:11 -0600
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:13.0) Gecko/20120615 Thunderbird/13.0.1
MIME-Version: 1.0
To: Rainer Blome <rainer.blome@gmx.de>
Subject: Re: Doc of "set -e" should mention non-locality
References: <20120628123717.51530@gmx.net> <3873506.x83VPejgYG@smorgbox>
	<20120704153725.51550@gmx.net>
In-Reply-To: <20120704153725.51550@gmx.net>
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="------------enig3E10428F679774B6EDF46A77"
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.132.183.28
Cc: Dan Douglas <ormaaj@gmail.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: Wed, 04 Jul 2012 16:48:44 -0000

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

On 07/04/2012 09:37 AM, Rainer Blome wrote:

>=20
> * Different POSIX shell implementations are free to behave
> differently, because the behavior is not specified exactly.

Actually, that's where you are wrong.  POSIX _does_ specify bash's
current behavior (in fact, bash changed behavior to match POSIX)

> http://pubs.opengroup.org/onlinepubs/009695399/utilities/set.html

http://austingroupbugs.net/view.php?id=3D52

which even includes this example:

    Application writers should avoid relying on set -e within
    functions. For example, in the following script:

        set -e
        start() {
           some_server
           echo some_server started successfully
        }
        start || echo >&2 some_server failed

    the -e setting is ignored within the function body (because the
    function is a command in an AND-OR list other than the last).
    Therefore if some_server fails, the function carries on to
    echo "server started successfully", and the exit status of the
    function is zero (which means "server failed" is not output).


> * Some shell implementations *do* behave differently from Bash
> in this regard. At least on AIX, ksh and sh do so.

Only because they haven't been patched to obey POSIX yet.

>=20
> * The average shell programmer probably seldomly encounters
> the difference, because it rarely matters.

Actually, the average shell programmer should avoid 'set -e', because of
its historical warts and non-intuitive behavior.

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


--------------enig3E10428F679774B6EDF46A77
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/

iQEcBAEBCAAGBQJP9HOQAAoJEKeha0olJ0Nq8AsIAK7CH+BsGVgCaqgzwHItUyNA
yAloDtTScpXX3n369jxn8JP6oCI7JIYs5eEiBoxd5iNQ2ZWCy4+BJS1wdN2w5o48
eo87XpRbgJAluUwAOiF63xulDVG+YiXmwMwjolmQJ37ULpPSoQUhkdMYxKdKDFdP
yHJyXmrlSBgY7586bp1bmYM3/ZIvlClUsl/CG0b+/t4S0+1hG4NVbKtp6YnNiPHr
RInfiIWBCfaBqVyC/jcQnS9/Z4wKwo1VWMP93kyuZBlSCpLAc9f1CYyFDpFoMvnW
IfL4/k2I6qOnHW5jZxkDRiAhm5Rb6JGa2rvtEleOl64cMiF9k9xZBs44zcstuVM=
=qpKv
-----END PGP SIGNATURE-----

--------------enig3E10428F679774B6EDF46A77--


From MAILER-DAEMON Wed Jul 04 14:03:36 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SmTvM-0001fu-T7
	for mharc-bug-bash@gnu.org; Wed, 04 Jul 2012 14:03:36 -0400
Received: from eggs.gnu.org ([208.118.235.92]:50295)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rainer.blome@gmx.de>) id 1SmTvJ-0001fM-UF
	for bug-bash@gnu.org; Wed, 04 Jul 2012 14:03:35 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rainer.blome@gmx.de>) id 1SmTvH-0006Qa-H9
	for bug-bash@gnu.org; Wed, 04 Jul 2012 14:03:33 -0400
Received: from mailout-de.gmx.net ([213.165.64.23]:47502)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <rainer.blome@gmx.de>) id 1SmTvH-0006QM-6F
	for bug-bash@gnu.org; Wed, 04 Jul 2012 14:03:31 -0400
Received: (qmail 7299 invoked by uid 0); 4 Jul 2012 18:03:29 -0000
Received: from 217.7.72.1 by www060.gmx.net with HTTP;
	Wed, 04 Jul 2012 20:03:28 +0200 (CEST)
Content-Type: text/plain; charset="utf-8"
Date: Wed, 04 Jul 2012 20:03:28 +0200
From: "Rainer Blome" <rainer.blome@gmx.de>
In-Reply-To: <4FF4738F.4040706@redhat.com>
Message-ID: <20120704180328.262830@gmx.net>
MIME-Version: 1.0
References: <20120628123717.51530@gmx.net> <3873506.x83VPejgYG@smorgbox>
	<20120704153725.51550@gmx.net> <4FF4738F.4040706@redhat.com>
Subject: Re: Doc of "set -e" should mention non-locality
To: Eric Blake <eblake@redhat.com>
X-Authenticated: #3213004
X-Flags: 0001
X-Mailer: WWW-Mail 6100 (Global Message Exchange)
X-Priority: 3
X-Provags-ID: V01U2FsdGVkX1+UMFEGD8CU6OxZ+rMuYJH9mKklTUwXlME/MYxy8V
	7mNL+CMSeAll9F9KkJhz9FiRNobXzhA2+7EQ== 
Content-Transfer-Encoding: 8bit
X-GMX-UID: J+CGb88HeSEqMK1lWnQhec5+IGRvb8AW
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 213.165.64.23
Cc: ormaaj@gmail.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: Wed, 04 Jul 2012 18:03:35 -0000

Thanks for pointing me to that issue report.

-------- Original-Nachricht --------
> Datum: Wed, 04 Jul 2012 10:47:11 -0600
> Von: Eric Blake <eblake@redhat.com>
> An: Rainer Blome <rainer.blome@gmx.de>
> CC: Dan Douglas <ormaaj@gmail.com>, bug-bash@gnu.org
> On 07/04/2012 09:37 AM, Rainer Blome wrote:

> > * Different POSIX shell implementations are free to behave
> > differently, because the behavior is not specified exactly.
> > http://pubs.opengroup.org/onlinepubs/009695399/utilities/set.html
> Actually, that's where you are wrong.  POSIX _does_ specify bash's
> current behavior (in fact, bash changed behavior to match POSIX)

Is POSIX an open and public standard?
Can you please provide a link to where this is documented?
The link I gave is apparently not the right one.

> http://austingroupbugs.net/view.php?id=52

Thanks for pointing to that issue record.
Is this part of the standard yet?

> which even includes this example:
> [clear doc omitted...]

That is what I was suggesting in the first place, clear documentation.  
Hope it makes it into the standard docs, if it hasn't already.

> > * Some shell implementations *do* behave differently from Bash
> > in this regard. At least on AIX, ksh and sh do so.
> 
> Only because they haven't been patched to obey POSIX yet.

OK.

Rainer


From MAILER-DAEMON Wed Jul 04 16:03:54 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SmVnm-0003yE-Sd
	for mharc-bug-bash@gnu.org; Wed, 04 Jul 2012 16:03:54 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46742)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SmVnj-0003xr-Sm
	for bug-bash@gnu.org; Wed, 04 Jul 2012 16:03:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SmVnh-00033l-PI
	for bug-bash@gnu.org; Wed, 04 Jul 2012 16:03:51 -0400
Received: from mx1.redhat.com ([209.132.183.28]:62629)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SmVnh-00033S-Gt
	for bug-bash@gnu.org; Wed, 04 Jul 2012 16:03:49 -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 q64K3XLr002360
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Wed, 4 Jul 2012 16:03:34 -0400
Received: from [10.3.113.17] ([10.3.113.17])
	by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
	id q64K3XaN031703; Wed, 4 Jul 2012 16:03:33 -0400
Message-ID: <4FF4A194.3030804@redhat.com>
Date: Wed, 04 Jul 2012 14:03:32 -0600
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:13.0) Gecko/20120615 Thunderbird/13.0.1
MIME-Version: 1.0
To: Rainer Blome <rainer.blome@gmx.de>
Subject: Re: Doc of "set -e" should mention non-locality
References: <20120628123717.51530@gmx.net> <3873506.x83VPejgYG@smorgbox>
	<20120704153725.51550@gmx.net> <4FF4738F.4040706@redhat.com>
	<20120704180328.262830@gmx.net>
In-Reply-To: <20120704180328.262830@gmx.net>
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="------------enig7588FA9DBFA7714DC9B7BDE8"
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: ormaaj@gmail.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: Wed, 04 Jul 2012 20:03:53 -0000

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

On 07/04/2012 12:03 PM, Rainer Blome wrote:
> Thanks for pointing me to that issue report.
>=20

>>> * Different POSIX shell implementations are free to behave
>>> differently, because the behavior is not specified exactly.
>>> http://pubs.opengroup.org/onlinepubs/009695399/utilities/set.html
>> Actually, that's where you are wrong.  POSIX _does_ specify bash's
>> current behavior (in fact, bash changed behavior to match POSIX)
>=20
> Is POSIX an open and public standard?

Yes, anyone can contribute.  From the POSIX document itself:
http://pubs.opengroup.org/onlinepubs/9699919799/frontmatter/preface.html

"Anyone wishing to participate in the Austin Group should contact the
chair with their request. There are no fees for participation or
membership. You may participate as an observer or as a contributor. You
do not have to attend face-to-face meetings to participate; electronic
participation is most welcome. For more information on the Austin Group
and how to participate, see www.opengroup.org/austin."

I personally call in to the majority of the meetings (generally a 90
minute teleconference about 2 or 3 times a month), while others on this
list (such as Chet) take a more passive role and only subscribe to the
mailing list to read the meeting minutes and provide feedback when
directly asked how a potential change to the standard would impact
existing implementations.

> Can you please provide a link to where this is documented?
> The link I gave is apparently not the right one.
>=20

The link you gave is the online version of POSIX 2008 (the .pdf is the
canonical version; the online rendition is for convenience); but you
should be aware that the Technical Corrigendum 1 for POSIX 2008 is due
out later this year.

>> http://austingroupbugs.net/view.php?id=3D52

This is one of the bugs that was approved for inclusion in the Technical
Corrigendum, currently under balloting (you can see the full list of
bugs that will be folded into TC1 by filtering the list to those bugs
with the 'tc1-2008' tag).

>=20
> Thanks for pointing to that issue record.
> Is this part of the standard yet?

Assuming balloting goes well, it will be later this year, but bash
proactively already implemented it.

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


--------------enig7588FA9DBFA7714DC9B7BDE8
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/

iQEcBAEBCAAGBQJP9KGVAAoJEKeha0olJ0NqIfAH/A1f0r9na5ojcLwmEfc86nfQ
8QrTa4zThlNsvl226AnXmRh28GT9WfiZO1ufvX5cGb1HGBIakZVBZigpjwPFiF1+
UJutDk5wJYqRqIUJC47vUPKNe3dHTzcuAmUGxSolOYjZy+jKGjE3TncJx6QHAZv2
F2f6nlK40jd9g8+t6xx0FVMUDVpVhtoPaXBpc/JU0Az+tA7PcMoWlpNq3SBS9SJx
6h3Wyyr7eGM2hYvIqTujtKWPdhA9dAS8tZaSpHtzg/WK0zRxLaurah7yRU4sAXlf
R6zsq3GDplfYhCrCiRXdMu7XsjfjnYXbvB6sLy9wG+XyzG8T9IQBjKrblMQSsF4=
=y10N
-----END PGP SIGNATURE-----

--------------enig7588FA9DBFA7714DC9B7BDE8--


From MAILER-DAEMON Thu Jul 05 06:58:53 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Smjlt-0004hn-Oj
	for mharc-bug-bash@gnu.org; Thu, 05 Jul 2012 06:58:53 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42832)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1Smjlr-0004hg-1Y
	for bug-bash@gnu.org; Thu, 05 Jul 2012 06:58:52 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1Smjlm-0006n3-DI
	for bug-bash@gnu.org; Thu, 05 Jul 2012 06:58:50 -0400
Received: from mail-lb0-f169.google.com ([209.85.217.169]:35435)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1Smjlm-0006mO-31
	for bug-bash@gnu.org; Thu, 05 Jul 2012 06:58:46 -0400
Received: by lbjn8 with SMTP id n8so5594507lbj.0
	for <bug-bash@gnu.org>; Thu, 05 Jul 2012 03:58:42 -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=S5pgyA57amc7tHUiqatoxfIq/ETomSY3NUZSDQXGlEQ=;
	b=VjBsMaV4ysVJTWGnKqqJOyhAQTEt+NNYK9NAogv9UoRJXJ1r1sW4937nrPBBOJakEG
	JgGeQlNGfnfWhuRYUqdQ5gIsHmszqjIdrbUwn0zkM7DdIywsxlcqFshqIOBIrVwvtx6/
	qFOhym3LNIwkGNl8ONeocZPC9MonJjOb1kTmyJm+j14Di9/WbYOizNVlRIEetCOFB47w
	3SyjhxjUfIdA0x+HAS90kz8M1IjN5lw2RAi+B2eOInHl7F/eZnSi9672Ct/CSV9Xy0qH
	Pma7Qo64DNjqL9q1bPgPlqMKO0e/9lnq9hrWGYF3mfHKbuNZK6xvaNZkR9mmwejb5USv
	df5A==
MIME-Version: 1.0
Received: by 10.112.54.100 with SMTP id i4mr11626540lbp.97.1341485922801; Thu,
	05 Jul 2012 03:58:42 -0700 (PDT)
Received: by 10.112.128.234 with HTTP; Thu, 5 Jul 2012 03:58:42 -0700 (PDT)
Received: by 10.112.128.234 with HTTP; Thu, 5 Jul 2012 03:58:42 -0700 (PDT)
Date: Thu, 5 Jul 2012 11:58:42 +0100
Message-ID: <CALyZvKxszx8cc=v3SZTXQ0yZx7cvGTzGhOHemdFTvuxXyJeHwA@mail.gmail.com>
Subject: readline expansion: 'cp $v/<TAB>' -> 'cp \$v/' (no expansion) - why?
From: Jason Vas Dias <jason.vas.dias@gmail.com>
To: bug-bash@gnu.org
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=UTF-8
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: Thu, 05 Jul 2012 10:58:52 -0000

my #1 bash gripe is that newer versions do not
expand command lines containing '$' in emacs
readline editing mode.  I used to be able to do:
$ export SRC=../somedir
$ less ${SRC}/<TAB>
(<TAB> meaning press horizontal tab key )
and emacs mode readline would expand,
displaying the contents of ../somedir .
Now it changes the input string into
'less \$SRC/' and prevents tab expansion
as would be done without use of any variables.
Would anyone know how to restore the old behavior
with bash 4.2.2 + readline 6.2 (linux ubuntu 12.04) ?
Thanks & Regards, Jason

From MAILER-DAEMON Thu Jul 05 07:24:19 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SmkAV-0001E3-Mg
	for mharc-bug-bash@gnu.org; Thu, 05 Jul 2012 07:24:19 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38161)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SmkAP-0001Dq-BB
	for bug-bash@gnu.org; Thu, 05 Jul 2012 07:24:19 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SmkAN-0004iC-EL
	for bug-bash@gnu.org; Thu, 05 Jul 2012 07:24:12 -0400
Received: from mx1.redhat.com ([209.132.183.28]:47680)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SmkAN-0004i8-5u
	for bug-bash@gnu.org; Thu, 05 Jul 2012 07:24:11 -0400
Received: from int-mx10.intmail.prod.int.phx2.redhat.com
	(int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q65BO8Y1023484
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Thu, 5 Jul 2012 07:24:08 -0400
Received: from [10.3.113.17] ([10.3.113.17])
	by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id q65BO88M022714; Thu, 5 Jul 2012 07:24:08 -0400
Message-ID: <4FF57957.4030109@redhat.com>
Date: Thu, 05 Jul 2012 05:24:07 -0600
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:13.0) Gecko/20120615 Thunderbird/13.0.1
MIME-Version: 1.0
To: Jason Vas Dias <jason.vas.dias@gmail.com>
Subject: Re: readline expansion: 'cp $v/<TAB>' -> 'cp \$v/' (no expansion)
	- why?
References: <CALyZvKxszx8cc=v3SZTXQ0yZx7cvGTzGhOHemdFTvuxXyJeHwA@mail.gmail.com>
In-Reply-To: <CALyZvKxszx8cc=v3SZTXQ0yZx7cvGTzGhOHemdFTvuxXyJeHwA@mail.gmail.com>
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="------------enigB05F9B61AD8608E830667E4B"
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
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
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, 05 Jul 2012 11:24:19 -0000

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

On 07/05/2012 04:58 AM, Jason Vas Dias wrote:

> Now it changes the input string into
> 'less \$SRC/' and prevents tab expansion
> as would be done without use of any variables.
> Would anyone know how to restore the old behavior
> with bash 4.2.2 + readline 6.2 (linux ubuntu 12.04) ?

Yep - upgrade to bash 4.2.29 (that is, patchlevel 2 is missing the fix
in patchlevel 29 that restores the behavior you want).
ftp://ftp.gnu.org/pub/gnu/bash/bash-4.2-patches/bash42-029

This topic comes up frequently on this list.

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




--------------enigB05F9B61AD8608E830667E4B
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/

iQEcBAEBCAAGBQJP9XlXAAoJEKeha0olJ0NqJxkH/0v88M2snzPtXbk3V6Q+MhZL
AZTGpiOFHdb/GpBcelweocXOg5gK4MrQ9ytZoaeWghOkDYkGTzf/vGFp7Q5CkTZJ
6q8IgYvQeQ3w79dA2xOn5YVUxVHiG2evP+T9XSW0E9JUYIa3L+a3DQqFeL/QXglr
xa8SaSQvRizF8BH/GhOZwx0OfMoC5MuE5F4Zx811+loKDz6MhDm1FQz/hzBUfbzw
0ucwiB8D36hkkkAwLD88iq1MZ17K+GWHodftC7RTHV9IEM9qsnOL5y08pzf/vnZV
c7DAIdFQ612VAtFq8ghLujNcc5IaMBKoUceMQED7mRj4WaxBv70Vb4HwnqoiyoI=
=wQpV
-----END PGP SIGNATURE-----

--------------enigB05F9B61AD8608E830667E4B--


From MAILER-DAEMON Thu Jul 05 08:00:10 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SmkjC-0006uF-AK
	for mharc-bug-bash@gnu.org; Thu, 05 Jul 2012 08:00:10 -0400
Received: from eggs.gnu.org ([208.118.235.92]:53598)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1Smkj4-0006f0-N5
	for bug-bash@gnu.org; Thu, 05 Jul 2012 08:00:09 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1Smkiz-0004aw-Jj
	for bug-bash@gnu.org; Thu, 05 Jul 2012 08:00:02 -0400
Received: from mail-lb0-f169.google.com ([209.85.217.169]:59217)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1Smkiz-0004af-9J
	for bug-bash@gnu.org; Thu, 05 Jul 2012 07:59:57 -0400
Received: by lbjn8 with SMTP id n8so5682878lbj.0
	for <bug-bash@gnu.org>; Thu, 05 Jul 2012 04:59: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:date:message-id:subject:from:to
	:content-type; bh=dWdB5x+/EnZR5tLmxauwExw9g+iV7DCKxnSF2lypPj8=;
	b=FBRhX1jJvm46RkRFALkwadLGmRJDPBH+Qebxb7D7JfXBFh35lKtSEqUcSiaLyGR0YQ
	L/bJtImlHbHuGuq9/9l45E8kMPs0N8eOjP8rWf7afIyVrWU7xQ3PTYvy+ycmcZvz10zm
	pZ67S9BHLo+q88s9DcCdKxHFJfQQHtI9oAjNah+9N7o+X/mjENzrFGLoKktanmzs4oY9
	gbhV3kxDYcRNGx0wISWi8a58SmKtgKW3RgQcDJbVcDb0JRiT4s4mcFiqrA94P5B51PzJ
	sZNjiI6XOJtEnOg7ZtcEvzJGAYABuudwGtkSvZETr2ctilgJsPLvmmR8Zpaw4kHYVoPM
	sMYw==
MIME-Version: 1.0
Received: by 10.112.49.230 with SMTP id x6mr11991629lbn.86.1341489594870; Thu,
	05 Jul 2012 04:59:54 -0700 (PDT)
Received: by 10.112.128.234 with HTTP; Thu, 5 Jul 2012 04:59:54 -0700 (PDT)
Received: by 10.112.128.234 with HTTP; Thu, 5 Jul 2012 04:59:54 -0700 (PDT)
In-Reply-To: <4FF57957.4030109@redhat.com>
References: <CALyZvKxszx8cc=v3SZTXQ0yZx7cvGTzGhOHemdFTvuxXyJeHwA@mail.gmail.com>
	<4FF57957.4030109@redhat.com>
Date: Thu, 5 Jul 2012 12:59:54 +0100
Message-ID: <CALyZvKyt75WfQXbiZ8o2MdYDj0J-tub-Zh5caA4AMMoF9oKQtw@mail.gmail.com>
Subject: Re: readline expansion: 'cp $v/<TAB>' -> 'cp \$v/' (no expansion) -
	why?
From: Jason Vas Dias <jason.vas.dias@gmail.com>
To: Eric Blake <eblake@redhat.com>, "bug-bash@gnu.org" <bug-bash@gnu.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.217.169
Content-Type: text/plain; charset=UTF-8
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: Thu, 05 Jul 2012 12:00:09 -0000

hi Eric - thanks for your response, but bash-4.2.29(2), just built from
latest patches from gnu on x86_64 ubuntu,  does NOT
"restore the old behavior" , but now refuses to tab-expand at
all - 'cat $SRC/<TAB>' on the command line still produces no
output.  Is there some option I need to give to enable it? Thanks!
On 5 Jul 2012 13:24, "Eric Blake" <eblake@redhat.com> wrote:

> On 07/05/2012 04:58 AM, Jason Vas Dias wrote:
>
> > Now it changes the input string into
> > 'less \$SRC/' and prevents tab expansion
> > as would be done without use of any variables.
> > Would anyone know how to restore the old behavior
> > with bash 4.2.2 + readline 6.2 (linux ubuntu 12.04) ?
>
> Yep - upgrade to bash 4.2.29 (that is, patchlevel 2 is missing the fix
> in patchlevel 29 that restores the behavior you want).
> ftp://ftp.gnu.org/pub/gnu/bash/bash-4.2-patches/bash42-029
>
> This topic comes up frequently on this list.
>
> --
> Eric Blake   eblake@redhat.com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>
>
>

From MAILER-DAEMON Thu Jul 05 08:12:58 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Smkva-0000J3-HO
	for mharc-bug-bash@gnu.org; Thu, 05 Jul 2012 08:12:58 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60973)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SmkvT-0000Io-B1
	for bug-bash@gnu.org; Thu, 05 Jul 2012 08:12:56 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SmkvI-0000bk-T5
	for bug-bash@gnu.org; Thu, 05 Jul 2012 08:12:50 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:3576)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SmkvI-0000af-Oi
	for bug-bash@gnu.org; Thu, 05 Jul 2012 08:12:40 -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 CAP96586 (AUTH cpr);
	Thu, 05 Jul 2012 08:12:39 -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 AZK84867 (AUTH cpr);
	Thu, 05 Jul 2012 08:12:38 -0400 (EDT)
Message-ID: <4FF584B6.5030900@case.edu>
Date: Thu, 05 Jul 2012 08:12:38 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: Jason Vas Dias <jason.vas.dias@gmail.com>
Subject: Re: readline expansion: 'cp $v/<TAB>' -> 'cp \$v/' (no expansion)
	- why?
References: <CALyZvKxszx8cc=v3SZTXQ0yZx7cvGTzGhOHemdFTvuxXyJeHwA@mail.gmail.com>
	<4FF57957.4030109@redhat.com>
	<CALyZvKyt75WfQXbiZ8o2MdYDj0J-tub-Zh5caA4AMMoF9oKQtw@mail.gmail.com>
In-Reply-To: <CALyZvKyt75WfQXbiZ8o2MdYDj0J-tub-Zh5caA4AMMoF9oKQtw@mail.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: Eric Blake <eblake@redhat.com>, "bug-bash@gnu.org" <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, 05 Jul 2012 12:12:57 -0000

On 7/5/12 7:59 AM, Jason Vas Dias wrote:
> hi Eric - thanks for your response, but bash-4.2.29(2), just built from
> latest patches from gnu on x86_64 ubuntu,  does NOT
> "restore the old behavior" , but now refuses to tab-expand at
> all - 'cat $SRC/<TAB>' on the command line still produces no
> output.  Is there some option I need to give to enable it? Thanks!

Make sure you're not using programmable completion to eliminate that as
a possible problem.

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 Jul 05 11:56:22 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SmoPm-0006ed-G1
	for mharc-bug-bash@gnu.org; Thu, 05 Jul 2012 11:56:22 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41740)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SmoPe-0006cP-Ve
	for bug-bash@gnu.org; Thu, 05 Jul 2012 11:56:20 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SmoPX-0001Bw-OO
	for bug-bash@gnu.org; Thu, 05 Jul 2012 11:56:14 -0400
Received: from mail-yw0-f41.google.com ([209.85.213.41]:46969)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SmoPX-0001B0-HJ
	for bug-bash@gnu.org; Thu, 05 Jul 2012 11:56:07 -0400
Received: by yhr47 with SMTP id 47so9869573yhr.0
	for <bug-bash@gnu.org>; Thu, 05 Jul 2012 08:56:05 -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=JOoodHa9WjH54EdIAr9h03Cg+azIxqOCh93X3nwwM5c=;
	b=Jcx6r5g6MfoI/1SI3Q2PhL4tkysLc1c0q0Xndr6Z4WuFWhN4BDCRQ4DAUTxVqhTKii
	XSHgUbxQqpO1nKKPOhAzS5rUt9n31F3qTG6zWMzUf6QEkpb1MW0+rfaI3QnPnrde6MGN
	OkKhveQbaG1oHtyG3c04+oVP4vWtoT8yWnVUevEDSdnkSV122ahljQ4WP1CcKDHaBx0i
	vASBzm3Cx+hWvkU6jivmqzH9a7addcES1kITDypokUygUG0sQdaQZUaQB3C5xpBKFMGv
	uehq9b/Xvg7ubMapoyLuTmksszL0JZK5QUC4nljUAIxLnXHQTccWyB2ns8ReS3j/9Bir
	LHwA==
Received: by 10.50.184.133 with SMTP id eu5mr271711igc.3.1341503764947;
	Thu, 05 Jul 2012 08:56:04 -0700 (PDT)
Received: from smorgbox.localnet (65-128-139-72.mpls.qwest.net.
	[65.128.139.72])
	by mx.google.com with ESMTPS id k6sm264221igz.9.2012.07.05.08.56.02
	(version=SSLv3 cipher=OTHER); Thu, 05 Jul 2012 08:56:04 -0700 (PDT)
From: Dan Douglas <ormaaj@gmail.com>
To: Rainer Blome <rainer.blome@gmx.de>
Subject: Re: Doc of "set -e" should mention non-locality
Date: Thu, 05 Jul 2012 10:55:48 -0500
Message-ID: <39471498.hlNgFVTVF7@smorgbox>
User-Agent: KMail/4.8.3 (Linux/3.4.2-pf+; KDE/4.8.3; x86_64; ; )
In-Reply-To: <20120704153725.51550@gmx.net>
References: <20120628123717.51530@gmx.net> <3873506.x83VPejgYG@smorgbox>
	<20120704153725.51550@gmx.net>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart2753268.qhK5Z50rQo";
	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.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: Thu, 05 Jul 2012 15:56:20 -0000


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

On Wednesday, July 04, 2012 05:37:25 PM Rainer Blome wrote:
> -------- Original-Nachricht --------
> > Datum: Fri, 29 Jun 2012 18:03:13 -0500
> > Von: Dan Douglas <ormaaj@gmail.com>
> > An: bug-bash@gnu.org
> > CC: Rainer Blome <rainer.blome@gmx.de>
> 
> Remember that my main suggestion is to clearly document the intended
> behavior (see the subject). This could mean to add a generic
> paragraph to the documentation of "set" that describes the scope
> and extent for all options. 

I'm all for better documentation. Scope in Bash is a complex subject. Almost 
none of it is documented, and there is little standardization around how 
function scope is supposed to work anyway. I'd call set -e a low priority 
relative to documenting what scope behaviors are actually in place.

> > 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 may very well be. Is this documented anywhere?

About the one thing you can count on with regards to scope in Bash, is that it 
won't be lexical. But that's true of the majority of shells that have any kind 
of scoping features at all beyond positional parameters and environment 
variables.

> PS: Your suggested "workaround" is, well, hard to understand.
> Reminds me of the way people extend FORTH by massaging the stacks.
> You have to know exactly what is parsed, substituted and evaluated
> when in order to understand this (if it even works, did not try it).
> I would not dare use this in production for fear of
> receiving a beating from colleagues over hard to maintain code. ;-)

That's basically what it is (and this is yet another an undocumented scope 
thing). Setting this trap within a function sets a hook on the function and 
all of its callers which essentially runs eval on the given string upon 
returning. To make matters more confusing, also potentially on callees if they 
have the trace attribute set.

Other than that there's not much to understand or maintain. It'll set -e when 
returning from the first function and set +e when returning from the second, 
then unset itself on any further callers.

> > 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
> > 
-- 
Dan Douglas
--nextPart2753268.qhK5Z50rQo
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/1uQkACgkQMmyDamdg+MzgmACfSdZAXaZGU6Wu0uDi3q1zoc2H
eT4Anj78q2Ihyl9WIzub8gPHCx55dAZe
=3l58
-----END PGP SIGNATURE-----

--nextPart2753268.qhK5Z50rQo--



From MAILER-DAEMON Thu Jul 05 12:08:02 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Smob4-0004FQ-0V
	for mharc-bug-bash@gnu.org; Thu, 05 Jul 2012 12:08:02 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57299)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Smoaw-0004EI-Lw
	for bug-bash@gnu.org; Thu, 05 Jul 2012 12:08:00 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Smoao-0004gf-AG
	for bug-bash@gnu.org; Thu, 05 Jul 2012 12:07:54 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:4850)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Smoao-0004gK-5S
	for bug-bash@gnu.org; Thu, 05 Jul 2012 12:07:46 -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 BMR89602;
	Thu, 5 Jul 2012 12:07:44 -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 AZL12251 (AUTH cpr);
	Thu, 05 Jul 2012 12:07:44 -0400 (EDT)
Message-ID: <4FF5BBD0.5060705@case.edu>
Date: Thu, 05 Jul 2012 12:07:44 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: Dan Douglas <ormaaj@gmail.com>
Subject: Re: Doc of "set -e" should mention non-locality
References: <20120628123717.51530@gmx.net> <3873506.x83VPejgYG@smorgbox>
	<20120704153725.51550@gmx.net> <39471498.hlNgFVTVF7@smorgbox>
In-Reply-To: <39471498.hlNgFVTVF7@smorgbox>
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: Rainer Blome <rainer.blome@gmx.de>, 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, 05 Jul 2012 16:08:00 -0000

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

On 7/5/12 11:55 AM, Dan Douglas wrote:

>> Remember that my main suggestion is to clearly document the intended
>> behavior (see the subject). This could mean to add a generic
>> paragraph to the documentation of "set" that describes the scope
>> and extent for all options. 
> 
> I'm all for better documentation. Scope in Bash is a complex subject. Almost 
> none of it is documented, and there is little standardization around how 
> function scope is supposed to work anyway. I'd call set -e a low priority 
> relative to documenting what scope behaviors are actually in place.

There really isn't that much scope.  Posix barely acknowledges the
existence of scopes, period.  It doesn't have local variables, options,
or traps.

The paragraph in the bash man page describing the behavior of the ERR,
DEBUG, and RETURN traps, and the various descriptions of local variables,
are about it.

Bash's use of dynamic scoping is where the complexity comes in, I think,
but the implementation is, I hope, consistent.

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/1u9AACgkQu1hp8GTqdKs19QCfRvkBQ0rUxgNklTCZYhliQv4j
d8MAoIfmHmDq9y3EP3y2wxz0fCshO+bo
=EmUI
-----END PGP SIGNATURE-----


From MAILER-DAEMON Sat Jul 07 11:40:08 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SnX7A-0002vo-FI
	for mharc-bug-bash@gnu.org; Sat, 07 Jul 2012 11:40:08 -0400
Received: from eggs.gnu.org ([208.118.235.92]:53260)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1SnX77-0002sx-7k
	for bug-bash@gnu.org; Sat, 07 Jul 2012 11:40:06 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1SnX75-0002wf-5A
	for bug-bash@gnu.org; Sat, 07 Jul 2012 11:40:04 -0400
Received: from mail-lb0-f169.google.com ([209.85.217.169]:58363)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1SnX74-0002sE-QV
	for bug-bash@gnu.org; Sat, 07 Jul 2012 11:40:03 -0400
Received: by lbjn8 with SMTP id n8so8834858lbj.0
	for <bug-bash@gnu.org>; Sat, 07 Jul 2012 08:39:59 -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
	:content-type; bh=021m1oz2JDomx5j+ZlFcsefCORS3pdaJnF0eGOTAgMM=;
	b=cjfzDNEEvI5LS7MFVeiIZOC3kZcQaZ7yXXepiUdlFpzSGfS0SLZIg+vpR/Nm6hCbNI
	gO4y+1WemG/ZgLTafKiLLS3NFxDMwDqkucP4TmEPzgkVwtL3HeyuDngsOopKKo1RzDai
	Tq6kgXjhxR9ZS/BtWzpsyklxFOPra7JasUiGJHxKVki623xqIBQTpJDAUVm+woeAxh3R
	KNV7sLCHHWwvT7xILCQJ++xlSZ6dOcbAfvC6PBXLDbLQB7YJyPbN/2WEsMIdnY5UcJIS
	LGhB3sv5u39zTBIdVxoMKOYKQ6uhOiWdT+L9RknhNbT0KMuILh3MWsylIMklq4kS1OVg
	2uTQ==
MIME-Version: 1.0
Received: by 10.152.131.9 with SMTP id oi9mr33755243lab.39.1341675599699; Sat,
	07 Jul 2012 08:39:59 -0700 (PDT)
Received: by 10.112.128.234 with HTTP; Sat, 7 Jul 2012 08:39:59 -0700 (PDT)
In-Reply-To: <CALyZvKyt75WfQXbiZ8o2MdYDj0J-tub-Zh5caA4AMMoF9oKQtw@mail.gmail.com>
References: <CALyZvKxszx8cc=v3SZTXQ0yZx7cvGTzGhOHemdFTvuxXyJeHwA@mail.gmail.com>
	<4FF57957.4030109@redhat.com>
	<CALyZvKyt75WfQXbiZ8o2MdYDj0J-tub-Zh5caA4AMMoF9oKQtw@mail.gmail.com>
Date: Sat, 7 Jul 2012 16:39:59 +0100
Message-ID: <CALyZvKxrYV7pdAZc14mVh6mfUpTio_g8cHerwNpFMnasYAsQVw@mail.gmail.com>
Subject: Re: readline expansion: 'cp $v/<TAB>' -> 'cp \$v/' (no expansion) -
	why?
From: Jason Vas Dias <jason.vas.dias@gmail.com>
To: Eric Blake <eblake@redhat.com>, "bug-bash@gnu.org" <bug-bash@gnu.org>
Content-Type: text/plain; charset=UTF-8
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.217.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: Sat, 07 Jul 2012 15:40:06 -0000

Sorry,  I tried 4.2-29(2) at home and it DOES correctly complete
'$SRC/<TAB>'  - of
courrse,  it helps if $SRC contains the name of an existing directory,
 which it did not at work.
Thanks !  a most interesting list .
Next Question :
  - any plans to allow us to export array or associative store
variables ? ie. represent them in *environ passed to programs
     with an integration with glibc  "getenv()"  to support this ?
Thanks & Regards,
Jason

On Thu, Jul 5, 2012 at 12:59 PM, Jason Vas Dias
<jason.vas.dias@gmail.com> wrote:
> hi Eric - thanks for your response, but bash-4.2.29(2), just built from
> latest patches from gnu on x86_64 ubuntu,  does NOT
> "restore the old behavior" , but now refuses to tab-expand at
> all - 'cat $SRC/<TAB>' on the command line still produces no
> output.  Is there some option I need to give to enable it? Thanks!
>
> On 5 Jul 2012 13:24, "Eric Blake" <eblake@redhat.com> wrote:
>>
>> On 07/05/2012 04:58 AM, Jason Vas Dias wrote:
>>
>> > Now it changes the input string into
>> > 'less \$SRC/' and prevents tab expansion
>> > as would be done without use of any variables.
>> > Would anyone know how to restore the old behavior
>> > with bash 4.2.2 + readline 6.2 (linux ubuntu 12.04) ?
>>
>> Yep - upgrade to bash 4.2.29 (that is, patchlevel 2 is missing the fix
>> in patchlevel 29 that restores the behavior you want).
>> ftp://ftp.gnu.org/pub/gnu/bash/bash-4.2-patches/bash42-029
>>
>> This topic comes up frequently on this list.
>>
>> --
>> Eric Blake   eblake@redhat.com    +1-919-301-3266
>> Libvirt virtualization library http://libvirt.org
>>
>>
>>
>


From MAILER-DAEMON Sun Jul 08 12:50:24 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Snugi-0002nk-Og
	for mharc-bug-bash@gnu.org; Sun, 08 Jul 2012 12:50:24 -0400
Received: from eggs.gnu.org ([208.118.235.92]:45435)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Snugg-0002nd-3c
	for bug-bash@gnu.org; Sun, 08 Jul 2012 12:50:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Snugd-0003Gj-TV
	for bug-bash@gnu.org; Sun, 08 Jul 2012 12:50:21 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:39236)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Snugd-0003Gd-OY
	for bug-bash@gnu.org; Sun, 08 Jul 2012 12:50:19 -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 CAT16397; Sun, 08 Jul 2012 12:50:17 -0400 (EDT)
Received: from h58.207.189.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.189.207.58]) by mpv8.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id UOO89458 (AUTH cpr);
	Sun, 08 Jul 2012 12:50:16 -0400 (EDT)
Message-ID: <4FF9BA47.3030702@case.edu>
Date: Sun, 08 Jul 2012 12:50:15 -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: Jason Vas Dias <jason.vas.dias@gmail.com>
Subject: Re: readline expansion: 'cp $v/<TAB>' -> 'cp \$v/' (no expansion)
	- why?
References: <CALyZvKxszx8cc=v3SZTXQ0yZx7cvGTzGhOHemdFTvuxXyJeHwA@mail.gmail.com>
	<4FF57957.4030109@redhat.com>
	<CALyZvKyt75WfQXbiZ8o2MdYDj0J-tub-Zh5caA4AMMoF9oKQtw@mail.gmail.com>
	<CALyZvKxrYV7pdAZc14mVh6mfUpTio_g8cHerwNpFMnasYAsQVw@mail.gmail.com>
In-Reply-To: <CALyZvKxrYV7pdAZc14mVh6mfUpTio_g8cHerwNpFMnasYAsQVw@mail.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: Eric Blake <eblake@redhat.com>, "bug-bash@gnu.org" <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: Sun, 08 Jul 2012 16:50:23 -0000

On 7/7/12 11:39 AM, Jason Vas Dias wrote:

> Next Question :
>   - any plans to allow us to export array or associative store
> variables ? ie. represent them in *environ passed to programs
>      with an integration with glibc  "getenv()"  to support this ?

There is already code -- commented out -- to export array variables in
a format that resembles a compound array assignment, and code -- still
commented out -- in bash to understand them.  It's not enabled because
the chance for obscure collisions with similarly-formed environment
variables is non-negligible and doesn't have an elegant solution.

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 Sun Jul 08 16:14:23 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Snxs7-0002Xs-BC
	for mharc-bug-bash@gnu.org; Sun, 08 Jul 2012 16:14:23 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38965)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1Snxs5-0002Wr-1U
	for bug-bash@gnu.org; Sun, 08 Jul 2012 16:14:22 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1Snxs3-0006TQ-8n
	for bug-bash@gnu.org; Sun, 08 Jul 2012 16:14:20 -0400
Received: from mail-lb0-f169.google.com ([209.85.217.169]:51633)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1Snxs2-0006TM-VI
	for bug-bash@gnu.org; Sun, 08 Jul 2012 16:14:19 -0400
Received: by lbjn8 with SMTP id n8so9751045lbj.0
	for <bug-bash@gnu.org>; Sun, 08 Jul 2012 13:14:16 -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;
	bh=swdv8N26F70F3LNZjyNa//1wG5sAoj9oEpdf+DKAyXI=;
	b=fghs8jSA8GXTZZbAhp6dWI7kLsMW6UPhSGI1xt7+hLwYNwUmDX/HvAW863P+rz3SXY
	Nw1/QTNRuedWpNDdFMSDz/B3mkJb97rPZGJW+xYmiMJPRX2wBU9//f64qojWSqrpgEWn
	BxtMeY4fnbFUm7fpaxaw80kZ0d20zxTQiQ3Wy03V/WFeozKWRbMIE+eRSl9pBRzGC6QP
	hgbcY6k72Qrk66aYokL3qpq2KE025X25GwFQ9QRMqHWF2FsOglnG1A1HMJjS0YdBOZOL
	lthTe2L48tr4gPhZjMKZV3d8I6G/E4AYFGsUsgIQA9rOPhLAbmm78nLpaRhjf5hZNoEF
	+QWg==
MIME-Version: 1.0
Received: by 10.112.49.230 with SMTP id x6mr17401525lbn.86.1341778455993; Sun,
	08 Jul 2012 13:14:15 -0700 (PDT)
Received: by 10.112.128.234 with HTTP; Sun, 8 Jul 2012 13:14:15 -0700 (PDT)
In-Reply-To: <4FF9BA47.3030702@case.edu>
References: <CALyZvKxszx8cc=v3SZTXQ0yZx7cvGTzGhOHemdFTvuxXyJeHwA@mail.gmail.com>
	<4FF57957.4030109@redhat.com>
	<CALyZvKyt75WfQXbiZ8o2MdYDj0J-tub-Zh5caA4AMMoF9oKQtw@mail.gmail.com>
	<CALyZvKxrYV7pdAZc14mVh6mfUpTio_g8cHerwNpFMnasYAsQVw@mail.gmail.com>
	<4FF9BA47.3030702@case.edu>
Date: Sun, 8 Jul 2012 21:14:15 +0100
Message-ID: <CALyZvKz=LjfTw6YMMYPXhUDN5q61xN7R+98HTxFT03sMQktu2Q@mail.gmail.com>
Subject: Re: readline expansion: 'cp $v/<TAB>' -> 'cp \$v/' (no expansion) -
	why?
From: Jason Vas Dias <jason.vas.dias@gmail.com>
To: chet.ramey@case.edu
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.217.169
Cc: Eric Blake <eblake@redhat.com>, "bug-bash@gnu.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: Sun, 08 Jul 2012 20:14:22 -0000

On Sun, Jul 8, 2012 at 5:50 PM, Chet Ramey <chet.ramey@case.edu> wrote:
> On 7/7/12 11:39 AM, Jason Vas Dias wrote:
>
>> Next Question :
>>   - any plans to allow us to export array or associative store
>> variables ? ie. represent them in *environ passed to programs
>>      with an integration with glibc  "getenv()"  to support this ?
>
> There is already code -- commented out -- to export array variables in
> a format that resembles a compound array assignment, and code -- still
> commented out -- in bash to understand them.  It's not enabled because
> the chance for obscure collisions with similarly-formed environment
> variables is non-negligible and doesn't have an elegant solution.
>
> Chet

Aha !  Interesting - which source file ?

The way I'd do it (and do it with shells that do not understand
indexed / associative arrays),  is,
for array "my_array" and member "index" having value "$item" :
  "Add" or "Set" an item:
     eval 'export my_array_'${item_deref}'_'${index}'='$item
   "Get" an item:
     eval '$my_array_'${item_deref}'_'${index}
   'Remove' an item
     eval 'undef my_array_'${item_deref}'_'${index}'
 and I'd suggest having item_deref=('.' or '__' or '@') also  known to
glibc getenv() or a new getenv_x()
  function in glibc so that programs can use them .  Any plans along
these lines ?
 And is there any way for the current bash to support exported
variables whose names contain '.' ?
Thanks & Regards , Jason



> --
> ``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 Sun Jul 08 19:56:40 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1So1LE-00049K-8r
	for mharc-bug-bash@gnu.org; Sun, 08 Jul 2012 19:56:40 -0400
Received: from eggs.gnu.org ([208.118.235.92]:56478)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1So1LC-00048z-1h
	for bug-bash@gnu.org; Sun, 08 Jul 2012 19:56:39 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1So1LA-00061c-0E
	for bug-bash@gnu.org; Sun, 08 Jul 2012 19:56:37 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:13068)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1So1L9-00061D-RB
	for bug-bash@gnu.org; Sun, 08 Jul 2012 19:56:35 -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 BMV21103;
	Sun, 8 Jul 2012 19:56:33 -0400
Received: from h58.207.189.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.189.207.58]) by mpv8.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id UOP76154 (AUTH cpr);
	Sun, 08 Jul 2012 19:56:33 -0400 (EDT)
Message-ID: <4FFA1E30.2050103@case.edu>
Date: Sun, 08 Jul 2012 19:56: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: Jason Vas Dias <jason.vas.dias@gmail.com>
Subject: Re: readline expansion: 'cp $v/<TAB>' -> 'cp \$v/' (no expansion)
	- why?
References: <CALyZvKxszx8cc=v3SZTXQ0yZx7cvGTzGhOHemdFTvuxXyJeHwA@mail.gmail.com>
	<4FF57957.4030109@redhat.com>
	<CALyZvKyt75WfQXbiZ8o2MdYDj0J-tub-Zh5caA4AMMoF9oKQtw@mail.gmail.com>
	<CALyZvKxrYV7pdAZc14mVh6mfUpTio_g8cHerwNpFMnasYAsQVw@mail.gmail.com>
	<4FF9BA47.3030702@case.edu>
	<CALyZvKz=LjfTw6YMMYPXhUDN5q61xN7R+98HTxFT03sMQktu2Q@mail.gmail.com>
In-Reply-To: <CALyZvKz=LjfTw6YMMYPXhUDN5q61xN7R+98HTxFT03sMQktu2Q@mail.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 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: Eric Blake <eblake@redhat.com>, "bug-bash@gnu.org" <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: Sun, 08 Jul 2012 23:56:39 -0000

On 7/8/12 4:14 PM, Jason Vas Dias wrote:

>> There is already code -- commented out -- to export array variables in
>> a format that resembles a compound array assignment, and code -- still
>> commented out -- in bash to understand them.  It's not enabled because
>> the chance for obscure collisions with similarly-formed environment
>> variables is non-negligible and doesn't have an elegant solution.
>>
>> Chet
> 
> Aha !  Interesting - which source file ?

bash-4.2.29: variables.c:371; variables.c:3479.

> The way I'd do it (and do it with shells that do not understand
> indexed / associative arrays),  is,
> for array "my_array" and member "index" having value "$item" :
>   "Add" or "Set" an item:
>      eval 'export my_array_'${item_deref}'_'${index}'='$item
>    "Get" an item:
>      eval '$my_array_'${item_deref}'_'${index}
>    'Remove' an item
>      eval 'undef my_array_'${item_deref}'_'${index}'
>  and I'd suggest having item_deref=('.' or '__' or '@') also  known to
> glibc getenv() or a new getenv_x()
>   function in glibc so that programs can use them .  Any plans along
> these lines ?

No. I'm not sure it's a good idea to create large numbers of environment
variables for exported arrays with large numbers of elements.  That can
slow exec() down and lead to weird errors if the ARG_MAX limit, which
includes the environment, is exceeded.  The same space problem exists for
the (currently-disabled) bash mechanism, granted.

I'm also not particularly interested in glibc-only interfaces.  That's one
of the reasons that I'd like a solution to this to require only bash and
be more-or-less agnostic to other programs that might scan the environment.

>  And is there any way for the current bash to support exported
> variables whose names contain '.' ?

No.  Bash-4.2 doesn't allow variables with characters outside the set
[_a-zA-Z][_a-zA-Z0-9]*.  It will pass environment strings that aren't
valid variable names through to the programs it invokes.

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 Jul 09 22:40:12 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SoQN2-0003mY-TF
	for mharc-bug-bash@gnu.org; Mon, 09 Jul 2012 22:40:12 -0400
Path: usenet.stanford.edu!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From: deepseamiracles@gmail.com
Newsgroups: gnu.bash.bug
Subject: Re: Online Adult Swingers Dating Services
Date: Mon, 9 Jul 2012 19:34:39 -0700 (PDT)
Organization: http://groups.google.com
Lines: 18
Message-ID: <eb06134b-eb5f-41e6-8dc5-1ce91779ae2b@googlegroups.com>
References: <79b032d0-9197-4656-a958-45110ae07a2c@f20g2000pro.googlegroups.com>
NNTP-Posting-Host: 71.237.56.233
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: posting.google.com 1341887785 21575 127.0.0.1 (10 Jul 2012 02:36:25
	GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 10 Jul 2012 02:36:25 +0000 (UTC)
In-Reply-To: <79b032d0-9197-4656-a958-45110ae07a2c@f20g2000pro.googlegroups.com>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=71.237.56.233;
	posting-account=1bNtmwoAAAB-RqWsblWw_5ErbEP53uX4
User-Agent: G2/1.0
Xref: usenet.stanford.edu gnu.bash.bug:24861
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: Tue, 10 Jul 2012 02:40:10 -0000

On Friday, September 10, 2010 6:37:38 AM UTC-6, Trisha B. Carson wrote:
> If you are adult single and ready to mingle, then free adult online
> dating site is a great choice. There are many advantages indeed with
> online sex and adult dating and here are just a few of them blogs for
> you:
> 
> For US Adult&#39;s:
> 
> http://www.adultxdating.us/blogs/free-dating-service-for-adult-swingers-personals/
> http://www.adultxdating.us/blogs/take-delight-in-adult-swingers-sex-dating/
> http://www.finddatingsingles.co.uk/blogs/get-improvement-of-find-singles-from-online-dating-websites/
> http://culturedating.blogspot.com/2010/09/online-dating-for-adult-sexy-swinger.html
> http://datingservicesites.blogspot.com/2010/09/effective-online-adult-dating-for-find.html
> http://datingmatchmaker.wordpress.com/2010/09/10/latest-online-adult-dating-service-in-us/
> http://singledating.multiply.com/journal/item/29/Singles_at_Online_Adult_Dating_Services
> http://plentysingles.angelfire.com/adultxdating/

Your forgot http://www.sexedinthecity.com

From MAILER-DAEMON Mon Jul 09 22:40:13 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SoQN3-0003nA-1q
	for mharc-bug-bash@gnu.org; Mon, 09 Jul 2012 22:40:13 -0400
Path: usenet.stanford.edu!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From: Intimate Tickles <deepseamiracles@gmail.com>
Newsgroups: gnu.bash.bug
Subject: New Sexy Social Network Rocking the U.S.A. www.SexedInTheCity.com
Date: Mon, 9 Jul 2012 19:35:25 -0700 (PDT)
Organization: http://groups.google.com
Lines: 2
Message-ID: <9272ff7a-bb9e-4601-878a-b7f0bc4d6be1@googlegroups.com>
NNTP-Posting-Host: 71.237.56.233
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: posting.google.com 1341887838 21929 127.0.0.1 (10 Jul 2012 02:37:18
	GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 10 Jul 2012 02:37:18 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=71.237.56.233;
	posting-account=1bNtmwoAAAB-RqWsblWw_5ErbEP53uX4
User-Agent: G2/1.0
Xref: usenet.stanford.edu gnu.bash.bug:24862
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: Tue, 10 Jul 2012 02:40:11 -0000

The new, hot sexy social network is finally ready, up, and running. 10's of thousands of sexy couples and singles are already enjoying connections with like minded, sexy, fun, ready for sex new friends.
http://www.sexedinthecity.com

From MAILER-DAEMON Tue Jul 10 12:02:22 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SoctK-0007jJ-7I
	for mharc-bug-bash@gnu.org; Tue, 10 Jul 2012 12:02:22 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41523)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SoctE-0007j5-LR
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:02:21 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Soct7-00085J-MS
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:02:16 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:43901)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Soct7-000852-HB
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:02:09 -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 BMW76258;
	Tue, 10 Jul 2012 12:02:07 -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 AZP37441; Tue, 10 Jul 2012 12:02:07 -0400 (EDT)
Date: Tue, 10 Jul 2012 12:01:33 -0400
From: Chet Ramey <chet.ramey@case.edu>
Sender: Chet Ramey <chet@caleb.ins.cwru.edu>
To: bug-bash@gnu.org
Subject: Bash-4.2 Official Patch 30
Message-ID: <120710160133.AA30641.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: 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, 10 Jul 2012 16:02:21 -0000

			     BASH PATCH REPORT
			     =================

Bash-Release:	4.2
Patch-ID:	bash42-030

Bug-Reported-by:	Roman Rakus <rrakus@redhat.com>
Bug-Reference-ID:	<4D7DD91E.7040808@redhat.com>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-03/msg00126.html

Bug-Description:

When attempting to glob strings in a multibyte locale, and those strings
contain invalid multibyte characters that cause mbsnrtowcs to return 0,
the globbing code loops infinitely.

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/lib/glob/xmbsrtowcs.c	2010-05-30 18:36:27.000000000 -0400
--- lib/glob/xmbsrtowcs.c	2011-03-22 16:06:47.000000000 -0400
***************
*** 36,39 ****
--- 36,41 ----
  #if HANDLE_MULTIBYTE
  
+ #define WSBUF_INC 32
+ 
  #ifndef FREE
  #  define FREE(x)	do { if (x) free (x); } while (0)
***************
*** 149,153 ****
    size_t wcnum;		/* Number of wide characters in WSBUF */
    mbstate_t state;	/* Conversion State */
!   size_t wcslength;	/* Number of wide characters produced by the conversion. */
    const char *end_or_backslash;
    size_t nms;	/* Number of multibyte characters to convert at one time. */
--- 151,155 ----
    size_t wcnum;		/* Number of wide characters in WSBUF */
    mbstate_t state;	/* Conversion State */
!   size_t n, wcslength;	/* Number of wide characters produced by the conversion. */
    const char *end_or_backslash;
    size_t nms;	/* Number of multibyte characters to convert at one time. */
***************
*** 172,176 ****
        tmp_p = p;
        tmp_state = state;
!       wcslength = mbsnrtowcs(NULL, &tmp_p, nms, 0, &tmp_state);
  
        /* Conversion failed. */
--- 174,189 ----
        tmp_p = p;
        tmp_state = state;
! 
!       if (nms == 0 && *p == '\\')	/* special initial case */
! 	nms = wcslength = 1;
!       else
! 	wcslength = mbsnrtowcs (NULL, &tmp_p, nms, 0, &tmp_state);
! 
!       if (wcslength == 0)
! 	{
! 	  tmp_p = p;		/* will need below */
! 	  tmp_state = state;
! 	  wcslength = 1;	/* take a single byte */
! 	}
  
        /* Conversion failed. */
***************
*** 187,191 ****
  	  wchar_t *wstmp;
  
! 	  wsbuf_size = wcnum+wcslength+1;	/* 1 for the L'\0' or the potential L'\\' */
  
  	  wstmp = (wchar_t *) realloc (wsbuf, wsbuf_size * sizeof (wchar_t));
--- 200,205 ----
  	  wchar_t *wstmp;
  
! 	  while (wsbuf_size < wcnum+wcslength+1) /* 1 for the L'\0' or the potential L'\\' */
! 	    wsbuf_size += WSBUF_INC;
  
  	  wstmp = (wchar_t *) realloc (wsbuf, wsbuf_size * sizeof (wchar_t));
***************
*** 200,207 ****
  
        /* Perform the conversion. This is assumed to return 'wcslength'.
!        * It may set 'p' to NULL. */
!       mbsnrtowcs(wsbuf+wcnum, &p, nms, wsbuf_size-wcnum, &state);
  
!       wcnum += wcslength;
  
        if (mbsinit (&state) && (p != NULL) && (*p == '\\'))
--- 214,229 ----
  
        /* Perform the conversion. This is assumed to return 'wcslength'.
! 	 It may set 'p' to NULL. */
!       n = mbsnrtowcs(wsbuf+wcnum, &p, nms, wsbuf_size-wcnum, &state);
  
!       /* Compensate for taking single byte on wcs conversion failure above. */
!       if (wcslength == 1 && (n == 0 || n == (size_t)-1))
! 	{
! 	  state = tmp_state;
! 	  p = tmp_p;
! 	  wsbuf[wcnum++] = *p++;
! 	}
!       else
!         wcnum += wcslength;
  
        if (mbsinit (&state) && (p != NULL) && (*p == '\\'))
***************
*** 231,236 ****
     of DESTP and INDICESP are NULL. */
  
- #define WSBUF_INC 32
- 
  size_t
  xdupmbstowcs (destp, indicesp, src)
--- 253,256 ----
*** ../bash-4.2-patched/lib/glob/glob.c	2009-11-14 18:39:30.000000000 -0500
--- lib/glob/glob.c	2012-07-07 12:09:56.000000000 -0400
***************
*** 201,206 ****
    size_t pat_n, dn_n;
  
    pat_n = xdupmbstowcs (&pat_wc, NULL, pat);
!   dn_n = xdupmbstowcs (&dn_wc, NULL, dname);
  
    ret = 0;
--- 201,209 ----
    size_t pat_n, dn_n;
  
+   pat_wc = dn_wc = (wchar_t *)NULL;
+ 
    pat_n = xdupmbstowcs (&pat_wc, NULL, pat);
!   if (pat_n != (size_t)-1)
!     dn_n = xdupmbstowcs (&dn_wc, NULL, dname);
  
    ret = 0;
***************
*** 222,225 ****
--- 225,230 ----
  	ret = 1;
      }
+   else
+     ret = skipname (pat, dname, flags);
  
    FREE (pat_wc);
***************
*** 267,272 ****
    n = xdupmbstowcs (&wpathname, NULL, pathname);
    if (n == (size_t) -1)
!     /* Something wrong. */
!     return;
    orig_wpathname = wpathname;
  
--- 272,280 ----
    n = xdupmbstowcs (&wpathname, NULL, pathname);
    if (n == (size_t) -1)
!     {
!       /* Something wrong.  Fall back to single-byte */
!       udequote_pathname (pathname);
!       return;
!     }
    orig_wpathname = wpathname;
  
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
--- patchlevel.h	Thu Feb 24 21:41:34 2011
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 29
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 30
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``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 Jul 10 12:02:47 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Soctj-0007r3-BW
	for mharc-bug-bash@gnu.org; Tue, 10 Jul 2012 12:02:47 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41579)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SoctZ-0007qd-4g
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:02:46 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SoctO-00086t-MD
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:02:36 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:44006)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SoctO-00086b-He
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:02:26 -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 BMW76297;
	Tue, 10 Jul 2012 12:02:25 -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 AZP37484; Tue, 10 Jul 2012 12:02:25 -0400 (EDT)
Date: Tue, 10 Jul 2012 12:02:08 -0400
From: Chet Ramey <chet.ramey@case.edu>
Sender: Chet Ramey <chet@caleb.ins.cwru.edu>
To: bug-bash@gnu.org
Subject: Bash-4.2 Official Patch 31
Message-ID: <120710160208.AA30641.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: 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, 10 Jul 2012 16:02:47 -0000

			     BASH PATCH REPORT
			     =================

Bash-Release:	4.2
Patch-ID:	bash42-031

Bug-Reported-by:	Max Horn <max@quendi.de>
Bug-Reference-ID:	<20CC5C60-07C3-4E41-9817-741E48D407C5@quendi.de>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-readline/2012-06/msg00005.html

Bug-Description:

A change between bash-4.1 and bash-4.2 to prevent the readline input hook
from being called too frequently had the side effect of causing delays
when reading pasted input on systems such as Mac OS X.  This patch fixes
those delays while retaining the bash-4.2 behavior.

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/lib/readline/input.c	2010-05-30 18:33:01.000000000 -0400
--- lib/readline/input.c	2012-06-25 21:08:42.000000000 -0400
***************
*** 410,414 ****
  rl_read_key ()
  {
!   int c;
  
    rl_key_sequence_length++;
--- 412,416 ----
  rl_read_key ()
  {
!   int c, r;
  
    rl_key_sequence_length++;
***************
*** 430,441 ****
  	  while (rl_event_hook)
  	    {
! 	      if (rl_gather_tyi () < 0)	/* XXX - EIO */
  		{
  		  rl_done = 1;
  		  return ('\n');
  		}
  	      RL_CHECK_SIGNALS ();
- 	      if (rl_get_char (&c) != 0)
- 		break;
  	      if (rl_done)		/* XXX - experimental */
  		return ('\n');
--- 432,447 ----
  	  while (rl_event_hook)
  	    {
! 	      if (rl_get_char (&c) != 0)
! 		break;
! 		
! 	      if ((r = rl_gather_tyi ()) < 0)	/* XXX - EIO */
  		{
  		  rl_done = 1;
  		  return ('\n');
  		}
+ 	      else if (r == 1)			/* read something */
+ 		continue;
+ 
  	      RL_CHECK_SIGNALS ();
  	      if (rl_done)		/* XXX - experimental */
  		return ('\n');
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
--- patchlevel.h	Thu Feb 24 21:41:34 2011
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 30
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 31
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``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 Jul 10 12:03:01 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Soctx-00083H-Up
	for mharc-bug-bash@gnu.org; Tue, 10 Jul 2012 12:03:01 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41654)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Soctr-0007yN-6Z
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:03:01 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Soctf-00088z-Kb
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:02:54 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:25488)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Soctf-00088j-Fj
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:02:43 -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 CAU98258; Tue, 10 Jul 2012 12:02:42 -0400 (EDT)
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 BAX12459; Tue, 10 Jul 2012 12:02:42 -0400 (EDT)
Date: Tue, 10 Jul 2012 12:02:27 -0400
From: Chet Ramey <chet.ramey@case.edu>
Sender: Chet Ramey <chet@caleb.ins.cwru.edu>
To: bug-bash@gnu.org
Subject: Bash-4.2 Official Patch 32
Message-ID: <120710160227.AA30641.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: 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, 10 Jul 2012 16:03:01 -0000

			     BASH PATCH REPORT
			     =================

Bash-Release:	4.2
Patch-ID:	bash42-032

Bug-Reported-by:	Ruediger Kuhlmann <RKuhlmann@orga-systems.com>
Bug-Reference-ID:	<OFDE975207.0C3622E5-ONC12579F3.00361A06-C12579F3.00365E39@orga-systems.com>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2012-05/msg00010.html

Bug-Description:

Bash-4.2 has problems with DEL characters in the expanded value of variables
used in the same quoted string as variables that expand to nothing.

Patch (apply with `patch -p0'):

*** ../bash-20120427/subst.c	2012-04-22 16:19:10.000000000 -0400
--- subst.c	2012-05-07 16:06:35.000000000 -0400
***************
*** 8152,8155 ****
--- 8152,8163 ----
  	  dispose_word_desc (tword);
  
+ 	  /* Kill quoted nulls; we will add them back at the end of
+ 	     expand_word_internal if nothing else in the string */
+ 	  if (had_quoted_null && temp && QUOTED_NULL (temp))
+ 	    {
+ 	      FREE (temp);
+ 	      temp = (char *)NULL;
+ 	    }
+ 
  	  goto add_string;
  	  break;
***************
*** 8556,8560 ****
        if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
  	tword->flags |= W_QUOTED;
!       if (had_quoted_null)
  	tword->flags |= W_HASQUOTEDNULL;
        list = make_word_list (tword, (WORD_LIST *)NULL);
--- 8564,8568 ----
        if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
  	tword->flags |= W_QUOTED;
!       if (had_quoted_null && QUOTED_NULL (istring))
  	tword->flags |= W_HASQUOTEDNULL;
        list = make_word_list (tword, (WORD_LIST *)NULL);
***************
*** 8587,8591 ****
  	  if (word->flags & W_NOEXPAND)
  	    tword->flags |= W_NOEXPAND;
! 	  if (had_quoted_null)
  	    tword->flags |= W_HASQUOTEDNULL;	/* XXX */
  	  list = make_word_list (tword, (WORD_LIST *)NULL);
--- 8595,8599 ----
  	  if (word->flags & W_NOEXPAND)
  	    tword->flags |= W_NOEXPAND;
! 	  if (had_quoted_null && QUOTED_NULL (istring))
  	    tword->flags |= W_HASQUOTEDNULL;	/* XXX */
  	  list = make_word_list (tword, (WORD_LIST *)NULL);
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
--- patchlevel.h	Thu Feb 24 21:41:34 2011
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 31
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 32
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``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 Jul 10 12:03:10 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Socu6-0008AS-36
	for mharc-bug-bash@gnu.org; Tue, 10 Jul 2012 12:03:10 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41710)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Socu3-0008AL-BW
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:03:08 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Socu0-0008DE-Um
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:03:06 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:10248)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Socu0-0008Ct-Qb
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:03:04 -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 BMW76352;
	Tue, 10 Jul 2012 12:03:03 -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 BAX12538; Tue, 10 Jul 2012 12:03:03 -0400 (EDT)
Date: Tue, 10 Jul 2012 12:02:43 -0400
From: Chet Ramey <chet.ramey@case.edu>
Sender: Chet Ramey <chet@caleb.ins.cwru.edu>
To: bug-bash@gnu.org
Subject: Bash-4.2 Official Patch 33
Message-ID: <120710160243.AA30641.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: 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, 10 Jul 2012 16:03:09 -0000

			     BASH PATCH REPORT
			     =================

Bash-Release:	4.2
Patch-ID:	bash42-033

Bug-Reported-by:	David Leverton <levertond@googlemail.com>
Bug-Reference-ID:	<4FCCE737.1060603@googlemail.com>
Bug-Reference-URL:

Bug-Description:

Bash uses a static buffer when expanding the /dev/fd prefix for the test
and conditional commands, among other uses, when it should use a dynamic
buffer to avoid buffer overflow.

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/lib/sh/eaccess.c	2011-01-08 20:50:10.000000000 -0500
--- lib/sh/eaccess.c	2012-06-04 21:06:43.000000000 -0400
***************
*** 83,86 ****
--- 83,88 ----
       struct stat *finfo;
  {
+   static char *pbuf = 0;
+ 
    if (*path == '\0')
      {
***************
*** 107,111 ****
       On most systems, with the notable exception of linux, this is
       effectively a no-op. */
!       char pbuf[32];
        strcpy (pbuf, DEV_FD_PREFIX);
        strcat (pbuf, path + 8);
--- 109,113 ----
       On most systems, with the notable exception of linux, this is
       effectively a no-op. */
!       pbuf = xrealloc (pbuf, sizeof (DEV_FD_PREFIX) + strlen (path + 8));
        strcpy (pbuf, DEV_FD_PREFIX);
        strcat (pbuf, path + 8);
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
--- patchlevel.h	Thu Feb 24 21:41:34 2011
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 32
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 33
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``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 Jul 10 12:03:44 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Socue-0008Hx-8c
	for mharc-bug-bash@gnu.org; Tue, 10 Jul 2012 12:03:44 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41812)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SocuT-0008Hj-1n
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:03:42 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SocuN-0008J8-PG
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:03:32 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:25488)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SocuN-00088j-Kw
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:03:27 -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 CAU98346; Tue, 10 Jul 2012 12:03:27 -0400 (EDT)
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 BAX12609; Tue, 10 Jul 2012 12:03:27 -0400 (EDT)
Date: Tue, 10 Jul 2012 12:03:05 -0400
From: Chet Ramey <chet.ramey@case.edu>
Sender: Chet Ramey <chet@caleb.ins.cwru.edu>
To: bug-bash@gnu.org
Subject: Bash-4.2 Official Patch 34
Message-ID: <120710160305.AA30641.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: 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, 10 Jul 2012 16:03:42 -0000

			     BASH PATCH REPORT
			     =================

Bash-Release:	4.2
Patch-ID:	bash42-034

Bug-Reported-by:	"Davide Brini" <dave_br@gmx.com>
Bug-Reference-ID:	<20120604164154.69781EC04B@imaps.oficinas.atrapalo.com>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2012-06/msg00030.html

Bug-Description:

In bash-4.2, the history code would inappropriately add a semicolon to
multi-line compound array assignments when adding them to the history.

Patch (apply with `patch -p0'):

*** ../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
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
--- patchlevel.h	Thu Feb 24 21:41:34 2011
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 33
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 34
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``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 Jul 10 12:04:21 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SocvF-0000cO-3I
	for mharc-bug-bash@gnu.org; Tue, 10 Jul 2012 12:04:21 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41971)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Socv4-0000aw-N1
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:04:20 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Socup-0000AG-84
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:04:10 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:17584)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Socup-00009c-3A
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:03:55 -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 CAU98408; Tue, 10 Jul 2012 12:03:54 -0400 (EDT)
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 BAX12697; Tue, 10 Jul 2012 12:03:54 -0400 (EDT)
Date: Tue, 10 Jul 2012 12:03:28 -0400
From: Chet Ramey <chet.ramey@case.edu>
Sender: Chet Ramey <chet@caleb.ins.cwru.edu>
To: bug-bash@gnu.org
Subject: Bash-4.2 Official Patch 35
Message-ID: <120710160328.AA30641.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: 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, 10 Jul 2012 16:04:20 -0000

			     BASH PATCH REPORT
			     =================

Bash-Release:	4.2
Patch-ID:	bash42-035

Bug-Reported-by:	Dan Douglas <ormaaj@gmail.com>
Bug-Reference-ID:	<2766482.Ksm3GrSoYi@smorgbox>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2012-06/msg00071.html

Bug-Description:

When given a number of lines to read, `mapfile -n lines' reads one too many.

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/builtins/mapfile.def	2010-05-29 22:09:47.000000000 -0400
--- builtins/mapfile.def	2012-06-20 09:48:33.000000000 -0400
***************
*** 196,206 ****
    interrupt_immediately++;
    for (array_index = origin, line_count = 1; 
!        zgetline (fd, &line, &line_length, unbuffered_read) != -1;
!        array_index++, line_count++) 
      {
-       /* Have we exceeded # of lines to store? */
-       if (line_count_goal != 0 && line_count > line_count_goal) 
- 	break;
- 
        /* Remove trailing newlines? */
        if (flags & MAPF_CHOP)
--- 196,202 ----
    interrupt_immediately++;
    for (array_index = origin, line_count = 1; 
!  	zgetline (fd, &line, &line_length, unbuffered_read) != -1;
! 	array_index++) 
      {
        /* Remove trailing newlines? */
        if (flags & MAPF_CHOP)
***************
*** 218,221 ****
--- 214,222 ----
  
        bind_array_element (entry, array_index, line, 0);
+ 
+       /* Have we exceeded # of lines to store? */
+       line_count++;
+       if (line_count_goal != 0 && line_count > line_count_goal) 
+ 	break;
      }
  
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
--- patchlevel.h	Thu Feb 24 21:41:34 2011
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 34
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 35
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``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 Jul 10 12:04:54 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Socvm-0000lQ-FF
	for mharc-bug-bash@gnu.org; Tue, 10 Jul 2012 12:04:54 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42134)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Socvc-0000ki-R8
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:04:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SocvW-0000Hy-B6
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:04:44 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:10666)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SocvW-0000Hp-5x
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:04:38 -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 BMW76522;
	Tue, 10 Jul 2012 12:04:37 -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 BAX12848; Tue, 10 Jul 2012 12:04:37 -0400 (EDT)
Date: Tue, 10 Jul 2012 12:03:59 -0400
From: Chet Ramey <chet.ramey@case.edu>
Sender: Chet Ramey <chet@caleb.ins.cwru.edu>
To: bug-bash@gnu.org
Subject: Bash-4.2 Official Patch 36
Message-ID: <120710160359.AA30641.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: 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, 10 Jul 2012 16:04:53 -0000

			     BASH PATCH REPORT
			     =================

Bash-Release:	4.2
Patch-ID:	bash42-036

Bug-Reported-by:	gregrwm <backuppc-users@whitleymott.net>
Bug-Reference-ID:	<CAD+dB9B4JG+qUwZBQUwiQmVt0j6NDn=DDTxr9R+nkA8DL4KLJA@mail.gmail.com>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2012-05/msg00108.html

Bug-Description:

Bash-4.2 produces incorrect word splitting results when expanding
double-quoted $@ in the same string as and adjacent to other variable
expansions.  The $@ should be split, the other expansions should not.

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/subst.c	2012-05-02 12:02:33.000000000 -0400
--- subst.c	2012-07-08 21:19:32.000000000 -0400
***************
*** 7923,7927 ****
    /* State flags */
    int had_quoted_null;
!   int has_dollar_at;
    int tflag;
    int pflags;			/* flags passed to param_expand */
--- 7923,7927 ----
    /* State flags */
    int had_quoted_null;
!   int has_dollar_at, temp_has_dollar_at;
    int tflag;
    int pflags;			/* flags passed to param_expand */
***************
*** 8128,8138 ****
  	    *expanded_something = 1;
  
! 	  has_dollar_at = 0;
  	  pflags = (word->flags & W_NOCOMSUB) ? PF_NOCOMSUB : 0;
  	  if (word->flags & W_NOSPLIT2)
  	    pflags |= PF_NOSPLIT2;
  	  tword = param_expand (string, &sindex, quoted, expanded_something,
! 			       &has_dollar_at, &quoted_dollar_at,
  			       &had_quoted_null, pflags);
  
  	  if (tword == &expand_wdesc_error || tword == &expand_wdesc_fatal)
--- 8128,8139 ----
  	    *expanded_something = 1;
  
! 	  temp_has_dollar_at = 0;
  	  pflags = (word->flags & W_NOCOMSUB) ? PF_NOCOMSUB : 0;
  	  if (word->flags & W_NOSPLIT2)
  	    pflags |= PF_NOSPLIT2;
  	  tword = param_expand (string, &sindex, quoted, expanded_something,
! 			       &temp_has_dollar_at, &quoted_dollar_at,
  			       &had_quoted_null, pflags);
+ 	  has_dollar_at += temp_has_dollar_at;
  
  	  if (tword == &expand_wdesc_error || tword == &expand_wdesc_fatal)
***************
*** 8275,8281 ****
  	      temp = (char *)NULL;
  
! 	      has_dollar_at = 0;
  	      /* Need to get W_HASQUOTEDNULL flag through this function. */
! 	      list = expand_word_internal (tword, Q_DOUBLE_QUOTES, 0, &has_dollar_at, (int *)NULL);
  
  	      if (list == &expand_word_error || list == &expand_word_fatal)
--- 8276,8283 ----
  	      temp = (char *)NULL;
  
! 	      temp_has_dollar_at = 0;	/* XXX */
  	      /* Need to get W_HASQUOTEDNULL flag through this function. */
! 	      list = expand_word_internal (tword, Q_DOUBLE_QUOTES, 0, &temp_has_dollar_at, (int *)NULL);
! 	      has_dollar_at += temp_has_dollar_at;
  
  	      if (list == &expand_word_error || list == &expand_word_fatal)
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
--- patchlevel.h	Thu Feb 24 21:41:34 2011
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 35
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 36
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``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 Jul 10 12:41:32 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SodVE-0004lX-VJ
	for mharc-bug-bash@gnu.org; Tue, 10 Jul 2012 12:41:32 -0400
Received: from eggs.gnu.org ([208.118.235.92]:45413)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <extern.martin.orlob@esolutions.de>)
	id 1SocUy-0004kK-Cs
	for bug-bash@gnu.org; Tue, 10 Jul 2012 11:37:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <extern.martin.orlob@esolutions.de>)
	id 1SocQr-0000Lh-Ht
	for bug-bash@gnu.org; Tue, 10 Jul 2012 11:33:17 -0400
Received: from mail-gw1.esolutions.de ([83.125.48.134]:33932)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <extern.martin.orlob@esolutions.de>)
	id 1SocQS-0000HF-50; Tue, 10 Jul 2012 11:32:32 -0400
Received: from DEGAMES01.eso.local (degames01.eso.local [10.2.0.245])
	by mail-gw1.esolutions.de (Postfix) with ESMTPS;
	Tue, 10 Jul 2012 17:32:27 +0200 (CEST)
Received: from DEGAMES01.eso.local ([fe80::cc92:a95d:287c:5d50]) by
	DEGAMES01.eso.local ([fe80::cc92:a95d:287c:5d50%16]) with mapi id
	14.01.0289.001; Tue, 10 Jul 2012 17:32:26 +0200
From: "Orlob Martin (EXT)" <extern.Martin.Orlob@esolutions.de>
To: "bug-bash@gnu.org" <bug-bash@gnu.org>
Subject: retrun value of buildin (( )) / GNU bash, version 4.2.24(1)-release
	(x86_64-pc-linux-gnu)
Thread-Topic: retrun value of buildin (( )) / GNU bash, version
	4.2.24(1)-release (x86_64-pc-linux-gnu)
Thread-Index: Ac1esI3hyThwCSB/Qb2c13vP31FpJg==
Date: Tue, 10 Jul 2012 15:32:26 +0000
Message-ID: <9C7C85B51EF79842B89771202C15306109D4B4F1@DEGAMES01.eso.local>
Accept-Language: de-DE, en-US
Content-Language: de-DE
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [10.2.0.32]
MIME-Version: 1.0
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 83.125.48.134
X-Mailman-Approved-At: Tue, 10 Jul 2012 12:41:31 -0400
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
X-Content-Filtered-By: Mailman/MimeDel 2.1.14
Cc: "bash-maintainers@gnu.org" <bash-maintainers@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: Tue, 10 Jul 2012 15:37:17 -0000

Hallo,

I was using the build in (( )) function for  count up an index. I think I f=
ound a bug in GNU bash, version 4.2.24(1)-release (x86_64-pc-linux-gnu).

The (( )) function is working fine, but the corresponding return value does=
 not match.
 Check following small example (have the focus on $?)

----------SCRIPT START-----------------
#!/bin/bash

index=3D-3
for a in 1 2 3 4 5 6 7  ; do
        echo "Index before: $index"
        (( index++ ))
      echo "Return value: $?"
      echo "Index after: $index"
      echo "----"
done
----------SCRIPT END------------------

OUTPUT is:


Index before: -3
Return value: 0
Index after: -2
----
Index before: -2
Return value: 0
Index after: -1
----
Index before: -1
Return value: 0
Index after: 0
----
Index before: 0
Return value: 1     <-- ?BUG? The index was counted up correctly, from 0 to=
 1, but return value of (( ))-function is "1"
Index after: 1
----
Index before: 1
Return value: 0
Index after: 2
----
Index before: 2
Return value: 0
Index after: 3
----
Index before: 3
Return value: 0
Index after: 4


Cheers,

Martin







----------------------------------------------------------
Martin Orlob - Systemintegrator

Im Auftrag der
e.solutions GmbH
GVZ Halle N West / Eingang A,
Pascalstra=DFe 5, 85057 Ingolstadt, Germany

Registered Office:
Pascalstr. 5, 85057 Ingolstadt, Germany

Phone +49-8458-3332-702
Fax +49-8458-3332-20130
mailto: extern.Martin.Orlob@esolutions.de<mailto:extern.Martin.Orlob@esolut=
ions.de>

e.solutions GmbH
Managing Directors Uwe Reder, Dr. Riclef Schmidt-Clausen
Register Court Ingolstadt HRB 5221


From MAILER-DAEMON Tue Jul 10 12:57:14 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SodkQ-00013q-Ne
	for mharc-bug-bash@gnu.org; Tue, 10 Jul 2012 12:57:14 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46767)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1SodkN-0000va-EJ
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:57:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1SodkH-0007Dm-Tc
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:57:10 -0400
Received: from mx1.redhat.com ([209.132.183.28]:22057)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1SodkH-0007DL-La
	for bug-bash@gnu.org; Tue, 10 Jul 2012 12:57:05 -0400
Received: from int-mx09.intmail.prod.int.phx2.redhat.com
	(int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6AGv3Vg007937
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
	for <bug-bash@gnu.org>; Tue, 10 Jul 2012 12:57:03 -0400
Received: from [10.36.5.36] (vpn1-5-36.ams2.redhat.com [10.36.5.36])
	by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id q6AGv2wb011107
	for <bug-bash@gnu.org>; Tue, 10 Jul 2012 12:57:03 -0400
Message-ID: <4FFC5EDD.1050507@redhat.com>
Date: Tue, 10 Jul 2012 18:57:01 +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: retrun value of buildin (( )) / GNU bash,
	version 4.2.24(1)-release (x86_64-pc-linux-gnu)
References: <9C7C85B51EF79842B89771202C15306109D4B4F1@DEGAMES01.eso.local>
In-Reply-To: <9C7C85B51EF79842B89771202C15306109D4B4F1@DEGAMES01.eso.local>
Content-Type: text/plain; charset=UTF-8; format=flowed
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id
	q6AGv3Vg007937
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: Tue, 10 Jul 2012 16:57:13 -0000

On 07/10/2012 05:32 PM, Orlob Martin (EXT) wrote:
> Hallo,
>
> I was using the build in (( )) function for  count up an index. I think=
 I found a bug in GNU bash, version 4.2.24(1)-release (x86_64-pc-linux-gn=
u).
((expression)) is one of Compound Commands (not builtin nor function).
Quoting the manual page:
((expression))
The expression is evaluated according to the rules described
below under ARITHMETIC EVALUATION. If the value of the expres=E2=80=90
sion is non-zero, the return status is 0; otherwise the return
status is 1. This is exactly equivalent to let "expression".

See also a comment below inline.
>
> The (( )) function is working fine, but the corresponding return value =
does not match.
>   Check following small example (have the focus on $?)
>
> ----------SCRIPT START-----------------
> #!/bin/bash
>
> index=3D-3
> for a in 1 2 3 4 5 6 7  ; do
>          echo "Index before: $index"
>          (( index++ ))
>        echo "Return value: $?"
>        echo "Index after: $index"
>        echo "----"
> done
> ----------SCRIPT END------------------
>
> OUTPUT is:
>
>
> Index before: -3
> Return value: 0
> Index after: -2
> ----
> Index before: -2
> Return value: 0
> Index after: -1
> ----
> Index before: -1
> Return value: 0
> Index after: 0
> ----
> Index before: 0
> Return value: 1<-- ?BUG? The index was counted up correctly, from 0 to =
1, but return value of (( ))-function is "1"
No, works like intended. index value is 0 (zero) and thus return value=20
of (( )) is 1. And the value of index is post-incremented.
> Index after: 1
> ----
> Index before: 1
> Return value: 0
> Index after: 2
> ----
> Index before: 2
> Return value: 0
> Index after: 3
> ----
> Index before: 3
> Return value: 0
> Index after: 4
>
>
> Cheers,
>
> Martin
>
>
>
>
>
>
>
> ----------------------------------------------------------
> Martin Orlob - Systemintegrator
>
> Im Auftrag der
> e.solutions GmbH
> GVZ Halle N West / Eingang A,
> Pascalstra=C3=9Fe 5, 85057 Ingolstadt, Germany
>
> Registered Office:
> Pascalstr. 5, 85057 Ingolstadt, Germany
>
> Phone +49-8458-3332-702
> Fax +49-8458-3332-20130
> mailto: extern.Martin.Orlob@esolutions.de<mailto:extern.Martin.Orlob@es=
olutions.de>
>
> e.solutions GmbH
> Managing Directors Uwe Reder, Dr. Riclef Schmidt-Clausen
> Register Court Ingolstadt HRB 5221
>



From MAILER-DAEMON Thu Jul 12 14:19:13 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SpNyr-0005q5-MQ
	for mharc-bug-bash@gnu.org; Thu, 12 Jul 2012 14:19:13 -0400
Received: from eggs.gnu.org ([208.118.235.92]:45070)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dennistwilliamson@gmail.com>) id 1SpNym-0005nG-94
	for bug-bash@gnu.org; Thu, 12 Jul 2012 14:19:12 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dennistwilliamson@gmail.com>) id 1SpNyk-0000ts-Tj
	for bug-bash@gnu.org; Thu, 12 Jul 2012 14:19:08 -0400
Received: from mail-vb0-f41.google.com ([209.85.212.41]:36465)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dennistwilliamson@gmail.com>) id 1SpNyk-0000tZ-QS
	for bug-bash@gnu.org; Thu, 12 Jul 2012 14:19:06 -0400
Received: by vbkv13 with SMTP id v13so2132825vbk.0
	for <bug-bash@gnu.org>; Thu, 12 Jul 2012 11:19:06 -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=ZZPycqvieHm5g8NZzAiVdnRcai4sBQg5xeRyyut2kTQ=;
	b=vSK66jHPbIMEp4w81yczfhcpItwnC4P2Kywm5STdiox49wY/sQGjyuERqR+lc50xJa
	CER5G9DuQz6Et9bpcwK+m8f9Xyf2xg+0h61YpRnB7HhAehU5T56QkoSboFGOtib2EmAF
	qE8kuNR03Ym6sMPZQKTjgbM6I8sLePtc2yL0mwl7fW/DBVxzWj29h99VfvEgr/ZPsCgE
	ey98leAC34YAyLLZ0CKSpifgmtyIVO+/5zL/URshr4jfNabMDWa3aPAJAM/+gVg+dG6l
	NVM0DQ+EqZSr+x7eIdWF3BqvbnNl5YuZqd1YgUu/zshqETUbEzU8L5gojGTlpsku9e9x
	n8FQ==
MIME-Version: 1.0
Received: by 10.52.28.71 with SMTP id z7mr22000315vdg.105.1342117146126; Thu,
	12 Jul 2012 11:19:06 -0700 (PDT)
Received: by 10.58.225.67 with HTTP; Thu, 12 Jul 2012 11:19:05 -0700 (PDT)
Date: Thu, 12 Jul 2012 13:19:05 -0500
Message-ID: <CANaoh6+T4h=d5z_uF2EQNUo_9R_XiEmEXKFPOZr1LZuVQNSWKg@mail.gmail.com>
Subject: Case modification fails for Unicode characters
From: Dennis Williamson <dennistwilliamson@gmail.com>
To: bug-bash@gnu.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: 209.85.212.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: Thu, 12 Jul 2012 18:19:12 -0000

s=3D=C5=82=C3=B3d=C5=BA; echo "${s^^} ${s~~}"'
=C5=82=C3=B3D=C5=BA =C5=81=C3=93D=C5=B9

The to-upper and the undocumented toggle operators should produce
identical output in this situation, but only the toggle works
correctly.

This is in en_US.UTF-8, but also reported in pl_PL.utf-8. In Bash
4.2.24 and Bash 4.0.33.

--=20
Visit serverfault.com to get your system administration questions answered.


From MAILER-DAEMON Thu Jul 12 14:57:50 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SpOaE-000397-R7
	for mharc-bug-bash@gnu.org; Thu, 12 Jul 2012 14:57:50 -0400
Received: from eggs.gnu.org ([208.118.235.92]:53550)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1SpOaA-00036a-Jj
	for bug-bash@gnu.org; Thu, 12 Jul 2012 14:57:48 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1SpOa6-0004za-2b
	for bug-bash@gnu.org; Thu, 12 Jul 2012 14:57:46 -0400
Received: from mail-ob0-f169.google.com ([209.85.214.169]:63314)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1SpOa5-0004z1-Tp
	for bug-bash@gnu.org; Thu, 12 Jul 2012 14:57:41 -0400
Received: by obhx4 with SMTP id x4so4346147obh.0
	for <bug-bash@gnu.org>; Thu, 12 Jul 2012 11:57:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=/PoeMZi/m1oxjdj0ThAe4FJeP+mFvQgp/zyoIz/af6w=;
	b=bot81+CzpSIxLYPwAjVD6x/tyxxCs+RKjnFQQgPY7d8I8CQ7w0ZduQZ0/IRjayH6Ha
	mA2SAMkd+KgDLpv3/S9CUGT6Qm60ks8swd9apktGtoRkrDiTOeVlhMTAyVaQvC418oOE
	7ujC/Wi0yRReAfUVYv++ht+YNn3cSO0e0B+jn/Hz0oaEud88KCEiuu8/h4pNdL6TW7J9
	BF1nwEptN93tuX8i/LdlAS3AK/1BpTlrDT2+a9jON+MMXrkooQuBHEKnd/kOfzDHDdMJ
	HZlaHLTEsGvN9zfg4mT1NcBlP0rwju9/U43cYpoJbWMbgWb2baMCpkQYhZXONCdyQdnc
	ymYA==
MIME-Version: 1.0
Received: by 10.182.1.72 with SMTP id 8mr50720916obk.61.1342119460920; Thu, 12
	Jul 2012 11:57:40 -0700 (PDT)
Sender: pyroinajar@gmail.com
Received: by 10.60.9.201 with HTTP; Thu, 12 Jul 2012 11:57:40 -0700 (PDT)
In-Reply-To: <CANaoh6+T4h=d5z_uF2EQNUo_9R_XiEmEXKFPOZr1LZuVQNSWKg@mail.gmail.com>
References: <CANaoh6+T4h=d5z_uF2EQNUo_9R_XiEmEXKFPOZr1LZuVQNSWKg@mail.gmail.com>
Date: Thu, 12 Jul 2012 14:57:40 -0400
X-Google-Sender-Auth: FGSEljM5_O6vuatWw2r8546FWII
Message-ID: <CAPg6Z0_Qo8DLAEazgV9PtgQVQy-+C-sb8FEUF+QpMGVE9c9j0A@mail.gmail.com>
Subject: Re: Case modification fails for Unicode characters
From: DJ Mills <danielmills1@gmail.com>
To: Dennis Williamson <dennistwilliamson@gmail.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: Thu, 12 Jul 2012 18:57:49 -0000

On Thu, Jul 12, 2012 at 2:19 PM, Dennis Williamson
<dennistwilliamson@gmail.com> wrote:
> s=3D=C5=82=C3=B3d=C5=BA; echo "${s^^} ${s~~}"'
> =C5=82=C3=B3D=C5=BA =C5=81=C3=93D=C5=B9
>
> The to-upper and the undocumented toggle operators should produce
> identical output in this situation, but only the toggle works
> correctly.
>
> This is in en_US.UTF-8, but also reported in pl_PL.utf-8. In Bash
> 4.2.24 and Bash 4.0.33.
>
> --
> Visit serverfault.com to get your system administration questions answere=
d.
>

I get the same result with:
=C2=BB echo "$s" | tr '[:lower:]' '[:upper:]'
=C5=82=C3=B3D=C5=BA

=C2=BB locale
LANG=3Den_US.UTF-8
LC_CTYPE=3D"en_US.UTF-8"
LC_NUMERIC=3D"en_US.UTF-8"
LC_TIME=3D"en_US.UTF-8"
LC_COLLATE=3D"en_US.UTF-8"
LC_MONETARY=3D"en_US.UTF-8"
LC_MESSAGES=3D"en_US.UTF-8"
LC_PAPER=3D"en_US.UTF-8"
LC_NAME=3D"en_US.UTF-8"
LC_ADDRESS=3D"en_US.UTF-8"
LC_TELEPHONE=3D"en_US.UTF-8"
LC_MEASUREMENT=3D"en_US.UTF-8"
LC_IDENTIFICATION=3D"en_US.UTF-8"
LC_ALL=3D


This is a locale issue, and has nothing to do with bash itself...


From MAILER-DAEMON Thu Jul 12 20:24:40 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SpTgW-0001s0-US
	for mharc-bug-bash@gnu.org; Thu, 12 Jul 2012 20:24:40 -0400
Received: from eggs.gnu.org ([208.118.235.92]:43945)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ernesto.messina@gmail.com>) id 1SpMtE-0004DD-5i
	for bug-bash@gnu.org; Thu, 12 Jul 2012 13:09:24 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ernesto.messina@gmail.com>) id 1SpMtA-0003n5-4n
	for bug-bash@gnu.org; Thu, 12 Jul 2012 13:09:20 -0400
Received: from mail-we0-f169.google.com ([74.125.82.169]:33878)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ernesto.messina@gmail.com>) id 1SpMt9-0003mz-Ug
	for bug-bash@gnu.org; Thu, 12 Jul 2012 13:09:16 -0400
Received: by weys10 with SMTP id s10so820405wey.0
	for <bug-bash@gnu.org>; Thu, 12 Jul 2012 10:09:14 -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=NeaiRWjx5g6IqslwU+RiA9Xd6HsohQEX7y3KwYJQFKE=;
	b=gzqS6tBul1dYkNp/zNUxSxBF7wsq/vdQOWQ09EI9ytLEuM7033YOjmT20z2WDAZlcF
	BKluhNqmz0UWb2ZfaCKb7Qt04S1YDeOOv4dhH8l2zyDwiq/XyEmLOdudGMN2MWSx9p9X
	oXxhm5SDmssmCoi3T3HPDPL0svzToF5cngCqm4DGs42orwinUvmxt8CHyT6Elj1mAkQT
	TgOztRXmyqyV7Lb3BvQqvUZHlbgMturyGGW+yASPWsbhdcBg7Gi+HeioaeGQQIZ/A9j4
	XqyhCv+hOF2Tyy8qSIpNbhWc2sKJoXbD3fT9B9JBnC3XF580heVln/xzYmqu+LHk9YU1
	K+3g==
MIME-Version: 1.0
Received: by 10.180.14.193 with SMTP id r1mr30118832wic.19.1342112954551; Thu,
	12 Jul 2012 10:09:14 -0700 (PDT)
Received: by 10.216.212.208 with HTTP; Thu, 12 Jul 2012 10:09:14 -0700 (PDT)
Date: Thu, 12 Jul 2012 14:09:14 -0300
Message-ID: <CAM5YFoMpT3HbNGrb35DDjEDw+OF-O_3kEd0RVomTO2n9XV7=HA@mail.gmail.com>
Subject: Overflow Bug
From: Ernesto Messina <ernesto.messina@gmail.com>
To: bug-bash@gnu.org
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.82.169
X-Mailman-Approved-At: Thu, 12 Jul 2012 20:24:39 -0400
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: Thu, 12 Jul 2012 17:09:24 -0000

Hello, I think I found an overflow bug. I got the follow C program:

#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[])
{
    char a[10];
    int i;

    strcpy(a, argv[1]);

  return 0;
}

Compiling with: gcc program.c -o program
And running: program `perl -e 'print "a" x 24'`

The terminal loses the control, entering into a infinite buckle, and
saying: (a variable number here):    transferring control: ./programm


I'm on: $uname -a
Linux cosmo 2.6.32-5-amd64 #1 SMP Sun May 6 04:00:17 UTC 2012 x86_64
GNU/Linux


-------------
Greetings from Argentina.
Ernesto Messina.

From MAILER-DAEMON Thu Jul 12 20:46:42 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SpU1q-0004iy-Nt
	for mharc-bug-bash@gnu.org; Thu, 12 Jul 2012 20:46:42 -0400
Received: from eggs.gnu.org ([208.118.235.92]:56413)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dennistwilliamson@gmail.com>) id 1SpU1m-0004gv-Gu
	for bug-bash@gnu.org; Thu, 12 Jul 2012 20:46:40 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dennistwilliamson@gmail.com>) id 1SpU1k-0002Wz-RI
	for bug-bash@gnu.org; Thu, 12 Jul 2012 20:46:38 -0400
Received: from mail-vc0-f169.google.com ([209.85.220.169]:47387)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dennistwilliamson@gmail.com>) id 1SpU1k-0002Wt-G7
	for bug-bash@gnu.org; Thu, 12 Jul 2012 20:46:36 -0400
Received: by vcbfl10 with SMTP id fl10so2399224vcb.0
	for <bug-bash@gnu.org>; Thu, 12 Jul 2012 17:46:36 -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=UiKp4b2nREMhvGZdV+a1rmaTs2cUQkINCH61RK7ivt4=;
	b=F/AG2qYXG1pWZWC6FMRKBTAKnP+BeIBzp243iJIQ+sXyZ1tqiIjoq/TQdlFdE4HGyD
	7JiwwsABkOc5IPBPasDyGbz2jtVDSSPk6j5gqYbyj3t9DIuuRYAZv+003fcAb7fHZdoC
	gspCk1xSNvLT1fX/HoEprn7+lbpiTvyDEiT6x1GxJlnzyLB+Zf9r11mI9qApl/AQEBE3
	i/Si1SJNw8Mrso6HLX3N9zDD+MWRAFbfHCbFZSbSsu1osCbNQKvAVnYUjSyixmBFBJtn
	fzmWglZ0ERWP2Cwpg/Hu0bJi2HBfOhMtXy1IFpLkXIZpv5pRs/hzozRFb+/863HP0jIp
	dTpg==
MIME-Version: 1.0
Received: by 10.220.223.195 with SMTP id il3mr136117vcb.57.1342140395965; Thu,
	12 Jul 2012 17:46:35 -0700 (PDT)
Received: by 10.58.225.67 with HTTP; Thu, 12 Jul 2012 17:46:35 -0700 (PDT)
In-Reply-To: <CAPg6Z0_Qo8DLAEazgV9PtgQVQy-+C-sb8FEUF+QpMGVE9c9j0A@mail.gmail.com>
References: <CANaoh6+T4h=d5z_uF2EQNUo_9R_XiEmEXKFPOZr1LZuVQNSWKg@mail.gmail.com>
	<CAPg6Z0_Qo8DLAEazgV9PtgQVQy-+C-sb8FEUF+QpMGVE9c9j0A@mail.gmail.com>
Date: Thu, 12 Jul 2012 19:46:35 -0500
Message-ID: <CANaoh6JWmixxBv-EFiAj8FQAiH51JYuWRnLdSt59tZdXx3RpAw@mail.gmail.com>
Subject: Re: Case modification fails for Unicode characters
From: Dennis Williamson <dennistwilliamson@gmail.com>
To: DJ Mills <danielmills1@gmail.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.220.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, 13 Jul 2012 00:46:40 -0000

On Thu, Jul 12, 2012 at 1:57 PM, DJ Mills <danielmills1@gmail.com> wrote:
> On Thu, Jul 12, 2012 at 2:19 PM, Dennis Williamson
> <dennistwilliamson@gmail.com> wrote:
>> s=3D=C5=82=C3=B3d=C5=BA; echo "${s^^} ${s~~}"'
>> =C5=82=C3=B3D=C5=BA =C5=81=C3=93D=C5=B9
>>
>> The to-upper and the undocumented toggle operators should produce
>> identical output in this situation, but only the toggle works
>> correctly.
>>
>> This is in en_US.UTF-8, but also reported in pl_PL.utf-8. In Bash
>> 4.2.24 and Bash 4.0.33.
>>
>> --
>> Visit serverfault.com to get your system administration questions answer=
ed.
>>
>
> I get the same result with:
> =C2=BB echo "$s" | tr '[:lower:]' '[:upper:]'
> =C5=82=C3=B3D=C5=BA
>
> =C2=BB locale
> LANG=3Den_US.UTF-8
> LC_CTYPE=3D"en_US.UTF-8"
> LC_NUMERIC=3D"en_US.UTF-8"
> LC_TIME=3D"en_US.UTF-8"
> LC_COLLATE=3D"en_US.UTF-8"
> LC_MONETARY=3D"en_US.UTF-8"
> LC_MESSAGES=3D"en_US.UTF-8"
> LC_PAPER=3D"en_US.UTF-8"
> LC_NAME=3D"en_US.UTF-8"
> LC_ADDRESS=3D"en_US.UTF-8"
> LC_TELEPHONE=3D"en_US.UTF-8"
> LC_MEASUREMENT=3D"en_US.UTF-8"
> LC_IDENTIFICATION=3D"en_US.UTF-8"
> LC_ALL=3D
>
>
> This is a locale issue, and has nothing to do with bash itself...


That's partly true except that ~~ works.

--=20
Visit serverfault.com to get your system administration questions answered.


From MAILER-DAEMON Fri Jul 13 01:10:13 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SpY8r-0007II-RW
	for mharc-bug-bash@gnu.org; Fri, 13 Jul 2012 01:10:13 -0400
Path: usenet.stanford.edu!postnews.google.com!nw7g2000pbb.googlegroups.com!not-for-mail
From: Richy Boy <1richyboy@gmail.com>
Newsgroups: gnu.bash.bug
Subject: Software Developer Required in Mumbai
Date: Thu, 12 Jul 2012 22:09:52 -0700 (PDT)
Organization: http://groups.google.com
Lines: 34
Message-ID: <f23c98fc-164f-46ab-ac23-8944b51451dc@nw7g2000pbb.googlegroups.com>
NNTP-Posting-Host: 27.106.31.71
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1342156192 10542 127.0.0.1 (13 Jul 2012 05:09:52
	GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 13 Jul 2012 05:09:52 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: nw7g2000pbb.googlegroups.com; posting-host=27.106.31.71;
	posting-account=lDnCbAoAAABgZJBwRFnOxm9G93q2ugF_
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.1;
	rv:13.0) Gecko/20100101 Firefox/13.0.1,gzip(gfe)
Xref: usenet.stanford.edu gnu.bash.bug:24876
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, 13 Jul 2012 05:10:11 -0000


=E2=86=90 D2K Technologies Requires Software Developer
Software Developer Required in Mumbai
Posted on July 13, 2012 by admin

Job Details

Area of Work: General / Other Software

Industry: IT =E2=80=93 Software

Location: Mumbai / Navi Mumbai / Thane

Job Description

Desired Candidate Profile

Education: B.Tech /B.E., B.Sc

Should have very good knowledge on crystal report, vb.net2.0/3.5,
SQL2005, Win forms good communication skill, attitude, handle
pressure, willing to travel.

Job Description

Should be able to design code and integrate the reports. Good
understanding of requirement, vb.net2.0/3.5/4.0,Sql2005, crystal
report joining in 10days.Office

Industry: IT Software, Software Services

Location: Mumbai

http://www.ways2work.in/software-developer-required-in-mumbai/

From MAILER-DAEMON Fri Jul 13 01:53:50 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SpYp4-0006mj-EX
	for mharc-bug-bash@gnu.org; Fri, 13 Jul 2012 01:53:50 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48981)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SpYp2-0006kx-7f
	for bug-bash@gnu.org; Fri, 13 Jul 2012 01:53:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SpYp1-0007x5-8W
	for bug-bash@gnu.org; Fri, 13 Jul 2012 01:53:48 -0400
Received: from mail-wg0-f45.google.com ([74.125.82.45]:37711)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SpYp1-0007wt-1a
	for bug-bash@gnu.org; Fri, 13 Jul 2012 01:53:47 -0400
Received: by wgbdt14 with SMTP id dt14so2518867wgb.26
	for <bug-bash@gnu.org>; Thu, 12 Jul 2012 22:53:45 -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=7g1WZs1cO3F3HPpTvWA/XMdIHJT3uZOmBri78Qpv3Gk=;
	b=X96gcPuh6j2WlL4BMhXHDfBLiXaY+xKx/p3jKb1+EBCXRTbwPbiyAJuCPcTmB97vib
	ueJchChXb5ldcbDXbYbijqVHeujgJWmDJES8HXQcq0D/CYzIzaDA8gesWjxujLaHWX0V
	XHxIaoHAdLEtotNlKoqIUYs85cEltV65ryJs7xbtGoHDfWeTLitwrSNoBfwBDmBEpLCx
	WeqORouo5vLVcxBYjjPLDVno/VCY9FlbglA98+4W3jzyr/VDdbdCSjZQwNl8VFoW7f6G
	kTJViSZc1cyenYdZRAxo/BUoV4WaP5cny0KowNduYJwYWydZFT42MBlyamxdHbiJXwaR
	UoAw==
Received: by 10.180.91.1 with SMTP id ca1mr1217165wib.8.1342158825458; Thu, 12
	Jul 2012 22:53:45 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.194.10.71 with HTTP; Thu, 12 Jul 2012 22:53:25 -0700 (PDT)
In-Reply-To: <CAM5YFoMpT3HbNGrb35DDjEDw+OF-O_3kEd0RVomTO2n9XV7=HA@mail.gmail.com>
References: <CAM5YFoMpT3HbNGrb35DDjEDw+OF-O_3kEd0RVomTO2n9XV7=HA@mail.gmail.com>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Fri, 13 Jul 2012 08:53:25 +0300
Message-ID: <CAPSX3sS33wMRbQbuBzYXK+bSmObPEVzbhL4o23wWgD6jBu4bgQ@mail.gmail.com>
Subject: Re: Overflow Bug
To: Ernesto Messina <ernesto.messina@gmail.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: 74.125.82.45
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, 13 Jul 2012 05:53:49 -0000

On Thu, Jul 12, 2012 at 8:09 PM, Ernesto Messina
<ernesto.messina@gmail.com> wrote:
> Hello, I think I found an overflow bug. I got the follow C program:
>
> #include <stdio.h>
> #include <string.h>
>
> int main(int argc, char *argv[])
> {
>     char a[10];
>     int i;
>
>     strcpy(a, argv[1]);
>
>   return 0;
> }
>
> Compiling with: gcc program.c -o program
> And running: program `perl -e 'print "a" x 24'`
>
> The terminal loses the control, entering into a infinite buckle, and

bash is not the terminal and is not involved once the program runs,
and yes, writing buggy programs can cause buggy behaviour. On this
system man strcpy says under BUGS:

       If the destination string of a strcpy() is not large enough, then  a=
ny=E2=80=90
       thing  might  happen.   Overflowing  fixed-length  string  buffers i=
s a
       favorite cracker technique for taking complete control of the  machi=
ne.


PS: "infinite loop" not "infinite buckle"


From MAILER-DAEMON Fri Jul 13 01:56:53 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SpYs1-0007Bu-R6
	for mharc-bug-bash@gnu.org; Fri, 13 Jul 2012 01:56:53 -0400
Received: from eggs.gnu.org ([208.118.235.92]:47767)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SpYrz-0007Bo-SJ
	for bug-bash@gnu.org; Fri, 13 Jul 2012 01:56:52 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SpYrx-0000Gm-Mk
	for bug-bash@gnu.org; Fri, 13 Jul 2012 01:56:51 -0400
Received: from mail-wi0-f177.google.com ([209.85.212.177]:40085)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SpYrx-0000GV-Gb
	for bug-bash@gnu.org; Fri, 13 Jul 2012 01:56:49 -0400
Received: by wibhm11 with SMTP id hm11so184960wib.12
	for <bug-bash@gnu.org>; Thu, 12 Jul 2012 22:56:48 -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=FmHXfca6+BVMoCdCwcQPbrdCc+QlExTuyjoig2ZA0tk=;
	b=HkPIprKPWzQJbFJlSC+RjpvfO55nSOR3PtvdpmU6Ykm1EHTKJJBdloAmOG4IUHcDGK
	nS6WgFJQwERaMu2pPW7xYm1y21o7x/t4eXZ11j5JHEQucjSw49WR+GW2OvaasAstdFax
	cnJ9Xb+/eLSw3R7MuHUnLvLJWynORgrUaIpGZDtSEwk8wKYW6sXnDPuBFaiDehBamouJ
	m/XOdfX8vWvjqRtwL08nG54rioLxDFhWhL56avbptHUBfqBZhE/vt0g8YBCi4JIb3WfS
	cJ7RxmeePpcD3mRch5TQzKXNiU7akmWgltGXkExjWJdeqIe9iucB4The1wEy2NWKLn+d
	z9SA==
Received: by 10.180.84.169 with SMTP id a9mr1223673wiz.8.1342159008561; Thu,
	12 Jul 2012 22:56:48 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.194.10.71 with HTTP; Thu, 12 Jul 2012 22:56:28 -0700 (PDT)
In-Reply-To: <CANaoh6JWmixxBv-EFiAj8FQAiH51JYuWRnLdSt59tZdXx3RpAw@mail.gmail.com>
References: <CANaoh6+T4h=d5z_uF2EQNUo_9R_XiEmEXKFPOZr1LZuVQNSWKg@mail.gmail.com>
	<CAPg6Z0_Qo8DLAEazgV9PtgQVQy-+C-sb8FEUF+QpMGVE9c9j0A@mail.gmail.com>
	<CANaoh6JWmixxBv-EFiAj8FQAiH51JYuWRnLdSt59tZdXx3RpAw@mail.gmail.com>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Fri, 13 Jul 2012 08:56:28 +0300
Message-ID: <CAPSX3sSjc3-J=d0LsH85RHS2FOxdP0k17h2bAe2WE9SgVgeysQ@mail.gmail.com>
Subject: Re: Case modification fails for Unicode characters
To: Dennis Williamson <dennistwilliamson@gmail.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.212.177
Cc: DJ Mills <danielmills1@gmail.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: Fri, 13 Jul 2012 05:56:52 -0000

On Fri, Jul 13, 2012 at 3:46 AM, Dennis Williamson
<dennistwilliamson@gmail.com> wrote:
> On Thu, Jul 12, 2012 at 1:57 PM, DJ Mills <danielmills1@gmail.com> wrote:
>> On Thu, Jul 12, 2012 at 2:19 PM, Dennis Williamson
>> <dennistwilliamson@gmail.com> wrote:
>>> s=3D=C5=82=C3=B3d=C5=BA; echo "${s^^} ${s~~}"'
>>> =C5=82=C3=B3D=C5=BA =C5=81=C3=93D=C5=B9
>>>
>>> The to-upper and the undocumented toggle operators should produce
>>> identical output in this situation, but only the toggle works
>>> correctly.
>>>
>>> This is in en_US.UTF-8, but also reported in pl_PL.utf-8. In Bash
>>> 4.2.24 and Bash 4.0.33.
>>>
>>> --
>>> Visit serverfault.com to get your system administration questions answe=
red.
>>>
>>
>> I get the same result with:
>> =C2=BB echo "$s" | tr '[:lower:]' '[:upper:]'
>> =C5=82=C3=B3D=C5=BA
>>
>> =C2=BB locale
>> LANG=3Den_US.UTF-8
>> LC_CTYPE=3D"en_US.UTF-8"
>> LC_NUMERIC=3D"en_US.UTF-8"
>> LC_TIME=3D"en_US.UTF-8"
>> LC_COLLATE=3D"en_US.UTF-8"
>> LC_MONETARY=3D"en_US.UTF-8"
>> LC_MESSAGES=3D"en_US.UTF-8"
>> LC_PAPER=3D"en_US.UTF-8"
>> LC_NAME=3D"en_US.UTF-8"
>> LC_ADDRESS=3D"en_US.UTF-8"
>> LC_TELEPHONE=3D"en_US.UTF-8"
>> LC_MEASUREMENT=3D"en_US.UTF-8"
>> LC_IDENTIFICATION=3D"en_US.UTF-8"
>> LC_ALL=3D
>>
>>
>> This is a locale issue, and has nothing to do with bash itself...
>
>
> That's partly true except that ~~ works.
>
Also many (all?) versions of tr don't know about locale, eg here:
$ echo =C5=BA | tr =C5=BA a
aa


From MAILER-DAEMON Fri Jul 13 03:40:21 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SpaU9-00081j-1E
	for mharc-bug-bash@gnu.org; Fri, 13 Jul 2012 03:40:21 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57859)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SpaU3-0007yn-8Y
	for bug-bash@gnu.org; Fri, 13 Jul 2012 03:40:19 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SpaTx-0000IV-BR
	for bug-bash@gnu.org; Fri, 13 Jul 2012 03:40:15 -0400
Received: from mail-out.m-online.net ([212.18.0.9]:42128)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SpaTx-00005f-4e
	for bug-bash@gnu.org; Fri, 13 Jul 2012 03:40:09 -0400
Received: from frontend4.mail.m-online.net (unknown [192.168.8.180])
	by mail-out.m-online.net (Postfix) with ESMTP id 3WYQtX72pmz4KK6w;
	Fri, 13 Jul 2012 09:41:08 +0200 (CEST)
Received: from igel.home (ppp-93-104-150-219.dynamic.mnet-online.de
	[93.104.150.219])
	by mail.mnet-online.de (Postfix) with ESMTPA id 3WYQsC04Blzbbgk;
	Fri, 13 Jul 2012 09:39:59 +0200 (CEST)
Received: by igel.home (Postfix, from userid 501)
	id 75646CA2A2; Fri, 13 Jul 2012 09:39:58 +0200 (CEST)
From: Andreas Schwab <schwab@linux-m68k.org>
To: DJ Mills <danielmills1@gmail.com>
Subject: Re: Case modification fails for Unicode characters
References: <CANaoh6+T4h=d5z_uF2EQNUo_9R_XiEmEXKFPOZr1LZuVQNSWKg@mail.gmail.com>
	<CAPg6Z0_Qo8DLAEazgV9PtgQVQy-+C-sb8FEUF+QpMGVE9c9j0A@mail.gmail.com>
X-Yow: On the road, ZIPPY is a pinhead without a purpose, but never
	without a POINT.
Date: Fri, 13 Jul 2012 09:39:57 +0200
In-Reply-To: <CAPg6Z0_Qo8DLAEazgV9PtgQVQy-+C-sb8FEUF+QpMGVE9c9j0A@mail.gmail.com>
	(DJ Mills's message of "Thu, 12 Jul 2012 14:57:40 -0400")
Message-ID: <m2394ww1ma.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: Dennis Williamson <dennistwilliamson@gmail.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: Fri, 13 Jul 2012 07:40:19 -0000

It _is_ a bash bug.

diff --git a/lib/sh/casemod.c b/lib/sh/casemod.c
index 3127d8c..d58b216 100644
--- a/lib/sh/casemod.c
+++ b/lib/sh/casemod.c
@@ -227,8 +227,8 @@ sh_modcase (string, pat, flags)
 	  {
 	  default:
 	  case CASE_NOOP:  nwc = wc; break;
-	  case CASE_UPPER:  nwc = TOUPPER (wc); break;
-	  case CASE_LOWER:  nwc = TOLOWER (wc); break;
+	  case CASE_UPPER:  nwc = _to_wupper (wc); break;
+	  case CASE_LOWER:  nwc = _to_wlower (wc); break;
 	  case CASE_TOGGLEALL:
 	  case CASE_TOGGLE: nwc = TOGGLE (wc); break;
 	  }

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 Fri Jul 13 08:35:24 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Spf5g-0003B0-J8
	for mharc-bug-bash@gnu.org; Fri, 13 Jul 2012 08:35:24 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33396)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Spf5Z-00039A-As
	for bug-bash@gnu.org; Fri, 13 Jul 2012 08:35:22 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Spf5P-0007JA-RM
	for bug-bash@gnu.org; Fri, 13 Jul 2012 08:35:17 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:43279
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Spf5P-00072q-Kz
	for bug-bash@gnu.org; Fri, 13 Jul 2012 08:35:07 -0400
Received: (qmail 28420 invoked from network); 13 Jul 2012 12:34:43 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Fri, 13 Jul 2012 08:34:43 -0400
Received: (qmail 11745 invoked by uid 563); 13 Jul 2012 12:34:42 -0000
Date: Fri, 13 Jul 2012 08:34:42 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Ernesto Messina <ernesto.messina@gmail.com>, bug-bash@gnu.org
Subject: Re: Overflow Bug
Message-ID: <20120713123442.GS8239@eeg.ccf.org>
References: <CAM5YFoMpT3HbNGrb35DDjEDw+OF-O_3kEd0RVomTO2n9XV7=HA@mail.gmail.com>
	<CAPSX3sS33wMRbQbuBzYXK+bSmObPEVzbhL4o23wWgD6jBu4bgQ@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAPSX3sS33wMRbQbuBzYXK+bSmObPEVzbhL4o23wWgD6jBu4bgQ@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
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, 13 Jul 2012 12:35:23 -0000

On Fri, Jul 13, 2012 at 08:53:25AM +0300, Pierre Gaston wrote:
> On Thu, Jul 12, 2012 at 8:09 PM, Ernesto Messina
> <ernesto.messina@gmail.com> wrote:
> > Hello, I think I found an overflow bug. I got the follow C program:
> >
> > #include <stdio.h>
> > #include <string.h>
> >
> > int main(int argc, char *argv[])
> > {
> >     char a[10];
> >     int i;
> >
> >     strcpy(a, argv[1]);
> >
> >   return 0;
> > }
> >
> > Compiling with: gcc program.c -o program
> > And running: program `perl -e 'print "a" x 24'`
> >
> > The terminal loses the control, entering into a infinite buckle, and
> 
> bash is not the terminal and is not involved once the program runs,
> and yes, writing buggy programs can cause buggy behaviour. On this
> system man strcpy says under BUGS:

It's not even related to the terminal, either.  The C program does not
perform any input or output at all (despite the <stdio.h> include).
Your platform goes into an infinite loop when you run this program,
so the terminal just sits there waiting for output that never arrives.
Bash just sits there waiting for its child process (your C program) to
terminate, which it never does (until you hit Ctrl-C or whatever your
terminal has mapped to Interrupt).

So, it's not a bug in either bash or the terminal.  It's a bug in your
C program.


From MAILER-DAEMON Fri Jul 13 09:15:55 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Spfit-0005JZ-CV
	for mharc-bug-bash@gnu.org; Fri, 13 Jul 2012 09:15:55 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52265)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Spfin-0005F1-RD
	for bug-bash@gnu.org; Fri, 13 Jul 2012 09:15:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Spfih-0002Tw-NB
	for bug-bash@gnu.org; Fri, 13 Jul 2012 09:15:49 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:61182)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Spfih-0002Tp-7k
	for bug-bash@gnu.org; Fri, 13 Jul 2012 09:15:43 -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 BMZ83677;
	Fri, 13 Jul 2012 09:15:42 -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 BBC02326 (AUTH cpr);
	Fri, 13 Jul 2012 09:15:41 -0400 (EDT)
Message-ID: <50001F7D.5070207@case.edu>
Date: Fri, 13 Jul 2012 09:15:41 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: Andreas Schwab <schwab@linux-m68k.org>
Subject: Re: Case modification fails for Unicode characters
References: <CANaoh6+T4h=d5z_uF2EQNUo_9R_XiEmEXKFPOZr1LZuVQNSWKg@mail.gmail.com>
	<CAPg6Z0_Qo8DLAEazgV9PtgQVQy-+C-sb8FEUF+QpMGVE9c9j0A@mail.gmail.com>
	<m2394ww1ma.fsf@igel.home>
In-Reply-To: <m2394ww1ma.fsf@igel.home>
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: DJ Mills <danielmills1@gmail.com>, chet.ramey@case.edu,
	Dennis Williamson <dennistwilliamson@gmail.com>, 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: Fri, 13 Jul 2012 13:15:53 -0000

On 7/13/12 3:39 AM, Andreas Schwab wrote:
> It _is_ a bash bug.

Thanks for the fix.

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 Jul 13 10:05:36 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SpgUy-0007aK-Ng
	for mharc-bug-bash@gnu.org; Fri, 13 Jul 2012 10:05:36 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60596)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SpgUv-0007a7-O2
	for Bug-bash@gnu.org; Fri, 13 Jul 2012 10:05:35 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SpgUp-0002P7-Vo
	for Bug-bash@gnu.org; Fri, 13 Jul 2012 10:05:33 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:7228)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>)
	id 1SpgUj-0002FY-R1; Fri, 13 Jul 2012 10:05:21 -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 CAX95794; Fri, 13 Jul 2012 10:05:21 -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 BBC14004 (AUTH cpr);
	Fri, 13 Jul 2012 10:05:21 -0400 (EDT)
Message-ID: <50002B20.5020409@case.edu>
Date: Fri, 13 Jul 2012 10:05:20 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: Daniel Amthor <INVALID.NOREPLY@gnu.org>
Subject: Re: [patch #7818] Loop breaks when trying to write to a readonly
	variable
References: <20120713-125304.sv88655.68139@savannah.gnu.org>
In-Reply-To: <20120713-125304.sv88655.68139@savannah.gnu.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: Daniel Amthor <daniel.amthor@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: Fri, 13 Jul 2012 14:05:35 -0000

On 7/13/12 8:53 AM, Daniel Amthor wrote:
> URL:
>   <http://savannah.gnu.org/patch/?7818>
> 
>                  Summary: Loop breaks when trying to write to a readonly
> variable

Yeah, that's an assignment error.  Posix says a non-interactive shell
should exit in that case and that an interactive shell should write an
error message without exiting.  Bash doesn't exit the shell, but it does
cause the current command to fail.


> In a construct like this: 
> 
> var=foo
> readonly var
> for num in 1 2 3 4 5
> do 
> 	if [ $num -eq 3 ] 
> 	then
> 		var=bar
> 	fi  	
> 	echo $num
> done
> 
> the loop breaks in the third round, after trying to set the r/o variable.

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 Jul 13 10:31:17 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Spgtp-0005so-7p
	for mharc-bug-bash@gnu.org; Fri, 13 Jul 2012 10:31:17 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33038)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Spgtj-0005rL-PW
	for bug-bash@gnu.org; Fri, 13 Jul 2012 10:31:15 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Spgtf-0001Wt-Iz
	for bug-bash@gnu.org; Fri, 13 Jul 2012 10:31:11 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:56515)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Spgtf-0001Wn-Eh
	for bug-bash@gnu.org; Fri, 13 Jul 2012 10:31:07 -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 CAX98764; Fri, 13 Jul 2012 10:31:06 -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 AZT12756 (AUTH cpr);
	Fri, 13 Jul 2012 10:31:06 -0400 (EDT)
Message-ID: <5000312A.7030706@case.edu>
Date: Fri, 13 Jul 2012 10:31:06 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: Dennis Williamson <dennistwilliamson@gmail.com>
Subject: Re: Case modification fails for Unicode characters
References: <CANaoh6+T4h=d5z_uF2EQNUo_9R_XiEmEXKFPOZr1LZuVQNSWKg@mail.gmail.com>
In-Reply-To: <CANaoh6+T4h=d5z_uF2EQNUo_9R_XiEmEXKFPOZr1LZuVQNSWKg@mail.gmail.com>
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, 13 Jul 2012 14:31:15 -0000

On 7/12/12 2:19 PM, Dennis Williamson wrote:
> s=łódź; echo "${s^^} ${s~~}"'
> łóDź ŁÓDŹ
> 
> The to-upper and the undocumented toggle operators should produce
> identical output in this situation, but only the toggle works
> correctly.

Thanks for the report.  Andreas's fix is correct.  That will be in 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 Fri Jul 13 11:28:32 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SphnE-00047T-LS
	for mharc-bug-bash@gnu.org; Fri, 13 Jul 2012 11:28:32 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42711)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SphnB-00046b-1D
	for Bug-bash@gnu.org; Fri, 13 Jul 2012 11:28:30 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sphn9-0008MQ-NE
	for Bug-bash@gnu.org; Fri, 13 Jul 2012 11:28:28 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:31790)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sphn9-0008MJ-I0
	for Bug-bash@gnu.org; Fri, 13 Jul 2012 11:28:27 -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 CAY03348; Fri, 13 Jul 2012 11:28:26 -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 BBC26922 (AUTH cpr);
	Fri, 13 Jul 2012 11:28:26 -0400 (EDT)
Message-ID: <50003E9A.4040304@case.edu>
Date: Fri, 13 Jul 2012 11:28:26 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: Daniel Amthor <daniel.amthor@gmail.com>
Subject: Re: [patch #7818] Loop breaks when trying to write to a readonly
	variable
References: <20120713-125304.sv88655.68139@savannah.gnu.org>
	<50002B20.5020409@case.edu>
	<CADnsMsp10-my0pNvN41C9jVm5US9mdBXj-tr26rLqVVk=NEiAA@mail.gmail.com>
In-Reply-To: <CADnsMsp10-my0pNvN41C9jVm5US9mdBXj-tr26rLqVVk=NEiAA@mail.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: 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, 13 Jul 2012 15:28:30 -0000

On 7/13/12 11:17 AM, Daniel Amthor wrote:
> Chet,
> 
> 2012/7/13 Chet Ramey <chet.ramey@case.edu <mailto:chet.ramey@case.edu>>
> 
>     On 7/13/12 8:53 AM, Daniel Amthor wrote:
> 
>     Yeah, that's an assignment error.  Posix says a non-interactive shell
>     should exit in that case and that an interactive shell should write an
>     error message without exiting.  Bash doesn't exit the shell, but it does
>     cause the current command to fail.
> 
> So...works as designed ?

Yes.  I think aborting the shell script is a little drastic, but bash does
it in Posix mode.

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 Jul 14 01:25:20 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Spur2-0006FZ-OW
	for mharc-bug-bash@gnu.org; Sat, 14 Jul 2012 01:25:20 -0400
Received: from eggs.gnu.org ([208.118.235.92]:54600)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <daniel.amthor@gmail.com>) id 1Sphd3-0001nQ-78
	for Bug-bash@gnu.org; Fri, 13 Jul 2012 11:18:05 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <daniel.amthor@gmail.com>) id 1Sphcv-0005KG-Hn
	for Bug-bash@gnu.org; Fri, 13 Jul 2012 11:18:01 -0400
Received: from mail-we0-f169.google.com ([74.125.82.169]:61396)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <daniel.amthor@gmail.com>) id 1Sphcv-0005KA-Bh
	for Bug-bash@gnu.org; Fri, 13 Jul 2012 11:17:53 -0400
Received: by weys10 with SMTP id s10so1638315wey.0
	for <Bug-bash@gnu.org>; Fri, 13 Jul 2012 08:17: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;
	bh=o8GN1KQMoh2nWQXI2KUyYMxRa8memfNJzLmpUtARbog=;
	b=z9ATUf1ocXjDHzYkpLngdndK878J057srcfA1apg/xLC2KtlifVRMtO99RQRc3En8Q
	Kt7/OaKW9OweIg9ugJEcpH8YQW8BdORo84NZsnowAgW+CbhpgZoSxlOaoTnXVXIYQyO9
	ukwrlRZRVbjiSbQr2VJ+JGjdnyApEgucLmRoeCCCS+JxThuheSt/5w7yLYScYHkd2HuJ
	J5MBcj0z7RS/lWTx+uEjZReSy45nn/5WRGfoJa+vnlpQ5QguALcUAEdseIngxmh1aF2z
	PBKnvsvMwx7zDydUGmpaqhqJyB5kD9qwQZw+DSdwKIYxF1Hm3S3iSRQLfygXCSaMphXd
	NiOQ==
Received: by 10.180.14.8 with SMTP id l8mr3518756wic.6.1342192672148; Fri, 13
	Jul 2012 08:17:52 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.223.9.133 with HTTP; Fri, 13 Jul 2012 08:17:11 -0700 (PDT)
In-Reply-To: <50002B20.5020409@case.edu>
References: <20120713-125304.sv88655.68139@savannah.gnu.org>
	<50002B20.5020409@case.edu>
From: Daniel Amthor <daniel.amthor@gmail.com>
Date: Fri, 13 Jul 2012 17:17:11 +0200
Message-ID: <CADnsMsp10-my0pNvN41C9jVm5US9mdBXj-tr26rLqVVk=NEiAA@mail.gmail.com>
Subject: Re: [patch #7818] Loop breaks when trying to write to a readonly
	variable
To: chet.ramey@case.edu
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.82.169
X-Mailman-Approved-At: Sat, 14 Jul 2012 01:25:19 -0400
Content-Type: text/plain; charset=ISO-8859-1
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: Fri, 13 Jul 2012 15:18:05 -0000

Chet,

2012/7/13 Chet Ramey <chet.ramey@case.edu>

> On 7/13/12 8:53 AM, Daniel Amthor wrote:
>
> Yeah, that's an assignment error.  Posix says a non-interactive shell
> should exit in that case and that an interactive shell should write an
> error message without exiting.  Bash doesn't exit the shell, but it does
> cause the current command to fail.
>
So...works as designed ?

Best
Dan

From MAILER-DAEMON Sat Jul 14 14:03:33 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sq6gn-0004IL-D1
	for mharc-bug-bash@gnu.org; Sat, 14 Jul 2012 14:03:33 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38730)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sq6gl-0004Dy-9I
	for bug-bash@gnu.org; Sat, 14 Jul 2012 14:03:32 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Sq6gk-0006C0-48
	for bug-bash@gnu.org; Sat, 14 Jul 2012 14:03:31 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:19349)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>)
	id 1Sq6gh-0006BS-LH; Sat, 14 Jul 2012 14:03:27 -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 BNA79854;
	Sat, 14 Jul 2012 14:03: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 AZT90611; Sat, 14 Jul 2012 14:03:26 -0400 (EDT)
Date: Sat, 14 Jul 2012 14:00:17 -0400
From: Chet Ramey <chet.ramey@case.edu>
Sender: Chet Ramey <chet@caleb.ins.cwru.edu>
To: help-bash@gnu.org
Subject: Re: [Help-bash] opposite of 'shift'
References: <CABrM6wkjeTcD-0vYvSyFHOKuA2sSLDfPPUfoewSWa=qGbeSwvA@mail.gmail.com>
	<3444582.IZgz39oDG4@smorgbox> <20120216143528.GF916@eeg.ccf.org>
	<1461212.uFSToYXSPv@smorgbox>
	<CAPSX3sQn28cHRfa48QYE680rWgVi-qHsC9F4oOejZYEVzHCEVA@mail.gmail.com>
	<4F4016CF.10303@case.edu>
In-Reply-To: Message from chet.ramey@case.edu of Sat,
	18 Feb 2012 16:23:27 -0500 (id <4F4016CF.10303@case.edu>)
Message-ID: <120714180017.AA43799.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, pierre.gaston@gmail.com, 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, 14 Jul 2012 18:03:32 -0000

> On 2/17/12 8:25 AM, Pierre Gaston wrote:

> > This is probably because bash lacks an easy way to pass an array by
> > reference to a function.
> 
> This is where a requested feature could make it into bash.  This seems to
> be a common problem with no clean solution (one can only get so far with
> eval and ${!param}).
> 
> The ksh93 `nameref' (typeset -n) feature would solve this.  It's not really
> well documented, and there are many corner cases to catch, but it's not
> that hard to implement.  One example: is it a symlink, where it's resolved
> at reference time, or a pointer, where the reference is assigned at initial
> declaration?  Another set of cases involve the scoping questions if the
> first alternative is chosen.

The next version of bash will have nameref variables and associated support
(declare/local -n, unset -n, slight changes to ${!var}, and so on).

The devel git tree has all of the changes.  If you're interested, check it
out and send me feedback.

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 Jul 14 18:45:11 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SqB5L-0002Vx-0E
	for mharc-bug-bash@gnu.org; Sat, 14 Jul 2012 18:45:11 -0400
Path: usenet.stanford.edu!tr22g12.aset.psu.edu!news.glorb.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From: kenasen@gmail.com
Newsgroups: gnu.bash.bug
Subject: Scent of Sexy Men Drives Women Wild
Date: Sat, 14 Jul 2012 03:41:05 -0700 (PDT)
Organization: http://groups.google.com
Lines: 6
Message-ID: <bc072b23-dd24-491a-a83d-9241dc936ae8@googlegroups.com>
NNTP-Posting-Host: 122.179.138.228
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1342262466 20470 127.0.0.1 (14 Jul 2012 10:41:06
	GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sat, 14 Jul 2012 10:41:06 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com;
	posting-host=122.179.138.228; 
	posting-account=NX0qDwoAAAAmF9X8Gp8110T-xD9kOO-Q
User-Agent: G2/1.0
Xref: usenet.stanford.edu gnu.bash.bug:24885
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: Sat, 14 Jul 2012 22:45:09 -0000

Women usually get attracted with keener sense of smell more than men and sc=
ent is one of the powerful magnets to attract person with opposite sex. Som=
e of these scents trigger the neurochemicals of the brain which in turn may=
 also create some sexual responses which can make women irresistible. More =
information @ http://www.adulthub.com.au/blogs/scent-of-sexy-men-drives-wom=
en-wild/

From MAILER-DAEMON Mon Jul 16 16:32:11 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sqrxj-00069e-Pc
	for mharc-bug-bash@gnu.org; Mon, 16 Jul 2012 16:32:11 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48361)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <xyzzy06@gmail.com>) id 1Sqqju-0007sW-NW
	for bug-bash@gnu.org; Mon, 16 Jul 2012 15:13:51 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <xyzzy06@gmail.com>) id 1Sqqjt-00061r-KW
	for bug-bash@gnu.org; Mon, 16 Jul 2012 15:13:50 -0400
Received: from mail-gh0-f169.google.com ([209.85.160.169]:62505)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <xyzzy06@gmail.com>) id 1Sqqjt-00061k-F5
	for bug-bash@gnu.org; Mon, 16 Jul 2012 15:13:49 -0400
Received: by ghrr18 with SMTP id r18so6248775ghr.0
	for <bug-bash@gnu.org>; Mon, 16 Jul 2012 12:13:48 -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=T2SYlPJPahG1Aju4u0rozl8Fad/wAh15HR8h3k+wCX4=;
	b=eGLo2gdm8oVZQYFbvvYj44folvz75UpF6GXlCkC9MVTXXMtrikrBdow4TYc+TOX2gm
	t8ziJfvQ5fOrJIvJ7IUEj12dhKBfTq+AwILxrBsEynMvKfLz0YMbFRyJKH7KZoI3i2OY
	naT+UNMMMpyVSdY3qua9PFihYfgDTUiluC201ZwzcE4t+34grxt/qcVblpGWlh81fvD1
	mRyikZI4ElIYfFtiYLnHeRzFzeCrlL1rvB2FH8tA462hDdOQOHzvCC15ko6AlALxGq9s
	obrVliF78/vqMoaAOWlTTMUA67JxA4ffcV+UphsTE7gvBLMPlQK12cc+lxv4LPWK2UVl
	S8Gg==
MIME-Version: 1.0
Received: by 10.60.172.143 with SMTP id bc15mr16959854oec.73.1342466028658;
	Mon, 16 Jul 2012 12:13:48 -0700 (PDT)
Received: by 10.76.11.37 with HTTP; Mon, 16 Jul 2012 12:13:48 -0700 (PDT)
Date: Mon, 16 Jul 2012 14:13:48 -0500
Message-ID: <CAM81yL7jaiwGkUFmMuiAmVJ-X-1_RU59rS5Y4MpJNkGFEp0QkQ@mail.gmail.com>
Subject: add vi mode refresh command of inputrc to documentation
From: Kevin Low <xyzzy06@gmail.com>
To: bug-bash@gnu.org
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.160.169
X-Mailman-Approved-At: Mon, 16 Jul 2012 16:32:10 -0400
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: Mon, 16 Jul 2012 19:13:51 -0000

I believe to be complete, you should add the vi mode refresh command of
inputrc to compliment the emacs refresh command you provided on the
following page:

http://www.gnu.org/software/bash/manual/bashref.html#Readline-Init-File-Syntax

8.3 Readline Init File

"In addition, the C-x C-r command re-reads this init file, thus
incorporating any changes that you might have made to it."

This refresh command you provided, won't work in VI mode.  It puts the
representation of CTRL-x (^x) on the command line, which I assume means it
wasn't interpreted as a command character.  CTRL-l, (el),  the redraw
screen command in VI does not cause bash to re-read its inputrc file
either.  Of course I would be interested to find out what the command is,
but more importantly, I think this information should be provided along
with the emacs information.

Thanks,
Kevin

From MAILER-DAEMON Mon Jul 16 16:42:10 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sqs7O-0008Oo-IB
	for mharc-bug-bash@gnu.org; Mon, 16 Jul 2012 16:42:10 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37272)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Sqs7L-0008MT-RX
	for bug-bash@gnu.org; Mon, 16 Jul 2012 16:42:08 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Sqs7L-0001Np-2U
	for bug-bash@gnu.org; Mon, 16 Jul 2012 16:42:07 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:44606
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Sqs7K-0001Iy-SY
	for bug-bash@gnu.org; Mon, 16 Jul 2012 16:42:06 -0400
Received: (qmail 25877 invoked from network); 16 Jul 2012 20:41:42 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Mon, 16 Jul 2012 16:41:42 -0400
Received: (qmail 16063 invoked by uid 563); 16 Jul 2012 20:41:42 -0000
Date: Mon, 16 Jul 2012 16:41:41 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Kevin Low <xyzzy06@gmail.com>
Subject: Re: add vi mode refresh command of inputrc to documentation
Message-ID: <20120716204141.GV8239@eeg.ccf.org>
References: <CAM81yL7jaiwGkUFmMuiAmVJ-X-1_RU59rS5Y4MpJNkGFEp0QkQ@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAM81yL7jaiwGkUFmMuiAmVJ-X-1_RU59rS5Y4MpJNkGFEp0QkQ@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: Mon, 16 Jul 2012 20:42:08 -0000

On Mon, Jul 16, 2012 at 02:13:48PM -0500, Kevin Low wrote:
> "In addition, the C-x C-r command re-reads this init file, thus
> incorporating any changes that you might have made to it."

Many of readline's functions are not bound in vi mode.

$ set -o emacs
$ bind -p | grep C-x | grep C-r
"\C-x\C-r": re-read-init-file
$ set -o vi
$ bind -p | grep re-read-init-file
# re-read-init-file (not bound)

You would need to pick a key sequence and set up your own binding for it.


From MAILER-DAEMON Wed Jul 18 11:34:53 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SrWH7-0006a2-DP
	for mharc-bug-bash@gnu.org; Wed, 18 Jul 2012 11:34:53 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33716)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jacknagel@gmail.com>) id 1SrP6H-0007WV-0j
	for bug-bash@gnu.org; Wed, 18 Jul 2012 03:55:18 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jacknagel@gmail.com>) id 1SrP6D-0004h7-1g
	for bug-bash@gnu.org; Wed, 18 Jul 2012 03:55:12 -0400
Received: from mail-wg0-f49.google.com ([74.125.82.49]:47502)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jacknagel@gmail.com>) id 1SrP6C-0004bv-PO
	for bug-bash@gnu.org; Wed, 18 Jul 2012 03:55:08 -0400
Received: by wgbez12 with SMTP id ez12so802903wgb.30
	for <bug-bash@gnu.org>; Wed, 18 Jul 2012 00:55:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:from:date:message-id:subject:to:content-type;
	bh=f/Ji3g6S3nenuCX5COxtNzo8iC2xU9qG7U/q6aLKXm4=;
	b=MZy3Bef+8ioJyv7sQlBOjNe0i18vczK6sLhFuWki1/aLuOzlx9izx0Gfqzq85ABRKk
	k/b1nfdH0x8+m4M9a7beAJgzA+QiTp3dS1K+BP85RN+mkuD0WSBZcdp+04KtnD1j29np
	fo/UUdeM/SUmj/jc/HgIrsB5ct1BPeCowtiV0sp3PU/LU/bPgtPEaL0V7qwDXoq2teqK
	Bw9p2pqgQd0yKQrpMnGKacAFC4FOfw/FWHh12hrk7WaccorTbFQMgY1GZktPnf/zAelx
	UM/oCDqafrcnslpPO5y87SJQFdMWAr+l0WsikYKWHn/g2tvHqDaiQKA7zl2CXqaMbJq7
	/K2A==
Received: by 10.180.92.129 with SMTP id cm1mr4203214wib.10.1342598104955; Wed,
	18 Jul 2012 00:55:04 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.194.54.103 with HTTP; Wed, 18 Jul 2012 00:54:44 -0700 (PDT)
From: Jack Nagel <jacknagel@gmail.com>
Date: Wed, 18 Jul 2012 02:54:44 -0500
Message-ID: <CAMYxyaXGx5Q6R=saOm2g0j2ZavikN1+bEqcEEJa-j9gq9cFAsA@mail.gmail.com>
Subject: Potential for a cumulative patch (or tarball)?
To: bug-bash@gnu.org
Content-Type: text/plain; charset=UTF-8
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.82.49
X-Mailman-Approved-At: Wed, 18 Jul 2012 11:34:52 -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, 18 Jul 2012 07:55:18 -0000

>From a package management standpoint it is somewhat cumbersome to
fetch the base 4.2 tarball and the 37 patches in order to build the
latest and greatest; it would simplify things greatly if there was a
cumulative patch (or a complete tarball, ideally).

Would something like this be possible? What are the reasons for the
current release/patch system?

Thanks.

Jack Nagel


From MAILER-DAEMON Wed Jul 18 12:29:55 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SrX8N-00049k-KV
	for mharc-bug-bash@gnu.org; Wed, 18 Jul 2012 12:29:55 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33287)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SrX8L-00047t-9g
	for bug-bash@gnu.org; Wed, 18 Jul 2012 12:29:54 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SrX8J-0008Vp-TF
	for bug-bash@gnu.org; Wed, 18 Jul 2012 12:29:53 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:3178)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SrX8J-0008Ve-NT
	for bug-bash@gnu.org; Wed, 18 Jul 2012 12:29:51 -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 BNE32880;
	Wed, 18 Jul 2012 12:29:50 -0400
Received: from rrcs-74-218-75-132.central.biz.rr.com (EHLO z4.local)
	([74.218.75.132]) by mpv8.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id UQQ59965 (AUTH cpr);
	Wed, 18 Jul 2012 12:29:50 -0400 (EDT)
Message-ID: <5006E47D.1090404@case.edu>
Date: Wed, 18 Jul 2012 12:29:49 -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: Jack Nagel <jacknagel@gmail.com>
Subject: Re: Potential for a cumulative patch (or tarball)?
References: <CAMYxyaXGx5Q6R=saOm2g0j2ZavikN1+bEqcEEJa-j9gq9cFAsA@mail.gmail.com>
In-Reply-To: <CAMYxyaXGx5Q6R=saOm2g0j2ZavikN1+bEqcEEJa-j9gq9cFAsA@mail.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 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, 18 Jul 2012 16:29:54 -0000

On 7/18/12 3:54 AM, Jack Nagel wrote:
> From a package management standpoint it is somewhat cumbersome to
> fetch the base 4.2 tarball and the 37 patches in order to build the
> latest and greatest; it would simplify things greatly if there was a
> cumulative patch (or a complete tarball, ideally).

This is what you can get from the `master' branch of the git tree on
savannah.

Make sure you've selected the `master' branch, click on the commit tab,
which should be something like
http://git.savannah.gnu.org/cgit/bash.git/commit/, and download
bash-master.tar.gz.

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 Jul 19 21:28:45 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Ss21N-0002GU-IZ
	for mharc-bug-bash@gnu.org; Thu, 19 Jul 2012 21:28:45 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46611)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Ss21L-0002FE-LU
	for bug-bash@gnu.org; Thu, 19 Jul 2012 21:28:44 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Ss21K-0000R4-Fg
	for bug-bash@gnu.org; Thu, 19 Jul 2012 21:28:43 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:64671)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Ss21K-0000Qy-Ap
	for bug-bash@gnu.org; Thu, 19 Jul 2012 21:28: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 CBE73834; Thu, 19 Jul 2012 21:28:41 -0400 (EDT)
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 BBM55877; Thu, 19 Jul 2012 21:28:41 -0400 (EDT)
Date: Thu, 19 Jul 2012 21:27:17 -0400
From: Chet Ramey <chet.ramey@case.edu>
Sender: Chet Ramey <chet@caleb.ins.cwru.edu>
To: bug-bash@gnu.org
Subject: Bash-4.2 Official Patch 37
Message-ID: <120720012717.AA91627.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: 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, 20 Jul 2012 01:28:44 -0000

			     BASH PATCH REPORT
			     =================

Bash-Release:	4.2
Patch-ID:	bash42-037

Bug-Reported-by:	Jakub Filak
Bug-Reference-ID:
Bug-Reference-URL:	https://bugzilla.redhat.com/show_bug.cgi?id=813289

Bug-Description:

Attempting to redo (using `.') the vi editing mode `cc', `dd', or `yy'
commands leads to an infinite loop.

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/lib/readline/vi_mode.c	2011-02-25 11:17:02.000000000 -0500
--- lib/readline/vi_mode.c	2012-06-02 12:24:47.000000000 -0400
***************
*** 1235,1243 ****
        r = rl_domove_motion_callback (_rl_vimvcxt);
      }
!   else if (vi_redoing)
      {
        _rl_vimvcxt->motion = _rl_vi_last_motion;
        r = rl_domove_motion_callback (_rl_vimvcxt);
      }
  #if defined (READLINE_CALLBACKS)
    else if (RL_ISSTATE (RL_STATE_CALLBACK))
--- 1297,1313 ----
        r = rl_domove_motion_callback (_rl_vimvcxt);
      }
!   else if (vi_redoing && _rl_vi_last_motion != 'd')	/* `dd' is special */
      {
        _rl_vimvcxt->motion = _rl_vi_last_motion;
        r = rl_domove_motion_callback (_rl_vimvcxt);
      }
+   else if (vi_redoing)		/* handle redoing `dd' here */
+     {
+       _rl_vimvcxt->motion = _rl_vi_last_motion;
+       rl_mark = rl_end;
+       rl_beg_of_line (1, key);
+       RL_UNSETSTATE (RL_STATE_VIMOTION);
+       r = vidomove_dispatch (_rl_vimvcxt);
+     }
  #if defined (READLINE_CALLBACKS)
    else if (RL_ISSTATE (RL_STATE_CALLBACK))
***************
*** 1317,1325 ****
        r = rl_domove_motion_callback (_rl_vimvcxt);
      }
!   else if (vi_redoing)
      {
        _rl_vimvcxt->motion = _rl_vi_last_motion;
        r = rl_domove_motion_callback (_rl_vimvcxt);
      }
  #if defined (READLINE_CALLBACKS)
    else if (RL_ISSTATE (RL_STATE_CALLBACK))
--- 1387,1403 ----
        r = rl_domove_motion_callback (_rl_vimvcxt);
      }
!   else if (vi_redoing && _rl_vi_last_motion != 'c')	/* `cc' is special */
      {
        _rl_vimvcxt->motion = _rl_vi_last_motion;
        r = rl_domove_motion_callback (_rl_vimvcxt);
      }
+   else if (vi_redoing)		/* handle redoing `cc' here */
+     {
+       _rl_vimvcxt->motion = _rl_vi_last_motion;
+       rl_mark = rl_end;
+       rl_beg_of_line (1, key);
+       RL_UNSETSTATE (RL_STATE_VIMOTION);
+       r = vidomove_dispatch (_rl_vimvcxt);
+     }
  #if defined (READLINE_CALLBACKS)
    else if (RL_ISSTATE (RL_STATE_CALLBACK))
***************
*** 1378,1381 ****
--- 1456,1472 ----
        r = rl_domove_motion_callback (_rl_vimvcxt);
      }
+   else if (vi_redoing && _rl_vi_last_motion != 'y')	/* `yy' is special */
+     {
+       _rl_vimvcxt->motion = _rl_vi_last_motion;
+       r = rl_domove_motion_callback (_rl_vimvcxt);
+     }
+   else if (vi_redoing)			/* handle redoing `yy' here */
+     {
+       _rl_vimvcxt->motion = _rl_vi_last_motion;
+       rl_mark = rl_end;
+       rl_beg_of_line (1, key);
+       RL_UNSETSTATE (RL_STATE_VIMOTION);
+       r = vidomove_dispatch (_rl_vimvcxt);
+     }
  #if defined (READLINE_CALLBACKS)
    else if (RL_ISSTATE (RL_STATE_CALLBACK))
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
--- patchlevel.h	Thu Feb 24 21:41:34 2011
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 36
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 37
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``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 Jul 24 11:03:51 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1StgeN-0002zt-V0
	for mharc-bug-bash@gnu.org; Tue, 24 Jul 2012 11:03:51 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58378)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <haubi@sauxz3.salomon.at>) id 1StgeG-0002yU-5c
	for bug-bash@gnu.org; Tue, 24 Jul 2012 11:03:50 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <haubi@sauxz3.salomon.at>) id 1StgeE-0004NB-Ne
	for bug-bash@gnu.org; Tue, 24 Jul 2012 11:03:44 -0400
Received: from smtp.salomon.at ([193.186.16.13]:60749)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <haubi@sauxz3.salomon.at>) id 1StgeE-0004MO-CB
	for bug-bash@gnu.org; Tue, 24 Jul 2012 11:03:42 -0400
Received: from samail03.wamas.com ([172.28.2.2] helo=mailhost.salomon.at)
	by smtp.salomon.at with esmtps (TLSv1:AES256-SHA:256) (Exim 4.77)
	(envelope-from <haubi@sauxz3.salomon.at>) id 1Stge9-00008t-7Z
	for bug-bash@gnu.org; Tue, 24 Jul 2012 17:03:39 +0200
Received: from sauxz3.salomon.at ([172.28.2.39])
	by mailhost.salomon.at with esmtp (Exim 4.77)
	(envelope-from <haubi@sauxz3.salomon.at>) id 1Stge9-0002st-35
	for bug-bash@gnu.org; Tue, 24 Jul 2012 17:03:37 +0200
Received: (from haubi@localhost)
	by sauxz3.salomon.at (AIX5.3/8.13.4/8.11.0) id q6OF3aaU141050;
	Tue, 24 Jul 2012 17:03:36 +0200
Date: Tue, 24 Jul 2012 17:03:36 +0200
Message-Id: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
From: michael.haubenwallner@salomon.at
To: bug-bash@gnu.org
Subject: AIX and Interix also do early PID recycling.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 193.186.16.13
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, 24 Jul 2012 15:03:50 -0000

Configuration Information [Automatically generated, do not change]:
Machine: powerpc
OS: aix5.3.0.0
Compiler: powerpc-ibm-aix5.3.0.0-gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='powerpc' -DCONF_OSTYPE='aix5.3.0.0' -DCONF_MACHTYPE='powerpc-ibm-aix5.3.0.0' -DCONF_VENDOR='ibm' -DLOCALEDIR='/tools/haubi/gentoo/sauxz3/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I. -I./include -I. -I./include -I./lib  -DDEFAULT_PATH_VALUE='/tools/haubi/gentoo/sauxz3/usr/sbin:/tools/haubi/gentoo/sauxz3/usr/bin:/tools/haubi/gentoo/sauxz3/sbin:/tools/haubi/gentoo/sauxz3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' -DSTANDARD_UTILS_PATH='/tools/haubi/gentoo/sauxz3/bin:/tools/haubi/gentoo/sauxz3/usr/bin:/tools/haubi/gentoo/sauxz3/sbin:/tools/haubi/gentoo/sauxz3/usr/sbin:/bin:/usr/bin:/sbin:/usr/sbin' -DSYS_BASHRC='/tools/haubi/gentoo/sauxz3/etc/bash/bashrc' -DSYS_BASH_LOGOUT='/tools/haubi/gentoo/sauxz3/etc/bash/bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS -DSSH_SOURCE_BASHRC -I/tools/haubi/gentoo/sauxz3/usr/include -g -O2
uname output: AIX sauxz3 3 5 00000A03D600
Machine Type: powerpc-ibm-aix5.3.0.0

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

Description:
	On AIX (5.3, 6.1, 7.1), as well as on Interix (any version) I do encounter
	some race condition in a code similar to:
	    if grep "unwanted" /some/nonexistent/filename
	    then
	      echo "bad"
	      exit 1
	    fi
	    echo "good"
	Sometimes it does "bad" while it should do "good" always.

	As this is part of some large build process, and occurs every once in a
	while, I've been unable to create a small testcase.

	However, I've found /very/ similar problem description with Cygwin,
	even if I don't grok why defining RECYCLES_PIDS shouldn't be enough here:
	http://www.cygwin.com/ml/cygwin/2004-09/msg00882.html

	Also, with an older version of libtool, I've had this problem too:
	http://lists.gnu.org/archive/html/bug-bash/2008-07/msg00117.html

	While this doesn't happen with more recent libtool any more,
	I've found an identical problem description with Cygwin again,
	even if that test script doesn't expose the problem to me:
	http://sources.redhat.com/ml/cygwin/2002-08/msg00449.html

	However, here's a rough script to show when PIDs get recycled.
	---
	  #! /usr/bin/env bash

	  count=0
	  min=
	  max=
	  while true
	  do
		  /bin/true &
		  last=$!
		  [[ ${min:=${last}} -gt ${last} ]] && min=${last}
		  [[ ${max:=${last}} -lt ${last} ]] && max=${last}
		  [[ ${#last} > 4 ]] && used=used_${last::((${#last}-4))} || used=used_0

		  if [[ ${!used} == *" ${last} "* ]]; then
			  break
		  fi
		  (( count+=1 ))
		  eval "${used}+=' ${last} '"
		  if [[ "${count}" == *000 ]]; then
			  echo ${count}
		  fi
	  done

	  echo "reused pid ${last} (min ${min}, max ${max}) after ${count} trials."
	---
	
	On AIX, this script shows something like:
	  "reused pid 121692 (min 88110, max 121854) after 254 trials."

	On Interix, this is something like:
	  "reused pid 1805 (min 135, max 2107) after 121 trials."

	Running this script multiple times in parallel reduces number of trials,
	especially on Interix.

	Linux, HP-UX and Solaris need something near 32k trials, depending
	on how the kernel is configured (Linux: kernel.pid_max).

Repeat-By:
	Unable to repeat in a small testcase, but adding some debug fprintf's
	to bash's job.c and execute_cmd.c near fork() and waitpid() allowed
	me to identify pid-recycling as the root problem.

Fix:
	Define RECYCLES_PIDS for AIX and Interix too (like for Cygwin and LynxOS).


From MAILER-DAEMON Tue Jul 24 11:49:43 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SthMl-0000xL-Kh
	for mharc-bug-bash@gnu.org; Tue, 24 Jul 2012 11:49:43 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46320)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SthMf-0000vo-5F
	for bug-bash@gnu.org; Tue, 24 Jul 2012 11:49:42 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SthMd-0003vu-TO
	for bug-bash@gnu.org; Tue, 24 Jul 2012 11:49:37 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:48164
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SthMd-0003nU-KK
	for bug-bash@gnu.org; Tue, 24 Jul 2012 11:49:35 -0400
Received: (qmail 10862 invoked from network); 24 Jul 2012 15:49:06 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Tue, 24 Jul 2012 11:49:06 -0400
Received: (qmail 26144 invoked by uid 563); 24 Jul 2012 15:49:05 -0000
Date: Tue, 24 Jul 2012 11:49:05 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: michael.haubenwallner@salomon.at
Subject: Re: AIX and Interix also do early PID recycling.
Message-ID: <20120724154904.GZ8239@eeg.ccf.org>
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
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: Tue, 24 Jul 2012 15:49:42 -0000

On Tue, Jul 24, 2012 at 05:03:36PM +0200, michael.haubenwallner@salomon.at wrote:
> Description:
> 	On AIX (5.3, 6.1, 7.1), as well as on Interix (any version) I do encounter
> 	some race condition in a code similar to:
> 	    if grep "unwanted" /some/nonexistent/filename
> 	    then
> 	      echo "bad"
> 	      exit 1
> 	    fi
> 	    echo "good"
> 	Sometimes it does "bad" while it should do "good" always.

If that happens, then I don't see how it is related to recyling PIDs.
In fact, if grep is failing to produce the correct result, it it a
problem with your OS's implementation of grep, and not with bash.

> 		  [[ ${#last} > 4 ]] && used=used_${last::((${#last}-4))} || used=used_0

That [[ ${#last} > 4 ]] check is incorrect.  You're doing a string
comparison there; [[ 10 > 4 ]] is false.  Either use ((...)) or use -gt.

In any case, if your script breaks because PIDs are recycled sooner than
you expect, then it is a bug in your script, and not in bash.  (What
would you expect bash to do about it in the first place?)  It may also
interest you to know that there are some operating systems that use
random PID allocation, instead of sequential (OpenBSD for example).

http://mywiki.wooledge.org/ProcessManagement has some tips on how to
deal with multiple processes.


From MAILER-DAEMON Tue Jul 24 12:54:55 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1StiNr-0002JK-9e
	for mharc-bug-bash@gnu.org; Tue, 24 Jul 2012 12:54:55 -0400
Received: from eggs.gnu.org ([208.118.235.92]:51094)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1StiNo-0002HV-Bj
	for bug-bash@gnu.org; Tue, 24 Jul 2012 12:54:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1StiNm-0008Ql-Nb
	for bug-bash@gnu.org; Tue, 24 Jul 2012 12:54:52 -0400
Received: from smtp.salomon.at ([193.186.16.13]:33410)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1StiNm-0008Q9-Cg
	for bug-bash@gnu.org; Tue, 24 Jul 2012 12:54:50 -0400
Received: from samail03.wamas.com ([172.28.2.2] helo=mailhost.salomon.at)
	by smtp.salomon.at with esmtps (TLSv1:AES256-SHA:256) (Exim 4.77)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1StiNg-0001VG-FN; Tue, 24 Jul 2012 18:54:46 +0200
Received: from [172.28.8.170] by mailhost.salomon.at with esmtp (Exim 4.77)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1StiNg-00035N-AZ; Tue, 24 Jul 2012 18:54:44 +0200
Message-ID: <500ED354.6050100@salomon.at>
Date: Tue, 24 Jul 2012 18:54:44 +0200
From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:10.0.3) Gecko/20120327 Thunderbird/10.0.3
MIME-Version: 1.0
To: Greg Wooledge <wooledg@eeg.ccf.org>
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
In-Reply-To: <20120724154904.GZ8239@eeg.ccf.org>
X-Enigmail-Version: 1.3.5
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 193.186.16.13
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: Tue, 24 Jul 2012 16:54:54 -0000


On 07/24/2012 05:49 PM, Greg Wooledge wrote:
> On Tue, Jul 24, 2012 at 05:03:36PM +0200, michael.haubenwallner@salomon.at wrote:
>> Description:
>> 	On AIX (5.3, 6.1, 7.1), as well as on Interix (any version) I do encounter
>> 	some race condition in a code similar to:
>> 	    if grep "unwanted" /some/nonexistent/filename
>> 	    then
>> 	      echo "bad"
>> 	      exit 1
>> 	    fi
>> 	    echo "good"

There is nothing multiprocessing nor asynchronous in this script snippet, there
isn't even a pipe or subshell somewhere. Copy&pasted the code actually is:

    # Verify that the libtool files don't contain bogus $D entries.
    local abort=no gentoo_bug=no
    for a in "${ED}"usr/lib*/*.la ; do
        s=${a##*/}
        if grep -qs "${D}" "${a}" ; then
                vecho -ne '\a\n'
                eqawarn "QA Notice: ${s} appears to contain PORTAGE_TMPDIR paths"
                abort="yes"
        fi
    done
    [[ ${abort} == "yes" ]] && die "soiled libtool library files found"

When it erroneously fails, the message is "QA Notice: *.la appears to contain ...",
however there is no filename '*.la'.

Agreeed, a bug here is that nullglob should be set to not run grep at all when
there is no *.la file, but this just would hide the bash bug...

>> 	Sometimes it does "bad" while it should do "good" always.
> 
> If that happens, then I don't see how it is related to recyling PIDs.
> In fact, if grep is failing to produce the correct result, it it a
> problem with your OS's implementation of grep, and not with bash.

Adding some debug-printfs to bash itself around fork, execve, waitpid shows:

Bash usually does fork()+execve("grep"), as well as waitpid(-1, ...).

Whenever waitpid() returns this "grep" one's PID, the reported exitstatus
always is 2, even when bash goes "bad"...

Adding more debug-printfs to bash's wait_for() and execute_command_internal() shows:

Usually, execute_command_internal() does wait_for(this one grep's PID) before
executing anything else, correctly evaluating the returnvalue to be "not true",
skipping the "bad" part.

But when there was some previous but unrelated command, where fork() returned the
same PID than for this "grep", execute_command_internal() does /not/ wait_for() at all,
because last_made_pid is equal to last_pid, and the path to "bad" is gone instead,
as another exitstatus is evaluated instead of this grep's one.

However, in a subsequent wait_for(another child), waitpid() does report exitstatus 2
for this grep's PID, but bash has gone "bad" already and ignores that exitstatus.

>> 		  [[ ${#last} > 4 ]] && used=used_${last::((${#last}-4))} || used=used_0
> 
> That [[ ${#last} > 4 ]] check is incorrect.  You're doing a string
> comparison there; [[ 10 > 4 ]] is false.  Either use ((...)) or use -gt.

Indeed! (but irrelevant - is just a performance optimisation)

> In any case, if your script breaks because PIDs are recycled sooner than
> you expect, then it is a bug in your script, and not in bash.

It's not me nor my script to expect anything about PIDs at all here.

> (What
> would you expect bash to do about it in the first place?)  It may also
> interest you to know that there are some operating systems that use
> random PID allocation, instead of sequential (OpenBSD for example).

PID randomisation isn't a problem at all, as long as a previously used PID
is not reused too early.

> http://mywiki.wooledge.org/ProcessManagement has some tips on how to
> deal with multiple processes.

Interesting page, but there's nothing that applies here.

Thank you anyway!
/haubi/


From MAILER-DAEMON Tue Jul 24 21:05:31 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Stq2d-0001LW-Cw
	for mharc-bug-bash@gnu.org; Tue, 24 Jul 2012 21:05:31 -0400
Received: from eggs.gnu.org ([208.118.235.92]:40349)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Stq2a-0001Jc-NW
	for bug-bash@gnu.org; Tue, 24 Jul 2012 21:05:29 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Stq2Z-0000XT-BT
	for bug-bash@gnu.org; Tue, 24 Jul 2012 21:05:28 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:21552)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Stq2Z-0000XG-6V
	for bug-bash@gnu.org; Tue, 24 Jul 2012 21:05:27 -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 CBI91669 (AUTH cpr);
	Tue, 24 Jul 2012 21:05:25 -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 ULP45551 (AUTH cpr);
	Tue, 24 Jul 2012 21:05:25 -0400 (EDT)
Message-ID: <500F464A.4070703@case.edu>
Date: Tue, 24 Jul 2012 21:05:14 -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: Michael Haubenwallner <michael.haubenwallner@salomon.at>
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org> <500ED354.6050100@salomon.at>
In-Reply-To: <500ED354.6050100@salomon.at>
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: Greg Wooledge <wooledg@eeg.ccf.org>, 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, 25 Jul 2012 01:05:30 -0000

On 7/24/12 12:54 PM, Michael Haubenwallner wrote:

>> (What
>> would you expect bash to do about it in the first place?)  It may also
>> interest you to know that there are some operating systems that use
>> random PID allocation, instead of sequential (OpenBSD for example).
> 
> PID randomisation isn't a problem at all, as long as a previously used PID
> is not reused too early.

And that's the problem.  Bash assumes that there's a PID space at least as
large as CHILD_MAX, and that the kernel will use all of it before reusing
any PID in the space.  Posix says that shells must remember up to CHILD_MAX
statuses of terminated asynchronous children (the description of `wait'),
so implicitly the kernel is not allowed to reuse process IDs until it has
exhausted CHILD_MAX PIDs.  The description of fork() doesn't mention this,
however.  The Posix fork() requirement that the PID returned can't
correspond to an existing process or process group is not sufficient to
satisfy the requirement on `wait'.

Bash holds on to the status of all terminated processes, not just
background ones, and only checks for the presence of a newly-forked PID
in that list if the list size exceeds CHILD_MAX.  One of the results of
defining RECYCLES_PIDS is that the check is performed on every created
process.

I'd be interested in knowing the value of CHILD_MAX (or even `ulimit -c')
on the system where you're seeing this problem.

The case where last_made_pid is equal to last_pid is a problem only when
the PID space is extremely small -- on the order of, say, 4 -- as long as
the kernel behaves as described above.

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 Jul 25 03:59:54 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1StwVe-0006p4-7b
	for mharc-bug-bash@gnu.org; Wed, 25 Jul 2012 03:59:54 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52261)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1StwVY-0006mJ-U3
	for bug-bash@gnu.org; Wed, 25 Jul 2012 03:59:52 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1StwVT-00039s-1K
	for bug-bash@gnu.org; Wed, 25 Jul 2012 03:59:48 -0400
Received: from smtp.salomon.at ([193.186.16.13]:38964)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1StwVS-00039j-MZ
	for bug-bash@gnu.org; Wed, 25 Jul 2012 03:59:42 -0400
Received: from samail03.wamas.com ([172.28.2.2] helo=mailhost.salomon.at)
	by smtp.salomon.at with esmtps (TLSv1:AES256-SHA:256) (Exim 4.77)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1StwVE-0003f0-Gh; Wed, 25 Jul 2012 09:59:29 +0200
Received: from [172.28.8.170] by mailhost.salomon.at with esmtp (Exim 4.77)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1StwVE-00046x-Ce; Wed, 25 Jul 2012 09:59:28 +0200
Message-ID: <500FA760.4090300@salomon.at>
Date: Wed, 25 Jul 2012 09:59:28 +0200
From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:10.0.3) Gecko/20120327 Thunderbird/10.0.3
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
In-Reply-To: <500F464A.4070703@case.edu>
X-Enigmail-Version: 1.3.5
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 193.186.16.13
Cc: Greg Wooledge <wooledg@eeg.ccf.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: Wed, 25 Jul 2012 07:59:53 -0000


On 07/25/2012 03:05 AM, Chet Ramey wrote:
> Bash assumes that there's a PID space at least as
> large as CHILD_MAX, and that the kernel will use all of it before reusing
> any PID in the space.  Posix says that shells must remember up to CHILD_MAX
> statuses of terminated asynchronous children (the description of `wait'),
> so implicitly the kernel is not allowed to reuse process IDs until it has
> exhausted CHILD_MAX PIDs.

What about grand-childs?
They do count for the kernel, but not for the toplevel shell...

> The description of fork() doesn't mention this,
> however.  The Posix fork() requirement that the PID returned can't
> correspond to an existing process or process group is not sufficient to
> satisfy the requirement on `wait'.

OTOH, AFAICT, as long as a PID isn't waitpid()ed for, it isn't reused by fork().
However, I'm unable to find that in the POSIX spec.

> Bash holds on to the status of all terminated processes, not just
> background ones, and only checks for the presence of a newly-forked PID
> in that list if the list size exceeds CHILD_MAX.  One of the results of
> defining RECYCLES_PIDS is that the check is performed on every created
> process.

What if the shell does not do waitpid(-1), but waitpid(known-child-PID).
That would mean to waitpid(synchronous-child-PID) immediately, and
waitpid(asynchronous-child-PID) upon some "wait $!" shell command, rendering
to waitpid(-1) when there's no PID passed to "wait".

> I'd be interested in knowing the value of CHILD_MAX (or even `ulimit -c')
> on the system where you're seeing this problem.

The AIX 6.1 I've debugged on has:
  #define CHILD_MAX 128
  #define _POSIX_CHILD_MAX 25
  sysconf(_SC_CHILD_MAX) = 1024

  $ ulimit -H -c -u
  core file size          (blocks, -c) unlimited
  max user processes              (-u) unlimited

  $ ulimit -S -c -u
  core file size          (blocks, -c) 1048575
  max user processes              (-u) unlimited

The Interix 6.1 we do have similar-looking stability problems has:
  CHILD_MAX not defined
  #define _POSIX_CHILD_MAX 6
  sysconf(_SC_CHILD_MAX) = 512

  $ ulimit -H -c -u
  core file size         (blocks, -c) unlimited
  max user processes             (-u) 512

  $ ulimit -S -c -u
  core file size         (blocks, -c) unlimited
  max user processes             (-u) 512

> The case where last_made_pid is equal to last_pid is a problem only when
> the PID space is extremely small -- on the order of, say, 4 -- as long as
> the kernel behaves as described above.

I'm going to run this build job with 'truss -t kfork' again, to eventually find
some too small count of different PIDs before PID-recycling by the kernel...

Anyway - defining RECYCLES_PIDS for that AIX 6.1 has reduced the error rate for
this one build job from ~37 to 0 when run 50 times.

/haubi/


From MAILER-DAEMON Wed Jul 25 08:15:14 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Su0Uk-00088w-Dm
	for mharc-bug-bash@gnu.org; Wed, 25 Jul 2012 08:15:14 -0400
Received: from eggs.gnu.org ([208.118.235.92]:45293)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Su0Ud-00086f-Qw
	for bug-bash@gnu.org; Wed, 25 Jul 2012 08:15:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Su0UY-0005CN-4r
	for bug-bash@gnu.org; Wed, 25 Jul 2012 08:15:07 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:48623
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Su0UX-0005AD-UJ
	for bug-bash@gnu.org; Wed, 25 Jul 2012 08:15:02 -0400
Received: (qmail 19583 invoked from network); 25 Jul 2012 12:14:59 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Wed, 25 Jul 2012 08:14:59 -0400
Received: (qmail 27289 invoked by uid 563); 25 Jul 2012 12:14:59 -0000
Date: Wed, 25 Jul 2012 08:14:59 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Michael Haubenwallner <michael.haubenwallner@salomon.at>
Subject: Re: AIX and Interix also do early PID recycling.
Message-ID: <20120725121459.GA8239@eeg.ccf.org>
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<500FA760.4090300@salomon.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <500FA760.4090300@salomon.at>
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: Wed, 25 Jul 2012 12:15:13 -0000

On Wed, Jul 25, 2012 at 09:59:28AM +0200, Michael Haubenwallner wrote:
> OTOH, AFAICT, as long as a PID isn't waitpid()ed for, it isn't reused by fork().
> However, I'm unable to find that in the POSIX spec.

A process that hasn't been waited for should become a zombie, which
should be sufficient to prevent its PID being reused.  Are you saying
that AIX and Interix don't have zombies?


From MAILER-DAEMON Wed Jul 25 08:31:28 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Su0kS-000646-RH
	for mharc-bug-bash@gnu.org; Wed, 25 Jul 2012 08:31:28 -0400
Received: from eggs.gnu.org ([208.118.235.92]:45644)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <steveo@syslang.net>) id 1Su0kL-000632-Sa
	for bug-bash@gnu.org; Wed, 25 Jul 2012 08:31:27 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <steveo@syslang.net>) id 1Su0kK-00018f-SW
	for bug-bash@gnu.org; Wed, 25 Jul 2012 08:31:21 -0400
Received: from saturn.syslang.net ([207.172.210.41]:42572)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <steveo@syslang.net>) id 1Su0kK-00017r-Nv
	for bug-bash@gnu.org; Wed, 25 Jul 2012 08:31:20 -0400
Received: from [IPv6:::1] (localhost [127.0.0.1])
	by saturn.syslang.net (8.14.5/8.14.5) with ESMTP id q6PCVIqP007263
	for <bug-bash@gnu.org>; Wed, 25 Jul 2012 08:31:18 -0400
Message-ID: <500FE715.6020701@syslang.net>
Date: Wed, 25 Jul 2012 08:31:17 -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: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>	<20120724154904.GZ8239@eeg.ccf.org>	<500ED354.6050100@salomon.at>
	<500F464A.4070703@case.edu>	<500FA760.4090300@salomon.at>
	<20120725121459.GA8239@eeg.ccf.org>
In-Reply-To: <20120725121459.GA8239@eeg.ccf.org>
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: Wed, 25 Jul 2012 12:31:27 -0000

On 7/25/2012 8:14 AM, Greg Wooledge wrote:
> On Wed, Jul 25, 2012 at 09:59:28AM +0200, Michael Haubenwallner wrote:
>> OTOH, AFAICT, as long as a PID isn't waitpid()ed for, it isn't reused by fork().
>> However, I'm unable to find that in the POSIX spec.
>
> A process that hasn't been waited for should become a zombie, which
> should be sufficient to prevent its PID being reused.  Are you saying
> that AIX and Interix don't have zombies?

One small nit:

A process that hasn't been waited for should become a zombie *if* the parent 
dies *or* the parent has set SIGCHLD to SIG_IGN. If the parent persists and 
the children are not harvested then the children are in a defunct state.

I don't know what Internix is, but I once discovered an AIX system that had 
over 10,000 defunct processes. The people would detect a slowdown every few 
days and just reboot it. Turns out that a programmer had written a server that 
did not manage its slaves, so they all just sat there waiting to be waited for.

I went in and added a few lines of code to do the wait calls. It never needed 
a reboot since.

-- 
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 Wed Jul 25 09:25:03 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Su1aJ-0007Cn-Jk
	for mharc-bug-bash@gnu.org; Wed, 25 Jul 2012 09:25:03 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38249)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su1a5-0006gp-EF
	for bug-bash@gnu.org; Wed, 25 Jul 2012 09:24:56 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su1Zy-0000rV-5h
	for bug-bash@gnu.org; Wed, 25 Jul 2012 09:24:49 -0400
Received: from smtp.salomon.at ([193.186.16.13]:44262)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su1Zx-0000rB-UO
	for bug-bash@gnu.org; Wed, 25 Jul 2012 09:24:42 -0400
Received: from samail03.wamas.com ([172.28.2.2] helo=mailhost.salomon.at)
	by smtp.salomon.at with esmtps (TLSv1:AES256-SHA:256) (Exim 4.77)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su1Zt-0008Km-Ik; Wed, 25 Jul 2012 15:24:38 +0200
Received: from [172.28.8.170] by mailhost.salomon.at with esmtp (Exim 4.77)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su1WC-0004rg-Lt; Wed, 25 Jul 2012 15:20:48 +0200
Message-ID: <500FF2B0.8000001@salomon.at>
Date: Wed, 25 Jul 2012 15:20:48 +0200
From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:10.0.3) Gecko/20120327 Thunderbird/10.0.3
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<500FA760.4090300@salomon.at>
In-Reply-To: <500FA760.4090300@salomon.at>
X-Enigmail-Version: 1.3.5
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 193.186.16.13
Cc: Greg Wooledge <wooledg@eeg.ccf.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: Wed, 25 Jul 2012 13:24:58 -0000


On 07/25/2012 09:59 AM, Michael Haubenwallner wrote:
> On 07/25/2012 03:05 AM, Chet Ramey wrote:
>> Bash holds on to the status of all terminated processes, not just
>> background ones, and only checks for the presence of a newly-forked PID
>> in that list if the list size exceeds CHILD_MAX.

> The AIX 6.1 I've debugged on has:
>   #define CHILD_MAX 128

> I'm going to run this build job with 'truss -t kfork' again, to eventually find
> some too small count of different PIDs before PID-recycling by the kernel...

Tracing shows:

The minimum fork count (including grand-childs to any depth) before PID recycling starts
looks like 255 (once), but usually 256 and more.

However, one process does see a PID recycled after *at least* 128 forks,
that is exactly the value of CHILD_MAX.

First thought is of some off-by-one bug, but reducing js.c_childmax in jobs.c (2 times)
by one doesn't help.

Investigating further... any hints what to look out for?

/haubi/


From MAILER-DAEMON Wed Jul 25 09:44:20 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Su1sy-00053N-7Y
	for mharc-bug-bash@gnu.org; Wed, 25 Jul 2012 09:44:20 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42432)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <steveo@syslang.net>) id 1Su1ss-00051t-8i
	for bug-bash@gnu.org; Wed, 25 Jul 2012 09:44:18 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <steveo@syslang.net>) id 1Su1sn-0006J0-Ub
	for bug-bash@gnu.org; Wed, 25 Jul 2012 09:44:14 -0400
Received: from saturn.syslang.net ([207.172.210.41]:43614)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <steveo@syslang.net>) id 1Su1sn-0006Iw-PZ
	for bug-bash@gnu.org; Wed, 25 Jul 2012 09:44:09 -0400
Received: from [IPv6:::1] (localhost [127.0.0.1])
	by saturn.syslang.net (8.14.5/8.14.5) with ESMTP id q6PDi84K010166
	for <bug-bash@gnu.org>; Wed, 25 Jul 2012 09:44:08 -0400
Message-ID: <500FF827.4050501@syslang.net>
Date: Wed, 25 Jul 2012 09:44:07 -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: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>	<20120724154904.GZ8239@eeg.ccf.org>	<500ED354.6050100@salomon.at>
	<500F464A.4070703@case.edu>	<500FA760.4090300@salomon.at>
	<500FF2B0.8000001@salomon.at>
In-Reply-To: <500FF2B0.8000001@salomon.at>
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: 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: Wed, 25 Jul 2012 13:44:18 -0000

On 7/25/2012 9:20 AM, Michael Haubenwallner wrote:
>
> On 07/25/2012 09:59 AM, Michael Haubenwallner wrote:
>> On 07/25/2012 03:05 AM, Chet Ramey wrote:
>>> Bash holds on to the status of all terminated processes, not just
>>> background ones, and only checks for the presence of a newly-forked PID
>>> in that list if the list size exceeds CHILD_MAX.
>
>> The AIX 6.1 I've debugged on has:
>>    #define CHILD_MAX 128
>
>> I'm going to run this build job with 'truss -t kfork' again, to eventually find
>> some too small count of different PIDs before PID-recycling by the kernel...
>
> Tracing shows:
>
> The minimum fork count (including grand-childs to any depth) before PID recycling starts
> looks like 255 (once), but usually 256 and more.
>
> However, one process does see a PID recycled after *at least* 128 forks,
> that is exactly the value of CHILD_MAX.
>
> First thought is of some off-by-one bug, but reducing js.c_childmax in jobs.c (2 times)
> by one doesn't help.
>
> Investigating further... any hints what to look out for?
>
> /haubi/


One thing that just springs to mind: Under AIX, I believe (but don't take this 
as gospel) that PIDs are not strictly ascending. The low byte may increment, 
but it might be another byte in the pid_t that gets the increment, and the 
byte that increments may alternate. I don't know if anyone else does this, but 
I seem to remember that AIX does (or did).

You might write a little C program that does a loop of 1000 fork and wait 
calls. Just print out the pids that you create. Something like this...

#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>

main()
{
     pid_t pid;
     int status;
     int ii;

     for (ii = 0; ii < 1000; ii++)
     {
         if ((pid = fork()) != 0)
         {
             printf("New child:%d\n", pid);
             waitpid(pid, &status, 0);
         }
         else
             exit(0);
     }
}

-- 
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 Wed Jul 25 10:11:41 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Su2JR-0006aX-QJ
	for mharc-bug-bash@gnu.org; Wed, 25 Jul 2012 10:11:41 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52364)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su2JL-0006Zo-L7
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:11:40 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su2JF-00068H-T1
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:11:35 -0400
Received: from smtp.salomon.at ([193.186.16.13]:44963)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su2JF-000682-Lr
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:11:29 -0400
Received: from samail03.wamas.com ([172.28.2.2] helo=mailhost.salomon.at)
	by smtp.salomon.at with esmtps (TLSv1:AES256-SHA:256) (Exim 4.77)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su2JD-0000b0-4d; Wed, 25 Jul 2012 16:11:27 +0200
Received: from [172.28.8.170] by mailhost.salomon.at with esmtp (Exim 4.77)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su2JC-00050y-Uq; Wed, 25 Jul 2012 16:11:26 +0200
Message-ID: <500FFE8E.2040903@salomon.at>
Date: Wed, 25 Jul 2012 16:11:26 +0200
From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:10.0.3) Gecko/20120327 Thunderbird/10.0.3
MIME-Version: 1.0
To: Greg Wooledge <wooledg@eeg.ccf.org>
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<500FA760.4090300@salomon.at> <20120725121459.GA8239@eeg.ccf.org>
In-Reply-To: <20120725121459.GA8239@eeg.ccf.org>
X-Enigmail-Version: 1.3.5
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 193.186.16.13
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: Wed, 25 Jul 2012 14:11:40 -0000


On 07/25/2012 02:14 PM, Greg Wooledge wrote:
> On Wed, Jul 25, 2012 at 09:59:28AM +0200, Michael Haubenwallner wrote:
>> OTOH, AFAICT, as long as a PID isn't waitpid()ed for, it isn't reused by fork().
>> However, I'm unable to find that in the POSIX spec.
> 
> A process that hasn't been waited for should become a zombie, which
> should be sufficient to prevent its PID being reused.  Are you saying
> that AIX and Interix don't have zombies?

Nope. My thought was that bash eventually could postpone waiting for a specific
child PID until required by the driving shell script. That is: immediately for
synchronous childs to set $?, and on "wait" for asynchronous childs. The idea
was to render storing CHILD_MAX returnvalues obsolete.
However, I'm investigating why respecting CHILD_MAX by bash doesn't work when
the kernel starts reusing PIDs after CHILD_MAX different ones.

/haubi/



From MAILER-DAEMON Wed Jul 25 10:51:01 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Su2vV-0006jN-5M
	for mharc-bug-bash@gnu.org; Wed, 25 Jul 2012 10:51:01 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49780)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su2vM-0006JH-Ik
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:50:56 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su2vG-0002eY-Bf
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:50:52 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:27299)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su2vG-0002eR-4m
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:50:46 -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 CBJ37193; Wed, 25 Jul 2012 10:50:45 -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 BAF26868 (AUTH cpr);
	Wed, 25 Jul 2012 10:50:44 -0400 (EDT)
Message-ID: <501007C4.3030604@case.edu>
Date: Wed, 25 Jul 2012 10:50:44 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: Michael Haubenwallner <michael.haubenwallner@salomon.at>
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<500FA760.4090300@salomon.at>
In-Reply-To: <500FA760.4090300@salomon.at>
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 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: Greg Wooledge <wooledg@eeg.ccf.org>, 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, 25 Jul 2012 14:50:57 -0000

On 7/25/12 3:59 AM, Michael Haubenwallner wrote:
> 
> On 07/25/2012 03:05 AM, Chet Ramey wrote:
>> Bash assumes that there's a PID space at least as
>> large as CHILD_MAX, and that the kernel will use all of it before reusing
>> any PID in the space.  Posix says that shells must remember up to CHILD_MAX
>> statuses of terminated asynchronous children (the description of `wait'),
>> so implicitly the kernel is not allowed to reuse process IDs until it has
>> exhausted CHILD_MAX PIDs.
> 
> What about grand-childs?
> They do count for the kernel, but not for the toplevel shell...

Yes, that's another problem.

>> The description of fork() doesn't mention this,
>> however.  The Posix fork() requirement that the PID returned can't
>> correspond to an existing process or process group is not sufficient to
>> satisfy the requirement on `wait'.
> 
> OTOH, AFAICT, as long as a PID isn't waitpid()ed for, it isn't reused by fork().
> However, I'm unable to find that in the POSIX spec.

If the process hasn't been reaped by its parent, it's still technically
active, and its PID is not supposed to be eligible for reuse.

> 
>> Bash holds on to the status of all terminated processes, not just
>> background ones, and only checks for the presence of a newly-forked PID
>> in that list if the list size exceeds CHILD_MAX.  One of the results of
>> defining RECYCLES_PIDS is that the check is performed on every created
>> process.
> 
> What if the shell does not do waitpid(-1), but waitpid(known-child-PID).
> That would mean to waitpid(synchronous-child-PID) immediately, and
> waitpid(asynchronous-child-PID) upon some "wait $!" shell command, rendering
> to waitpid(-1) when there's no PID passed to "wait".

That's not how the shell is architected.  In your scenario, the shell
would ignore process status changes until and unless the script asked
for them.  You'd never reap processes that were begun to run command
substitutions, for example, and async processes would linger until the
script happened to ask for some status (which few do).

> 
>> I'd be interested in knowing the value of CHILD_MAX (or even `ulimit -c')
>> on the system where you're seeing this problem.
> 
> The AIX 6.1 I've debugged on has:
>   #define CHILD_MAX 128
>   #define _POSIX_CHILD_MAX 25
>   sysconf(_SC_CHILD_MAX) = 1024
> 
>   $ ulimit -H -c -u
>   core file size          (blocks, -c) unlimited
>   max user processes              (-u) unlimited
> 
>   $ ulimit -S -c -u
>   core file size          (blocks, -c) 1048575
>   max user processes              (-u) unlimited

Bash prefers sysconf(_SC_CHILD_MAX) and will use it over the other
defines (lib/sh/oslib.c:getmaxchild()).  I don't know why AIX chooses
to return a different value via sysconf than it defines for CHILD_MAX,
especially when it seems to use the CHILD_MAX value to decide when it
can recycle the PID space.


>> The case where last_made_pid is equal to last_pid is a problem only when
>> the PID space is extremely small -- on the order of, say, 4 -- as long as
>> the kernel behaves as described above.
> 
> I'm going to run this build job with 'truss -t kfork' again, to eventually find
> some too small count of different PIDs before PID-recycling by the kernel...
> 
> Anyway - defining RECYCLES_PIDS for that AIX 6.1 has reduced the error rate for
> this one build job from ~37 to 0 when run 50 times.

And I suspect that the single change of significance is to not check
against the childmax value when deciding whether or not to look for and
remove this pid from the list of saved termination status values.

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 Jul 25 10:52:23 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Su2wp-0001dz-RV
	for mharc-bug-bash@gnu.org; Wed, 25 Jul 2012 10:52:23 -0400
Received: from eggs.gnu.org ([208.118.235.92]:50132)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su2wm-0001S8-8E
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:52:21 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su2wb-0002xC-N4
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:52:20 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:27715)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su2wb-0002x8-I9
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:52:09 -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 CBJ37297; Wed, 25 Jul 2012 10:52:09 -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 BAF27034 (AUTH cpr);
	Wed, 25 Jul 2012 10:52:08 -0400 (EDT)
Message-ID: <50100818.9060506@case.edu>
Date: Wed, 25 Jul 2012 10:52:08 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: Greg Wooledge <wooledg@eeg.ccf.org>
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<500FA760.4090300@salomon.at> <20120725121459.GA8239@eeg.ccf.org>
In-Reply-To: <20120725121459.GA8239@eeg.ccf.org>
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 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, bug-bash@gnu.org,
	Michael Haubenwallner <michael.haubenwallner@salomon.at>
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, 25 Jul 2012 14:52:22 -0000

On 7/25/12 8:14 AM, Greg Wooledge wrote:
> On Wed, Jul 25, 2012 at 09:59:28AM +0200, Michael Haubenwallner wrote:
>> OTOH, AFAICT, as long as a PID isn't waitpid()ed for, it isn't reused by fork().
>> However, I'm unable to find that in the POSIX spec.
> 
> A process that hasn't been waited for should become a zombie, which
> should be sufficient to prevent its PID being reused.  Are you saying
> that AIX and Interix don't have zombies?

No, a slightly different problem.  Bash interprets the Posix text for the
`wait' builtin as guaranteeing that the kernel will wait at least CHILD_MAX
children before reusing a PID, whether they've terminated or not.


-- 
``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 Jul 25 10:53:15 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Su2xf-0002Wm-Th
	for mharc-bug-bash@gnu.org; Wed, 25 Jul 2012 10:53:15 -0400
Received: from eggs.gnu.org ([208.118.235.92]:50362)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su2xY-0002Tn-6B
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:53:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su2xO-0003SK-Em
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:53:08 -0400
Received: from smtp.salomon.at ([193.186.16.13]:45610)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su2xO-0003SE-7V
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:52:58 -0400
Received: from samail03.wamas.com ([172.28.2.2] helo=mailhost.salomon.at)
	by smtp.salomon.at with esmtps (TLSv1:AES256-SHA:256) (Exim 4.77)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su2xK-0001BO-Ej; Wed, 25 Jul 2012 16:52:54 +0200
Received: from [172.28.8.170] by mailhost.salomon.at with esmtp (Exim 4.77)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su2xK-00056r-AU; Wed, 25 Jul 2012 16:52:54 +0200
Message-ID: <50100846.7040007@salomon.at>
Date: Wed, 25 Jul 2012 16:52:54 +0200
From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:10.0.3) Gecko/20120327 Thunderbird/10.0.3
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<500FA760.4090300@salomon.at> <500FF2B0.8000001@salomon.at>
In-Reply-To: <500FF2B0.8000001@salomon.at>
X-Enigmail-Version: 1.3.5
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 193.186.16.13
Cc: Greg Wooledge <wooledg@eeg.ccf.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: Wed, 25 Jul 2012 14:53:13 -0000


On 07/25/2012 03:20 PM, Michael Haubenwallner wrote:
> On 07/25/2012 09:59 AM, Michael Haubenwallner wrote:
>> On 07/25/2012 03:05 AM, Chet Ramey wrote:
>>> Bash holds on to the status of all terminated processes, not just
>>> background ones, and only checks for the presence of a newly-forked PID
>>> in that list if the list size exceeds CHILD_MAX.
> 
>> The AIX 6.1 I've debugged on has:
>>   #define CHILD_MAX 128
>>   #define _POSIX_CHILD_MAX 25
>>   sysconf(_SC_CHILD_MAX) = 1024

> Tracing shows:
> 
> The minimum fork count (including grand-childs to any depth) before PID recycling starts
> looks like 255 (once), but usually 256 and more.
> 
> However, one process does see a PID recycled after *at least* 128 forks,
> that is exactly the value of CHILD_MAX.

Got it: The value used for js.c_childmax isn't 128, but 1024.

In lib/sh/oslib.c, getmaxchild() prefers sysconf(_SC_CHILD_MAX) over CHILD_MAX over MAXUPRC.

But sysconf(_SC_CHILD_MAX) does return the number of "processes per real user id" (similar to
ulimit -u), rather than the number of CHILD_MAX (whenever defined).

For Interix, things are different though:
There is no CHILD_MAX nor MAXUPRC defined, and sysconf(_SC_CHILD_MAX) does return 512,
but PIDs start to be recycled at ~120 already...

Any idea about the "correct" fix for getmaxchild() across platforms?

/haubi/


From MAILER-DAEMON Wed Jul 25 10:56:18 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Su30c-0003rk-Nl
	for mharc-bug-bash@gnu.org; Wed, 25 Jul 2012 10:56:18 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58719)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su30a-0003ra-Dd
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:56:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su30Z-0004Vb-3V
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:56:16 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:47017)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su30Y-0004VX-Ua
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:56:15 -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 BNK01303;
	Wed, 25 Jul 2012 10:56:14 -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 BAF27578 (AUTH cpr);
	Wed, 25 Jul 2012 10:56:13 -0400 (EDT)
Message-ID: <5010090D.40501@case.edu>
Date: Wed, 25 Jul 2012 10:56:13 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: Michael Haubenwallner <michael.haubenwallner@salomon.at>
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<500FA760.4090300@salomon.at> <500FF2B0.8000001@salomon.at>
In-Reply-To: <500FF2B0.8000001@salomon.at>
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: Greg Wooledge <wooledg@eeg.ccf.org>, 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, 25 Jul 2012 14:56:17 -0000

On 7/25/12 9:20 AM, Michael Haubenwallner wrote:
> 
> On 07/25/2012 09:59 AM, Michael Haubenwallner wrote:
>> On 07/25/2012 03:05 AM, Chet Ramey wrote:
>>> Bash holds on to the status of all terminated processes, not just
>>> background ones, and only checks for the presence of a newly-forked PID
>>> in that list if the list size exceeds CHILD_MAX.
> 
>> The AIX 6.1 I've debugged on has:
>>   #define CHILD_MAX 128
> 
>> I'm going to run this build job with 'truss -t kfork' again, to eventually find
>> some too small count of different PIDs before PID-recycling by the kernel...
> 
> Tracing shows:
> 
> The minimum fork count (including grand-childs to any depth) before PID recycling starts
> looks like 255 (once), but usually 256 and more.
> 
> However, one process does see a PID recycled after *at least* 128 forks,
> that is exactly the value of CHILD_MAX.
> 
> First thought is of some off-by-one bug, but reducing js.c_childmax in jobs.c (2 times)
> by one doesn't help.

It wouldn't. Bash prefers sysconf(_SC_CHILD_MAX) to the CHILD_MAX define,
and those two are apparently different.  You could replace js.c_childmax
in tests against its value (three places in jobs.c) with CHILD_MAX and
see whether that makes a difference.

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 Jul 25 10:57:11 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Su31S-00041W-V9
	for mharc-bug-bash@gnu.org; Wed, 25 Jul 2012 10:57:10 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58919)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su31M-00041C-Iq
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:57:10 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su31L-0004cO-Dz
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:57:04 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:47513)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su31L-0004cK-9R
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:57:03 -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 BNK01434;
	Wed, 25 Jul 2012 10:57:02 -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 BBU67114 (AUTH cpr);
	Wed, 25 Jul 2012 10:57:02 -0400 (EDT)
Message-ID: <5010093E.6040800@case.edu>
Date: Wed, 25 Jul 2012 10:57:02 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: "Steven W. Orr" <steveo@syslang.net>
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>	<20120724154904.GZ8239@eeg.ccf.org>	<500ED354.6050100@salomon.at>
	<500F464A.4070703@case.edu>	<500FA760.4090300@salomon.at>
	<500FF2B0.8000001@salomon.at> <500FF827.4050501@syslang.net>
In-Reply-To: <500FF827.4050501@syslang.net>
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: Wed, 25 Jul 2012 14:57:10 -0000

On 7/25/12 9:44 AM, Steven W. Orr wrote:

> One thing that just springs to mind: Under AIX, I believe (but don't take
> this as gospel) that PIDs are not strictly ascending. The low byte may
> increment, but it might be another byte in the pid_t that gets the
> increment, and the byte that increments may alternate. I don't know if
> anyone else does this, but I seem to remember that AIX does (or did).

That does not (or should not) matter.

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 Jul 25 10:58:05 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Su32L-0004Bh-5u
	for mharc-bug-bash@gnu.org; Wed, 25 Jul 2012 10:58:05 -0400
Received: from eggs.gnu.org ([208.118.235.92]:59109)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1Su32E-0004BM-1a
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:58:03 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1Su328-00055A-8K
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:57:57 -0400
Received: from mx1.redhat.com ([209.132.183.28]:51817)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1Su328-00054x-0I
	for bug-bash@gnu.org; Wed, 25 Jul 2012 10:57:52 -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 q6PEvow2026106
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
	for <bug-bash@gnu.org>; Wed, 25 Jul 2012 10:57:50 -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 q6PEvnI8001432
	for <bug-bash@gnu.org>; Wed, 25 Jul 2012 10:57:50 -0400
Message-ID: <5010096D.4070502@redhat.com>
Date: Wed, 25 Jul 2012 16:57:49 +0200
From: Roman Rakus <rrakus@redhat.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:13.0) Gecko/20120615 Thunderbird/13.0.1
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<500FA760.4090300@salomon.at> <500FF2B0.8000001@salomon.at>
	<50100846.7040007@salomon.at>
In-Reply-To: <50100846.7040007@salomon.at>
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
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
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: Wed, 25 Jul 2012 14:58:03 -0000

On 07/25/2012 04:52 PM, Michael Haubenwallner wrote:
> Got it: The value used for js.c_childmax isn't 128, but 1024.
>
> In lib/sh/oslib.c, getmaxchild() prefers sysconf(_SC_CHILD_MAX) over CHILD_MAX over MAXUPRC.
>
> But sysconf(_SC_CHILD_MAX) does return the number of "processes per real user id" (similar to
> ulimit -u), rather than the number of CHILD_MAX (whenever defined).
>
> For Interix, things are different though:
> There is no CHILD_MAX nor MAXUPRC defined, and sysconf(_SC_CHILD_MAX) does return 512,
> but PIDs start to be recycled at ~120 already...
>
> Any idea about the "correct" fix for getmaxchild() across platforms?
>
> /haubi/
>
And there is also a problem when you change the `ulimit -u' value.
See  https://bugzilla.redhat.com/show_bug.cgi?id=832997

RR

From MAILER-DAEMON Wed Jul 25 11:33:15 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Su3aN-00042H-GI
	for mharc-bug-bash@gnu.org; Wed, 25 Jul 2012 11:33:15 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42564)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su3aK-0003yo-7s
	for bug-bash@gnu.org; Wed, 25 Jul 2012 11:33:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su3aF-00077n-Mf
	for bug-bash@gnu.org; Wed, 25 Jul 2012 11:33:12 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:52679)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su3aF-00077T-HK
	for bug-bash@gnu.org; Wed, 25 Jul 2012 11:33:07 -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 BNK05012;
	Wed, 25 Jul 2012 11:33:06 -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 BBU72912 (AUTH cpr);
	Wed, 25 Jul 2012 11:33:05 -0400 (EDT)
Message-ID: <501011B1.3010508@case.edu>
Date: Wed, 25 Jul 2012 11:33:05 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: Michael Haubenwallner <michael.haubenwallner@salomon.at>
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<500FA760.4090300@salomon.at> <20120725121459.GA8239@eeg.ccf.org>
	<500FFE8E.2040903@salomon.at>
In-Reply-To: <500FFE8E.2040903@salomon.at>
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: Greg Wooledge <wooledg@eeg.ccf.org>, 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, 25 Jul 2012 15:33:13 -0000

On 7/25/12 10:11 AM, Michael Haubenwallner wrote:
> 
> On 07/25/2012 02:14 PM, Greg Wooledge wrote:
>> On Wed, Jul 25, 2012 at 09:59:28AM +0200, Michael Haubenwallner wrote:
>>> OTOH, AFAICT, as long as a PID isn't waitpid()ed for, it isn't reused by fork().
>>> However, I'm unable to find that in the POSIX spec.
>>
>> A process that hasn't been waited for should become a zombie, which
>> should be sufficient to prevent its PID being reused.  Are you saying
>> that AIX and Interix don't have zombies?
> 
> Nope. My thought was that bash eventually could postpone waiting for a specific
> child PID until required by the driving shell script. That is: immediately for
> synchronous childs to set $?, and on "wait" for asynchronous childs. The idea
> was to render storing CHILD_MAX returnvalues obsolete.

It won't; Posix makes it required.  However, Posix does allow shells to
detect when $! is referenced and not save that many termination statuses
if it's not.  The problem is as I explained in a previous message: you
have processes you have to reap whether or not the script calls `wait'.

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 Jul 25 11:33:43 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Su3ap-0004Fe-N1
	for mharc-bug-bash@gnu.org; Wed, 25 Jul 2012 11:33:43 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42802)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1Su3ai-0004Bn-NS
	for bug-bash@gnu.org; Wed, 25 Jul 2012 11:33:42 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1Su3ac-0007F3-T7
	for bug-bash@gnu.org; Wed, 25 Jul 2012 11:33:36 -0400
Received: from mail-out.m-online.net ([212.18.0.10]:35375)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1Su3ac-0007DW-GH
	for bug-bash@gnu.org; Wed, 25 Jul 2012 11:33:30 -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 3Wj0nw5XwSz3hhgk;
	Wed, 25 Jul 2012 17:33:24 +0200 (CEST)
X-Auth-Info: Y3lwpgjRnfn/yJV4CcTPmEZkO5AZh9x03pM14EpX3y4=
Received: from igel.home (ppp-93-104-157-219.dynamic.mnet-online.de
	[93.104.157.219])
	by mail.mnet-online.de (Postfix) with ESMTPA id 3Wj0nw3SXXzbbgx;
	Wed, 25 Jul 2012 17:33:24 +0200 (CEST)
Received: by igel.home (Postfix, from userid 501)
	id EF775CA2A2; Wed, 25 Jul 2012 17:33:23 +0200 (CEST)
From: Andreas Schwab <schwab@linux-m68k.org>
To: chet.ramey@case.edu
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org> <500ED354.6050100@salomon.at>
	<500F464A.4070703@case.edu>
X-Yow: I'm a fuschia bowling ball somewhere in Brittany
Date: Wed, 25 Jul 2012 17:33:23 +0200
In-Reply-To: <500F464A.4070703@case.edu> (Chet Ramey's message of "Tue, 24 Jul
	2012 21:05:14 -0400")
Message-ID: <m27gtrhn3w.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: Greg Wooledge <wooledg@eeg.ccf.org>, bug-bash@gnu.org,
	Michael Haubenwallner <michael.haubenwallner@salomon.at>
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, 25 Jul 2012 15:33:42 -0000

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

> And that's the problem.  Bash assumes that there's a PID space at least as
> large as CHILD_MAX, and that the kernel will use all of it before reusing
> any PID in the space.  Posix says that shells must remember up to CHILD_MAX
> statuses of terminated asynchronous children (the description of `wait'),
> so implicitly the kernel is not allowed to reuse process IDs until it has
> exhausted CHILD_MAX PIDs.

I cannot see how CHILD_MAX is related to pid reuse.  CHILD_MAX is a
per-user limit, but the pid namespace is global.  If the shell forks a
new process, and the pid of it matches one of the previously used pids
for asynchronous jobs it can surely discard the remembered status for
that job.

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 Wed Jul 25 12:00:09 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Su40P-0008Kv-8H
	for mharc-bug-bash@gnu.org; Wed, 25 Jul 2012 12:00:09 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48711)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su40G-000839-Rk
	for bug-bash@gnu.org; Wed, 25 Jul 2012 12:00:06 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su40E-0000yx-Jp
	for bug-bash@gnu.org; Wed, 25 Jul 2012 12:00:00 -0400
Received: from smtp.salomon.at ([193.186.16.13]:46411)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su40E-0000yp-Db
	for bug-bash@gnu.org; Wed, 25 Jul 2012 11:59:58 -0400
Received: from samail03.wamas.com ([172.28.2.2] helo=mailhost.salomon.at)
	by smtp.salomon.at with esmtps (TLSv1:AES256-SHA:256) (Exim 4.77)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su40A-00023P-BL; Wed, 25 Jul 2012 17:59:54 +0200
Received: from [172.28.8.170] by mailhost.salomon.at with esmtp (Exim 4.77)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Su40A-0005Gd-7L; Wed, 25 Jul 2012 17:59:54 +0200
Message-ID: <501017FA.1040200@salomon.at>
Date: Wed, 25 Jul 2012 17:59:54 +0200
From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:10.0.3) Gecko/20120327 Thunderbird/10.0.3
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<500FA760.4090300@salomon.at> <501007C4.3030604@case.edu>
In-Reply-To: <501007C4.3030604@case.edu>
X-Enigmail-Version: 1.3.5
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 193.186.16.13
Cc: Greg Wooledge <wooledg@eeg.ccf.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: Wed, 25 Jul 2012 16:00:07 -0000


On 07/25/2012 04:50 PM, Chet Ramey wrote:
>> The AIX 6.1 I've debugged on has:
>>   #define CHILD_MAX 128
>>   #define _POSIX_CHILD_MAX 25
>>   sysconf(_SC_CHILD_MAX) = 1024

> Bash prefers sysconf(_SC_CHILD_MAX) and will use it over the other
> defines (lib/sh/oslib.c:getmaxchild()).  I don't know why AIX chooses
> to return a different value via sysconf than it defines for CHILD_MAX,
> especially when it seems to use the CHILD_MAX value to decide when it
> can recycle the PID space.

Well, _SC_CHILD_MAX is documented across platforms as:
(Linux)   "The max number of simultaneous processes per user ID."
(HP-UX)   "Maximum number of simultaneous processes per user ID."
(Solaris) "Max processes allowed to a UID"
(AIX)     "Specifies the number of simultaneous processes per real user ID."
(Interix) "Maximum number of simultaneous processes per user ID."

Also, one Linux machine actually shows the _SC_CHILD_MAX value equal to
kernel.pid_max (32768 here), so even Linux could see this problem in theory,
because PIDs really are recycled before kernel.pid_max.

> And I suspect that the single change of significance is to not check
> against the childmax value when deciding whether or not to look for and
> remove this pid from the list of saved termination status values.

Agreed - but is this still different to defining RECYCLES_PIDS then?

Thank you!
/haubi/


From MAILER-DAEMON Wed Jul 25 13:06:47 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Su52t-0000AZ-MG
	for mharc-bug-bash@gnu.org; Wed, 25 Jul 2012 13:06:47 -0400
Received: from eggs.gnu.org ([208.118.235.92]:55900)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su52r-0000AI-H7
	for bug-bash@gnu.org; Wed, 25 Jul 2012 13:06:46 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su52q-000554-7v
	for bug-bash@gnu.org; Wed, 25 Jul 2012 13:06:45 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:63158)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su52p-00054l-SC
	for bug-bash@gnu.org; Wed, 25 Jul 2012 13:06:44 -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 BNK13604;
	Wed, 25 Jul 2012 13:06:42 -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 BBU87575 (AUTH cpr);
	Wed, 25 Jul 2012 13:06:42 -0400 (EDT)
Message-ID: <501027A2.3070402@case.edu>
Date: Wed, 25 Jul 2012 13:06:42 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: Michael Haubenwallner <michael.haubenwallner@salomon.at>
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<500FA760.4090300@salomon.at> <501007C4.3030604@case.edu>
	<501017FA.1040200@salomon.at>
In-Reply-To: <501017FA.1040200@salomon.at>
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: Greg Wooledge <wooledg@eeg.ccf.org>, 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, 25 Jul 2012 17:06:46 -0000

On 7/25/12 11:59 AM, Michael Haubenwallner wrote:
> 
> On 07/25/2012 04:50 PM, Chet Ramey wrote:
>>> The AIX 6.1 I've debugged on has:
>>>   #define CHILD_MAX 128
>>>   #define _POSIX_CHILD_MAX 25
>>>   sysconf(_SC_CHILD_MAX) = 1024
> 
>> Bash prefers sysconf(_SC_CHILD_MAX) and will use it over the other
>> defines (lib/sh/oslib.c:getmaxchild()).  I don't know why AIX chooses
>> to return a different value via sysconf than it defines for CHILD_MAX,
>> especially when it seems to use the CHILD_MAX value to decide when it
>> can recycle the PID space.
> 
> Well, _SC_CHILD_MAX is documented across platforms as:
> (Linux)   "The max number of simultaneous processes per user ID."
> (HP-UX)   "Maximum number of simultaneous processes per user ID."
> (Solaris) "Max processes allowed to a UID"
> (AIX)     "Specifies the number of simultaneous processes per real user ID."
> (Interix) "Maximum number of simultaneous processes per user ID."
> 
> Also, one Linux machine actually shows the _SC_CHILD_MAX value equal to
> kernel.pid_max (32768 here), so even Linux could see this problem in theory,
> because PIDs really are recycled before kernel.pid_max.

That's interesting, since Posix describes sysconf() as simply a way to
retrieve values from limits.h or unistd.h that one wishes to get at
run time rather than compile time.  And interesting that it establishes a
correspondence between CHILD_MAX and _SC_CHILD_MAX.

> 
>> And I suspect that the single change of significance is to not check
>> against the childmax value when deciding whether or not to look for and
>> remove this pid from the list of saved termination status values.
> 
> Agreed - but is this still different to defining RECYCLES_PIDS then?

It is not.  It is one of the things that happens when you define
RECYCLES_PIDS.  The question is whether or not that is the single thing
that makes a difference in this case.  If it is, there is merit in
removing the check against js.c_childmax entirely or making it dependent
on something else.

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 Jul 25 13:08:41 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Su54j-00019s-Cc
	for mharc-bug-bash@gnu.org; Wed, 25 Jul 2012 13:08:41 -0400
Received: from eggs.gnu.org ([208.118.235.92]:56649)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su54h-00019a-PP
	for bug-bash@gnu.org; Wed, 25 Jul 2012 13:08:40 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su54d-0005v8-6v
	for bug-bash@gnu.org; Wed, 25 Jul 2012 13:08:39 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:60547)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su54d-0005v3-21
	for bug-bash@gnu.org; Wed, 25 Jul 2012 13:08:35 -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 BNK13762;
	Wed, 25 Jul 2012 13:08:34 -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 BBU87829 (AUTH cpr);
	Wed, 25 Jul 2012 13:08:34 -0400 (EDT)
Message-ID: <50102812.8010208@case.edu>
Date: Wed, 25 Jul 2012 13:08:34 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: Andreas Schwab <schwab@linux-m68k.org>
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<m27gtrhn3w.fsf@igel.home>
In-Reply-To: <m27gtrhn3w.fsf@igel.home>
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: Michael Haubenwallner <michael.haubenwallner@salomon.at>, bug-bash@gnu.org,
	Greg Wooledge <wooledg@eeg.ccf.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, 25 Jul 2012 17:08:40 -0000

On 7/25/12 11:33 AM, Andreas Schwab wrote:

> I cannot see how CHILD_MAX is related to pid reuse.  CHILD_MAX is a
> per-user limit, but the pid namespace is global.  If the shell forks a
> new process, and the pid of it matches one of the previously used pids
> for asynchronous jobs it can surely discard the remembered status for
> that job.

Thanks, that's a good restatement of the problem.  Your proposed solution
is one of the possibles.  The question is whether or not it's necessary
(apparently on some systems) and sufficient (probably).

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 Jul 25 13:12:28 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Su58O-00024Z-0R
	for mharc-bug-bash@gnu.org; Wed, 25 Jul 2012 13:12:28 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38399)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su58K-00023s-QB
	for bug-bash@gnu.org; Wed, 25 Jul 2012 13:12:25 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su58J-0007Vm-Kc
	for bug-bash@gnu.org; Wed, 25 Jul 2012 13:12:24 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:61675)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Su58J-0007UT-Ef
	for bug-bash@gnu.org; Wed, 25 Jul 2012 13:12:23 -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 BNK14159;
	Wed, 25 Jul 2012 13:12:22 -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 BAF46609 (AUTH cpr);
	Wed, 25 Jul 2012 13:12:22 -0400 (EDT)
Message-ID: <501028F6.3070104@case.edu>
Date: Wed, 25 Jul 2012 13:12: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/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: Roman Rakus <rrakus@redhat.com>
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<500FA760.4090300@salomon.at> <500FF2B0.8000001@salomon.at>
	<50100846.7040007@salomon.at> <5010096D.4070502@redhat.com>
In-Reply-To: <5010096D.4070502@redhat.com>
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: Wed, 25 Jul 2012 17:12:26 -0000

On 7/25/12 10:57 AM, Roman Rakus wrote:

> And there is also a problem when you change the `ulimit -u' value.
> See  https://bugzilla.redhat.com/show_bug.cgi?id=832997

It's not clear to me that it's desirable to attempt to remember a
potentially unlimited number of process exit statuses.  You have to
bound it somewhere.

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 Jul 26 05:31:46 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SuKQ6-00059h-HF
	for mharc-bug-bash@gnu.org; Thu, 26 Jul 2012 05:31:46 -0400
Received: from eggs.gnu.org ([208.118.235.92]:59337)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1SuKPz-00058o-3t
	for bug-bash@gnu.org; Thu, 26 Jul 2012 05:31:44 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1SuKPt-0000Uo-6W
	for bug-bash@gnu.org; Thu, 26 Jul 2012 05:31:39 -0400
Received: from smtp.salomon.at ([193.186.16.13]:54170)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1SuKPs-0000Uh-S4
	for bug-bash@gnu.org; Thu, 26 Jul 2012 05:31:33 -0400
Received: from samail03.wamas.com ([172.28.2.2] helo=mailhost.salomon.at)
	by smtp.salomon.at with esmtps (TLSv1:AES256-SHA:256) (Exim 4.77)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1SuKPk-0006l2-G0; Thu, 26 Jul 2012 11:31:25 +0200
Received: from s01aa24.wamas.com ([172.28.53.138])
	by mailhost.salomon.at with esmtps (TLSv1:CAMELLIA256-SHA:256)
	(Exim 4.77) (envelope-from <michael.haubenwallner@salomon.at>)
	id 1SuKPk-0006Ze-9A; Thu, 26 Jul 2012 11:31:24 +0200
Message-ID: <50110E6B.9080804@salomon.at>
Date: Thu, 26 Jul 2012 11:31:23 +0200
From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
User-Agent: Mozilla/5.0 (X11; Linux i686;
	rv:8.0) Gecko/20120113 Thunderbird/8.0
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<500FA760.4090300@salomon.at> <501007C4.3030604@case.edu>
	<501017FA.1040200@salomon.at> <501027A2.3070402@case.edu>
In-Reply-To: <501027A2.3070402@case.edu>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 193.186.16.13
Cc: Greg Wooledge <wooledg@eeg.ccf.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, 26 Jul 2012 09:31:44 -0000


On 07/25/12 19:06, Chet Ramey wrote:
>> Well, _SC_CHILD_MAX is documented across platforms as:

Heck, even POSIX specifies CHILD_MAX as:
"Maximum number of simultaneous processes per real user ID."

>> Also, one Linux machine actually shows the _SC_CHILD_MAX value equal to
>> kernel.pid_max (32768 here),
>
> That's interesting, since Posix describes sysconf() as simply a way to
> retrieve values from limits.h or unistd.h that one wishes to get at
> run time rather than compile time.  And interesting that it establishes a
> correspondence between CHILD_MAX and _SC_CHILD_MAX.

There's this one sentence in sysconf spec:
   The value returned shall not be more restrictive than the corresponding
   value described to the application when it was compiled with the
   implementation's <limits.h> or <unistd.h>.

So CHILD_MAX is the /minimum/ value sysconf(_SC_CHILD_MAX) may return.

>>> And I suspect that the single change of significance is to not check
>>> against the childmax value when deciding whether or not to look for and
>>> remove this pid from the list of saved termination status values.
>>
>> Agreed - but is this still different to defining RECYCLES_PIDS then?
>
> It is not.  It is one of the things that happens when you define
> RECYCLES_PIDS.  The question is whether or not that is the single thing
> that makes a difference in this case.  If it is, there is merit in
> removing the check against js.c_childmax entirely or making it dependent
> on something else.

IMO, checking against js.c_childmax (sysconf's value) still makes sense
to have some upper limit, while being large enough to be useful.
However, defining the "useful" value is up to the kernel, which does
guarantee for static CHILD_MAX (or _POSIX_CHILD_MAX) at least, while
providing more than 100 in practice across various platforms.

However, having the "useful" value unavailable to bash feels like
rendering the RECYCLES_PIDS-implementation mandatory for /any/ platform.

/haubi/


From MAILER-DAEMON Thu Jul 26 06:20:08 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SuLAu-00059L-1m
	for mharc-bug-bash@gnu.org; Thu, 26 Jul 2012 06:20:08 -0400
Path: usenet.stanford.edu!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From: wangzhong.neu@gmail.com
Newsgroups: gnu.bash.bug
Subject: Unexpected return from subscripts
Date: Thu, 26 Jul 2012 02:48:30 -0700 (PDT)
Organization: http://groups.google.com
Lines: 34
Message-ID: <4f670beb-9985-4765-8f6f-8164e53191b0@googlegroups.com>
NNTP-Posting-Host: 122.1.9.28
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1343297769 13437 127.0.0.1 (26 Jul 2012 10:16:09
	GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 26 Jul 2012 10:16:09 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=122.1.9.28;
	posting-account=1KdX7QoAAAAQwdyX4aN4JctED-ZjRm9e
User-Agent: G2/1.0
Xref: usenet.stanford.edu gnu.bash.bug:24915
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: Thu, 26 Jul 2012 10:20:07 -0000

Hi all,

I'm not sure whether I should post this here. Sorry if disturb.

We met a very strange problem with bash "version 3.00.15(1)-release". We ar=
e using a hadoop-test script to test whether a file exists on HDFS. But we =
observed several times that the hadoop-test script, which is a subscript in=
 a control-flow script, returned unexpectly. It seems the subscript was put=
 in background, and the main-control script just go on and got a wrong retu=
rn value. We added some debug log in the hadoop-test script, and it looks l=
ike this:

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D sh -x DEBUG LOG =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ /home/work/hadoop-client/hadoop/bin/hadoop dfs -test -e xxxFile
+ '[' 0 -ne 0 ']'    # this is unexpected, the real return value is 1
+ some other things...
+ ...
+ ...
+ test: File does not exists: xxxFile    # this is unexpeted, should be pri=
nted before the condition statement. Looks like test script goes to backgro=
und
+ ...
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

This problem bothered us for several months because we have a large cluster=
 with thousands of nodes running the hadoop-test script. We met this case e=
very month. Anybody ever met the same problem?

Thanks,
Zhong



From MAILER-DAEMON Thu Jul 26 08:04:17 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SuMnh-0001hH-KF
	for mharc-bug-bash@gnu.org; Thu, 26 Jul 2012 08:04:17 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41939)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SuMnW-0001ad-JN
	for bug-bash@gnu.org; Thu, 26 Jul 2012 08:04:16 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SuMnQ-0008OP-Qw
	for bug-bash@gnu.org; Thu, 26 Jul 2012 08:04:06 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:49152
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SuMnQ-0008Kg-Kf
	for bug-bash@gnu.org; Thu, 26 Jul 2012 08:04:00 -0400
Received: (qmail 30836 invoked from network); 26 Jul 2012 12:03:36 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Thu, 26 Jul 2012 08:03:36 -0400
Received: (qmail 28808 invoked by uid 563); 26 Jul 2012 12:03:35 -0000
Date: Thu, 26 Jul 2012 08:03:35 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: wangzhong.neu@gmail.com
Subject: Re: Unexpected return from subscripts
Message-ID: <20120726120335.GD8239@eeg.ccf.org>
References: <4f670beb-9985-4765-8f6f-8164e53191b0@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4f670beb-9985-4765-8f6f-8164e53191b0@googlegroups.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: Thu, 26 Jul 2012 12:04:16 -0000

On Thu, Jul 26, 2012 at 02:48:30AM -0700, wangzhong.neu@gmail.com wrote:
> Hi all,
> 
> I'm not sure whether I should post this here. Sorry if disturb.

help-bash would be a better choice than bug-bash.

> We met a very strange problem with bash "version 3.00.15(1)-release". We are
> using a hadoop-test script to test whether a file exists on HDFS. [...]

Since you did not show the code that is failing, there's not much we
can do.

> ============== sh -x DEBUG LOG ==============
> + /home/work/hadoop-client/hadoop/bin/hadoop dfs -test -e xxxFile
> + '[' 0 -ne 0 ']'    # this is unexpected, the real return value is 1

If you believe that your "hadoop" command should have returned 1,
but bash believes that it returned 0, then perhaps the bug is in this
"hadoop" command.

Of course, since we have no idea what your bash code actually says,
we can't conclude much of *anything* at this point.


From MAILER-DAEMON Thu Jul 26 14:29:21 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SuSoL-0008JF-AW
	for mharc-bug-bash@gnu.org; Thu, 26 Jul 2012 14:29:21 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49072)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SuSoI-0008G6-MO
	for bug-bash@gnu.org; Thu, 26 Jul 2012 14:29:19 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SuSoG-0002Mq-I5
	for bug-bash@gnu.org; Thu, 26 Jul 2012 14:29:18 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:20504)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SuSoG-0002M9-Bn
	for bug-bash@gnu.org; Thu, 26 Jul 2012 14:29:16 -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 CBK53917; Thu, 26 Jul 2012 14:29:14 -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 BAG71735 (AUTH cpr);
	Thu, 26 Jul 2012 14:29:09 -0400 (EDT)
Message-ID: <50118C75.80008@case.edu>
Date: Thu, 26 Jul 2012 14:29:09 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: Michael Haubenwallner <michael.haubenwallner@salomon.at>
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<m27gtrhn3w.fsf@igel.home> <50102812.8010208@case.edu>
In-Reply-To: <50102812.8010208@case.edu>
X-Enigmail-Version: 1.4.2
Content-Type: multipart/mixed; boundary="------------040706030206010705010109"
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: Greg Wooledge <wooledg@eeg.ccf.org>, Andreas Schwab <schwab@linux-m68k.org>,
	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, 26 Jul 2012 18:29:19 -0000

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

On 7/25/12 1:08 PM, Chet Ramey wrote:
> On 7/25/12 11:33 AM, Andreas Schwab wrote:
> 
>> I cannot see how CHILD_MAX is related to pid reuse.  CHILD_MAX is a
>> per-user limit, but the pid namespace is global.  If the shell forks a
>> new process, and the pid of it matches one of the previously used pids
>> for asynchronous jobs it can surely discard the remembered status for
>> that job.
> 
> Thanks, that's a good restatement of the problem.  Your proposed solution
> is one of the possibles.  The question is whether or not it's necessary
> (apparently on some systems) and sufficient (probably).

OK, we have some data, we have a hypothesis, and we have a way to test it.
Let's test it.

Michael, please apply the attached patch, disable RECYCLES_PIDS, and run
your tests again.  This makes the check for previously-saved exit statuses
unconditional.

Let's see if this is the one change of significance.

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/



--------------040706030206010705010109
Content-Type: application/x-patch;
 name="pid-recycle.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="pid-recycle.patch"

KioqIC4uL2Jhc2gtNC4yLXBhdGNoZWQvam9icy5jCTIwMTEtMDEtMDcgMTA6NTk6MjkuMDAw
MDAwMDAwIC0wNTAwCi0tLSBqb2JzLmMJMjAxMi0wNy0yNiAxMDo1Mzo1My4wMDAwMDAwMDAg
LTA0MDAKKioqKioqKioqKioqKioqCioqKiAxOTAwLDE5MDMgKioqKgotLS0gMTkwMiwxOTA4
IC0tLS0KICAJZGVsZXRlX29sZF9qb2IgKHBpZCk7CiAgCisgI2lmIDAKKyAgICAgICAvKiBQ
ZXJmb3JtIHRoZSBjaGVjayBmb3IgcGlkIHJldXNlIHVuY29uZGl0aW9uYWxseS4gIFNvbWUg
c3lzdGVtcyByZXVzZQorICAgICAgICAgIFBJRHMgYmVmb3JlIGdpdmluZyBhIHByb2Nlc3Mg
Q0hJTERfTUFYL19TQ19DSElMRF9NQVggdW5pcXVlIG9uZXMuICovCiAgI2lmICFkZWZpbmVk
IChSRUNZQ0xFU19QSURTKQogICAgICAgIC8qIE9ubHkgY2hlY2sgZm9yIHNhdmVkIHN0YXR1
cyBpZiB3ZSd2ZSBzYXZlZCBtb3JlIHRoYW4gQ0hJTERfTUFYCioqKioqKioqKioqKioqKgoq
KiogMTkwNSwxOTA4ICoqKioKLS0tIDE5MTAsMTkxNCAtLS0tCiAgICAgICAgaWYgKChqcy5j
X3JlYXBlZCArIGJncGlkcy5ucGlkKSA+PSBqcy5jX2NoaWxkbWF4KQogICNlbmRpZgorICNl
bmRpZgogIAliZ3BfZGVsZXRlIChwaWQpOwkJLyogbmV3IHByb2Nlc3MsIGRpc2NhcmQgYW55
IHNhdmVkIHN0YXR1cyAqLwogIAo=
--------------040706030206010705010109--



From MAILER-DAEMON Thu Jul 26 17:37:47 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SuVkh-0007oX-93
	for mharc-bug-bash@gnu.org; Thu, 26 Jul 2012 17:37:47 -0400
Received: from eggs.gnu.org ([208.118.235.92]:34854)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1SuVke-0007m3-NP
	for bug-bash@gnu.org; Thu, 26 Jul 2012 17:37:45 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1SuVkd-0001Fs-Ov
	for bug-bash@gnu.org; Thu, 26 Jul 2012 17:37:44 -0400
Received: from smtp.salomon.at ([193.186.16.13]:33670)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1SuVkd-0001FZ-Ht
	for bug-bash@gnu.org; Thu, 26 Jul 2012 17:37:43 -0400
Received: from samail03.wamas.com ([172.28.2.2] helo=mailhost.salomon.at)
	by smtp.salomon.at with esmtps (TLSv1:AES256-SHA:256) (Exim 4.77)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1SuVkY-0001jW-B6; Thu, 26 Jul 2012 23:37:39 +0200
Received: from s03mkw01.wamas.com ([172.28.53.139])
	by mailhost.salomon.at with esmtps (TLSv1:CAMELLIA256-SHA:256)
	(Exim 4.77) (envelope-from <michael.haubenwallner@salomon.at>)
	id 1SuVkY-0007h6-1o; Thu, 26 Jul 2012 23:37:38 +0200
Message-ID: <5011B8A1.2040000@salomon.at>
Date: Thu, 26 Jul 2012 23:37:37 +0200
From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
User-Agent: Mozilla/5.0 (X11; Linux i686;
	rv:8.0) Gecko/20120113 Thunderbird/8.0
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<m27gtrhn3w.fsf@igel.home> <50102812.8010208@case.edu>
	<50118C75.80008@case.edu>
In-Reply-To: <50118C75.80008@case.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 193.186.16.13
Cc: Greg Wooledge <wooledg@eeg.ccf.org>, Andreas Schwab <schwab@linux-m68k.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, 26 Jul 2012 21:37:45 -0000


On 07/26/12 20:29, Chet Ramey wrote:
> OK, we have some data, we have a hypothesis, and we have a way to test it.
> Let's test it.
>
> Michael, please apply the attached patch, disable RECYCLES_PIDS, and run
> your tests again.  This makes the check for previously-saved exit statuses
> unconditional.
>
> Let's see if this is the one change of significance.

Nope, doesn't fix the problem, even if it might be necessary though
to not mix up stored exitstates.

Somehow this is related to last_made_pid being preserved across childs
created for { $() } or { `` }.

In execute_command_internal(), last_made_pid still holds the 128 forks
old (first) PID, causing wait_for() to be not run when getting the same
PID by execute_simple_command() again.

However, I've been able to create a short testcase now:

---
#! /bin/bash

/bin/false # make first child

for x in {1..127}; do
   x=$( : ) # make CHILD_MAX-1 more childs
done

# breaks when first child's PID is recycled here
if /bin/false; then
   echo BOOM
   exit 1
fi

echo GOOD
---

/haubi/



From MAILER-DAEMON Fri Jul 27 09:50:38 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SukwA-0002vb-Jt
	for mharc-bug-bash@gnu.org; Fri, 27 Jul 2012 09:50:38 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38838)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Sukw0-0002R9-ER
	for bug-bash@gnu.org; Fri, 27 Jul 2012 09:50:37 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Sukvq-00051M-QK
	for bug-bash@gnu.org; Fri, 27 Jul 2012 09:50:28 -0400
Received: from smtp.salomon.at ([193.186.16.13]:42539)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Sukvq-00050k-Fx
	for bug-bash@gnu.org; Fri, 27 Jul 2012 09:50:18 -0400
Received: from samail03.wamas.com ([172.28.2.2] helo=mailhost.salomon.at)
	by smtp.salomon.at with esmtps (TLSv1:AES256-SHA:256) (Exim 4.77)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Sukvj-0006MI-EY; Fri, 27 Jul 2012 15:50:11 +0200
Received: from [172.28.8.170] by mailhost.salomon.at with esmtp (Exim 4.77)
	(envelope-from <michael.haubenwallner@salomon.at>)
	id 1Sukvj-0000jy-A1; Fri, 27 Jul 2012 15:50:11 +0200
Message-ID: <50129C93.5010903@salomon.at>
Date: Fri, 27 Jul 2012 15:50:11 +0200
From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:10.0.3) Gecko/20120327 Thunderbird/10.0.3
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<m27gtrhn3w.fsf@igel.home> <50102812.8010208@case.edu>
	<50118C75.80008@case.edu> <5011B8A1.2040000@salomon.at>
In-Reply-To: <5011B8A1.2040000@salomon.at>
X-Enigmail-Version: 1.3.5
Content-Type: multipart/mixed; boundary="------------070601040901080705020306"
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 193.186.16.13
Cc: Greg Wooledge <wooledg@eeg.ccf.org>, Andreas Schwab <schwab@linux-m68k.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: Fri, 27 Jul 2012 13:50:38 -0000

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


On 07/26/2012 11:37 PM, Michael Haubenwallner wrote:
> On 07/26/12 20:29, Chet Ramey wrote:
>> OK, we have some data, we have a hypothesis, and we have a way to test it.
>> Let's test it.
>>
>> Michael, please apply the attached patch, disable RECYCLES_PIDS, and run
>> your tests again.  This makes the check for previously-saved exit statuses
>> unconditional.
>>
>> Let's see if this is the one change of significance.
> 
> Nope, doesn't fix the problem, even if it might be necessary though
> to not mix up stored exitstates.

For mixing up stored exitstates: This patch isn't enough to get below testcase
working reliably - it also is necessary to drop the pid_wrap detection, as pids
aren't guaranteed to be (re)used in any particular order. However, this highly
depends on the machine's load.

With attached patch I haven't been able to break the testcase below so far
on that AIX 6.1 box here.

But still, the other one using the $()-childs still fails.

---
for job in {128..511} {0..127}
do
  if [[ ${job} -lt 128 ]]; then
    ( exit 17 ) & 
  else  
    ( exit 1 ) &
  fi
  eval "pidof_${job}=\$!"
done

for job in {127..0}; do
  pid=pidof_${job}
  pid=${!pid}

  wait ${pid}
  ret=$?

  if [ ${ret} -ne 17 ]; then
    echo "job ${job} failed with ret ${ret}" 
  fi
done
---

Thank you!
/haubi/ (away for next 3 weeks)

--------------070601040901080705020306
Content-Type: text/x-patch;
 name="pid-recycle-wrap.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="pid-recycle-wrap.patch"

*** jobs.c.orig	2012-07-27 15:29:54.283862562 +0200
--- jobs.c	2012-07-27 15:29:51.960238374 +0200
***************
*** 1897,1903 ****
--- 1897,1906 ----
  #endif
  
+ #if 0
        if (pid_wrap > 0)
+ #endif
  	delete_old_job (pid);
  
+ #if 0
  #if !defined (RECYCLES_PIDS)
        /* Only check for saved status if we've saved more than CHILD_MAX
***************
*** 1905,1908 ****
--- 1908,1912 ----
        if ((js.c_reaped + bgpids.npid) >= js.c_childmax)
  #endif
+ #endif
  	bgp_delete (pid);		/* new process, discard any saved status */
  

--------------070601040901080705020306--


From MAILER-DAEMON Fri Jul 27 10:55:09 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sulwb-0004oR-Mm
	for mharc-bug-bash@gnu.org; Fri, 27 Jul 2012 10:55:09 -0400
Received: from eggs.gnu.org ([208.118.235.92]:45921)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SulwU-0004iX-76
	for bug-bash@gnu.org; Fri, 27 Jul 2012 10:55:07 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SulwN-0003FM-Bz
	for bug-bash@gnu.org; Fri, 27 Jul 2012 10:55:02 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:56421)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SulwN-0003FB-6y
	for bug-bash@gnu.org; Fri, 27 Jul 2012 10:54:55 -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 CBL35423; Fri, 27 Jul 2012 10:54:54 -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 BBX84323 (AUTH cpr);
	Fri, 27 Jul 2012 10:54:53 -0400 (EDT)
Message-ID: <5012ABBD.9020405@case.edu>
Date: Fri, 27 Jul 2012 10:54:53 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: Michael Haubenwallner <michael.haubenwallner@salomon.at>
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<m27gtrhn3w.fsf@igel.home> <50102812.8010208@case.edu>
	<50118C75.80008@case.edu> <5011B8A1.2040000@salomon.at>
In-Reply-To: <5011B8A1.2040000@salomon.at>
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: Greg Wooledge <wooledg@eeg.ccf.org>, Andreas Schwab <schwab@linux-m68k.org>,
	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, 27 Jul 2012 14:55:08 -0000

On 7/26/12 5:37 PM, Michael Haubenwallner wrote:
> 
> On 07/26/12 20:29, Chet Ramey wrote:
>> OK, we have some data, we have a hypothesis, and we have a way to test it.
>> Let's test it.
>>
>> Michael, please apply the attached patch, disable RECYCLES_PIDS, and run
>> your tests again.  This makes the check for previously-saved exit statuses
>> unconditional.
>>
>> Let's see if this is the one change of significance.
> 
> Nope, doesn't fix the problem, even if it might be necessary though
> to not mix up stored exitstates.
> 
> Somehow this is related to last_made_pid being preserved across childs
> created for { $() } or { `` }.

I'll take a look at your test script.  Keep in mind that last_made_pid is
supposed to retain its value across command substitutions.  It's used to
decide whether or not to wait for a command.  Command substitutions are
not commands in that sense.

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 Jul 27 17:05:12 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Surii-0003Sr-88
	for mharc-bug-bash@gnu.org; Fri, 27 Jul 2012 17:05:12 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41615)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Suric-0003Oo-7P
	for bug-bash@gnu.org; Fri, 27 Jul 2012 17:05:10 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Suria-00075G-MC
	for bug-bash@gnu.org; Fri, 27 Jul 2012 17:05:06 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:16342)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Suria-000735-Hi
	for bug-bash@gnu.org; Fri, 27 Jul 2012 17:05:04 -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 CBL67914; Fri, 27 Jul 2012 17:05:03 -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 BBY37305 (AUTH cpr);
	Fri, 27 Jul 2012 17:05:02 -0400 (EDT)
Message-ID: <5013027E.9060900@case.edu>
Date: Fri, 27 Jul 2012 17:05:02 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: Michael Haubenwallner <michael.haubenwallner@salomon.at>
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<m27gtrhn3w.fsf@igel.home> <50102812.8010208@case.edu>
	<50118C75.80008@case.edu> <5011B8A1.2040000@salomon.at>
In-Reply-To: <5011B8A1.2040000@salomon.at>
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 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: Greg Wooledge <wooledg@eeg.ccf.org>, Andreas Schwab <schwab@linux-m68k.org>,
	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, 27 Jul 2012 21:05:10 -0000

On 7/26/12 5:37 PM, Michael Haubenwallner wrote:
> 
> On 07/26/12 20:29, Chet Ramey wrote:
>> OK, we have some data, we have a hypothesis, and we have a way to test it.
>> Let's test it.
>>
>> Michael, please apply the attached patch, disable RECYCLES_PIDS, and run
>> your tests again.  This makes the check for previously-saved exit statuses
>> unconditional.
>>
>> Let's see if this is the one change of significance.
> 
> Nope, doesn't fix the problem, even if it might be necessary though
> to not mix up stored exitstates.
> 
> Somehow this is related to last_made_pid being preserved across childs
> created for { $() } or { `` }.

As I said in a previous message, it's supposed to be.  last_made_pid is
really used as last-pid-that-should-be-waited-for.  You really don't
want to wait for processes begun to run command substitutions for any
reason other to reap them, and you don't want to save their return
statuses any longer than you have to.

So last_made_pid is used as a sentinel to indicate that there are
synchronous children we need to wait for and reap.  I'd have to do
an audit to make sure the shell does the right thing with exit statuses
of commands that consist solely of assignment statements.  I suspect
that with your change, and with RECYCLES_PIDS in general, the exit
status of an assignment statement is the exit status of the last
command waited for.  I'll have to verify and figure out what to do about
this.

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 Jul 28 12:38:21 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SvA21-0005Sn-KS
	for mharc-bug-bash@gnu.org; Sat, 28 Jul 2012 12:38:21 -0400
Received: from eggs.gnu.org ([208.118.235.92]:59023)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <lhunath@lyndir.com>) id 1SvA1z-0005SO-RM
	for bug-bash@gnu.org; Sat, 28 Jul 2012 12:38:20 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <lhunath@lyndir.com>) id 1SvA1y-0000cy-IZ
	for bug-bash@gnu.org; Sat, 28 Jul 2012 12:38:19 -0400
Received: from mail-we0-f169.google.com ([74.125.82.169]:47281)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <lhunath@lyndir.com>) id 1SvA1y-0000cp-8k
	for bug-bash@gnu.org; Sat, 28 Jul 2012 12:38:18 -0400
Received: by weys10 with SMTP id s10so3029056wey.0
	for <bug-bash@gnu.org>; Sat, 28 Jul 2012 09:38:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lyndir.com; s=google;
	h=from:content-type:subject:message-id:date:to:mime-version:x-mailer;
	bh=m+F+1eiDXjbFUwZA/Y6nCzRjqHB/9cUWy5b6l2BsNeA=;
	b=TmbA8W0p3cRA/cRwG04lIuv2dAxnHO6AQurgZ6hT/O9VFdWDBsRfSjC6MH75jFVDPO
	E7KrSPUPKbvIOVSpyevqGm6q+rI/RUhooy/trabqiIGM6nfrUfnBptsO/37Q/JrI5OTA
	wfmKcKyGqs7rxVw0+yUseS6XpsYEzlyjYEvCs=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=google.com; s=20120113;
	h=from:content-type:subject:message-id:date:to:mime-version:x-mailer
	:x-gm-message-state;
	bh=m+F+1eiDXjbFUwZA/Y6nCzRjqHB/9cUWy5b6l2BsNeA=;
	b=T/Epm9AH3DZKUHC0YLbV5Frc566lF8yZH4VHulWJSc1JcfJZnrUtw0Rtm9TcIGXBpy
	e01yYvzqPP8Xg7CrNz4rLir8+er6h5w81lnb9tL1d7NfG8Fyczd13VSQIrum79HBvTyC
	dgSOiIQiBAsOf7DyMMAhTCJnk3egqy++9CkSDhP3Bj3c5/8fjfaU9HPX+nxrZxTyVM73
	5HoU/DFuS5Wo6ot7WPsR9swzavV+LVD0CiEUhvTFlBmKoBlUMIG2O1/g9iht+9HjVj9A
	+gYuhXOCUiOGNIRql57RcsU5hzeEDENVe+JLkyhnGliTyqQxtHWdnNHU2yOKg6ED/Z7+
	Mcmw==
Received: by 10.180.100.133 with SMTP id ey5mr14430007wib.4.1343493496599;
	Sat, 28 Jul 2012 09:38:16 -0700 (PDT)
Received: from [192.168.0.10] (ip-213-49-98-105.dsl.scarlet.be.
	[213.49.98.105])
	by mx.google.com with ESMTPS id ef5sm7742176wib.3.2012.07.28.09.38.14
	(version=TLSv1/SSLv3 cipher=OTHER);
	Sat, 28 Jul 2012 09:38:15 -0700 (PDT)
From: Maarten Billemont <lhunath@lyndir.com>
Content-Type: multipart/signed;
	boundary="Apple-Mail=_386CFACE-8ECA-499E-A35B-447611512B96";
	protocol="application/pkcs7-signature"; micalg=sha1
Subject: EXIT traps in interactive shells
Message-Id: <F2CB5713-5F04-4952-A7A8-546F96D799B9@lyndir.com>
Date: Sat, 28 Jul 2012 18:38:09 +0200
To: bug-bash Bug <bug-bash@gnu.org>
Mime-Version: 1.0 (Mac OS X Mail 6.0 \(1485\))
X-Mailer: Apple Mail (2.1485)
X-Gm-Message-State: ALoCoQnY2vlfKnb5uc/aycaW5jQNBCfJ6gM/YyJzKFO3Il47mp8VZf5gZq0zhXATl0hbiC2FsSLa
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: Sat, 28 Jul 2012 16:38:20 -0000


--Apple-Mail=_386CFACE-8ECA-499E-A35B-447611512B96
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

Trapping on EXIT is a really convenient way of cleaning up after =
yourself when your script ends.

The nice thing about it is that you don't need to handle all sorts of =
signals, handle them, and re-throw them.  It makes for a single clean =
point to define your exit handlers.

Unfortunately, I've noticed that EXIT handlers don't play so nice in =
interactive shells.  This is of particular interest when you background =
a subshell from them:

{
    trap 'rm tempfile' EXIT
    dowork tempfile
} &
...
kill $!

This works fine from a script (non-interactive) but not when performed =
from the prompt.

Here's some demonstrational code:

interactive:

~ $ { trap 'echo exiting' EXIT; sleep 5; } & sleep 1; kill $!
[1] 59061
[1]+  Terminated: 15          { trap 'echo exiting' EXIT; sleep 5; }

non-interactive:

~ $ bash -c '{ trap "echo exiting" EXIT; sleep 5; }' & sleep 1; kill $!
[1] 59168
exiting
[1]+  Terminated: 15          bash -c '{ trap "echo exiting" EXIT; sleep =
5; }'

So, why is this, is this a bug, and we have this fixed?  I like being =
able to rely on my EXIT handler.

Cheers,
Maarten.=

--Apple-Mail=_386CFACE-8ECA-499E-A35B-447611512B96
Content-Disposition: attachment;
	filename=smime.p7s
Content-Type: application/pkcs7-signature;
	name=smime.p7s
Content-Transfer-Encoding: base64

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIPvzCCB9Uw
gga9oAMCAQICAiFeMA0GCSqGSIb3DQEBBQUAMIGMMQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3Rh
cnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzE4
MDYGA1UEAxMvU3RhcnRDb20gQ2xhc3MgMiBQcmltYXJ5IEludGVybWVkaWF0ZSBDbGllbnQgQ0Ew
HhcNMTIwNTIzMTQyNTI5WhcNMTQwNTI1MTM1MTMyWjCBozEZMBcGA1UEDRMQa1M5RDZWS2hJZkdV
MXg4SzELMAkGA1UEBhMCQkUxGDAWBgNVBAgTD09vc3QtVmxhYW5kZXJlbjEYMBYGA1UEBxMPU2lu
dC1BbWFuZHNiZXJnMRowGAYDVQQDExFNYWFydGVuIEJpbGxlbW9udDEpMCcGCSqGSIb3DQEJARYa
bWFhcnRlbi5iaWxsZW1vbnRAZW5jYXAubm8wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
AQDaEkB95TRxLqTqn8dM3+Q7LKAm995qhUkNWvCuV3dmiGSjQsd15pZb9Iu5A8PxmpusFgFWFlU3
SQcakg0LT8DUS85FBs3O6zpxWbZGB/4txSMbgN19rtMeWWlMluTzttpAufhOsjA96Xkdvao5dgzD
ywgHM0GHz+g64to+pHRT4HJrMYkfr9Nx+QhxQoyHq6Oei8X1QO5N88kHvP6HIrRq2BpUY8DHZaEk
SpDcjm2LBZJOBuOcg7OsFqEOuptbWHYQ/BF23FuV9POMXcyjbLrscXpkiVFrBqQuoGERDs7U4y8e
stRCmv9tuRKGnRUa0gZALPv8v7cxrPRSA6zx0uepAgMBAAGjggQmMIIEIjAJBgNVHRMEAjAAMAsG
A1UdDwQEAwIEsDAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwQwHQYDVR0OBBYEFGfGD71l
Vke3vX0cD3AmLsPGb/YSMB8GA1UdIwQYMBaAFK5Vg2/sMcq59x36r2sx88gd46y7MIGVBgNVHREE
gY0wgYqBGm1hYXJ0ZW4uYmlsbGVtb250QGVuY2FwLm5vgRptYWFydGVuLmJpbGxlbW9udEBlbmNh
cC5ub4EbbWFhcnRlbi5iaWxsZW1vbnRAbGluLWsubmV0gR9tYWFydGVuLmJpbGxlbW9udEB2aWxs
YS1lbW1hLmJlgRJsaHVuYXRoQGx5bmRpci5jb20wggIhBgNVHSAEggIYMIICFDCCAhAGCysGAQQB
gbU3AQICMIIB/zAuBggrBgEFBQcCARYiaHR0cDovL3d3dy5zdGFydHNzbC5jb20vcG9saWN5LnBk
ZjA0BggrBgEFBQcCARYoaHR0cDovL3d3dy5zdGFydHNzbC5jb20vaW50ZXJtZWRpYXRlLnBkZjCB
9wYIKwYBBQUHAgIwgeowJxYgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwAwIBARqB
vlRoaXMgY2VydGlmaWNhdGUgd2FzIGlzc3VlZCBhY2NvcmRpbmcgdG8gdGhlIENsYXNzIDIgVmFs
aWRhdGlvbiByZXF1aXJlbWVudHMgb2YgdGhlIFN0YXJ0Q29tIENBIHBvbGljeSwgcmVsaWFuY2Ug
b25seSBmb3IgdGhlIGludGVuZGVkIHB1cnBvc2UgaW4gY29tcGxpYW5jZSBvZiB0aGUgcmVseWlu
ZyBwYXJ0eSBvYmxpZ2F0aW9ucy4wgZwGCCsGAQUFBwICMIGPMCcWIFN0YXJ0Q29tIENlcnRpZmlj
YXRpb24gQXV0aG9yaXR5MAMCAQIaZExpYWJpbGl0eSBhbmQgd2FycmFudGllcyBhcmUgbGltaXRl
ZCEgU2VlIHNlY3Rpb24gIkxlZ2FsIGFuZCBMaW1pdGF0aW9ucyIgb2YgdGhlIFN0YXJ0Q29tIENB
IHBvbGljeS4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5zdGFydHNzbC5jb20vY3J0dTIt
Y3JsLmNybDCBjgYIKwYBBQUHAQEEgYEwfzA5BggrBgEFBQcwAYYtaHR0cDovL29jc3Auc3RhcnRz
c2wuY29tL3N1Yi9jbGFzczIvY2xpZW50L2NhMEIGCCsGAQUFBzAChjZodHRwOi8vYWlhLnN0YXJ0
c3NsLmNvbS9jZXJ0cy9zdWIuY2xhc3MyLmNsaWVudC5jYS5jcnQwIwYDVR0SBBwwGoYYaHR0cDov
L3d3dy5zdGFydHNzbC5jb20vMA0GCSqGSIb3DQEBBQUAA4IBAQDBc8VqD8gO2ZRknYHZze+O4iv2
prLPnI791XRTAm6gyBpUFdQ+YDvga2H6ajEnQf7cKX7xuF4umCd3ShMfdaZe+e4RBEcUOdEKXGtI
9yau2bUx4Y+j4fUU+kFTk5fRetAkb4d8uHMsLgeFaDaWtxXVVCNzfvIPWalCIRDnNSAh4VlLV/7e
TZw1PbW6s5MyNFQjwn/9AQXnP8x7tx+wbPRT7S6SUEZj95i0/v261nSJ90d6KwoPJTxMnf7/pvI9
7iJxpKgi5EaLB7S9Zl/COLPCwkg29kf5wxdloB1BWAyPHqZ+4+0cO4zSdDA6n/3Xbo/ezyZSlFos
obJPacQWMW/jMIIH4jCCBcqgAwIBAgIBDjANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEW
MBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNh
dGUgU2lnbmluZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcN
MDcxMDI0MjEwMjU0WhcNMTIxMDIyMjEwMjU0WjCBjDELMAkGA1UEBhMCSUwxFjAUBgNVBAoTDVN0
YXJ0Q29tIEx0ZC4xKzApBgNVBAsTIlNlY3VyZSBEaWdpdGFsIENlcnRpZmljYXRlIFNpZ25pbmcx
ODA2BgNVBAMTL1N0YXJ0Q29tIENsYXNzIDIgUHJpbWFyeSBJbnRlcm1lZGlhdGUgQ2xpZW50IENB
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyyiFRZwBLPsZ8qulM4wqoA3L0FXtXSKB
Z0bEDwhTvsvdpPEStD59zG0NhnfpnoYfRgWft+rlEAO14/QBjOsID4RBN+LyrX6QDebSfC3Bcb3g
zmwiqy+zuVE/VrJwGR7+zmD2EkevJnZpxJyfNzOMEICjtfW/kbfLDwwM/abZELJ7Qp+Bnic4N6tk
lXOECU4P1h6O8BdmoeSzDnofMSVUihhJnerj5Em49dd8ijJvL5jabUT5jNfmIJlcHHTmCTowoBbW
9rDj+/Y44vLoVkfdcce06TNSt4b/8KwWcH365phKVHrlx0bNOyaggrxYfXKCheFEGb3xIPsd/+vc
UQs29QIDAQABo4IDWzCCA1cwDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAaYwHQYDVR0OBBYEFK5V
g2/sMcq59x36r2sx88gd46y7MIGoBgNVHSMEgaAwgZ2AFE4L7xqkQFulF2mHMMo0aEPQQa7yoYGB
pH8wfTELMAkGA1UEBhMCSUwxFjAUBgNVBAoTDVN0YXJ0Q29tIEx0ZC4xKzApBgNVBAsTIlNlY3Vy
ZSBEaWdpdGFsIENlcnRpZmljYXRlIFNpZ25pbmcxKTAnBgNVBAMTIFN0YXJ0Q29tIENlcnRpZmlj
YXRpb24gQXV0aG9yaXR5ggEBMAkGA1UdEgQCMAAwPQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzAC
hiFodHRwOi8vd3d3LnN0YXJ0c3NsLmNvbS9zZnNjYS5jcnQwYAYDVR0fBFkwVzAsoCqgKIYmaHR0
cDovL2NlcnQuc3RhcnRjb20ub3JnL3Nmc2NhLWNybC5jcmwwJ6AloCOGIWh0dHA6Ly9jcmwuc3Rh
cnRzc2wuY29tL3Nmc2NhLmNybDCCAV0GA1UdIASCAVQwggFQMIIBTAYLKwYBBAGBtTcBAQQwggE7
MC8GCCsGAQUFBwIBFiNodHRwOi8vY2VydC5zdGFydGNvbS5vcmcvcG9saWN5LnBkZjA1BggrBgEF
BQcCARYpaHR0cDovL2NlcnQuc3RhcnRjb20ub3JnL2ludGVybWVkaWF0ZS5wZGYwgdAGCCsGAQUF
BwICMIHDMCcWIFN0YXJ0IENvbW1lcmNpYWwgKFN0YXJ0Q29tKSBMdGQuMAMCAQEagZdMaW1pdGVk
IExpYWJpbGl0eSwgcmVhZCB0aGUgc2VjdGlvbiAqTGVnYWwgTGltaXRhdGlvbnMqIG9mIHRoZSBT
dGFydENvbSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBQb2xpY3kgYXZhaWxhYmxlIGF0IGh0dHA6
Ly9jZXJ0LnN0YXJ0Y29tLm9yZy9wb2xpY3kucGRmMBEGCWCGSAGG+EIBAQQEAwIABzBQBglghkgB
hvhCAQ0EQxZBU3RhcnRDb20gQ2xhc3MgMiBQcmltYXJ5IEludGVybWVkaWF0ZSBGcmVlIFNTTCBF
bWFpbCBDZXJ0aWZpY2F0ZXMwDQYJKoZIhvcNAQEFBQADggIBAB73EBf+9umEeS+QN02uyVdZ07t8
PclqqdNPeOaYO7nmvtSlbUf+/8njRQFezD0MpTxPKUThHBlPkcMAxbjZ/XHj3wDMzgU6cv+lRNO+
voGJGWuJ/Llmi+QNhVaPLUZhMn6E+IES/QeYecPGOGckgiQS8n6eIwcssR2k0yFmfEyJMVEC0gXh
Z5hymBcGMDGwQNEoG/DjQr6vc3iXKTJJA2nYSUgnwfXPYGaHG2mlR1ak5UnhDUa+f2N9XWqcyEUI
Nj5fVfwOuQqtNykMTFwaV5/B5Czv4NhQreymJCQmk3uqk9iV/LYZgd52/uUZrVkCCEwj/jzzZBUA
rbOrozrScek5Qy1gPrVe0CzdkPkvfKf0sJ14raPhltDe5F3C/EAwVbBfJQr8As/iUK71CHFucRM6
QFZPcUm6Xj8VSDMzRFEIQaG5BaI4VKhrflclNxh//gT9m685eErTidSl7sNhMxbNGovTjLKglBUc
ocpJujK257J0q6oVkp0kD2CLvs6c8Fgv/LGRcaCQsL22yLvuhPgCBmvLT/qWBfnpqT5/+6ZCKE0+
C0pJBCMRir1LwyU4fOlQzS/GyCEBNix1Q8HDqvpnEMeNehQAPTcNQwRsqxa+oUHuck1V6yeBu7ya
LDURgsD58d9NoKJ2hXcIvvmMqoz8oTzuquH0Wq2L1sqqeS+lMYIDbDCCA2gCAQEwgZMwgYwxCzAJ
BgNVBAYTAklMMRYwFAYDVQQKEw1TdGFydENvbSBMdGQuMSswKQYDVQQLEyJTZWN1cmUgRGlnaXRh
bCBDZXJ0aWZpY2F0ZSBTaWduaW5nMTgwNgYDVQQDEy9TdGFydENvbSBDbGFzcyAyIFByaW1hcnkg
SW50ZXJtZWRpYXRlIENsaWVudCBDQQICIV4wCQYFKw4DAhoFAKCCAa0wGAYJKoZIhvcNAQkDMQsG
CSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTIwNzI4MTYzODEwWjAjBgkqhkiG9w0BCQQxFgQU
fKz+FVV6A5jYx2lZJjSwsuC4QgQwgaQGCSsGAQQBgjcQBDGBljCBkzCBjDELMAkGA1UEBhMCSUwx
FjAUBgNVBAoTDVN0YXJ0Q29tIEx0ZC4xKzApBgNVBAsTIlNlY3VyZSBEaWdpdGFsIENlcnRpZmlj
YXRlIFNpZ25pbmcxODA2BgNVBAMTL1N0YXJ0Q29tIENsYXNzIDIgUHJpbWFyeSBJbnRlcm1lZGlh
dGUgQ2xpZW50IENBAgIhXjCBpgYLKoZIhvcNAQkQAgsxgZaggZMwgYwxCzAJBgNVBAYTAklMMRYw
FAYDVQQKEw1TdGFydENvbSBMdGQuMSswKQYDVQQLEyJTZWN1cmUgRGlnaXRhbCBDZXJ0aWZpY2F0
ZSBTaWduaW5nMTgwNgYDVQQDEy9TdGFydENvbSBDbGFzcyAyIFByaW1hcnkgSW50ZXJtZWRpYXRl
IENsaWVudCBDQQICIV4wDQYJKoZIhvcNAQEBBQAEggEAtmi+spNxHPRDt8uApZblLwQu0BIjjyDp
cffo+b4si+bKwQz8J2VsMJktrhLd2ZPwH+JqSGuYNPIms4bpAapCbhyQ9LupZTVARjBwIiF3wzEF
floueG/9/7abYTWPRcEsFVRsNFM2/YzYhxqjuXIECZ6q7R3Q2a3jecSTmKeg1i0CXkRcmnW9JXlb
X3euUgTgLeKk7EkyF23eh7KRXCSD1EJR0/LojXc6pdx1B1QpzZ1EUTAX9bw60C5lBT86zeUr5WkO
N34xXHj/D0iKbEfDDv9507ck48pCYhcMlnTSl8J+JeVdAw/KnzTUwpj2ATy4S7gEug2GjFszgKZt
Q+k6MAAAAAAAAA==

--Apple-Mail=_386CFACE-8ECA-499E-A35B-447611512B96--


From MAILER-DAEMON Sat Jul 28 18:46:36 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SvFmO-0002pu-Dz
	for mharc-bug-bash@gnu.org; Sat, 28 Jul 2012 18:46:36 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35359)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SvFmM-0002oR-2Z
	for bug-bash@gnu.org; Sat, 28 Jul 2012 18:46:35 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SvFmK-0005o0-Oo
	for bug-bash@gnu.org; Sat, 28 Jul 2012 18:46:33 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:23787)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SvFmK-0005mm-J4
	for bug-bash@gnu.org; Sat, 28 Jul 2012 18:46:32 -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 BNM95211;
	Sat, 28 Jul 2012 18:46:30 -0400
Received: from h199.191.190.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.190.191.199]) by mpv7.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id UMU56643 (AUTH cpr);
	Sat, 28 Jul 2012 18:46:29 -0400 (EDT)
Message-ID: <50146BD1.2040908@case.edu>
Date: Sat, 28 Jul 2012 18:46:41 -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: Michael Haubenwallner <michael.haubenwallner@salomon.at>
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<m27gtrhn3w.fsf@igel.home> <50102812.8010208@case.edu>
	<50118C75.80008@case.edu> <5011B8A1.2040000@salomon.at>
	<50129C93.5010903@salomon.at>
In-Reply-To: <50129C93.5010903@salomon.at>
X-Enigmail-Version: 1.4.2
Content-Type: multipart/mixed; boundary="------------000904090601010208070205"
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: Greg Wooledge <wooledg@eeg.ccf.org>, Andreas Schwab <schwab@linux-m68k.org>,
	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, 28 Jul 2012 22:46:35 -0000

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

On 7/27/12 9:50 AM, Michael Haubenwallner wrote:

> With attached patch I haven't been able to break the testcase below so far
> on that AIX 6.1 box here.
> 
> But still, the other one using the $()-childs still fails.

Try the attached patch for that.

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/



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

*** ../bash-4.2-patched/execute_cmd.c	2012-05-02 12:02:27.000000000 -0400
--- execute_cmd.c	2012-07-28 18:14:33.000000000 -0400
***************
*** 752,758 ****
  
  	/* XXX - this is something to watch out for if there are problems
! 	   when the shell is compiled without job control. */
! 	if (already_making_children && pipe_out == NO_PIPE &&
! 	    last_made_pid != last_pid)
  	  {
  	    stop_pipeline (asynchronous, (COMMAND *)NULL);
--- 776,784 ----
  
  	/* XXX - this is something to watch out for if there are problems
! 	   when the shell is compiled without job control.  Don't worry about
! 	   whether or not last_made_pid == last_pid; already_making_children
! 	   tells us whether or not there are unwaited-for children to wait
! 	   for and reap. */
! 	if (already_making_children && pipe_out == NO_PIPE)
  	  {
  	    stop_pipeline (asynchronous, (COMMAND *)NULL);

--------------000904090601010208070205--



From MAILER-DAEMON Sun Jul 29 10:23:34 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SvUP8-00061o-Jy
	for mharc-bug-bash@gnu.org; Sun, 29 Jul 2012 10:23:34 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44852)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1SvUP6-00061i-KE
	for bug-bash@gnu.org; Sun, 29 Jul 2012 10:23:33 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1SvUP5-0005yk-Lj
	for bug-bash@gnu.org; Sun, 29 Jul 2012 10:23:32 -0400
Received: from mail-lb0-f169.google.com ([209.85.217.169]:34215)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1SvUP5-0005yS-EA
	for bug-bash@gnu.org; Sun, 29 Jul 2012 10:23:31 -0400
Received: by lbjn8 with SMTP id n8so3317858lbj.0
	for <bug-bash@gnu.org>; Sun, 29 Jul 2012 07:23:29 -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:cc:content-type;
	bh=UUfyAJ5RqxoAZjcW5VzYjH9z130oRLwS8p0ayPGXOkc=;
	b=T2qbxx1y1ng8UsXcn55L/u/Qqm+s0Bq73oZvKcQ5dv1Fvc53KNegP4EXxIOaYkTIqZ
	eWJ2SYZ3Mf2eoYNm6GP7aZrZ965qXm/tJL8ktK/q1eNYOgkvACw0ThBAobyMAIrdZ/t6
	E7eZnG6SQpjDhmbLH7Q+5SG65bUh1uyFQHZIcoTXOvJLgEIlXwsg/BgDZqbb8LueQppa
	Q6ts2/SOcLWR159GF36OQwz7gHaRm8Qi+2n807O2ddLjnE0hy40hvh2C926NQEwx/LBQ
	IylVYc+WvCZmzFe1xFkI3hm8U7aD8BjLTWZ3ky8i25Z7jHGpe6YieWhZJb/Cu+HJUwWM
	JWVw==
MIME-Version: 1.0
Received: by 10.152.111.71 with SMTP id ig7mr8503510lab.28.1343571809544; Sun,
	29 Jul 2012 07:23:29 -0700 (PDT)
Received: by 10.112.128.234 with HTTP; Sun, 29 Jul 2012 07:23:29 -0700 (PDT)
Date: Sun, 29 Jul 2012 15:23:29 +0100
Message-ID: <CALyZvKwgS15wtORMMLaLaNUFNa7ywOsLahypuLevV-me_71W0g@mail.gmail.com>
Subject: why must non-standard $IFS members be treated so differently ?
From: Jason Vas Dias <jason.vas.dias@gmail.com>
To: Chet Ramey <chet.ramey@case.edu>
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.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: Sun, 29 Jul 2012 14:23:33 -0000

Good day Chet, list -
 I'm concerned about the difference in output of these functions with
the example input
 given on the '$' prefixed line below (with 4.2.29(2)-release
(x86_64-unknown-linux-gnu)):

     function count_args     {                v=($@);  echo ${#v[@]}; }

     function count_colons {  IFS=':' ;    v=($@);  echo ${#v[@]}; }

 $ echo $(count_args 1 2 3\ 4) $(count_colons 1:2:3\:4)
 3 4

 It appears to be impossible for an item delimited by 'X' to contain
an escaped  'X' ('\X')  if 'X' is not
 a standard delimiter (' ', '<TAB>') .  Quoting doesn't seem to help either:

 $ echo $(count_args 1 2 3\ 4) $(count_colons 1:2:3':4')
 3 4

To me, this appears to be a bug.

But I bet you're going to tell me it is a feature ?
Please explain.

Thanks & Regards,
Jason

BTW, documentation on $IFS does not appear to mention this issue:

   Word Splitting
       The shell scans the results of parameter expansion, command
substitution, and arithmetic expansion that did not occur  within
       double quotes for word splitting.

       The  shell  treats  each  character of IFS as a delimiter, and
splits the results of the other expansions into words on these
       characters.  If IFS is unset, or its value is exactly
<space><tab><newline>, the default, then sequences of  <space>,
<tab>,
       and <newline> at the beginning and end of the results of the
previous expansions are ignored, and any sequence of IFS charac-
       ters not at the beginning or end serves to delimit words.  If
IFS has a value other than the default, then sequences  of  the
       whitespace  characters space and tab are ignored at the
beginning and end of the word, as long as the whitespace character is
       in the value of IFS (an IFS whitespace character).  Any
character in IFS that is not IFS whitespace, along with any  adjacent
       IFS whitespace characters, delimits a field.  A sequence of IFS
whitespace characters is also treated as a delimiter.  If the
       value of IFS is null, no word splitting occurs.


From MAILER-DAEMON Sun Jul 29 11:03:20 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SvV1c-0000LH-Hy
	for mharc-bug-bash@gnu.org; Sun, 29 Jul 2012 11:03:20 -0400
Received: from eggs.gnu.org ([208.118.235.92]:34360)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SvV1a-0000L9-8e
	for bug-bash@gnu.org; Sun, 29 Jul 2012 11:03:19 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SvV1Y-0003NS-QK
	for bug-bash@gnu.org; Sun, 29 Jul 2012 11:03:18 -0400
Received: from mail-gh0-f169.google.com ([209.85.160.169]:55275)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SvV1Y-0003MK-Kk
	for bug-bash@gnu.org; Sun, 29 Jul 2012 11:03:16 -0400
Received: by ghrr18 with SMTP id r18so5042989ghr.0
	for <bug-bash@gnu.org>; Sun, 29 Jul 2012 08:03:15 -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=RRUooMYPbv+XefF0IcKs2Ven9cBgWOQBkdlMK3RqSPs=;
	b=dMIE6+e5kNm49iu8HTtzy/wXLFu8/Fvak9z1XtN2UJuwRlq/KIuXRGoAPvQsZVHISG
	Qm2IJ4eqbm+bk6/eax6V70E5SjYo5KE+XiAV9CuscE6xuP9el6HoMjGIUvE2gow7agLy
	/dtFKIDythPcCaJQ0Y7zPGx9q9HC4FiTMsYjMgDxnQTqOT+is7A30qqJNSYIPGtnFVDI
	dRl1IJzaCSQHRE7X7i6+SsO6kibQZFxX98bvxrmekMnVm1fAcH7DE5og17K2h91UjZpO
	wyTSbVNcXmT1nKrxZ24Jsuv8QUmUGEZ0CpFfseiSocRk6/VlFwAdFnUFHbPevjukj+R+
	TuyQ==
Received: by 10.50.182.231 with SMTP id eh7mr9068644igc.42.1343574195126;
	Sun, 29 Jul 2012 08:03:15 -0700 (PDT)
Received: from ormaajbox (184-97-250-123.mpls.qwest.net. [184.97.250.123])
	by mx.google.com with ESMTPS id hx4sm4180171igc.8.2012.07.29.08.03.12
	(version=SSLv3 cipher=OTHER); Sun, 29 Jul 2012 08:03:13 -0700 (PDT)
From: Dan Douglas <ormaaj@gmail.com>
To: bug-bash@gnu.org
Subject: Re: why must non-standard $IFS members be treated so differently ?
Date: Sun, 29 Jul 2012 10:02:54 -0500
Message-ID: <1539728.cZIdvsRxC9@smorgbox>
User-Agent: KMail/4.8.3 (Linux/3.4.6-pf+; KDE/4.8.3; x86_64; ; )
In-Reply-To: <CALyZvKwgS15wtORMMLaLaNUFNa7ywOsLahypuLevV-me_71W0g@mail.gmail.com>
References: <CALyZvKwgS15wtORMMLaLaNUFNa7ywOsLahypuLevV-me_71W0g@mail.gmail.com>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart2862883.Qrg6fhFghj";
	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.160.169
Cc: Jason Vas Dias <jason.vas.dias@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, 29 Jul 2012 15:03:19 -0000


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

On Sunday, July 29, 2012 03:23:29 PM Jason Vas Dias wrote:
> Good day Chet, list -
>  I'm concerned about the difference in output of these functions with
> the example input
>  given on the '$' prefixed line below (with 4.2.29(2)-release
> (x86_64-unknown-linux-gnu)):
> 
>      function count_args     {                v=($@);  echo ${#v[@]}; }
> 
>      function count_colons {  IFS=':' ;    v=($@);  echo ${#v[@]}; }
> 
>  $ echo $(count_args 1 2 3\ 4) $(count_colons 1:2:3\:4)
>  3 4
> 
>  It appears to be impossible for an item delimited by 'X' to contain
> an escaped  'X' ('\X')  if 'X' is not
>  a standard delimiter (' ', '<TAB>') .  Quoting doesn't seem to help either:
> 
>  $ echo $(count_args 1 2 3\ 4) $(count_colons 1:2:3':4')
>  3 4
> 
> To me, this appears to be a bug.
> 
> But I bet you're going to tell me it is a feature ?
> Please explain.

Bash doesn't re-parse the results of expansions for quotes or escaping. When you expand something unquoted, the entire result is always subject to word-splitting. 

In the case of `count_args 1 2 3\ 4', you are passing 3 arguments. The backslash is not the result of expansion , so it gets treated as escaping a space. Note this is because bash is pass-by-value, this escaping/expansion is processed prior to calling the function.

In the case of `count_colons 1:2:3\:4', you are passing one argument. The shell strips away the backslash when the function is called (just as it did in the first example), so the argument being passed is actually '1:2:3:4'

 $ printf '%s\n' 1:2:3\:4
1:2:3:4

If you wanted to pass the backslash, you would have to either quote the argument, or use \\.

However in either case, you're going to have 4 arguments, because as previously stated, escape characters  resulting from expansions are not treated as escapes.

 $ f() { IFS=: local -a 'v=( $@ )'; printf '<%s> ' "${v[@]}"; echo; }; f 1:2:3\:4
<1> <2> <3> <4>
 $ f() { IFS=: local -a 'v=( $@ )'; printf '<%s> ' "${v[@]}"; echo; }; f 1:2:3\\:4
<1> <2> <3\> <4>

See also my answer to this recent question: http://superuser.com/a/454564/78905
-- 
Dan Douglas
--nextPart2862883.Qrg6fhFghj
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)

iEYEABECAAYFAlAVUKgACgkQMmyDamdg+MyV5wCff5PUmRV2YQbnbSTIfah0oN05
i8kAn1qL8j/iAMFnqMb4bjA+kwk8JVgV
=Hv7L
-----END PGP SIGNATURE-----

--nextPart2862883.Qrg6fhFghj--



From MAILER-DAEMON Sun Jul 29 11:19:58 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SvVHh-0001Rm-Vt
	for mharc-bug-bash@gnu.org; Sun, 29 Jul 2012 11:19:57 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38249)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SvVHg-0001RC-7S
	for bug-bash@gnu.org; Sun, 29 Jul 2012 11:19:57 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SvVHf-0008Ri-Eu
	for bug-bash@gnu.org; Sun, 29 Jul 2012 11:19:56 -0400
Received: from mail-yw0-f41.google.com ([209.85.213.41]:56817)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SvVHf-0008RZ-A7
	for bug-bash@gnu.org; Sun, 29 Jul 2012 11:19:55 -0400
Received: by yhr47 with SMTP id 47so5064886yhr.0
	for <bug-bash@gnu.org>; Sun, 29 Jul 2012 08:19:54 -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=mCkSykoB4V+slK0hkr5VSCZY2xbE1PolWAgogD3v2uA=;
	b=WMpcC1ZYzFdHpwnjWhOnoOA0khPggdYoptnqPad8UI0Ppz6dHnyWFOSgZnLoKOq7xO
	fq2qU5RIMlPGcQOwKn3Q5BuwmTNBTlnpv4BzozUvNtMaWwq8z3MmMlk5w326OslB7yl9
	bDiHrTJQjWKwTqftDshO1sN8gDdNWRbiMFhyDanyvzhrdSmt0p8lpetj1NGhR/fojx94
	M6497Pqn3HGxadFFxMqUKpN1r25XoI8ARoiNaPZIw6g8KubsqTrnFcYgdL9NAk8yWSwP
	ZwmsyAMhGVz/0WWa8pfrWwDpgpsU1+1DI0RW/0uoWwG3NYlFPlHgneh3wX5ZMqBwuFPs
	Z0DQ==
Received: by 10.50.170.65 with SMTP id ak1mr6286755igc.43.1343575194500;
	Sun, 29 Jul 2012 08:19:54 -0700 (PDT)
Received: from ormaajbox (184-97-250-123.mpls.qwest.net. [184.97.250.123])
	by mx.google.com with ESMTPS id o1sm4195931igm.16.2012.07.29.08.19.52
	(version=SSLv3 cipher=OTHER); Sun, 29 Jul 2012 08:19:53 -0700 (PDT)
From: Dan Douglas <ormaaj@gmail.com>
To: bug-bash@gnu.org
Subject: Re: why must non-standard $IFS members be treated so differently ?
Date: Sun, 29 Jul 2012 10:19:40 -0500
Message-ID: <1934639.kCo5UiQ7IR@smorgbox>
User-Agent: KMail/4.8.3 (Linux/3.4.6-pf+; KDE/4.8.3; x86_64; ; )
In-Reply-To: <CALyZvKwgS15wtORMMLaLaNUFNa7ywOsLahypuLevV-me_71W0g@mail.gmail.com>
References: <CALyZvKwgS15wtORMMLaLaNUFNa7ywOsLahypuLevV-me_71W0g@mail.gmail.com>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart26875718.McfLgIH7N7";
	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.41
Cc: Jason Vas Dias <jason.vas.dias@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, 29 Jul 2012 15:19:57 -0000


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

On Sunday, July 29, 2012 03:23:29 PM Jason Vas Dias wrote:
> echo $(count_args 1 2 3\ 4)

I should also have mentioned that I couldn't reproduce this case. You should 
be getting 4 here in your example, not 3. I have the same Bash version. Are 
you sure you were echoing `${#v[@]} ' and not `${#@}', and also that you did 
not set IFS=: for count_args? If you use exactly the function you sent  with 
the default IFS then you should get 4 here.
-- 
Dan Douglas
--nextPart26875718.McfLgIH7N7
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)

iEYEABECAAYFAlAVVJIACgkQMmyDamdg+MyCwQCffZWX+mk3CccHsZrTZtZ0sulq
FBEAoI7+ic4YbXRDcPg8h+znHZ+TJJj9
=rm1a
-----END PGP SIGNATURE-----

--nextPart26875718.McfLgIH7N7--



From MAILER-DAEMON Sun Jul 29 12:55:14 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SvWlu-0006Es-DY
	for mharc-bug-bash@gnu.org; Sun, 29 Jul 2012 12:55:14 -0400
Received: from eggs.gnu.org ([208.118.235.92]:43625)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SvWls-0006C0-12
	for bug-bash@gnu.org; Sun, 29 Jul 2012 12:55:12 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SvWlq-0007de-G3
	for bug-bash@gnu.org; Sun, 29 Jul 2012 12:55:11 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:51125)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SvWlq-0007dY-BS
	for bug-bash@gnu.org; Sun, 29 Jul 2012 12:55:10 -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 CBM90147; Sun, 29 Jul 2012 12:55:09 -0400 (EDT)
Received: from h199.191.190.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.190.191.199]) by mpv8.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id UTJ57677 (AUTH cpr);
	Sun, 29 Jul 2012 12:55:09 -0400 (EDT)
Message-ID: <50156AFB.3050602@case.edu>
Date: Sun, 29 Jul 2012 12:55:23 -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: Maarten Billemont <lhunath@lyndir.com>
Subject: Re: EXIT traps in interactive shells
References: <F2CB5713-5F04-4952-A7A8-546F96D799B9@lyndir.com>
In-Reply-To: <F2CB5713-5F04-4952-A7A8-546F96D799B9@lyndir.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: bug-bash Bug <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: Sun, 29 Jul 2012 16:55:13 -0000

On 7/28/12 12:38 PM, Maarten Billemont wrote:
> Trapping on EXIT is a really convenient way of cleaning up after yourself when your script ends.

I agree that the EXIT trap should work on {} asynchronous subshells, and I
will make sure that the next version of bash does this.

However, the two examples you gave don't really differ in that respect.  If
you take out the `kill', neither interactive nor non-interactive shells run
the exit trap.  The difference is how interactive and non-interactive
shells handle SIGTERM.  That's the place I'll have to look.

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 Sun Jul 29 15:04:44 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SvYnE-0007aI-Qh
	for mharc-bug-bash@gnu.org; Sun, 29 Jul 2012 15:04:44 -0400
Received: from eggs.gnu.org ([208.118.235.92]:40397)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chris@cfajohnson.com>) id 1SvYnC-0007a3-Gj
	for bug-bash@gnu.org; Sun, 29 Jul 2012 15:04:43 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chris@cfajohnson.com>) id 1SvYnB-0003YW-93
	for bug-bash@gnu.org; Sun, 29 Jul 2012 15:04:42 -0400
Received: from ironport2-out.teksavvy.com ([206.248.154.182]:25681)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chris@cfajohnson.com>) id 1SvYnB-0003YQ-4v
	for bug-bash@gnu.org; Sun, 29 Jul 2012 15:04:41 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Av0EAG6Zu09soXZp/2dsb2JhbABEtBGBCIIVAQEEATgCHCMFCws0EjkeBi6HbgW6CYsIhTwDliqNCYFYgwU
X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="194264623"
Received: from 108-161-118-105.dsl.teksavvy.com (HELO linux.local)
	([108.161.118.105])
	by ironport2-out.teksavvy.com with ESMTP; 29 Jul 2012 15:04:38 -0400
Date: Sun, 29 Jul 2012 15:04:21 -0400 (EDT)
From: "Chris F.A. Johnson" <chris@cfajohnson.com>
To: Jason Vas Dias <jason.vas.dias@gmail.com>
Subject: Re: why must non-standard $IFS members be treated so differently ?
In-Reply-To: <CALyZvKwgS15wtORMMLaLaNUFNa7ywOsLahypuLevV-me_71W0g@mail.gmail.com>
Message-ID: <alpine.LMD.2.00.1207291502120.13516@localhost.localdomain>
References: <CALyZvKwgS15wtORMMLaLaNUFNa7ywOsLahypuLevV-me_71W0g@mail.gmail.com>
User-Agent: Alpine 2.00 (LMD 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 206.248.154.182
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: Sun, 29 Jul 2012 19:04:43 -0000

On Sun, 29 Jul 2012, Jason Vas Dias wrote:

> Good day Chet, list -
> I'm concerned about the difference in output of these functions with
> the example input
> given on the '$' prefixed line below (with 4.2.29(2)-release
> (x86_64-unknown-linux-gnu)):
>
>     function count_args     {                v=($@);  echo ${#v[@]}; }

    Always quote $@. Without quotes, it's the same as $*

function count_args     {                v=( "$@" );  echo ${#v[@]}; }

-- 
    Chris F.A. Johnson, <http://cfajohnson.com/>
    Author:
    Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
    Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)


From MAILER-DAEMON Sun Jul 29 15:25:11 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SvZ71-0000UB-2R
	for mharc-bug-bash@gnu.org; Sun, 29 Jul 2012 15:25:11 -0400
Received: from eggs.gnu.org ([208.118.235.92]:53396)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1SvZ6z-0000U5-DF
	for bug-bash@gnu.org; Sun, 29 Jul 2012 15:25:10 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1SvZ6y-0002Qc-1A
	for bug-bash@gnu.org; Sun, 29 Jul 2012 15:25:09 -0400
Received: from mail-lb0-f169.google.com ([209.85.217.169]:59001)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1SvZ6x-0002Pp-PH
	for bug-bash@gnu.org; Sun, 29 Jul 2012 15:25:07 -0400
Received: by lbjn8 with SMTP id n8so3389301lbj.0
	for <bug-bash@gnu.org>; Sun, 29 Jul 2012 12:25: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:date:message-id:subject:from:to
	:cc:content-type;
	bh=+PpApJ4JgBuBfkHoNguh1y1zyfgI80S/zZOUJNrRUxE=;
	b=BNl53YqJY5GBBO4bdsaBnRFEWY+eRJc+59k+lVnEme9RD+/tSKM+PBPZD+d9LxVvOm
	qOfcfVGyFPzuqPxJpgBc0ALU83jKU+1aaA3LjcqWr0PwOC3ThZO4TTUzGL5gbf6HRh4+
	BMbJUNSZBSXHttVpLbg+tt1/kJib8jhwi8rxlAChI1SEgfsbck2jddJpINCCiQC62FfR
	XL+AqeHz1XdKAmB3ybgpQVRxQjogn2gdinH1DcCFGeAlrcsNJJ2I2bEeyfdfX6DQeZ5y
	X4VNGGWebwJn3dLFC0WY/7NpaQByc4+E6VmwBEMwN7GfXkXgIAvFC1J4zle9AeANr5k0
	TNRQ==
MIME-Version: 1.0
Received: by 10.112.23.196 with SMTP id o4mr4275268lbf.49.1343589906717; Sun,
	29 Jul 2012 12:25:06 -0700 (PDT)
Received: by 10.112.128.234 with HTTP; Sun, 29 Jul 2012 12:25:06 -0700 (PDT)
In-Reply-To: <1934639.kCo5UiQ7IR@smorgbox>
References: <CALyZvKwgS15wtORMMLaLaNUFNa7ywOsLahypuLevV-me_71W0g@mail.gmail.com>
	<1934639.kCo5UiQ7IR@smorgbox>
Date: Sun, 29 Jul 2012 20:25:06 +0100
Message-ID: <CALyZvKyq_-6mdT0nqP_Svc4kiFVwCVyf8GZwSUaYWgB6kFzdew@mail.gmail.com>
Subject: Re: why must non-standard $IFS members be treated so differently ?
From: Jason Vas Dias <jason.vas.dias@gmail.com>
To: Dan Douglas <ormaaj@gmail.com>
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.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: Sun, 29 Jul 2012 19:25:10 -0000

Thanks Dan -
 The plot thickens - Yes, you're right, I had $IFS mistakenly set to ':' in the
  shell in which I ran 'count_args' . Without this IFS setting, I get
a count of 4:
  $ env -i PATH=/bin:/usr/bin HOME=${HOME} /bin/bash --norc
  $ count_args 1 2 3\ 4
  4
  $ IFS=: count_args 1 2 3\ 4
  3
 This to me is strange , as I've asked bash not to use ' ' as a
delimiter, when $IFS==: , but it is doing so !
 And shouldn't '3\ 4' be a single string in any case, regardless of IFS ?
 If word splitting is not doing any escaping, why not - shouldn't it
be doing so?
 Escaping works in filenames, so why not in word-splitting ?
Thanks & Regards,
Jason




On Sun, Jul 29, 2012 at 4:19 PM, Dan Douglas <ormaaj@gmail.com> wrote:
> On Sunday, July 29, 2012 03:23:29 PM Jason Vas Dias wrote:
>> echo $(count_args 1 2 3\ 4)
>
> I should also have mentioned that I couldn't reproduce this case. You should
> be getting 4 here in your example, not 3. I have the same Bash version. Are
> you sure you were echoing `${#v[@]} ' and not `${#@}', and also that you did
> not set IFS=: for count_args? If you use exactly the function you sent  with
> the default IFS then you should get 4 here.
> --
> Dan Douglas
RE:
>why must non-standard $IFS members be treated so differently ?
>Jason Vas Dias	
>3:23 PM (4 hours ago)
>
>Good day Chet, list -
> I'm concerned about the difference in output of these functions with
>the example input
> given on the '$' prefixed line below (with 4.2.29(2)-release
> (x86_64-unknown-linux-gnu)):
>
>    function count_args     {                v=($@);  echo ${#v[@]}; }
>
>    function count_colons {  IFS=':' ;    v=($@);  echo ${#v[@]}; }
>
> $ echo $(count_args 1 2 3\ 4) $(count_colons 1:2:3\:4)
> 3 4
> It appears to be impossible for an item delimited by 'X' to contain
> an escaped  'X' ('\X')  if 'X' is not
> a standard delimiter (' ', '<TAB>') .  Quoting doesn't seem to help either:
>
> $ echo $(count_args 1 2 3\ 4) $(count_colons 1:2:3':4')
> 3 4
>
>To me, this appears to be a bug.
>
>But I bet you're going to tell me it is a feature ?
>Please explain.
>
>Thanks & Regards,
>Jason
>
>BTW, documentation on $IFS does not appear to mention this issue:
>
>   Word Splitting
>       The shell scans the results of parameter expansion, command
>       substitution, and arithmetic expansion that did not occur  within
>       double quotes for word splitting.
>
>      The  shell  treats  each  character of IFS as a delimiter, and
>      splits the results of the other expansions into words on these
>     characters.  If IFS is unset, or its value is exactly
>     <space><tab><newline>, the default, then sequences of  <space>,
>     <tab>, and <newline> at the beginning and end of the results of the
>     previous expansions are ignored, and any sequence of IFS charac-
>     ters not at the beginning or end serves to delimit words.  If
>     IFS has a value other than the default, then sequences  of  the
>    whitespace  characters space and tab are ignored at the
>    beginning and end of the word, as long as the whitespace character is
>    in the value of IFS (an IFS whitespace character).  Any
>    character in IFS that is not IFS whitespace, along with any  adjacent
>    IFS whitespace characters, delimits a field.  A sequence of IFS
>   whitespace characters is also treated as a delimiter.  If the
>   value of IFS is null, no word splitting occurs.


From MAILER-DAEMON Sun Jul 29 16:05:40 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SvZkC-0003Mb-41
	for mharc-bug-bash@gnu.org; Sun, 29 Jul 2012 16:05:40 -0400
Received: from eggs.gnu.org ([208.118.235.92]:36158)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SvZkA-0003MS-2l
	for bug-bash@gnu.org; Sun, 29 Jul 2012 16:05:39 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SvZk8-0007Qv-Uo
	for bug-bash@gnu.org; Sun, 29 Jul 2012 16:05:38 -0400
Received: from mail-out.m-online.net ([212.18.0.10]:51673)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SvZk8-0007OS-Or
	for bug-bash@gnu.org; Sun, 29 Jul 2012 16:05:36 -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 3WlZf36wmXz3hhb4;
	Sun, 29 Jul 2012 22:05:31 +0200 (CEST)
X-Auth-Info: WI6zuy/AT6/myTi4FaZFikU2s5IJcACwwYj/Cz2xA88=
Received: from igel.home (ppp-88-217-108-229.dynamic.mnet-online.de
	[88.217.108.229])
	by mail.mnet-online.de (Postfix) with ESMTPA id 3WlZf36Vldzbbg7;
	Sun, 29 Jul 2012 22:05:31 +0200 (CEST)
Received: by igel.home (Postfix, from userid 501)
	id D4DADCA2A5; Sun, 29 Jul 2012 22:05:30 +0200 (CEST)
From: Andreas Schwab <schwab@linux-m68k.org>
To: Jason Vas Dias <jason.vas.dias@gmail.com>
Subject: Re: why must non-standard $IFS members be treated so differently ?
References: <CALyZvKwgS15wtORMMLaLaNUFNa7ywOsLahypuLevV-me_71W0g@mail.gmail.com>
	<1934639.kCo5UiQ7IR@smorgbox>
	<CALyZvKyq_-6mdT0nqP_Svc4kiFVwCVyf8GZwSUaYWgB6kFzdew@mail.gmail.com>
X-Yow: C'MON, everybody!!  I've flown in LESLIE GORE and two dozen KOSHER
	BUTCHERS!  They'll be doing intricate MILITARY MANEUVERS to the
	soundtrack from "OKLAHOMA"!!
Date: Sun, 29 Jul 2012 22:05:30 +0200
In-Reply-To: <CALyZvKyq_-6mdT0nqP_Svc4kiFVwCVyf8GZwSUaYWgB6kFzdew@mail.gmail.com>
	(Jason Vas Dias's message of "Sun, 29 Jul 2012 20:25:06 +0100")
Message-ID: <m2sjcaib91.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: Dan Douglas <ormaaj@gmail.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, 29 Jul 2012 20:05:39 -0000

Jason Vas Dias <jason.vas.dias@gmail.com> writes:

> Thanks Dan -
>  The plot thickens - Yes, you're right, I had $IFS mistakenly set to ':' in the
>   shell in which I ran 'count_args' . Without this IFS setting, I get
> a count of 4:
>   $ env -i PATH=/bin:/usr/bin HOME=${HOME} /bin/bash --norc
>   $ count_args 1 2 3\ 4
>   4
>   $ IFS=: count_args 1 2 3\ 4
>   3
>  This to me is strange , as I've asked bash not to use ' ' as a
> delimiter, when $IFS==: , but it is doing so !

IFS does not change the shell syntax.  It only controls field splitting
as applied to the result of expansions.  Compare:

$ bash -c 'IFS=:; echo a:b:c'
a:b:c
$ bash -c 'IFS=:; a=a:b:c; echo "$a" $a'
a:b:c a b c
$ bash -c 'IFS=:; a=a:b:c; b=$a; echo "$b" $b'
a:b:c a b c

In the last example the assignment "b=$a" doesn't undergo field
splitting, so the colons are still preserved.

>  And shouldn't '3\ 4' be a single string in any case, regardless of IFS ?

It is.  But if field splitting is applied to it it will be split in two
words when $IFS contains a space.

>  If word splitting is not doing any escaping, why not - shouldn't it
> be doing so?

Escape characters are part of the shell syntax.  They are never special
when they result from expansions, unless they are reinterpreted as shell
input through eval.

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 Sun Jul 29 18:17:41 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Svbnx-0001uO-QT
	for mharc-bug-bash@gnu.org; Sun, 29 Jul 2012 18:17:41 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57917)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1Svbnv-0001rg-5o
	for bug-bash@gnu.org; Sun, 29 Jul 2012 18:17:40 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1Svbnu-0004Oh-6A
	for bug-bash@gnu.org; Sun, 29 Jul 2012 18:17:39 -0400
Received: from mail-lpp01m010-f41.google.com ([209.85.215.41]:54462)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jason.vas.dias@gmail.com>) id 1Svbnt-0004OX-UT
	for bug-bash@gnu.org; Sun, 29 Jul 2012 18:17:38 -0400
Received: by lahi5 with SMTP id i5so3342609lah.0
	for <bug-bash@gnu.org>; Sun, 29 Jul 2012 15:17:36 -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;
	bh=Z7LW401BGB6vUiiW9R4xvje4MVdAOwJJNKlumFXMatE=;
	b=tl4mqk7+3xOmDy9qhavsC0VBZVC5ZIBpmovyz5WJV/wkHjvT14eDjmrsoX1oNy1a0m
	iPSCv6dcmmXAiocNOSiyaeCt/gubhe6DhB6AbhKKhGN9qrIyffAFIcYUwAqAoWM8LT7f
	8IQCHbNL2yq4/O8qXlmAtcO27zOhsOo4ItzDAg1xt+ue//6D6WvgRAQaSkkkVj+C27oO
	7FPPCDtX5sofznwn593uEyc8yV41NF5An6SN/mQjOnCUXxZFNicNp/0rA44a+JbZqYyu
	B5NG/2xF4neJ6ubWJPUl5cMpWcnZhWlQwr2Z4B5Yxj9xTnK1JVw/TtInA16gP8JcNpeF
	/aSA==
MIME-Version: 1.0
Received: by 10.152.132.233 with SMTP id ox9mr9449357lab.25.1343600256908;
	Sun, 29 Jul 2012 15:17:36 -0700 (PDT)
Received: by 10.112.128.234 with HTTP; Sun, 29 Jul 2012 15:17:36 -0700 (PDT)
In-Reply-To: <m2sjcaib91.fsf@igel.home>
References: <CALyZvKwgS15wtORMMLaLaNUFNa7ywOsLahypuLevV-me_71W0g@mail.gmail.com>
	<1934639.kCo5UiQ7IR@smorgbox>
	<CALyZvKyq_-6mdT0nqP_Svc4kiFVwCVyf8GZwSUaYWgB6kFzdew@mail.gmail.com>
	<m2sjcaib91.fsf@igel.home>
Date: Sun, 29 Jul 2012 23:17:36 +0100
Message-ID: <CALyZvKyYCTTOqC1i5_nTXsQqmWcAEZrJSUTLgSOP1QaM0t4=Rw@mail.gmail.com>
Subject: Re: why must non-standard $IFS members be treated so differently ?
From: Jason Vas Dias <jason.vas.dias@gmail.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Content-Type: text/plain; charset=UTF-8
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.215.41
Cc: Dan Douglas <ormaaj@gmail.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, 29 Jul 2012 22:17:40 -0000

Thanks Andreas -

I guess your answer mostly explains my issue - except for one thing:
>>  And shouldn't '3\ 4' be a single string in any case, regardless of IFS ?
>
> It is.  But if field splitting is applied to it it will be split in two
> words when $IFS contains a space.

This was really the point of my question - why, if escaping is permitted and
an escape is shell syntax,  does word-splitting not honor escapes, ESPECIALLY
if the character being escaped is a character in $IFS ?

Would it be much work to make word-splitting honor escapes ?

Why is this issue of escaping not being enabled during word-splitting
not documented anywhere ?

Thanks & Regards,
Jason

On Sun, Jul 29, 2012 at 9:05 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Jason Vas Dias <jason.vas.dias@gmail.com> writes:
>
>> Thanks Dan -
>>  The plot thickens - Yes, you're right, I had $IFS mistakenly set to ':' in the
>>   shell in which I ran 'count_args' . Without this IFS setting, I get
>> a count of 4:
>>   $ env -i PATH=/bin:/usr/bin HOME=${HOME} /bin/bash --norc
>>   $ count_args 1 2 3\ 4
>>   4
>>   $ IFS=: count_args 1 2 3\ 4
>>   3
>>  This to me is strange , as I've asked bash not to use ' ' as a
>> delimiter, when $IFS==: , but it is doing so !
>
> IFS does not change the shell syntax.  It only controls field splitting
> as applied to the result of expansions.  Compare:
>
> $ bash -c 'IFS=:; echo a:b:c'
> a:b:c
> $ bash -c 'IFS=:; a=a:b:c; echo "$a" $a'
> a:b:c a b c
> $ bash -c 'IFS=:; a=a:b:c; b=$a; echo "$b" $b'
> a:b:c a b c
>
> In the last example the assignment "b=$a" doesn't undergo field
> splitting, so the colons are still preserved.
>
>>  And shouldn't '3\ 4' be a single string in any case, regardless of IFS ?
>
> It is.  But if field splitting is applied to it it will be split in two
> words when $IFS contains a space.
>
>>  If word splitting is not doing any escaping, why not - shouldn't it
>> be doing so?
>
> Escape characters are part of the shell syntax.  They are never special
> when they result from expansions, unless they are reinterpreted as shell
> input through eval.
>
> 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 Sun Jul 29 18:58:25 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SvcRN-0005im-24
	for mharc-bug-bash@gnu.org; Sun, 29 Jul 2012 18:58:25 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33163)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1SvcRL-0005if-7s
	for bug-bash@gnu.org; Sun, 29 Jul 2012 18:58:24 -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 1SvcRJ-0001Le-Qq
	for bug-bash@gnu.org; Sun, 29 Jul 2012 18:58:23 -0400
Received: from plane.gmane.org ([80.91.229.3]:59153)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1SvcRJ-0001LK-JV
	for bug-bash@gnu.org; Sun, 29 Jul 2012 18:58:21 -0400
Received: from list by plane.gmane.org with local (Exim 4.69)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1SvcRD-0007Dn-S6
	for bug-bash@gnu.org; Mon, 30 Jul 2012 00:58:15 +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>; Mon, 30 Jul 2012 00:58:15 +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>; Mon, 30 Jul 2012 00:58:15 +0200
X-Injected-Via-Gmane: http://gmane.org/
To: bug-bash@gnu.org
From: "John E. Malmberg" <wb8tyw@qsl.net>
Subject: sys/param.h not checked for by configure
Date: Sun, 29 Jul 2012 17:57:52 -0500
Lines: 52
Message-ID: <jv4f5p$bgn$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:13.0) Gecko/20120614 Thunderbird/13.0.1
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: Sun, 29 Jul 2012 22:58:24 -0000

Hello all,

The header file sys/param.h is not checked for by configure and is not 
provided by the VMS environment.

I have worked around this issue by having the VMS specific build script 
create an empty substitute file.

The HP VMS Engineering team has indicated a willingness to add the 
sys/param.h file to the operating system in a future release or patch 
kit, but has a problem.

There does not seem to be a standards document as to what exactly should 
be in this header file.

The sys/param.h header file is mentioned at The Open Group web site as 
existing in some implementations, but I can not find any definition for it.

http://pubs.opengroup.org/onlinepubs/009604599/basedefs/sys/stat.h.html 
is the reference.

The Linux System Base navigator shows it as defining two macros for 
constants by name.  I can not find in the Linux system Base definition 
explorer any description about what those two macros represent in a 
conforming implementation.  It also does not mention the constant value 
that The Open Group link states could be in that file.

http://www.linuxbase.org/navigator/browse/header.php?cmd=display&Hid=112

Falling back to a search on general usage gives some views on the two 
constants of MAXPATHLEN and NOFILE, as being for the maximum size of a 
file specification and the number of open files, but no references to a 
standards organization.

It did find one post that claimed that the Linux value of 4096 for 
MAXPATHLEN was wrong, and that it was easy to create longer paths.

For current VMS versions, MAXPATHLEN is 4096 and NOFILE is 65535.  The 
actual limit on files is usually set by a quota to that can be retrieved 
by getdtablesize() and is typically only a few thousand at most, so the 
NOFILE value is not that useful.

MAXPATHLEN appears to be a duplicate for the macros PATH_MAX and 
FILENAME_MAX that are defined in other standard headers.

So does anyone know of a link to a reference standard about what should 
be in the sys/param.h file.

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



From MAILER-DAEMON Mon Jul 30 08:09:38 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Svon4-0001PJ-BF
	for mharc-bug-bash@gnu.org; Mon, 30 Jul 2012 08:09:38 -0400
Received: from eggs.gnu.org ([208.118.235.92]:39897)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Svomu-0001P2-0r
	for bug-bash@gnu.org; Mon, 30 Jul 2012 08:09:37 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Svoml-0006YD-Nl
	for bug-bash@gnu.org; Mon, 30 Jul 2012 08:09:27 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:50852
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Svoml-0006W7-HF
	for bug-bash@gnu.org; Mon, 30 Jul 2012 08:09:19 -0400
Received: (qmail 5222 invoked from network); 30 Jul 2012 12:08:55 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Mon, 30 Jul 2012 08:08:55 -0400
Received: (qmail 5163 invoked by uid 563); 30 Jul 2012 12:08:55 -0000
Date: Mon, 30 Jul 2012 08:08:54 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: "Chris F.A. Johnson" <chris@cfajohnson.com>
Subject: Re: why must non-standard $IFS members be treated so differently ?
Message-ID: <20120730120854.GI8239@eeg.ccf.org>
References: <CALyZvKwgS15wtORMMLaLaNUFNa7ywOsLahypuLevV-me_71W0g@mail.gmail.com>
	<alpine.LMD.2.00.1207291502120.13516@localhost.localdomain>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <alpine.LMD.2.00.1207291502120.13516@localhost.localdomain>
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: Jason Vas Dias <jason.vas.dias@gmail.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: Mon, 30 Jul 2012 12:09:37 -0000

On Sun, Jul 29, 2012 at 03:04:21PM -0400, Chris F.A. Johnson wrote:
> On Sun, 29 Jul 2012, Jason Vas Dias wrote:
> >    function count_args     {                v=($@);  echo ${#v[@]}; }
> 
>    Always quote $@. Without quotes, it's the same as $*
> 
> function count_args     {                v=( "$@" );  echo ${#v[@]}; }

count_args() { echo $#; }

However, if you actually wanted to stuff the function's positional
parameters into an array for some other reason, Chris is absolutely
correct.


From MAILER-DAEMON Mon Jul 30 10:41:34 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SvrA6-0008P4-Hj
	for mharc-bug-bash@gnu.org; Mon, 30 Jul 2012 10:41:34 -0400
Received: from eggs.gnu.org ([208.118.235.92]:59766)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1Svr9z-0008MT-8t
	for bug-bash@gnu.org; Mon, 30 Jul 2012 10:41:32 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1Svr9o-0006ZJ-Dj
	for bug-bash@gnu.org; Mon, 30 Jul 2012 10:41:27 -0400
Received: from mx1.redhat.com ([209.132.183.28]:64571)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1Svr9o-0006Z4-5e
	for bug-bash@gnu.org; Mon, 30 Jul 2012 10:41:16 -0400
Received: from int-mx10.intmail.prod.int.phx2.redhat.com
	(int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6UEfDd7019887
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Mon, 30 Jul 2012 10:41:13 -0400
Received: from dhcp-25-98.brq.redhat.com (dhcp-25-98.brq.redhat.com
	[10.34.25.98])
	by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id q6UEfBZ3018120; Mon, 30 Jul 2012 10:41:12 -0400
Message-ID: <50169D06.4020706@redhat.com>
Date: Mon, 30 Jul 2012 16:41:10 +0200
From: Roman Rakus <rrakus@redhat.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:13.0) Gecko/20120615 Thunderbird/13.0.1
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: AIX and Interix also do early PID recycling.
References: <201207241503.q6OF3aaU141050@sauxz3.salomon.at>
	<20120724154904.GZ8239@eeg.ccf.org>
	<500ED354.6050100@salomon.at> <500F464A.4070703@case.edu>
	<500FA760.4090300@salomon.at> <500FF2B0.8000001@salomon.at>
	<50100846.7040007@salomon.at> <5010096D.4070502@redhat.com>
	<501028F6.3070104@case.edu>
In-Reply-To: <501028F6.3070104@case.edu>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
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
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, 30 Jul 2012 14:41:32 -0000

On 07/25/2012 07:12 PM, Chet Ramey wrote:
> On 7/25/12 10:57 AM, Roman Rakus wrote:
>
>> And there is also a problem when you change the `ulimit -u' value.
>> See  https://bugzilla.redhat.com/show_bug.cgi?id=832997
> It's not clear to me that it's desirable to attempt to remember a
> potentially unlimited number of process exit statuses.  You have to
> bound it somewhere.
>
> Chet
Hmm... I don't know much about boundaries of maximum number of user 
processes. But anyway - do you think that (re)changing js.c_childmax 
(when `ulimit -u' is changed) is not good?

RR



From MAILER-DAEMON Mon Jul 30 12:12:55 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SvsaV-0006G8-4s
	for mharc-bug-bash@gnu.org; Mon, 30 Jul 2012 12:12:55 -0400
Received: from eggs.gnu.org ([208.118.235.92]:53198)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1SvsaT-0006EW-58
	for bug-bash@gnu.org; Mon, 30 Jul 2012 12:12:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1SvsaR-0004gW-LZ
	for bug-bash@gnu.org; Mon, 30 Jul 2012 12:12:53 -0400
Received: from caiajhbdcbbj.dreamhost.com ([208.97.132.119]:44658
	helo=homiemail-a62.g.dreamhost.com)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1SvsaQ-0004er-G0
	for bug-bash@gnu.org; Mon, 30 Jul 2012 12:12:51 -0400
Received: from homiemail-a62.g.dreamhost.com (localhost [127.0.0.1])
	by homiemail-a62.g.dreamhost.com (Postfix) with ESMTP id 10446634079
	for <bug-bash@gnu.org>; Mon, 30 Jul 2012 09:12:47 -0700 (PDT)
DomainKey-Signature: a=rsa-sha1; c=nofws; d=jidanni.org; h=from:to:subject
	:date:message-id:mime-version:content-type; q=dns; s=jidanni.org
	; b=di5UePavWw8VwlAnoK/Bbtaal2iyy+RC6dT7XUq21ZH0ot3dTo3vBdgSVXaH
	SW8O/mAZAgoH9ThIo+o1Wg+0Y70S0t0rpBaeXFhXDIeIwuqYL3pH3cJrIH8B7Iem
	CF6D1X3k0inQCd4RbIWxLRhEmj4R5dUngxdNP0wr30E9zu4=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=jidanni.org; h=from:to
	:subject:date:message-id:mime-version:content-type; s=
	jidanni.org; bh=OMbtTaM64bR5AbM+2N8UUk9YL44=; b=awl9AC+schZsTfXI
	X2bV1zi1sKwXT+bvrk2BkiKXkHPvT5tr4hq2yIpy339d3vSSVgKWyWmYYN5ZOyoa
	yA7ScCZaZjY3ruWvH3DuhF7G7/fXtCDtk5B0Kpi3kBqnnWzrTzMipFR+8wQ46mPb
	RRGWz2bE+xPFhIpGVjBuOjaEGiI=
Received: from jidanni.org (114-26-44-231.dynamic.hinet.net [114.26.44.231])
	(using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
	(No client certificate requested)
	(Authenticated sender: jidanni@jidanni.org)
	by homiemail-a62.g.dreamhost.com (Postfix) with ESMTPSA id 6882163406F
	for <bug-bash@gnu.org>; Mon, 30 Jul 2012 09:12:47 -0700 (PDT)
From: jidanni@jidanni.org
To: bug-bash@gnu.org
Subject: Why does -v not work until after "}" in scripts?
Date: Tue, 31 Jul 2012 00:12:42 +0800
Message-ID: <87lii16xdx.fsf@jidanni.org>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 208.97.132.119
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, 30 Jul 2012 16:12:54 -0000

Why does -v not work until after "}" in this script?

# su - nobody
No directory, logging in with HOME=/
$ cat /tmp/o
{
    set -v
# NO STDERR
}
# YES STDERR
$ sh /tmp/o
# YES STDERR

bash:
  Installed: 4.2-4


From MAILER-DAEMON Mon Jul 30 12:16:20 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Svsdo-0000Qd-6O
	for mharc-bug-bash@gnu.org; Mon, 30 Jul 2012 12:16:20 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49784)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Svsdj-0000QI-1p
	for bug-bash@gnu.org; Mon, 30 Jul 2012 12:16:18 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Svsdd-0005m1-9X
	for bug-bash@gnu.org; Mon, 30 Jul 2012 12:16:14 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:50925
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Svsdd-0005lZ-3O
	for bug-bash@gnu.org; Mon, 30 Jul 2012 12:16:09 -0400
Received: (qmail 7737 invoked from network); 30 Jul 2012 16:16:07 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Mon, 30 Jul 2012 12:16:07 -0400
Received: (qmail 5404 invoked by uid 563); 30 Jul 2012 16:16:06 -0000
Date: Mon, 30 Jul 2012 12:16:06 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: jidanni@jidanni.org
Subject: Re: Why does -v not work until after "}" in scripts?
Message-ID: <20120730161606.GJ8239@eeg.ccf.org>
References: <87lii16xdx.fsf@jidanni.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <87lii16xdx.fsf@jidanni.org>
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, 30 Jul 2012 16:16:19 -0000

On Tue, Jul 31, 2012 at 12:12:42AM +0800, jidanni@jidanni.org wrote:
> Why does -v not work until after "}" in this script?
> 
> # su - nobody
> No directory, logging in with HOME=/
> $ cat /tmp/o
> {
>     set -v
> # NO STDERR
> }
> # YES STDERR
> $ sh /tmp/o
> # YES STDERR

Because bash reads its input line by line, but also command by command.
When bash reads the { line, it knows it has to keep reading until a
matching } in order to be able to parse the entire command.  So it does
that -- it reads the entire command group into memory.

Then it executes the command group, which turns on -v.

Then it reads the NEXT command, and since -v is now in effect, it echoes
that command after reading it.


From MAILER-DAEMON Mon Jul 30 12:36:42 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SvsxW-0007f6-BF
	for mharc-bug-bash@gnu.org; Mon, 30 Jul 2012 12:36:42 -0400
Received: from eggs.gnu.org ([208.118.235.92]:36106)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1SvsxT-0007eT-VH
	for bug-bash@gnu.org; Mon, 30 Jul 2012 12:36:40 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1SvsxT-0004t3-2H
	for bug-bash@gnu.org; Mon, 30 Jul 2012 12:36:39 -0400
Received: from mail-ob0-f169.google.com ([209.85.214.169]:51940)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1SvsxS-0004sw-R2
	for bug-bash@gnu.org; Mon, 30 Jul 2012 12:36:38 -0400
Received: by obhx4 with SMTP id x4so11270206obh.0
	for <bug-bash@gnu.org>; Mon, 30 Jul 2012 09:36:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type;
	bh=2+q+tyjpb2fiwdKFyjG1yVxOu95l2DxWTkQzf3mZF+o=;
	b=Q6T0Q1fguYmZ9xi71dInicb8cbVE+AybWoQEU6fcwkV8rCWH6ZQMMisYwjr3pq3cCZ
	FMiZx0aR5lthqzRPekdfE1pvS36J7gC5jtg6kAFxewruFlWLAF8VuK6Bmw2L0ay9zQpg
	Gte/HHI+8/ganhJ88dD20N/PmSoDECHRpw5fNgxxfnmfX63RC5JG6nfAqWgp5gUjiTIs
	j8HqQM0Mj7mcjsEbPyqYK+tFleY5C8mBZCZja6dvJGmuR8lIEgAUrZeQWklyNa5wHXzJ
	DxaupylkTwT3kP3XpuX4pYAIJ82ufFbsNtZPCRDPXBtaj8Rfq0Hzg3+h7ZgAeobw9vc3
	utzg==
MIME-Version: 1.0
Received: by 10.182.174.70 with SMTP id bq6mr18516324obc.78.1343666197910;
	Mon, 30 Jul 2012 09:36:37 -0700 (PDT)
Sender: pyroinajar@gmail.com
Received: by 10.60.9.201 with HTTP; Mon, 30 Jul 2012 09:36:37 -0700 (PDT)
In-Reply-To: <CALyZvKwgS15wtORMMLaLaNUFNa7ywOsLahypuLevV-me_71W0g@mail.gmail.com>
References: <CALyZvKwgS15wtORMMLaLaNUFNa7ywOsLahypuLevV-me_71W0g@mail.gmail.com>
Date: Mon, 30 Jul 2012 12:36:37 -0400
X-Google-Sender-Auth: wh1JTe6F-K7VwhbJcDCNT0ExC2U
Message-ID: <CAPg6Z0-G+KjwLLSPMR286yzbaWZPsjWHVvWUS1PmXiYEZYY+1w@mail.gmail.com>
Subject: Re: why must non-standard $IFS members be treated so differently ?
From: DJ Mills <danielmills1@gmail.com>
To: Jason Vas Dias <jason.vas.dias@gmail.com>
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: 209.85.214.169
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: Mon, 30 Jul 2012 16:36:41 -0000

On Sun, Jul 29, 2012 at 10:23 AM, Jason Vas Dias
<jason.vas.dias@gmail.com> wrote:
>
>      function count_colons {  IFS=':' ;    v=($@);  echo ${#v[@]}; }
>
>

count_colons() { local n=${*//[!:]}; printf '%s\n' "${#n}"; }


From MAILER-DAEMON Mon Jul 30 18:23:51 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SvyNT-0007oP-2K
	for mharc-bug-bash@gnu.org; Mon, 30 Jul 2012 18:23:51 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33546)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <andrewresch@gmail.com>) id 1SvxL4-0003TR-Sb
	for bug-bash@gnu.org; Mon, 30 Jul 2012 17:17:19 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <andrewresch@gmail.com>) id 1SvxL3-0002r7-N4
	for bug-bash@gnu.org; Mon, 30 Jul 2012 17:17:18 -0400
Received: from mail-wi0-f177.google.com ([209.85.212.177]:58940)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <andrewresch@gmail.com>) id 1SvxL3-0002pj-F4
	for bug-bash@gnu.org; Mon, 30 Jul 2012 17:17:17 -0400
Received: by wibhm11 with SMTP id hm11so1697793wib.12
	for <bug-bash@gnu.org>; Mon, 30 Jul 2012 14:17: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
	:content-transfer-encoding;
	bh=U5IpJeRb0b6pIJCy4+VMsIH4g05mj2ZgEuiptOZsNSg=;
	b=eKSO8aGqgx0ZqNMZJXFDEFeJAKd00P/TG2CSwhm8oDMo+OL4r5o3yjF09mhgc6kQvS
	tgelMKn2/nZWse3J6v4yD0M1O7eomkJeUeTw7RbYK6/5pZt0TrPzG+IyhReZ5Ty/S+s+
	WGHbHb7zZvMTyDlwpwOKDd4aipDvgKXyB3Ex3cIM+8tlOwXGHcxKiUiKkBSFGWy1FzAI
	tHHNluWMVGFmWJ9WVloEc8jQYB7u7t9usGgRdWqWb0ODHdOnhhnrygIoYloqBDNQ7Vrh
	AW1jJWwAzc9KUdsqJ4rqdFAsn4jL7N8R9pQF4UTwRhA0quUrZu/lcUN0j9EnnrlHhNP/
	EfMw==
MIME-Version: 1.0
Received: by 10.180.86.106 with SMTP id o10mr1037926wiz.22.1343683035555; Mon,
	30 Jul 2012 14:17:15 -0700 (PDT)
Received: by 10.223.99.145 with HTTP; Mon, 30 Jul 2012 14:17:15 -0700 (PDT)
Date: Mon, 30 Jul 2012 14:17:15 -0700
Message-ID: <CAAHy0xDyLSJZ1ePnj2bE964Z-Gy+_eb9oOWqBtPJO_NaPJTCZQ@mail.gmail.com>
Subject: HP-UX exec tee hanging/not working intermittently
From: Andrew Resch <andrewresch@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.177
X-Mailman-Approved-At: Mon, 30 Jul 2012 18:23:49 -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, 30 Jul 2012 21:17:19 -0000

Configuration Information [Automatically generated, do not change]:
Machine: ia64
OS: hpux11.31
Compiler: cc
Compilation CFLAGS:  -DPROGRAM=3D'bash' -DCONF_HOSTTYPE=3D'ia64'
-DCONF_OSTYPE=3D'hpux11.31' -DCONF_MACHTYPE=3D'ia64-hp-hpux11.31'
-DCONF_VENDOR=3D'hp' -DLOCALEDIR=3D'/u
sr/local/share/locale' -DPACKAGE=3D'bash' -DSHELL -DHAVE_CONFIG_H -DHPUX
  -I.  -I. -I./include -I./lib   -O -I/usr/local/include
-D_XOPEN_SOURCE_EXTENDED
uname output: HP-UX van-saml B.11.31 U ia64 3018224905 unlimited-user licen=
se
Machine Type: ia64-hp-hpux11.31

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

Description:
        I am attempting to use exec and tee to have my scripts
stdout/stderr appended to a log file like such: exec > >(tee -a $LOG)
2>&1
        These scripts will often call other scripts with a similar
exec statement, often writing to a separate log file.  On my GNU/Linux
systems,
        these scripts will run just fine without any issue, but on
HP-UX they seem to hang or not display any output.

Repeat-By:

$ cat test_exec1.sh
#!/bin/bash

LOG=3D"test_exec.log"
exec > >(/usr/bin/tee -a $LOG) 2>&1

echo "i am exec1.."

./test_exec2.sh

echo "i am done in exec1.."

$ cat test_exec2.sh
#!/bin/bash

LOG=3D"test_exec2.log"
exec > >(/usr/bin/tee -a $LOG) 2>&1

echo "i am exec2.."

echo "i am done in exec2.."


On one of my HP-UX hosts I can run this script many times before it hangs.

$ while true; do ./test_exec1.sh; done
i am exec1..
i am done in exec1..
i am exec2..
i am done in exec2..
...snip lots of repeats...
i am done in exec1..
i am exec2..
i am done in exec2..
i am exec1..
=03<hangs here, ctrl+c to end>
$ echo $?
130

On the following host it hangs much more quickly and we don't in fact
get any output from test_exec2.sh script.

$ while true; do ./test_exec1.sh; done
i am exec1..
i am done in exec1..
i am exec1..
i am done in exec1..
i am exec1..
i am done in exec1..
i am exec1..
i am done in exec1..
i am exec1..
i am done in exec1..
i am exec1..
i am done in exec1..
i am exec1..
i am done in exec1..
i am exec1..
i am done in exec1..
i am exec1..
i am done in exec1..
i am exec1..
i am done in exec1..
<hangs here, ctrl+c to end>
$ echo $?
130

Other times it just refuses to run at all:

$ ./test_exec1.sh
$ echo $?
141


I'd really appreciate some guidance on this issue, if you believe it
is a bash bug or if in fact it's purely an issue with HP-UX or system
configuration.  If its helpful, I can provide tusc output for these
commands.

Thank you.


From MAILER-DAEMON Mon Jul 30 18:58:09 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Svyuf-0007Eg-5C
	for mharc-bug-bash@gnu.org; Mon, 30 Jul 2012 18:58:09 -0400
Received: from eggs.gnu.org ([208.118.235.92]:50516)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1Svyuc-0007Cz-Dc
	for bug-bash@gnu.org; Mon, 30 Jul 2012 18:58:07 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1Svyub-0002JF-HX
	for bug-bash@gnu.org; Mon, 30 Jul 2012 18:58:06 -0400
Received: from caiajhbdcaib.dreamhost.com ([208.97.132.81]:60027
	helo=homiemail-a61.g.dreamhost.com)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1Svyub-0002Ig-8h
	for bug-bash@gnu.org; Mon, 30 Jul 2012 18:58:05 -0400
Received: from homiemail-a61.g.dreamhost.com (localhost [127.0.0.1])
	by homiemail-a61.g.dreamhost.com (Postfix) with ESMTP id 427F7578077;
	Mon, 30 Jul 2012 15:58:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=jidanni.org; h=from:to:cc
	:subject:references:date:message-id:mime-version:content-type;
	s=jidanni.org; bh=cPjt9uoeSpW9GwYvM4oQPby5IpA=; b=IUS71XLvlpsQF
	i6WUlx+7s1jWZYKqyiF/sAC2zHXJZpSZBp1gjYrxq65JHjgolL2VfTXBmkASHbHj
	BYQfptor4UL7HN9+Gjrt+SjU1gOtF9pUyGf3uXgJVrL+3Is1+v2s6m49jufna2KN
	D8FnGfDDV5vaExI6WeHK1np8Bjzw6g=
Received: from jidanni.org (unknown [218.187.41.66])
	(using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
	(No client certificate requested)
	(Authenticated sender: jidanni@jidanni.org)
	by homiemail-a61.g.dreamhost.com (Postfix) with ESMTPSA id 67F6E57806E; 
	Mon, 30 Jul 2012 15:58:03 -0700 (PDT)
From: jidanni@jidanni.org
To: wooledg@eeg.ccf.org
Subject: Re: Why does -v not work until after "}" in scripts?
References: <20120730161606.GJ8239@eeg.ccf.org>
Date: Tue, 31 Jul 2012 06:05:55 +0800
Message-ID: <87sjc8sy4c.fsf@jidanni.org>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 208.97.132.81
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, 30 Jul 2012 22:58:07 -0000

Well -x works right away, but -v gets stuck until all depths of nested { } are
over with.


From MAILER-DAEMON Mon Jul 30 19:33:11 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SvzSY-0003jB-Ua
	for mharc-bug-bash@gnu.org; Mon, 30 Jul 2012 19:33:10 -0400
Received: from eggs.gnu.org ([208.118.235.92]:56614)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SvzSV-0003bS-Sb
	for bug-bash@gnu.org; Mon, 30 Jul 2012 19:33:08 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SvzST-00005I-TG
	for bug-bash@gnu.org; Mon, 30 Jul 2012 19:33:07 -0400
Received: from mx1.redhat.com ([209.132.183.28]:40994)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SvzST-000051-Lh
	for bug-bash@gnu.org; Mon, 30 Jul 2012 19:33: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 q6UNWcBm019700
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Mon, 30 Jul 2012 19:32:38 -0400
Received: from [10.3.113.77] (ovpn-113-77.phx2.redhat.com [10.3.113.77])
	by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id q6UNWbLj017741; Mon, 30 Jul 2012 19:32:38 -0400
Message-ID: <50171995.9020705@redhat.com>
Date: Mon, 30 Jul 2012 17:32:37 -0600
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:14.0) Gecko/20120717 Thunderbird/14.0
MIME-Version: 1.0
To: jidanni@jidanni.org
Subject: Re: Why does -v not work until after "}" in scripts?
References: <20120730161606.GJ8239@eeg.ccf.org> <87sjc8sy4c.fsf@jidanni.org>
In-Reply-To: <87sjc8sy4c.fsf@jidanni.org>
X-Enigmail-Version: 1.4.3
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="------------enigD551CFF7B26BEC13A0116CDD"
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
Cc: wooledg@eeg.ccf.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: Mon, 30 Jul 2012 23:33:09 -0000

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

On 07/30/2012 04:05 PM, jidanni@jidanni.org wrote:
> Well -x works right away, but -v gets stuck until all depths of nested =
{ } are
> over with.

Yes, this point has been made before, and the conclusion is unchanged -
this is not a bug.  By the way, alias definitions have the same behavior.=


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


--------------enigD551CFF7B26BEC13A0116CDD
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/

iQEcBAEBCAAGBQJQFxmVAAoJEKeha0olJ0NqsQMIAJ02QU1k29erRoMOfk9EYMuR
YGX1btnPaqPXzH//5eNt6GBbNZiijTJIhaYEomaY+388yWVgDbApHKXfn1Ua0AKy
qp5NflHfECo7WIwMzygML4+TJ5FooYIfru5dpJJ3uo9nsxWvPzv6j+0uJ+4Qf3VC
OcrFUnleOFW/pAyRV+kNGrLRU30ix7zHLItRhE3P4QNcZWjfYEPZunZhQIwmJp7J
jA2eJFzL1MSghFWpLyZRcD11OEOrv+zeFTmxxu+e0//wTBAQLJ4PPH12brvXbUdJ
YYlf+NJWb03RCvpMZuSjovMiME4ovUXR/VL9L8avZEOQj3uKTHv6mV55d2g6GdI=
=i6lg
-----END PGP SIGNATURE-----

--------------enigD551CFF7B26BEC13A0116CDD--


From MAILER-DAEMON Tue Jul 31 07:56:09 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SwB3Z-0003qj-25
	for mharc-bug-bash@gnu.org; Tue, 31 Jul 2012 07:56:09 -0400
Received: from eggs.gnu.org ([208.118.235.92]:34534)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SwB3V-0003pC-SC
	for bug-bash@gnu.org; Tue, 31 Jul 2012 07:56:06 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SwB3R-0005gU-FR
	for bug-bash@gnu.org; Tue, 31 Jul 2012 07:56:05 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:51413
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SwB3R-0005f0-9N
	for bug-bash@gnu.org; Tue, 31 Jul 2012 07:56:01 -0400
Received: (qmail 16645 invoked from network); 31 Jul 2012 11:55:58 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Tue, 31 Jul 2012 07:55:58 -0400
Received: (qmail 6587 invoked by uid 563); 31 Jul 2012 11:55:58 -0000
Date: Tue, 31 Jul 2012 07:55:57 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Andrew Resch <andrewresch@gmail.com>
Subject: Re: HP-UX exec tee hanging/not working intermittently
Message-ID: <20120731115557.GK8239@eeg.ccf.org>
References: <CAAHy0xDyLSJZ1ePnj2bE964Z-Gy+_eb9oOWqBtPJO_NaPJTCZQ@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAAHy0xDyLSJZ1ePnj2bE964Z-Gy+_eb9oOWqBtPJO_NaPJTCZQ@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: Tue, 31 Jul 2012 11:56:07 -0000

On Mon, Jul 30, 2012 at 02:17:15PM -0700, Andrew Resch wrote:
>         I am attempting to use exec and tee to have my scripts
> stdout/stderr appended to a log file like such: exec > >(tee -a $LOG)
> 2>&1
>         These scripts will often call other scripts with a similar
> exec statement, often writing to a separate log file.  On my GNU/Linux
> systems,
>         these scripts will run just fine without any issue, but on
> HP-UX they seem to hang or not display any output.

The major difference here is that bash on HP-UX implements process
substitutions (the <() syntax) with a named pipe, whereas on Linux
it uses a /dev/fd/* file.

> $ cat test_exec1.sh
> #!/bin/bash
> 
> LOG="test_exec.log"
> exec > >(/usr/bin/tee -a $LOG) 2>&1
> 
> echo "i am exec1.."
> 
> ./test_exec2.sh
> 
> echo "i am done in exec1.."

> $ while true; do ./test_exec1.sh; done

You are opening a slew of named pipes and background jobs in rapid
succession, and not waiting for the jobs to finish.  (It might still be
considered a bug... I'm just pointing out the practical aspects.)

I would bet that putting a "sleep 1" in the loop would make the problem
stop happening, as horrible a hack as that may be.

I discuss this a bit on <http://mywiki.wooledge.org/BashFAQ/106>.  The
only way to ensure clean operation is to avoid the <() syntax altogether
and use your own explicit named pipe and background job.  Then you can
close the pipe and wait for the background job to terminate before
exiting.


From MAILER-DAEMON Tue Jul 31 13:10:00 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SwFxI-0001ed-6v
	for mharc-bug-bash@gnu.org; Tue, 31 Jul 2012 13:10:00 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52628)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <andrewresch@gmail.com>) id 1SwFxF-0001eO-Gu
	for bug-bash@gnu.org; Tue, 31 Jul 2012 13:09:58 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <andrewresch@gmail.com>) id 1SwFxE-0001RX-4j
	for bug-bash@gnu.org; Tue, 31 Jul 2012 13:09:57 -0400
Received: from mail-wg0-f49.google.com ([74.125.82.49]:38951)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <andrewresch@gmail.com>) id 1SwFxD-0001RP-UU
	for bug-bash@gnu.org; Tue, 31 Jul 2012 13:09:56 -0400
Received: by wgbez12 with SMTP id ez12so4740710wgb.30
	for <bug-bash@gnu.org>; Tue, 31 Jul 2012 10:09:55 -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;
	bh=6oNslzAsvRbfYzFOTQvMObzPfbNvggBoZPjZ7aIfERw=;
	b=FMi2UoAFndgJYnCu1hVP+KVaRI5U4Pg+ksAIkD/HjFwXy7OUI6PIrSDLHXqDbdy0af
	LELWhxXNlg27Z+PBHAl9txKnZ006oo5BloSxzspUdl2Tv35lhZgO1NCDmojYwLtI5DH/
	GzYFA4dbWFbiNo0zJvbrHfKvoGojp8UCIFlcOPFOGtiQIjhnwz5JAMd18B4euW9jt6O6
	sPbLLmAIcRPFvv6ZtMe8ktSHl2MuG5biW4b45OWllLz1WQGFBNdSa+U1hkL7Iv6C/zN4
	nmObG0Vd0v6vK7BPW0bf6YCDFCR0Mx2xt+Tv53M5oo0o3nhWF2Av1bJ5q5sLdyhUcxKk
	ZXCQ==
MIME-Version: 1.0
Received: by 10.180.92.9 with SMTP id ci9mr3570511wib.22.1343754595242; Tue,
	31 Jul 2012 10:09:55 -0700 (PDT)
Received: by 10.223.99.145 with HTTP; Tue, 31 Jul 2012 10:09:55 -0700 (PDT)
In-Reply-To: <20120731115557.GK8239@eeg.ccf.org>
References: <CAAHy0xDyLSJZ1ePnj2bE964Z-Gy+_eb9oOWqBtPJO_NaPJTCZQ@mail.gmail.com>
	<20120731115557.GK8239@eeg.ccf.org>
Date: Tue, 31 Jul 2012 10:09:55 -0700
Message-ID: <CAAHy0xBdhr_ye51Kf1=LoFKT2EFintQurAaT5e7F=CW3DXtmCQ@mail.gmail.com>
Subject: Re: HP-UX exec tee hanging/not working intermittently
From: Andrew Resch <andrewresch@gmail.com>
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.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: Tue, 31 Jul 2012 17:09:58 -0000

On Tue, Jul 31, 2012 at 4:55 AM, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
> On Mon, Jul 30, 2012 at 02:17:15PM -0700, Andrew Resch wrote:
>>         I am attempting to use exec and tee to have my scripts
>> stdout/stderr appended to a log file like such: exec > >(tee -a $LOG)
>> 2>&1
>>         These scripts will often call other scripts with a similar
>> exec statement, often writing to a separate log file.  On my GNU/Linux
>> systems,
>>         these scripts will run just fine without any issue, but on
>> HP-UX they seem to hang or not display any output.
>
> The major difference here is that bash on HP-UX implements process
> substitutions (the <() syntax) with a named pipe, whereas on Linux
> it uses a /dev/fd/* file.
>
>> $ cat test_exec1.sh
>> #!/bin/bash
>>
>> LOG="test_exec.log"
>> exec > >(/usr/bin/tee -a $LOG) 2>&1
>>
>> echo "i am exec1.."
>>
>> ./test_exec2.sh
>>
>> echo "i am done in exec1.."
>
>> $ while true; do ./test_exec1.sh; done
>
> You are opening a slew of named pipes and background jobs in rapid
> succession, and not waiting for the jobs to finish.  (It might still be
> considered a bug... I'm just pointing out the practical aspects.)
> I would bet that putting a "sleep 1" in the loop would make the problem
> stop happening, as horrible a hack as that may be.

Yes, fair enough.  I did the loop to simply make the issue more apparent,
but many times I couldn't even run the test_exec1.sh script once successfully
on one of my hosts.  In those cases I'm not sure how large of a sleep
I'd need to make it work ;)

> I discuss this a bit on <http://mywiki.wooledge.org/BashFAQ/106>.  The
> only way to ensure clean operation is to avoid the <() syntax altogether
> and use your own explicit named pipe and background job.  Then you can
> close the pipe and wait for the background job to terminate before
> exiting.

Thank you for this.  I have removed the process substitution from my scripts
and replaced it with using explicit named pipes, and now everything is
working as expected.


