From MAILER-DAEMON Tue May 01 08:43:12 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SPCQC-0006Xj-OO
	for mharc-bug-bash@gnu.org; Tue, 01 May 2012 08:43:12 -0400
Received: from eggs.gnu.org ([208.118.235.92]:47675)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SPCQ9-0006XG-KG
	for bug-bash@gnu.org; Tue, 01 May 2012 08:43:10 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SPCQ7-0005V5-K7
	for bug-bash@gnu.org; Tue, 01 May 2012 08:43:09 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:2177)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SPCQ7-0005UG-Fk
	for bug-bash@gnu.org; Tue, 01 May 2012 08:43: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 BKI20634;
	Tue, 1 May 2012 08:43:03 -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 AWI00595 (AUTH cpr);
	Tue, 01 May 2012 08:43:03 -0400 (EDT)
Message-ID: <4F9FDA57.1050905@case.edu>
Date: Tue, 01 May 2012 08:43:03 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Dan Douglas <ormaaj@gmail.com>
Subject: Re: Passing variables by reference conflicts with local
References: <20100501081803.GA4615@rebase.prov>
	<20100504175709.GA3757@blondy.prov>
	<CADv8-ohX7OcHePHWPnGWaK3z5ZnsWn1CR9A=5xRTLPEpnf9M1Q@mail.gmail.com>
	<28430124.VShIv7qHlk@smorgbox>
In-Reply-To: <28430124.VShIv7qHlk@smorgbox>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv2.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.37
Cc: Clark Wang <clark.wang@oracle.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: Tue, 01 May 2012 12:43:11 -0000

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

On 4/30/12 5:24 AM, Dan Douglas wrote:
> On Monday, April 23, 2012 04:56:09 PM Clark Wang wrote:
>> On Wed, May 5, 2010 at 01:57, Freddy Vulto <fvulto@gmail.com> wrote:
>>> It appears that `unset' is capable of traversing down the call-stack and
>>> ...
> 
> I reverse engineered most of this behavior a few months ago and wrote a 
> detailed explaination and example here:
> 
> http://wiki.bash-hackers.org/commands/builtin/unset#scope
> 
> Hopefully most of that is correct.

This is pretty much right on.  It's a nice piece of deduction.

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+f2lcACgkQu1hp8GTqdKuj1wCfWIueDj9uVd/gokS8xEKuTRxJ
iToAn30d8ByDafMoiaZLBCGYh7+WchnN
=2222
-----END PGP SIGNATURE-----


From MAILER-DAEMON Wed May 02 09:40:10 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SPZms-0007QS-Jd
	for mharc-bug-bash@gnu.org; Wed, 02 May 2012 09:40:10 -0400
Path: usenet.stanford.edu!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From: seo10@sentientit.net
Newsgroups: gnu.bash.bug
Subject: Re: Wedding App
Date: Wed, 2 May 2012 06:36:31 -0700 (PDT)
Organization: http://groups.google.com
Lines: 117
Message-ID: <3310354.539.1335965792203.JavaMail.geo-discussion-forums@pbph1>
References: <27354ff1-4728-4fc7-a4c6-2f491d08ffc2@9g2000pbd.googlegroups.com>
NNTP-Posting-Host: 122.174.61.177
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1335965870 1218 127.0.0.1 (2 May 2012 13:37:50 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 2 May 2012 13:37:50 +0000 (UTC)
In-Reply-To: <27354ff1-4728-4fc7-a4c6-2f491d08ffc2@9g2000pbd.googlegroups.com>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=122.174.61.177;
	posting-account=jHX-twoAAADOYYewG9LOwBFCdw_6ekEH
User-Agent: G2/1.0
Xref: usenet.stanford.edu gnu.bash.bug:24591
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: Wed, 02 May 2012 13:40:09 -0000

On Thursday, February 9, 2012 12:48:36 PM UTC+5:30, kevin wrote:
> iWedPlanner is a wedding planner which provides all the features
> necessary to plan and organize your wedding. The wedding app
> periodically reminds about the forthcoming events to make the plan
> well organized. The app also provides information about the wedding
> rings, wedding dresses, wedding cakes, wedding flowers etc through
> various vendors. The entire wedding planning is just in your hands.
> Just plan your wedding with "iWedplanner" and have a happy wedding.
>=20
> The features included in iWedPlanner are mentioned below:
>=20
> 1. My Wedding To-Do List:
>=20
> =E2=97=8FThe user will be able to View To Do List, Completed List, Incomp=
lete
> List.
> =E2=97=8FThe To Do List is divided into two types: Category Wise To Do Li=
st
> and Duration Wise To Do List.
> =E2=97=8FThe user can also add personal tasks, delete personal tasks.
> =E2=97=8FThe email alert feature helps to alert the user monthly alert, w=
eekly
> alert and daily alert.
>=20
> 2. Resources: The bride or bridegroom will be able to find the vendor
> details for the categories mentioned below:
>=20
> =E2=97=8F Accessories
> =E2=97=8F Entertainment
> =E2=97=8F Family
> =E2=97=8F Gift & Flowers
> =E2=97=8F Hotels
> =E2=97=8F Invitation stores
> =E2=97=8F Restaurants
> =E2=97=8F Wedding Jewelry
> =E2=97=8F Wedding Venue
> =E2=97=8F Wedding Dresses
> =E2=97=8F Wedding Cakes
>=20
> The bride or bridegroom can also add vendor details.
>=20
> 3. My Wedding Day: The My Wedding Day shows the countdown of number of
> Days, number of Months, number of Hours And Number of Minutes left for
> the wedding day.
>=20
> 4. Organizer: Features in the Organizer section:
>=20
> =E2=97=8FAdd Quick Notes
> =E2=97=8FAdd Appointments
> =E2=97=8FAdd Contact Details
> =E2=97=8FGift Tracker
> =E2=97=8FIntegration with Facebook
> =E2=97=8FIntegration with Twitter
> =E2=97=8FFirst Dance Songs
> =E2=97=8FFAQs
>=20
> 5. My Reminder: The =E2=80=9CMy Reminder=E2=80=9D feature helps to send r=
eminders to
> the bride or bridegroom one day, three days or five days before.
>=20
> 6. RSVP The bride or bridegroom can send RSVP to the guests for
> Engagement, Wedding and Reception events. Features included in RSVP:
>=20
> =E2=97=8FGuest Invite
> =E2=97=8FInvitation Sent List
> =E2=97=8FGuest Response
> =E2=97=8FGuests List: The Guests List is divided into three different
> categories such as Engagement Guests List, Wedding Guests List and
> Reception Guests List. In each category, the user can view the list of
> family guests, list of friend=E2=80=99s guests, list of co-workers, list =
of
> relatives and list of VIP=E2=80=99s invited.
> =E2=97=8FFunction Arrangements
> =E2=97=8FOccasion List: The Occasion list helps to view the overall list =
of
> guests invited for Engagement, Wedding and Reception.
> =E2=97=8FList of All Guests: The bride or bridegroom can see the list of =
all
> guests.
>=20
> 7. Seating Arrangement: Seating Arrangements are divided into three
> categories for Engagement, Wedding and Reception.
>=20
> =E2=97=8FThe bride or bridegroom will be able to assign the seats to the
> guests invited for Engagement, Wedding and Reception.
> =E2=97=8FTable can be defined by specifying number of adult and kids seat=
s.
> =E2=97=8FCan view the summary of tables defined.
> =E2=97=8FCan view the summary of Seating Assigned Guests List.
> =E2=97=8FCan view the summary of Seating not Assigned Guests List.
> =E2=97=8FCan do Family Wise Seat Assignment.
> =E2=97=8FCan do Group Wise Seat Assignment.
> =E2=97=8FCan view the summary of Family Wise Seat Assignment.
> =E2=97=8FCan view the summary of Group Wise Seat Assignment.
> =E2=97=8FCan view the summary of Table Wise Seating Assignment Status.
> =E2=97=8FCan view Total Seating Assignment Status.
>=20
> 8. Budget Calculation: Budget can be calculated for the items needed
> for the wedding. =E2=80=9CPlanner Dashboard=E2=80=9D provides Actual cost=
 incurred,
> Estimated cost, Amount paid, Amount need to be paid, Bride
> contributions, Groom contributions and other=E2=80=99s contributions.
>=20
> Visit Website:
>=20
> http://www.iwedplanner.com
>=20
> Download iPhone,iPod touch, iPad App:
>=20
> http://itunes.apple.com/us/app/iwedplanner-the-wedding-planner/id40837353=
7?mt=3D8
>=20
> Download Android App:
>=20
> https://market.android.com/details?id=3Dcom.sentientit.newiwedplanner

It's a nice app. Thanks to Sharing this wonderful wedding app .....

From MAILER-DAEMON Wed May 02 16:18:47 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SPg0d-0000nB-Ki
	for mharc-bug-bash@gnu.org; Wed, 02 May 2012 16:18:47 -0400
Received: from eggs.gnu.org ([208.118.235.92]:54498)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Tillmann.Crueger@telekom.de>) id 1SPXY7-0008Re-Tf
	for bug-bash@gnu.org; Wed, 02 May 2012 07:16:52 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Tillmann.Crueger@telekom.de>) id 1SPXY5-0003Ly-V1
	for bug-bash@gnu.org; Wed, 02 May 2012 07:16:47 -0400
Received: from tcmail83.telekom.de ([62.225.183.131]:23239)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Tillmann.Crueger@telekom.de>) id 1SPXY5-0003Lk-NI
	for bug-bash@gnu.org; Wed, 02 May 2012 07:16:45 -0400
Received: from he101251.emea1.cds.t-internal.com ([10.125.92.154])
	by tcmail81.telekom.de with ESMTP/TLS/AES128-SHA;
	02 May 2012 13:16:25 +0200
Received: from HE111540.emea1.cds.t-internal.com ([169.254.1.29]) by
	HE101251.emea1.cds.t-internal.com ([fe80::e428:2144:dcc5:bcce%15]) with
	mapi; Wed, 2 May 2012 13:16:24 +0200
From: <Tillmann.Crueger@telekom.de>
To: <bug-bash@gnu.org>
Date: Wed, 2 May 2012 13:16:23 +0200
Subject: Possible bug: Race condition when calling external commands during
	trap handling
Thread-Topic: Possible bug: Race condition when calling external commands
	during trap handling
Thread-Index: Ac0oVQJBzdU5azABR+K3nAa+f0bOMQ==
Message-ID: <E76DF6102FDBC04BA291EAE9A3BAECB501381DBD8583@HE111540.emea1.cds.t-internal.com>
Accept-Language: en-US, de-DE
Content-Language: de-DE
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
acceptlanguage: en-US, de-DE
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 62.225.183.131
X-Mailman-Approved-At: Wed, 02 May 2012 16:18:45 -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, 02 May 2012 11:16:52 -0000

Hi,

I have a problem with a trap handler in a script, which is doing some loggi=
ng and needs external commands (date and hostname). In some cases there see=
ms to be a race condition causing a syntax error every once in a while. I a=
m assuming it is a race condition, because the syntax errors only happen ve=
ry very infrequently.

I have produced the following script as a small example:

-----------------------

#!/bin/bash

log() {
  local text=3D"$(date +'%Y-%m-%d %H:%M:%S') $(hostname -s) $1"
  echo $text >> /dev/null
}

thread() {
  while true; do
    log "Thread is running"
    kill -ALRM $$
    sleep 1
  done
}

trap "log 'received ALRM'" ALRM=20

thread &
trap "kill $?; exit 0" INT TERM


while true; do
  log "Main is running"
  sleep 1
done

-----------------------

Very infrequently this script will fail with a syntax error in line 5 (echo=
 $text >> /dev/null). The actual error message is:

> /path/to/script.sh: command substitution: line 5: syntax error near unexp=
ected token `)'=20
> /path/to/script.sh: command substitution: line 5: `hostname -s) $1'=20

Since there is not "hostname -s) $1" in line 5, I am assuming there also is=
 an off-by-one error and line 4 is actually meant (local text=3D"$(date +'%=
Y-%m-%d %H:%M:%S') $(hostname -s) $1").

I have encountered this problem both on bash 4.2.24(1)-release (x86_64-pc-l=
inux-gnu) on ubuntu 12.04 as well as on bash 4.1.2(1)-release (x86_64-redha=
t-linux-gnu) on RHEL 6.2.

There may be something wrong with the way traps are used in this case, but =
the documentation is very sparse on this topic. I also opened a question on=
 StackOverflow.com (http://stackoverflow.com/questions/10194837/concurrent-=
logging-in-bash-scripts) but did not receive any usefull answers yet.

Since this is a race condition, it might take a while for the bug to hit. I=
n some cases the script was running up to 30 minutes before the bug trigger=
ed.

Please let me know if you have any furhter questions or hints on how to res=
olve this issue.

Thank you,
  Till Crueger=


From MAILER-DAEMON Thu May 03 02:46:52 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SPpoS-0002OX-9x
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 02:46:52 -0400
Received: from eggs.gnu.org ([208.118.235.92]:43672)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <panruochen@gmail.com>) id 1SPpcO-00019L-Di
	for bug-bash@gnu.org; Thu, 03 May 2012 02:34:25 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <panruochen@gmail.com>) id 1SPpcJ-0004mY-He
	for bug-bash@gnu.org; Thu, 03 May 2012 02:34:23 -0400
Received: from mail-vb0-f41.google.com ([209.85.212.41]:45741)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <panruochen@gmail.com>) id 1SPpcJ-0004ip-B7
	for bug-bash@gnu.org; Thu, 03 May 2012 02:34:19 -0400
Received: by vbbey12 with SMTP id ey12so1310168vbb.0
	for <bug-bash@gnu.org>; Wed, 02 May 2012 23:34:16 -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=jfiFYhxHVAb2c8y7dnUSGoix7aoCkRJpjzoee/wJHGw=;
	b=RWZU8bdEM5pcJBhkRAcOUonYxczvtkqEzJOkiZ/kK7YZNZqF5Mx1lgRlZ9C05Cnyyv
	qw6+F54r7SuZG38UGCbLtMvdBXOl53SGoqSdfeZKL18p2x6ZouFRM65eGbGZW8o5ovRp
	4VvRq18UVgnc+CyFw+S3jUe2QlZhW6RIJhkKu28ZtL4L83KQ6EACqGu4qf6YAYqXn9DM
	y6MgCAH4uX4Rl7pR9PafiluzljBEuEZdgOfMiAHKSWskUz/Z4kQfv1dnqdh2CehvjwyX
	72GuDmaZCMR6UaPGKN3NAan03fcWaAVroc1k6RF0lGjMBxmjpFwKusr/vb0mBEWt00Er
	R12w==
MIME-Version: 1.0
Received: by 10.220.154.2 with SMTP id m2mr581705vcw.55.1336026856841; Wed, 02
	May 2012 23:34:16 -0700 (PDT)
Received: by 10.220.66.10 with HTTP; Wed, 2 May 2012 23:34:16 -0700 (PDT)
Date: Thu, 3 May 2012 14:34:16 +0800
Message-ID: <CALX7UOjVv5e1aH9wg6M33KNHZ+J3oZpLaCn-2FqsHmf4+Y7O=A@mail.gmail.com>
Subject: ((i++)) no longer supported?
From: Pan ruochen <panruochen@gmail.com>
To: bug-bash@gnu.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: 209.85.212.41
X-Mailman-Approved-At: Thu, 03 May 2012 02:46:51 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 03 May 2012 06:34:25 -0000

Hi All,

Suddenly I found that ((i++)) is not supported on bash.
Just try the following simple case:
$i=0; ((i++)); echo $?
And the result is
1
which means an error.
I got the same result on GNU bash, version 4.1.2(1)-release
(x86_64-redhat-linux-gnu) and GNU bash, version 4.1.10(4)-release
(i686-pc-cygwin).

- BR, Ruochen


From MAILER-DAEMON Thu May 03 02:54:27 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SPpvn-00051d-Ok
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 02:54:27 -0400
Received: from eggs.gnu.org ([208.118.235.92]:36802)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SPpvl-00051X-Ju
	for bug-bash@gnu.org; Thu, 03 May 2012 02:54:26 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SPpvj-00048o-Bl
	for bug-bash@gnu.org; Thu, 03 May 2012 02:54:25 -0400
Received: from mail-wi0-f177.google.com ([209.85.212.177]:47780)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SPpvj-00044l-3L
	for bug-bash@gnu.org; Thu, 03 May 2012 02:54:23 -0400
Received: by wibhj13 with SMTP id hj13so23434wib.12
	for <bug-bash@gnu.org>; Wed, 02 May 2012 23:54:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type;
	bh=XHTv1/wiyGVrTFpzpX/3xyCsYJo+xZQ93b2NfUF57fA=;
	b=j3g0r2Xtm5NuuNuksz2B4O3OH0loZU/2+b/CotCqGm1C5si3EFC0zK9DsRTVtinDtj
	IolPOEaFegGT4ZzRbWVVt+r/M4beDtgB54E7hCs9IU68NDnSaVGfCcdFMYYksAKx4jY1
	Wrq+jtf9BkeL11/kLbjtx8zomxPdHXr3/oPsSa+NdTdT4QczJVHU7EyfjmxPwYqFuQBE
	hHb7UquSZluerrhkD+Cub4DNul9hDYcf/2Z6a9ygRIz5Mkj/RWQ25djIQbFvDp7O2Anr
	+F89n6fnjGoRVQ279+ORgrV5ztDnPMxJi4mmr5xsH7pqmi2Ay4elJSmiaL7TSmNt9Gbu
	hu7g==
Received: by 10.180.77.233 with SMTP id v9mr187341wiw.22.1336028060248; Wed,
	02 May 2012 23:54:20 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.223.75.202 with HTTP; Wed, 2 May 2012 23:53:59 -0700 (PDT)
In-Reply-To: <CALX7UOjVv5e1aH9wg6M33KNHZ+J3oZpLaCn-2FqsHmf4+Y7O=A@mail.gmail.com>
References: <CALX7UOjVv5e1aH9wg6M33KNHZ+J3oZpLaCn-2FqsHmf4+Y7O=A@mail.gmail.com>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Thu, 3 May 2012 09:53:59 +0300
Message-ID: <CAPSX3sQq4vTWXaqdnjVMJWK+3+yOfzrc+MMuzQcvOWySone_Pw@mail.gmail.com>
Subject: Re: ((i++)) no longer supported?
To: Pan ruochen <panruochen@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.212.177
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 03 May 2012 06:54:26 -0000

On Thu, May 3, 2012 at 9:34 AM, Pan ruochen <panruochen@gmail.com> wrote:
> Hi All,
>
> Suddenly I found that ((i++)) is not supported on bash.
> Just try the following simple case:
> $i=0; ((i++)); echo $?
> And the result is
> 1
> which means an error.
> I got the same result on GNU bash, version 4.1.2(1)-release
> (x86_64-redhat-linux-gnu) and GNU bash, version 4.1.10(4)-release
> (i686-pc-cygwin).
>
> - BR, Ruochen
>

It has always been the case, and fits the documentation since i++
value is 0 and that is false in the arithmetic context.

What changed is that it bash exits in this case if you use set -e.
Some Possible workarounds:
((i++)) || :
((i+=1))
i=$((i+1))
and a gazillon others.


From MAILER-DAEMON Thu May 03 03:08:01 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SPq8u-0006iS-W0
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 03:08:00 -0400
Received: from eggs.gnu.org ([208.118.235.92]:34037)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1SPq8t-0006iL-7n
	for bug-bash@gnu.org; Thu, 03 May 2012 03:08:00 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1SPq8m-0008Ai-TB
	for bug-bash@gnu.org; Thu, 03 May 2012 03:07:58 -0400
Received: from joseki.proulx.com ([216.17.153.58]:45704)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1SPq8m-0008Ac-M3
	for bug-bash@gnu.org; Thu, 03 May 2012 03:07:52 -0400
Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119])
	by joseki.proulx.com (Postfix) with ESMTP id 8D827211D6;
	Thu,  3 May 2012 01:07:50 -0600 (MDT)
Received: by hysteria.proulx.com (Postfix, from userid 1000)
	id 6D7D72DC82; Thu,  3 May 2012 01:07:50 -0600 (MDT)
Date: Thu, 3 May 2012 01:07:50 -0600
From: Bob Proulx <bob@proulx.com>
To: Tillmann.Crueger@telekom.de
Subject: Re: Possible bug: Race condition when calling external commands
	during trap handling
Message-ID: <20120503070750.GA23091@hysteria.proulx.com>
Mail-Followup-To: Tillmann.Crueger@telekom.de, bug-bash@gnu.org
References: <E76DF6102FDBC04BA291EAE9A3BAECB501381DBD8583@HE111540.emea1.cds.t-internal.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <E76DF6102FDBC04BA291EAE9A3BAECB501381DBD8583@HE111540.emea1.cds.t-internal.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 216.17.153.58
Cc: 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, 03 May 2012 07:08:00 -0000

Tillmann.Crueger@telekom.de wrote:
> I have produced the following script as a small example:

A good small example!  I do not understand the problem but I do have a
question about one of the lines in it and a comment about another.

> trap "kill $?; exit 0" INT TERM

What did you intend with "kill $?; exit 0"?  Did you mean "kill $$"
instead?

>   local text="$(date +'%Y-%m-%d %H:%M:%S') $(hostname -s) $1"

Note that GNU date can use "+%F %T" as a shortcut for "%Y-%m-%d %H:%M:%S".
It is useful to save typing.

And lastly I will comment that you are doing quite a bit inside of an
interrupt routine.  Typically in a C program it is not safe to perform
any operation that may call malloc() within an interupt service
routine since malloc isn't reentrant.  Bash is a C program and I
assume the same restriction would apply.

Bob


From MAILER-DAEMON Thu May 03 03:13:46 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SPqEU-0007Vv-86
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 03:13:46 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41178)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1SPqEQ-0007S7-VX
	for bug-bash@gnu.org; Thu, 03 May 2012 03:13:45 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1SPqEO-0001VS-NP
	for bug-bash@gnu.org; Thu, 03 May 2012 03:13:42 -0400
Received: from mail-ob0-f169.google.com ([209.85.214.169]:49715)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1SPqEO-0001V4-GJ
	for bug-bash@gnu.org; Thu, 03 May 2012 03:13:40 -0400
Received: by obbwd18 with SMTP id wd18so2552731obb.0
	for <bug-bash@gnu.org>; Thu, 03 May 2012 00:13:37 -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=71I6SCRthH2UC6aqFKBEA1IlIydKe1jvjvOHHtQUvFE=;
	b=UD2WQbOCRFRJLfzTtSGWt/Bl9SCUQuXN9oZgiN22Lbxf9bq91BFwWQ+iXKFwR4DU/6
	pK6FnVqD5Sdg5nS/bTdtoH9ahSB6+3e8FtAT1zpVeD9JXRQALZbKmfAd+M/ruT/N868o
	MzDtsE9VagXmSR/4uhstGVHCjw79gu0OwgdqdBx1mdEs0iKjXMMflp5E6lw2rUnq8w9y
	xw/zlGEBTMnxAQ21kWqgwU/YoHcLSCxPozooh+1OgP1yG1M1cc8CNeB9UZHB9VluoY4/
	bRR7jJp/WTX421tYyEUp0U3MFjmJZHVkYwFnDhW1z8g+qNHYBfRz06zVkyKW0ixbA23w
	RQMw==
MIME-Version: 1.0
Received: by 10.60.19.106 with SMTP id d10mr1211326oee.40.1336029217806; Thu,
	03 May 2012 00:13:37 -0700 (PDT)
Sender: pyroinajar@gmail.com
Received: by 10.60.33.199 with HTTP; Thu, 3 May 2012 00:13:37 -0700 (PDT)
In-Reply-To: <CAPSX3sQq4vTWXaqdnjVMJWK+3+yOfzrc+MMuzQcvOWySone_Pw@mail.gmail.com>
References: <CALX7UOjVv5e1aH9wg6M33KNHZ+J3oZpLaCn-2FqsHmf4+Y7O=A@mail.gmail.com>
	<CAPSX3sQq4vTWXaqdnjVMJWK+3+yOfzrc+MMuzQcvOWySone_Pw@mail.gmail.com>
Date: Thu, 3 May 2012 03:13:37 -0400
X-Google-Sender-Auth: 4u1dXmYQAhzWgxEoq1ZNnp81odk
Message-ID: <CAPg6Z09vVhyva6b=wruQMrTeagjiBYv9kRboQod4pRpLGL0qRw@mail.gmail.com>
Subject: Re: ((i++)) no longer supported?
From: DJ Mills <danielmills1@gmail.com>
To: Pierre Gaston <pierre.gaston@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, Pan ruochen <panruochen@gmail.com>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 03 May 2012 07:13:45 -0000

On Thu, May 3, 2012 at 2:53 AM, Pierre Gaston <pierre.gaston@gmail.com> wrote:
> On Thu, May 3, 2012 at 9:34 AM, Pan ruochen <panruochen@gmail.com> wrote:
>> Hi All,
>>
>> Suddenly I found that ((i++)) is not supported on bash.
>> Just try the following simple case:
>> $i=0; ((i++)); echo $?
>> And the result is
>> 1
>> which means an error.
>> I got the same result on GNU bash, version 4.1.2(1)-release
>> (x86_64-redhat-linux-gnu) and GNU bash, version 4.1.10(4)-release
>> (i686-pc-cygwin).
>>
>> - BR, Ruochen
>>
>
> It has always been the case, and fits the documentation since i++
> value is 0 and that is false in the arithmetic context.
>
> What changed is that it bash exits in this case if you use set -e.
> Some Possible workarounds:
> ((i++)) || :
> ((i+=1))
> i=$((i+1))
> and a gazillon others.
>

The most sane workaround would probably be to stop using set -e.

But another one, just for S&G: ((i++, 1))


From MAILER-DAEMON Thu May 03 04:06:15 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SPr3H-0006Y6-Ew
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 04:06:15 -0400
Received: from eggs.gnu.org ([208.118.235.92]:51751)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Tillmann.Crueger@telekom.de>) id 1SPr39-0006Vn-EW
	for bug-bash@gnu.org; Thu, 03 May 2012 04:06:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Tillmann.Crueger@telekom.de>) id 1SPr31-0004Yz-A1
	for bug-bash@gnu.org; Thu, 03 May 2012 04:06:07 -0400
Received: from tcmail73.telekom.de ([217.243.239.135]:11816)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Tillmann.Crueger@telekom.de>) id 1SPr31-0004YT-3B
	for bug-bash@gnu.org; Thu, 03 May 2012 04:05:59 -0400
Received: from he111297.emea1.cds.t-internal.com ([10.125.90.15])
	by tcmail71.telekom.de with ESMTP/TLS/AES128-SHA;
	03 May 2012 10:05:49 +0200
Received: from HE111540.emea1.cds.t-internal.com ([169.254.1.29]) by
	HE111297.EMEA1.CDS.T-INTERNAL.COM ([fe80::9835:b110:c489:6d64%16]) with
	mapi; Thu, 3 May 2012 10:05:42 +0200
From: <Tillmann.Crueger@telekom.de>
CC: <bug-bash@gnu.org>
Date: Thu, 3 May 2012 10:05:42 +0200
Subject: Possible bug: Race condition when calling external commands during
	trap handling
Thread-Topic: Possible bug: Race condition when calling external commands
	during trap handling
Thread-Index: Ac0o+3fnI2KSF60lR5uQlzpTmHrEBQABYDsgAACatLA=
Message-ID: <E76DF6102FDBC04BA291EAE9A3BAECB501381DBD8585@HE111540.emea1.cds.t-internal.com>
Accept-Language: en-US, de-DE
Content-Language: de-DE
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
acceptlanguage: en-US, de-DE
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 217.243.239.135
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, 03 May 2012 08:06:13 -0000

Yes, you are correct, that line is buggy and contains a typo. I added it la=
ter in a hurry after I could reproduce the error, to ensure a clean shutdow=
n of the script. What I meant to type was:

> trap "kill $!; exit 0" INT TERM

However thinking about it, this also does not work as intended.

The problem exists, though, even if that line is deleted (one just has to k=
ill all remaining threads manually after the crash or after ^C).

If you need, I can update the script with a INT and TERM handler, which act=
ually kills, however since this is not relevant to the problem in question,=
 I did not sent a correction after I noticed the typo.


I am also aware of the strict restrictions on operations allowed during sig=
nal handling in C and C++. I tried to find any documentation on allowed ope=
rations during trap handlers for bash, but even after a prolonged search in=
 the man and info pages as well as online, I could not find an resources on=
 that topic. The low number of responses to the same question on SO also se=
ems to show, that hardly anyone is aware of such restrictions. If such docu=
mentation exists of course this is not bug. In that case my personal sugges=
tion would be to somehow mention the available documentation in the man pag=
es. This would be especially usefull, since it is not very clear, what oper=
ations would need a malloc() internally (note that in C most kinds of exec(=
) do malloc() and therefore are not thread safe, however executing external=
 commands is very common in bash, so the restrictions cannot just be derive=
d from the C-side).

I also noted, that the behaviour is different from problems during signal h=
andling. The most likely result of a forbidden operation during signal hand=
ling would be a deadlock (since the operation will try to lock the same res=
ource twice in the same thread). However in this case somehow the parser se=
ems to mess up it's internal state, resulting in the parser error I am seei=
ng.

I hope this makes the problem more clear.=20

Thank you for your feedback,
  Till

-----Urspr=FCngliche Nachricht-----
Von: Bob Proulx [mailto:bob@proulx.com]
Gesendet: Donnerstag, 3. Mai 2012 09:08
An: Crueger, Tillmann
Cc: bug-bash@gnu.org
Betreff: Re: Possible bug: Race condition when calling external commands du=
ring trap handling

Tillmann.Crueger@telekom.de wrote:
> I have produced the following script as a small example:

A good small example!  I do not understand the problem but I do have a ques=
tion about one of the lines in it and a comment about another.

> trap "kill $?; exit 0" INT TERM

What did you intend with "kill $?; exit 0"?  Did you mean "kill $$"
instead?

>   local text=3D"$(date +'%Y-%m-%d %H:%M:%S') $(hostname -s) $1"

Note that GNU date can use "+%F %T" as a shortcut for "%Y-%m-%d %H:%M:%S".
It is useful to save typing.

And lastly I will comment that you are doing quite a bit inside of an inter=
rupt routine.  Typically in a C program it is not safe to perform any opera=
tion that may call malloc() within an interupt service routine since malloc=
 isn't reentrant.  Bash is a C program and I assume the same restriction wo=
uld apply.

Bob


From MAILER-DAEMON Thu May 03 04:06:31 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SPr3X-0006fF-Pq
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 04:06:31 -0400
Received: from eggs.gnu.org ([208.118.235.92]:51808)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SPr3Q-0006eH-8j
	for bug-bash@gnu.org; Thu, 03 May 2012 04:06:29 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SPr3J-0004b0-Dg
	for bug-bash@gnu.org; Thu, 03 May 2012 04:06:23 -0400
Received: from mail-out.m-online.net ([212.18.0.10]:56381)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SPr3J-0004a9-7k
	for bug-bash@gnu.org; Thu, 03 May 2012 04:06:17 -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 3VjppF02mLz3hhXT;
	Thu,  3 May 2012 10:06:10 +0200 (CEST)
Received: from igel.home (ppp-88-217-97-66.dynamic.mnet-online.de
	[88.217.97.66])
	by mail.mnet-online.de (Postfix) with ESMTPA id 3VjppB5b9Vz4KK3s;
	Thu,  3 May 2012 10:06:10 +0200 (CEST)
Received: by igel.home (Postfix, from userid 501)
	id 60D6CCA2A0; Thu,  3 May 2012 10:06:10 +0200 (CEST)
From: Andreas Schwab <schwab@linux-m68k.org>
To: Tillmann.Crueger@telekom.de
Subject: Re: Possible bug: Race condition when calling external commands
	during trap handling
References: <E76DF6102FDBC04BA291EAE9A3BAECB501381DBD8583@HE111540.emea1.cds.t-internal.com>
	<20120503070750.GA23091@hysteria.proulx.com>
X-Yow: Yow!  And then we could sit on the hoods of cars at stop lights!
Date: Thu, 03 May 2012 10:06:09 +0200
In-Reply-To: <20120503070750.GA23091@hysteria.proulx.com> (Bob Proulx's
	message of "Thu, 3 May 2012 01:07:50 -0600")
Message-ID: <m2bom54rke.fsf@igel.home>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.96 (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: 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, 03 May 2012 08:06:30 -0000

Bob Proulx <bob@proulx.com> writes:

> And lastly I will comment that you are doing quite a bit inside of an
> interrupt routine.  Typically in a C program it is not safe to perform
> any operation that may call malloc() within an interupt service
> routine since malloc isn't reentrant.  Bash is a C program and I
> assume the same restriction would apply.

Traps are executed only at command boundaries.  Executing them in a
signal handler would make them completely unusable, of course.

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 Thu May 03 08:17:55 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SPuyp-0007MI-Bt
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 08:17:55 -0400
Received: from eggs.gnu.org ([208.118.235.92]:51133)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SPuyj-00076n-Fh
	for bug-bash@gnu.org; Thu, 03 May 2012 08:17:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SPuye-0004AM-P0
	for bug-bash@gnu.org; Thu, 03 May 2012 08:17:49 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:49429
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SPuye-00049w-LC
	for bug-bash@gnu.org; Thu, 03 May 2012 08:17:44 -0400
Received: (qmail 12348 invoked from network); 3 May 2012 12:17:42 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Thu, 03 May 2012 08:17:42 -0400
Received: (qmail 2892 invoked by uid 563); 3 May 2012 12:17:41 -0000
Date: Thu, 3 May 2012 08:17:41 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Pan ruochen <panruochen@gmail.com>
Subject: Re: ((i++)) no longer supported?
Message-ID: <20120503121741.GC1622@eeg.ccf.org>
References: <CALX7UOjVv5e1aH9wg6M33KNHZ+J3oZpLaCn-2FqsHmf4+Y7O=A@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CALX7UOjVv5e1aH9wg6M33KNHZ+J3oZpLaCn-2FqsHmf4+Y7O=A@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: Thu, 03 May 2012 12:17:53 -0000

On Thu, May 03, 2012 at 02:34:16PM +0800, Pan ruochen wrote:
> $i=0; ((i++)); echo $?
> And the result is
> 1

Which means it's supported.

> which means an error.

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


From MAILER-DAEMON Thu May 03 08:44:01 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SPvO4-0007jE-Vu
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 08:44:00 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52728)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SPvNy-0007iZ-Dq
	for Bug-bash@gnu.org; Thu, 03 May 2012 08:43:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SPvNt-0006Q8-Ml
	for Bug-bash@gnu.org; Thu, 03 May 2012 08:43:53 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:38590)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SPvNt-0006LE-GO
	for Bug-bash@gnu.org; Thu, 03 May 2012 08:43:49 -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 BKJ91912;
	Thu, 3 May 2012 08:43:46 -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 AWU52939 (AUTH cpr);
	Thu, 03 May 2012 08:43:46 -0400 (EDT)
Message-ID: <4FA27D82.6010703@case.edu>
Date: Thu, 03 May 2012 08:43:46 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Bug-bash@gnu.org
Subject: Fwd: Bash bug interpolating delete characters
References: <OFDE975207.0C3622E5-ONC12579F3.00361A06-C12579F3.00365E39@orga-systems.com>
In-Reply-To: <OFDE975207.0C3622E5-ONC12579F3.00361A06-C12579F3.00365E39@orga-systems.com>
X-Enigmail-Version: 1.4.1
X-Forwarded-Message-Id: <OFDE975207.0C3622E5-ONC12579F3.00361A06-C12579F3.00365E39@orga-systems.com>
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
Content-Type: message/rfc822;
	name="Bash bug interpolating delete characters.eml"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="Bash bug interpolating delete characters.eml"
X-Content-Filtered-By: Mailman/MimeDel 2.1.14
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: Thu, 03 May 2012 12:43:59 -0000

Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,

please try the following bash script:

a=3Dx
del=3D"$(echo -e "\\x7f")"

echo "$del${a#x}" | od -ta
echo "$del ${a#x}" | od -ta
echo " $del${a#x}" | od -ta

Using bash 3.2, the output is:

0000000 del  nl
0000002
0000000 del  sp  nl
0000003
0000000  sp del  nl
0000003

however with bash 4.1 and bash 4.2.20, the output is only:

0000000 del  nl
0000002
0000000  sp  nl
0000002
0000000  sp  nl
0000002

... so in the second and third line, the delete character magically=20
disappears. Neither OS nor locale seem to influence this. Using a delete=20=

character directly in the script instead of $del also has no impact,=20
either.

Feel free to post this to gnu.bash.bug - unfortunately I don't have a spam=
=20
protected email address at hand right now.

Thanks for looking at this!

Yours, R=FCdiger.

The information included in this e-mail and any files transmitted with it =
is strictly confidential and may be privileged or otherwise protected from=
 disclosure. If you are not the intended recipient, please notify the send=
er immediately by e-mail and delete this e-mail as well as any attachment =
from your system. If you are not the intended recipient you are not author=
ized to use and/or copy this message and/or attachment and/or disclose the=
 contents to any other person.

From MAILER-DAEMON Thu May 03 09:01:43 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SPvfD-0004L2-Mm
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 09:01:43 -0400
Received: from eggs.gnu.org ([208.118.235.92]:43101)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SPvev-0004GB-Fv
	for bug-bash@gnu.org; Thu, 03 May 2012 09:01:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SPvef-0007T3-7y
	for bug-bash@gnu.org; Thu, 03 May 2012 09:01:25 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:49446
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SPvef-0007Rv-1X
	for bug-bash@gnu.org; Thu, 03 May 2012 09:01:09 -0400
Received: (qmail 12598 invoked from network); 3 May 2012 13:01:04 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Thu, 03 May 2012 09:01:04 -0400
Received: (qmail 2944 invoked by uid 563); 3 May 2012 13:01:04 -0000
Date: Thu, 3 May 2012 09:01:04 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Chet Ramey <chet.ramey@case.edu>
Subject: Re: Fwd: Bash bug interpolating delete characters
Message-ID: <20120503130103.GD1622@eeg.ccf.org>
References: <OFDE975207.0C3622E5-ONC12579F3.00361A06-C12579F3.00365E39@orga-systems.com>
	<4FA27D82.6010703@case.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <4FA27D82.6010703@case.edu>
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, 03 May 2012 13:01:42 -0000

> Yours, Rüdiger.

> a=x
> del="$(echo -e "\\x7f")"
> 
> echo "$del${a#x}" | od -ta
> echo "$del ${a#x}" | od -ta
> echo " $del${a#x}" | od -ta

Yup, confirmed that it breaks here, and only when the # parameter expansion
is included.

imadev:~$ del=$'\x7f' a=x b=
imadev:~$ echo " $del$b" | od -ta
0000000   sp del  nl
0000003
imadev:~$ echo " $del${b}" | od -ta
0000000   sp del  nl
0000003
imadev:~$ echo " $del${b#x}" | od -ta
0000000   sp del  nl
0000003
imadev:~$ echo " $del${a#x}" | od -ta
0000000   sp  nl
0000002

Bash 4.2.24.


From MAILER-DAEMON Thu May 03 13:41:42 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQ02A-0003RB-L6
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 13:41:42 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44427)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQ027-0003Qz-UU
	for bug-bash@gnu.org; Thu, 03 May 2012 13:41:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQ026-0004ij-7C
	for bug-bash@gnu.org; Thu, 03 May 2012 13:41:39 -0400
Received: from fmmailgate01.web.de ([217.72.192.221]:49953)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQ025-0004iS-Tx
	for bug-bash@gnu.org; Thu, 03 May 2012 13:41:38 -0400
Received: from moweb002.kundenserver.de (moweb002.kundenserver.de
	[172.19.20.108])
	by fmmailgate01.web.de (Postfix) with ESMTP id 538161AD54CB3
	for <bug-bash@gnu.org>; Thu,  3 May 2012 19:41:35 +0200 (CEST)
Received: from [192.168.178.49] ([77.13.116.115]) by smtp.web.de (mrweb001)
	with ESMTPA (Nemesis) id 0Lh6fv-1Rn8v200e7-00oUqh;
	Thu, 03 May 2012 19:41:35 +0200
Message-ID: <4FA2C34B.2050203@web.de>
Date: Thu, 03 May 2012 19:41:31 +0200
From: John Kearney <dethrophes@web.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:12.0) Gecko/20120428 Thunderbird/12.0.1
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Re: Fwd: Bash bug interpolating delete characters
References: <OFDE975207.0C3622E5-ONC12579F3.00361A06-C12579F3.00365E39@orga-systems.com>
	<4FA27D82.6010703@case.edu> <20120503130103.GD1622@eeg.ccf.org>
In-Reply-To: <20120503130103.GD1622@eeg.ccf.org>
Content-Type: text/plain; charset=ISO-8859-1
X-Provags-ID: V02:K0:L2vbBY7xykqc5l0Y9BOPlingyOhsRO5OVgPFaPm2mM8
	PQjr5I+Be0ThZwsU5HuUzK5J4jzUfllIEeb79y/NzjSTZxmcGo
	Xyp7heIssZhVLHVdmPTR4V2GvCP6vU+rHh9y1iGj+fPcyazbu1
	t6a+mnuirBKFsYQ7QwoLaMIS2MHJxgT89ufQ4OsWjgVgq7iyVc
	gGilDAaL1V4EiSkG+EKPA==
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-Received-From: 217.72.192.221
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, 03 May 2012 17:41:41 -0000

Am 03.05.2012 15:01, schrieb Greg Wooledge:
>> Yours, R=FCdiger.
>> a=3Dx
>> del=3D"$(echo -e "\\x7f")"
>>
>> echo "$del${a#x}" | od -ta
>> echo "$del ${a#x}" | od -ta
>> echo " $del${a#x}" | od -ta
> Yup, confirmed that it breaks here, and only when the # parameter expan=
sion
> is included.
>
> imadev:~$ del=3D$'\x7f' a=3Dx b=3D
> imadev:~$ echo " $del$b" | od -ta
> 0000000   sp del  nl
> 0000003
> imadev:~$ echo " $del${b}" | od -ta
> 0000000   sp del  nl
> 0000003
> imadev:~$ echo " $del${b#x}" | od -ta
> 0000000   sp del  nl
> 0000003
> imadev:~$ echo " $del${a#x}" | od -ta
> 0000000   sp  nl
> 0000002
>
> Bash 4.2.24.
>
Also Confirmed, but my output is a bit wackier.
printf %q seems to get confused, and do invalid things as well.

the \x7f becomes a \

function printTests {
    while [ $# -gt 0 ]; do
        printf    "%-20s=3D[%q]\n"    "${1}" "$(eval echo "${1}")"
        shift
    done
}

a=3Dx
del=3D$'\x7f'
printTests '"$del${a#x}"' '"$del ${a#x}"' '" $del${a#x}"' '" $del${a%x}"'
printTests '" $del${a:0:0}"' '" $del"${a:0:0}' '" $del""${a:0:0}"'
printTests '" $del${a}"' '" $del"' '" ${del}${a:0:0}"' '"
${del:0:1}${a:0:0}"'
printTests '" ${del:0:1}${a}"' '"${del:0:1}${a#d}"' '"${del:0:1}${a#x}"'
printTests '" ${del:0:1} ${a}"' '"${del:0:1} ${a#d}"' '"${del:0:1} ${a#x}=
"'

output
"$del${a#x}"        =3D[$'\177']
"$del ${a#x}"       =3D[\ ]
" $del${a#x}"       =3D[\ ]
" $del${a%x}"       =3D[\ ]
" $del${a:0:0}"     =3D[\ ]
" $del"${a:0:0}     =3D[$' \177']
" $del""${a:0:0}"   =3D[$' \177']
" $del${a}"         =3D[$' \177x']
" $del"             =3D[$' \177']
" ${del}${a:0:0}"   =3D[\ ]
" ${del:0:1}${a:0:0}"=3D[\ ]
" ${del:0:1}${a}"   =3D[$' \177x']
"${del:0:1}${a#d}"  =3D[$'\177x']
"${del:0:1}${a#x}"  =3D[$'\177']
" ${del:0:1} ${a}"  =3D[$' \177 x']
"${del:0:1} ${a#d}" =3D[$'\177 x']
"${del:0:1} ${a#x}" =3D[\ ]







From MAILER-DAEMON Thu May 03 13:44:13 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQ04b-0003zj-Hc
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 13:44:13 -0400
Received: from eggs.gnu.org ([208.118.235.92]:45256)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQ04Y-0003zd-90
	for bug-bash@gnu.org; Thu, 03 May 2012 13:44:11 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQ04W-0005tf-8a
	for bug-bash@gnu.org; Thu, 03 May 2012 13:44:09 -0400
Received: from fmmailgate03.web.de ([217.72.192.234]:50405)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQ04V-0005rj-VI
	for bug-bash@gnu.org; Thu, 03 May 2012 13:44:08 -0400
Received: from moweb001.kundenserver.de (moweb001.kundenserver.de
	[172.19.20.114])
	by fmmailgate03.web.de (Postfix) with ESMTP id 84C831B422022
	for <bug-bash@gnu.org>; Thu,  3 May 2012 19:44:06 +0200 (CEST)
Received: from [192.168.178.49] ([77.13.116.115]) by smtp.web.de (mrweb001)
	with ESMTPA (Nemesis) id 0Lcxfc-1RhtoM0UoC-00iBT4;
	Thu, 03 May 2012 19:44:06 +0200
Message-ID: <4FA2C3E2.5050107@web.de>
Date: Thu, 03 May 2012 19:44:02 +0200
From: John Kearney <dethrophes@web.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:12.0) Gecko/20120428 Thunderbird/12.0.1
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Re: Fwd: Bash bug interpolating delete characters
References: <OFDE975207.0C3622E5-ONC12579F3.00361A06-C12579F3.00365E39@orga-systems.com>
	<4FA27D82.6010703@case.edu> <20120503130103.GD1622@eeg.ccf.org>
	<4FA2C34B.2050203@web.de>
In-Reply-To: <4FA2C34B.2050203@web.de>
Content-Type: text/plain; charset=ISO-8859-1
X-Provags-ID: V02:K0:nlpXl/tvVioSawqa5iESIcQqR+NpXhJ/Lmv66LIp5dz
	IkQQE+7p4OTryeb4PpAqoCiBQ9I3JG6X4nTRwnRJEEAOC3WeTB
	TUohdx3f2gToeYbNPIRfljjhF5E93jDrluyxd8DWPEV7z2p1TS
	cr8LQwyvqR+VYwOWXRLqRbmT15LXc/B9htHNStTUwk3nIgYIRe
	Px4MLdcteM2R5MthEsqyg==
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-Received-From: 217.72.192.234
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, 03 May 2012 17:44:11 -0000

Am 03.05.2012 19:41, schrieb John Kearney:
> Am 03.05.2012 15:01, schrieb Greg Wooledge:
>>> Yours, R=FCdiger.
>>> a=3Dx
>>> del=3D"$(echo -e "\\x7f")"
>>>
>>> echo "$del${a#x}" | od -ta
>>> echo "$del ${a#x}" | od -ta
>>> echo " $del${a#x}" | od -ta
>> Yup, confirmed that it breaks here, and only when the # parameter expa=
nsion
>> is included.
>>
>> imadev:~$ del=3D$'\x7f' a=3Dx b=3D
>> imadev:~$ echo " $del$b" | od -ta
>> 0000000   sp del  nl
>> 0000003
>> imadev:~$ echo " $del${b}" | od -ta
>> 0000000   sp del  nl
>> 0000003
>> imadev:~$ echo " $del${b#x}" | od -ta
>> 0000000   sp del  nl
>> 0000003
>> imadev:~$ echo " $del${a#x}" | od -ta
>> 0000000   sp  nl
>> 0000002
>>
>> Bash 4.2.24.
>>
> Also Confirmed, but my output is a bit wackier.
> printf %q seems to get confused, and do invalid things as well.
>
> the \x7f becomes a \
disregard the comment about printf its just escaping the space.
>
> function printTests {
>     while [ $# -gt 0 ]; do
>         printf    "%-20s=3D[%q]\n"    "${1}" "$(eval echo "${1}")"
>         shift
>     done
> }
>
> a=3Dx
> del=3D$'\x7f'
> printTests '"$del${a#x}"' '"$del ${a#x}"' '" $del${a#x}"' '" $del${a%x}=
"'
> printTests '" $del${a:0:0}"' '" $del"${a:0:0}' '" $del""${a:0:0}"'
> printTests '" $del${a}"' '" $del"' '" ${del}${a:0:0}"' '"
> ${del:0:1}${a:0:0}"'
> printTests '" ${del:0:1}${a}"' '"${del:0:1}${a#d}"' '"${del:0:1}${a#x}"=
'
> printTests '" ${del:0:1} ${a}"' '"${del:0:1} ${a#d}"' '"${del:0:1} ${a#=
x}"'
>
> output
> "$del${a#x}"        =3D[$'\177']
> "$del ${a#x}"       =3D[\ ]
> " $del${a#x}"       =3D[\ ]
> " $del${a%x}"       =3D[\ ]
> " $del${a:0:0}"     =3D[\ ]
> " $del"${a:0:0}     =3D[$' \177']
> " $del""${a:0:0}"   =3D[$' \177']
> " $del${a}"         =3D[$' \177x']
> " $del"             =3D[$' \177']
> " ${del}${a:0:0}"   =3D[\ ]
> " ${del:0:1}${a:0:0}"=3D[\ ]
> " ${del:0:1}${a}"   =3D[$' \177x']
> "${del:0:1}${a#d}"  =3D[$'\177x']
> "${del:0:1}${a#x}"  =3D[$'\177']
> " ${del:0:1} ${a}"  =3D[$' \177 x']
> "${del:0:1} ${a#d}" =3D[$'\177 x']
> "${del:0:1} ${a#x}" =3D[\ ]
>
>
>
>
>
>



From MAILER-DAEMON Thu May 03 14:24:22 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQ0hS-0001zI-94
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 14:24:22 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46812)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chris@cfajohnson.com>) id 1SQ0hP-0001xZ-1k
	for bug-bash@gnu.org; Thu, 03 May 2012 14:24:20 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chris@cfajohnson.com>) id 1SQ0hM-0005Cn-Vu
	for bug-bash@gnu.org; Thu, 03 May 2012 14:24:18 -0400
Received: from ironport-out.teksavvy.com ([206.248.143.162]:5359)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chris@cfajohnson.com>) id 1SQ0hM-00052a-RV
	for bug-bash@gnu.org; Thu, 03 May 2012 14:24:16 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Av0EACxOgk9Ld/Dq/2dsb2JhbABDuTKBCIIJAQEEATgCHCMFCwsYLiEYHgYTG4dlAwYFtDoNgWuKLYYtBJZ9iiiDIIFdgwM
X-IronPort-AV: E=Sophos;i="4.75,391,1330923600"; d="scan'208";a="178215457"
Received: from 75-119-240-234.dsl.teksavvy.com (HELO linux-2.local)
	([75.119.240.234])
	by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA;
	03 May 2012 14:24:12 -0400
Date: Thu, 3 May 2012 14:21:42 -0400 (EDT)
From: "Chris F.A. Johnson" <chris@cfajohnson.com>
To: DJ Mills <danielmills1@gmail.com>
Subject: Re: ((i++)) no longer supported?
In-Reply-To: <CAPg6Z09vVhyva6b=wruQMrTeagjiBYv9kRboQod4pRpLGL0qRw@mail.gmail.com>
Message-ID: <alpine.LMD.2.00.1205031421200.15129@localhost.localdomain>
References: <CALX7UOjVv5e1aH9wg6M33KNHZ+J3oZpLaCn-2FqsHmf4+Y7O=A@mail.gmail.com>
	<CAPSX3sQq4vTWXaqdnjVMJWK+3+yOfzrc+MMuzQcvOWySone_Pw@mail.gmail.com>
	<CAPg6Z09vVhyva6b=wruQMrTeagjiBYv9kRboQod4pRpLGL0qRw@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.143.162
Cc: Pierre Gaston <pierre.gaston@gmail.com>, Pan ruochen <panruochen@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: Thu, 03 May 2012 18:24:20 -0000

On Thu, 3 May 2012, DJ Mills wrote:

> On Thu, May 3, 2012 at 2:53 AM, Pierre Gaston <pierre.gaston@gmail.com> wrote:
>> On Thu, May 3, 2012 at 9:34 AM, Pan ruochen <panruochen@gmail.com> wrote:
>>> Hi All,
>>>
>>> Suddenly I found that ((i++)) is not supported on bash.
>>> Just try the following simple case:
>>> $i=0; ((i++)); echo $?
>>> And the result is
>>> 1
>>> which means an error.
>>> I got the same result on GNU bash, version 4.1.2(1)-release
>>> (x86_64-redhat-linux-gnu) and GNU bash, version 4.1.10(4)-release
>>> (i686-pc-cygwin).
>>>
>>> - BR, Ruochen
>>>
>>
>> It has always been the case, and fits the documentation since i++
>> value is 0 and that is false in the arithmetic context.
>>
>> What changed is that it bash exits in this case if you use set -e.
>> Some Possible workarounds:
>> ((i++)) || :
>> ((i+=1))
>> i=$((i+1))
>> and a gazillon others.
>>
>
> The most sane workaround would probably be to stop using set -e.

    Better still, use the POSIX standard method shown above: i=$((i+1))

-- 
    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 Thu May 03 14:50:04 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQ16K-0005gF-Cg
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 14:50:04 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41113)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <colin.mcewan@gmail.com>) id 1SQ16H-0005f3-Qy
	for bug-bash@gnu.org; Thu, 03 May 2012 14:50:03 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <colin.mcewan@gmail.com>) id 1SQ16G-0006xn-09
	for bug-bash@gnu.org; Thu, 03 May 2012 14:50:01 -0400
Received: from mail-gh0-f169.google.com ([209.85.160.169]:44413
	helo=mail-gy0-f169.google.com) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <colin.mcewan@gmail.com>) id 1SQ16F-0006xi-Od
	for bug-bash@gnu.org; Thu, 03 May 2012 14:49:59 -0400
Received: by ghrr18 with SMTP id r18so2591458ghr.0
	for <bug-bash@gnu.org>; Thu, 03 May 2012 11:49:58 -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=H3AHHjjXKpPicCa+We9A5ToEUWdmL76dlvnUtj55AIE=;
	b=mnH1tyl3dM6DMQoW6Tm5F8LEVYPJdhiWClqUr15hN1Ijto2ivO1Mqvp7/7ydoaP17L
	giW/RrCathPX09EayUJt0FDMMddTQQt8QYs1C81R2zkSULVa7QvJT7Vgw/MKCltS82J5
	khDOtpgvR77ymdToNiV3CE7hWvCwtFtKlJVjfUSWWrYAH+OB7EClsGCbSGfyU04oTNJX
	K31wesIiEiNhujf2fqIOtBY7ctNIPFbTHjzEZaDfh2JF5oGmbCOl+1U9R/5+kbbHkFZV
	Fbl25Dv6mWkPqoCImCmVqGrxFJdo1MBFTwSDKgPreqyXlq6yjDV1cTIFbc6f//n/yvqI
	ZNtA==
Received: by 10.50.51.197 with SMTP id m5mr1376776igo.38.1336070997606; Thu,
	03 May 2012 11:49:57 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.231.236.11 with HTTP; Thu, 3 May 2012 11:49:37 -0700 (PDT)
From: Colin McEwan <colin.mcewan@gmail.com>
Date: Thu, 3 May 2012 19:49:37 +0100
Message-ID: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
Subject: Parallelism a la make -j <n> / GNU parallel
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
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, 03 May 2012 18:50:03 -0000

Hi there,

I don't know if this is anything that has ever been discussed or
considered, but would be interested in any thoughts.

I frequently find myself these days writing shell scripts, to run on
multi-core machines, which could easily exploit lots of parallelism (eg. a
batch of a hundred independent simulations).

The basic parallelism construct of '&' for async execution is highly
expressive, but it's not useful for this sort of use-case: starting up 100
jobs at once will leave them competing, and lead to excessive context
switching and paging.

So for practical purposes, I find myself reaching for 'make -j<n>' or GNU
parallel, both of which destroy the expressiveness of the shell script as I
have to redirect commands and parameters to Makefiles or stdout, and
wrestle with appropriate levels of quoting.

What I would really *like* would be an extension to the shell which
implements the same sort of parallelism-limiting / 'process pooling' found
in make or 'parallel' via an operator in the shell language, similar to '&'
which has semantics of *possibly* continuing asynchronously (like '&') if
system resources allow, or waiting for the process to complete (';').

Any thoughts, anyone?

Thanks!

-- 
C.

https://plus.google.com/109211294311109803299
https://www.facebook.com/mcewanca

From MAILER-DAEMON Thu May 03 15:21:38 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQ1as-0001fR-7C
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 15:21:38 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57723)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <elliott.forney@gmail.com>) id 1SQ1ao-0001ey-Gq
	for bug-bash@gnu.org; Thu, 03 May 2012 15:21:37 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <elliott.forney@gmail.com>) id 1SQ1ah-0002E0-Sq
	for bug-bash@gnu.org; Thu, 03 May 2012 15:21:34 -0400
Received: from mail-bk0-f41.google.com ([209.85.214.41]:55351)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <elliott.forney@gmail.com>) id 1SQ1ah-0002Dt-Ix
	for bug-bash@gnu.org; Thu, 03 May 2012 15:21:27 -0400
Received: by bkcjm19 with SMTP id jm19so2117017bkc.0
	for <bug-bash@gnu.org>; Thu, 03 May 2012 12:21:25 -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=YqkujbIfOYyjtFlzV3AB4GNTz7FdJBWXfZSp3PSGkkQ=;
	b=Wdl7EFWccQISS6GubqAwgBsAEM17GMjpUamedkQewYxej8YtQKse3DkJbtB7KTEGrM
	6LlMcdcsCn8fhtWKvINFLJT4hxNstr6QVGJptoP4R2m6wgsojFDNjqGdEHjvCHpKbK3N
	Dkq8xJOM10SAdIYYzPM2By5bgkEualFnUUnItHRQDrnogWyEB4t/+TOLNER0sURwwZAG
	YchU2PzUwkJ+MqyYHIquLQB2gjAj87Av8EPaRB8ztiLLTHJgYj45OAunKFHrV8RZsdTE
	Mk5TQ+vEfHanB0gooagwiPKV9Q1h/1S+rceRKJrWr2TtzfFV79VL+V/Zddq0MHst+9pJ
	pFKA==
MIME-Version: 1.0
Received: by 10.204.133.220 with SMTP id g28mr1158328bkt.54.1336072884979;
	Thu, 03 May 2012 12:21:24 -0700 (PDT)
Received: by 10.205.64.70 with HTTP; Thu, 3 May 2012 12:21:24 -0700 (PDT)
In-Reply-To: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
Date: Thu, 3 May 2012 13:21:24 -0600
Message-ID: <CAMTFtYLo-sVb5XnfiyzsgxYgEQtaj5M-6jH9719vdhMKD79fRQ@mail.gmail.com>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
From: Elliott Forney <elliott.forney@gmail.com>
To: Colin McEwan <colin.mcewan@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.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, 03 May 2012 19:21:37 -0000

Here is a construct that I use sometimes... although you might wind up
waiting for the slowest job in each iteration of the loop:


maxiter=100
ncore=8

for iter in $(seq 1 $maxiter)
do
  startjob $iter &

  if (( (iter % $ncore) == 0 ))
  then
    wait
  fi
done


On Thu, May 3, 2012 at 12:49 PM, Colin McEwan <colin.mcewan@gmail.com> wrote:
> Hi there,
>
> I don't know if this is anything that has ever been discussed or
> considered, but would be interested in any thoughts.
>
> I frequently find myself these days writing shell scripts, to run on
> multi-core machines, which could easily exploit lots of parallelism (eg. a
> batch of a hundred independent simulations).
>
> The basic parallelism construct of '&' for async execution is highly
> expressive, but it's not useful for this sort of use-case: starting up 100
> jobs at once will leave them competing, and lead to excessive context
> switching and paging.
>
> So for practical purposes, I find myself reaching for 'make -j<n>' or GNU
> parallel, both of which destroy the expressiveness of the shell script as I
> have to redirect commands and parameters to Makefiles or stdout, and
> wrestle with appropriate levels of quoting.
>
> What I would really *like* would be an extension to the shell which
> implements the same sort of parallelism-limiting / 'process pooling' found
> in make or 'parallel' via an operator in the shell language, similar to '&'
> which has semantics of *possibly* continuing asynchronously (like '&') if
> system resources allow, or waiting for the process to complete (';').
>
> Any thoughts, anyone?
>
> Thanks!
>
> --
> C.
>
> https://plus.google.com/109211294311109803299
> https://www.facebook.com/mcewanca


From MAILER-DAEMON Thu May 03 15:46:12 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQ1ye-0005mL-Gt
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 15:46:12 -0400
Received: from eggs.gnu.org ([208.118.235.92]:34372)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <colin.mcewan@gmail.com>) id 1SQ1yb-0005mA-TU
	for bug-bash@gnu.org; Thu, 03 May 2012 15:46:11 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <colin.mcewan@gmail.com>) id 1SQ1ya-0006ht-1b
	for bug-bash@gnu.org; Thu, 03 May 2012 15:46:09 -0400
Received: from mail-wi0-f171.google.com ([209.85.212.171]:53737)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <colin.mcewan@gmail.com>) id 1SQ1yZ-0006hW-Ow
	for bug-bash@gnu.org; Thu, 03 May 2012 15:46:07 -0400
Received: by wibhj13 with SMTP id hj13so538082wib.12
	for <bug-bash@gnu.org>; Thu, 03 May 2012 12:46:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=references:in-reply-to:mime-version:content-transfer-encoding
	:content-type:message-id:cc:x-mailer:from:subject:date:to;
	bh=yAMQJSfq/XsvPZXayXIzU6DlBiatIxF0F4Za6Y3j+KQ=;
	b=XfAkwZaO4l5EvqV9IWgSQCBm6frcUqVMV5ShJLLS3p3VVFEPqerkQXkoC/FZq3GOP3
	X7Uvj4pj0lZdoT8LtB4yLfwtGo9XfzrJCcIXKqxmyX2vLp/rJWKzxTFvXMYvQHXYcXq4
	I+W6oVh/rPQuo0zswWP3g4LhPWkKxCRNIb5SLk04yxaPNCD2wr7Zo1VbEaCxXc69Yt4E
	gs//1XeZGvG5LtmgcWZ86OHn/7juoHa+03dkEvCwCKDPf1PKyGn+7lDOwGfQGt4mpM2G
	wOUeOUK1+drGipC51Wt7eEa8AMm7YA/CkZPLwQdurgKJAHWvnMB3CCqObQPq+Pfm5QZm
	pELA==
Received: by 10.180.101.136 with SMTP id fg8mr6292363wib.4.1336074365642;
	Thu, 03 May 2012 12:46:05 -0700 (PDT)
Received: from [192.168.0.5]
	(cpc1-sgyl6-0-0-cust859.18-2.cable.virginmedia.com. [82.41.43.92])
	by mx.google.com with ESMTPS id fn2sm6433502wib.0.2012.05.03.12.45.59
	(version=TLSv1/SSLv3 cipher=OTHER);
	Thu, 03 May 2012 12:46:04 -0700 (PDT)
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<CAMTFtYLo-sVb5XnfiyzsgxYgEQtaj5M-6jH9719vdhMKD79fRQ@mail.gmail.com>
In-Reply-To: <CAMTFtYLo-sVb5XnfiyzsgxYgEQtaj5M-6jH9719vdhMKD79fRQ@mail.gmail.com>
Mime-Version: 1.0 (1.0)
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii
Message-Id: <54168ACE-B1D0-4B6B-B0E2-61EBEBA05849@gmail.com>
X-Mailer: iPhone Mail (9B176)
From: Colin McEwan <colin.mcewan@gmail.com>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
Date: Thu, 3 May 2012 20:45:57 +0100
To: Elliott Forney <elliott.forney@gmail.com>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.212.171
Cc: "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: Thu, 03 May 2012 19:46:11 -0000

Indeed, I've used variations of most of these in the past. :)

My contention is that this is the sort of thing that more people will want t=
o do more frequently, and that this is a reasonable argument in favour of in=
cluding the functionality *correctly* in the core language for maximum expre=
ssiveness without external dependencies.

I just don't know if that fits with the maintenance/extension philosophy app=
lied to bash ;)

--=20
iC.

On 3 May 2012, at 20:21, Elliott Forney <elliott.forney@gmail.com> wrote:

> Here is a construct that I use sometimes... although you might wind up
> waiting for the slowest job in each iteration of the loop:
>=20
>=20
> maxiter=3D100
> ncore=3D8
>=20
> for iter in $(seq 1 $maxiter)
> do
>  startjob $iter &
>=20
>  if (( (iter % $ncore) =3D=3D 0 ))
>  then
>    wait
>  fi
> done
>=20
>=20
> On Thu, May 3, 2012 at 12:49 PM, Colin McEwan <colin.mcewan@gmail.com> wro=
te:
>> Hi there,
>>=20
>> I don't know if this is anything that has ever been discussed or
>> considered, but would be interested in any thoughts.
>>=20
>> I frequently find myself these days writing shell scripts, to run on
>> multi-core machines, which could easily exploit lots of parallelism (eg. a=

>> batch of a hundred independent simulations).
>>=20
>> The basic parallelism construct of '&' for async execution is highly
>> expressive, but it's not useful for this sort of use-case: starting up 10=
0
>> jobs at once will leave them competing, and lead to excessive context
>> switching and paging.
>>=20
>> So for practical purposes, I find myself reaching for 'make -j<n>' or GNU=

>> parallel, both of which destroy the expressiveness of the shell script as=
 I
>> have to redirect commands and parameters to Makefiles or stdout, and
>> wrestle with appropriate levels of quoting.
>>=20
>> What I would really *like* would be an extension to the shell which
>> implements the same sort of parallelism-limiting / 'process pooling' foun=
d
>> in make or 'parallel' via an operator in the shell language, similar to '=
&'
>> which has semantics of *possibly* continuing asynchronously (like '&') if=

>> system resources allow, or waiting for the process to complete (';').
>>=20
>> Any thoughts, anyone?
>>=20
>> Thanks!
>>=20
>> --
>> C.
>>=20
>> https://plus.google.com/109211294311109803299
>> https://www.facebook.com/mcewanca


From MAILER-DAEMON Thu May 03 16:01:31 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQ2DT-0001Kb-J7
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 16:01:31 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33722)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SQ2DQ-0001K2-NX
	for bug-bash@gnu.org; Thu, 03 May 2012 16:01:29 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SQ2DO-0005QW-N5
	for bug-bash@gnu.org; Thu, 03 May 2012 16:01:28 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:49585
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SQ2DO-0005PM-GS
	for bug-bash@gnu.org; Thu, 03 May 2012 16:01:26 -0400
Received: (qmail 15909 invoked from network); 3 May 2012 20:01:21 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Thu, 03 May 2012 16:01:21 -0400
Received: (qmail 3464 invoked by uid 563); 3 May 2012 20:01:20 -0000
Date: Thu, 3 May 2012 16:01:20 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Colin McEwan <colin.mcewan@gmail.com>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
Message-ID: <20120503200120.GG1622@eeg.ccf.org>
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<CAMTFtYLo-sVb5XnfiyzsgxYgEQtaj5M-6jH9719vdhMKD79fRQ@mail.gmail.com>
	<54168ACE-B1D0-4B6B-B0E2-61EBEBA05849@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <54168ACE-B1D0-4B6B-B0E2-61EBEBA05849@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" <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, 03 May 2012 20:01:30 -0000

On Thu, May 03, 2012 at 08:45:57PM +0100, Colin McEwan wrote:
> My contention is that this is the sort of thing that more people will want to
> do more frequently, and that this is a reasonable argument in favour of
> including the functionality *correctly* in the core language for maximum
> expressiveness without external dependencies.

It seems like a rather complex and esoteric feature to be adding to a
shell, but that's ultimately Chet's decision to make, not ours.


From MAILER-DAEMON Thu May 03 16:12:28 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQ2O4-0004BY-Lk
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 16:12:28 -0400
Received: from eggs.gnu.org ([208.118.235.92]:40465)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQ2O2-0004B3-8z
	for bug-bash@gnu.org; Thu, 03 May 2012 16:12:27 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQ2Nz-00027w-OH
	for bug-bash@gnu.org; Thu, 03 May 2012 16:12:25 -0400
Received: from fmmailgate01.web.de ([217.72.192.221]:51525)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQ2Nz-00027M-Dj
	for bug-bash@gnu.org; Thu, 03 May 2012 16:12:23 -0400
Received: from moweb001.kundenserver.de (moweb001.kundenserver.de
	[172.19.20.114])
	by fmmailgate01.web.de (Postfix) with ESMTP id BB5331AD6CCAE
	for <bug-bash@gnu.org>; Thu,  3 May 2012 22:12:21 +0200 (CEST)
Received: from [192.168.178.49] ([77.13.116.115]) by smtp.web.de (mrweb001)
	with ESMTPA (Nemesis) id 0MMnD5-1SXTyc2TmR-008XCp;
	Thu, 03 May 2012 22:12:21 +0200
Message-ID: <4FA2E6A1.7090605@web.de>
Date: Thu, 03 May 2012 22:12:17 +0200
From: John Kearney <dethrophes@web.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:12.0) Gecko/20120428 Thunderbird/12.0.1
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<CAMTFtYLo-sVb5XnfiyzsgxYgEQtaj5M-6jH9719vdhMKD79fRQ@mail.gmail.com>
In-Reply-To: <CAMTFtYLo-sVb5XnfiyzsgxYgEQtaj5M-6jH9719vdhMKD79fRQ@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Provags-ID: V02:K0:khF2iLrurtLQvZZ1/dKwaUTO9rC0mLtOsAG9lp+qOrM
	1zVird0FyrIYPoAXNanFOs8V29/KPjZkpbWzKH4fh+kX8T9ixm
	olOQSXfLrsj5Px1xmyuwZ3UUFCqYBJCS8geT9Ak4hWODUvG6Eh
	XW5w9O6g6EtUa4qiJ0N3iv2B0ZYBUxNhsGTHDWtub4RtAu+4ho
	4/p3tF3iAXtWOAXcn57lA==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-Received-From: 217.72.192.221
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, 03 May 2012 20:12:27 -0000

I tend to do something more like this


    function runJobParrell {
        local mjobCnt=${1} && shift
        jcnt=0
        function WrapJob {
            "${@}"
            kill -s USR2 $$
        }
        function JobFinised {
            jcnt=$((${jcnt}-1))
        }
        trap JobFinised USR2
        while [ $# -gt 0 ] ; do
            while [ ${jcnt} -lt ${mjobCnt} ]; do
                jcnt=$((${jcnt}+1))
                echo WrapJob "${1}" "${2}"
                WrapJob "${1}" "${2}" &
                shift 2
        done
        sleep 1
        done
    }
    function testProcess {
        echo "${*}"
        sleep 1
    }
    runJobParrell 2  testProcess "jiji#" testProcess "jiji#" testProcess
"jiji#"

    tends to work well enough.
it gets a bit more complex if you want to recover output but not too much.

Am 03.05.2012 21:21, schrieb Elliott Forney:
> Here is a construct that I use sometimes... although you might wind up
> waiting for the slowest job in each iteration of the loop:
>
>
> maxiter=100
> ncore=8
>
> for iter in $(seq 1 $maxiter)
> do
>   startjob $iter &
>
>   if (( (iter % $ncore) == 0 ))
>   then
>     wait
>   fi
> done
>
>
> On Thu, May 3, 2012 at 12:49 PM, Colin McEwan <colin.mcewan@gmail.com> wrote:
>> Hi there,
>>
>> I don't know if this is anything that has ever been discussed or
>> considered, but would be interested in any thoughts.
>>
>> I frequently find myself these days writing shell scripts, to run on
>> multi-core machines, which could easily exploit lots of parallelism (eg. a
>> batch of a hundred independent simulations).
>>
>> The basic parallelism construct of '&' for async execution is highly
>> expressive, but it's not useful for this sort of use-case: starting up 100
>> jobs at once will leave them competing, and lead to excessive context
>> switching and paging.
>>
>> So for practical purposes, I find myself reaching for 'make -j<n>' or GNU
>> parallel, both of which destroy the expressiveness of the shell script as I
>> have to redirect commands and parameters to Makefiles or stdout, and
>> wrestle with appropriate levels of quoting.
>>
>> What I would really *like* would be an extension to the shell which
>> implements the same sort of parallelism-limiting / 'process pooling' found
>> in make or 'parallel' via an operator in the shell language, similar to '&'
>> which has semantics of *possibly* continuing asynchronously (like '&') if
>> system resources allow, or waiting for the process to complete (';').
>>
>> Any thoughts, anyone?
>>
>> Thanks!
>>
>> --
>> C.
>>
>> https://plus.google.com/109211294311109803299
>> https://www.facebook.com/mcewanca



From MAILER-DAEMON Thu May 03 16:31:09 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQ2g9-0008DW-Se
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 16:31:09 -0400
Received: from eggs.gnu.org ([208.118.235.92]:36849)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SQ2g5-0007xD-3E
	for bug-bash@gnu.org; Thu, 03 May 2012 16:31:06 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SQ2g3-0003EI-EQ
	for bug-bash@gnu.org; Thu, 03 May 2012 16:31:04 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:49595
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SQ2g2-0003DJ-Uv
	for bug-bash@gnu.org; Thu, 03 May 2012 16:31:03 -0400
Received: (qmail 16169 invoked from network); 3 May 2012 20:30:57 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Thu, 03 May 2012 16:30:57 -0400
Received: (qmail 3525 invoked by uid 563); 3 May 2012 20:30:57 -0000
Date: Thu, 3 May 2012 16:30:57 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: John Kearney <dethrophes@web.de>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
Message-ID: <20120503203057.GH1622@eeg.ccf.org>
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<CAMTFtYLo-sVb5XnfiyzsgxYgEQtaj5M-6jH9719vdhMKD79fRQ@mail.gmail.com>
	<4FA2E6A1.7090605@web.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4FA2E6A1.7090605@web.de>
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, 03 May 2012 20:31:06 -0000

On Thu, May 03, 2012 at 10:12:17PM +0200, John Kearney wrote:
>     function runJobParrell {
>         local mjobCnt=${1} && shift
>         jcnt=0
>         function WrapJob {
>             "${@}"
>             kill -s USR2 $$
>         }
>         function JobFinised {
>             jcnt=$((${jcnt}-1))
>         }
>         trap JobFinised USR2
>         while [ $# -gt 0 ] ; do
>             while [ ${jcnt} -lt ${mjobCnt} ]; do
>                 jcnt=$((${jcnt}+1))
>                 echo WrapJob "${1}" "${2}"
>                 WrapJob "${1}" "${2}" &
>                 shift 2
>         done
>         sleep 1
>         done
>     }
>     function testProcess {
>         echo "${*}"
>         sleep 1
>     }
>     runJobParrell 2  testProcess "jiji#" testProcess "jiji#" testProcess
> "jiji#"
> 
>     tends to work well enough.
> it gets a bit more complex if you want to recover output but not too much.

The real issue here is that there is no generalizable way to store an
arbitrary command for later execution.  Your example assumes that each
pair of arguments constitutes one simple command, which is fine if that's
all you need it to do.  But the next guy asking for this will want to
schedule arbitrarily complex shell pipelines and complex commands with
here documents and brace expansions and ....


From MAILER-DAEMON Thu May 03 17:23:21 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQ3Uf-0001oF-Mf
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 17:23:21 -0400
Received: from eggs.gnu.org ([208.118.235.92]:59671)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQ3Ud-0001o6-EV
	for bug-bash@gnu.org; Thu, 03 May 2012 17:23:20 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQ3Ub-00084J-KT
	for bug-bash@gnu.org; Thu, 03 May 2012 17:23:19 -0400
Received: from fmmailgate01.web.de ([217.72.192.221]:43867)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQ3Ub-000845-AB
	for bug-bash@gnu.org; Thu, 03 May 2012 17:23:17 -0400
Received: from moweb002.kundenserver.de (moweb002.kundenserver.de
	[172.19.20.108])
	by fmmailgate01.web.de (Postfix) with ESMTP id A44551AD711B0
	for <bug-bash@gnu.org>; Thu,  3 May 2012 23:23:15 +0200 (CEST)
Received: from [192.168.178.49] ([77.13.116.115]) by smtp.web.de (mrweb001)
	with ESMTPA (Nemesis) id 0MEEMy-1SNoS31u9o-00FRmR;
	Thu, 03 May 2012 23:23:15 +0200
Message-ID: <4FA2F73F.7020003@web.de>
Date: Thu, 03 May 2012 23:23:11 +0200
From: John Kearney <dethrophes@web.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:12.0) Gecko/20120428 Thunderbird/12.0.1
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<CAMTFtYLo-sVb5XnfiyzsgxYgEQtaj5M-6jH9719vdhMKD79fRQ@mail.gmail.com>
	<4FA2E6A1.7090605@web.de> <20120503203057.GH1622@eeg.ccf.org>
In-Reply-To: <20120503203057.GH1622@eeg.ccf.org>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Provags-ID: V02:K0:hJrOj0R1s1KcoFlYjUZFawOaEGzeZeDYGXyAKfluy61
	Rn1NBTQbUm90Yierw/kG3FYB8NOhrnsseUN/xC+pP3Hcrt1t4C
	zELQ/UYQTFkYZtmPA7OjMpY8LWqgGpaUYz6CECNbG+i5V67gi0
	rogCBxQ23XWouEDdTlBpxiQFthRymfTOr2e4/I5v8U4Qd/zJFY
	1Ntf573jLuPK+HKXN0ecg==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-Received-From: 217.72.192.221
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, 03 May 2012 21:23:21 -0000

Am 03.05.2012 22:30, schrieb Greg Wooledge:
> On Thu, May 03, 2012 at 10:12:17PM +0200, John Kearney wrote:
>>     function runJobParrell {
>>         local mjobCnt=${1} && shift
>>         jcnt=0
>>         function WrapJob {
>>             "${@}"
>>             kill -s USR2 $$
>>         }
>>         function JobFinised {
>>             jcnt=$((${jcnt}-1))
>>         }
>>         trap JobFinised USR2
>>         while [ $# -gt 0 ] ; do
>>             while [ ${jcnt} -lt ${mjobCnt} ]; do
>>                 jcnt=$((${jcnt}+1))
>>                 echo WrapJob "${1}" "${2}"
>>                 WrapJob "${1}" "${2}" &
>>                 shift 2
>>         done
>>         sleep 1
>>         done
>>     }
>>     function testProcess {
>>         echo "${*}"
>>         sleep 1
>>     }
>>     runJobParrell 2  testProcess "jiji#" testProcess "jiji#" testProcess
>> "jiji#"
>>
>>     tends to work well enough.
>> it gets a bit more complex if you want to recover output but not too much.
> The real issue here is that there is no generalizable way to store an
> arbitrary command for later execution.  Your example assumes that each
> pair of arguments constitutes one simple command, which is fine if that's
> all you need it to do.  But the next guy asking for this will want to
> schedule arbitrarily complex shell pipelines and complex commands with
> here documents and brace expansions and ....
>


:)
A more complex/flexible example. More like what I actually use.




  CNiceLevel=$(nice)
    declare -a JobArray
    function PushAdvancedCmd {
        local IFS=$'\v'
        JobArray+=("${*}")
    }
    function PushSimpleCmd {
        PushAdvancedCmd  WrapJob ${CNiceLevel} "${@}"
    }
    function PushNiceCmd {
        PushAdvancedCmd  WrapJob "${@}"
    }
    function UnpackCmd {
        local IFS=$'\v'
        set -o noglob
        _RETURN=( .${1}. )  
        set +o noglob
        _RETURN[0]="${_RETURN[0]#.}"
        local -i le=${#_RETURN[@]}-1
        _RETURN[${le}]="${_RETURN[${le}]%.}"
    }
    function runJobParrell {
        local mjobCnt=${1} && shift
        jcnt=0
        function WrapJob {
            [ ${1} -le ${CNiceLevel} ] || renice -n ${1}
            local Buffer=$("${@:2}")
            echo "${Buffer}"
            kill -s USR2 $$
        }
        function JobFinised {
            jcnt=$((${jcnt}-1))
        }
        trap JobFinised USR2
        while [ $# -gt 0 ] ; do
            while [ ${jcnt} -lt ${mjobCnt} ]; do
                jcnt=$((${jcnt}+1))
                UnpackCmd "${1}"
                "${_RETURN[@]}" &
                shift
        done
        sleep 1
        done
    }



    function testProcess {
        echo "${*}"
        sleep 1
    }
    #  So standard variable args can be handled in 2 ways 1
    #  encode them as such
    PushSimpleCmd testProcess "jiji#" dfds dfds dsfsd
    PushSimpleCmd testProcess "jiji#" dfds dfds
    PushNiceCmd 20 testProcess "jiji#" dfds
    PushSimpleCmd testProcess "jiji#"
    PushSimpleCmd testProcess "jiji#" "*" s
    # more complex things just wrap them in a function and call it
    function DoComplexMagicStuff1 {
        echo "${@}" >&2
    }
    # Or more normally just do a hybrid of both.
    PushSimpleCmd DoComplexMagicStuff1 "jiji#"

    #
   
    runJobParrell 1 "${JobArray[@]}"



Note there is another level of complexity where I start a JobQueue
Process and issues it commands using a fifo.




From MAILER-DAEMON Thu May 03 17:59:44 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQ43s-0004FE-M6
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 17:59:44 -0400
Received: from eggs.gnu.org ([208.118.235.92]:39336)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQ43q-0004Et-27
	for bug-bash@gnu.org; Thu, 03 May 2012 17:59:43 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQ43o-0005ub-53
	for bug-bash@gnu.org; Thu, 03 May 2012 17:59:41 -0400
Received: from fmmailgate01.web.de ([217.72.192.221]:49878)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQ43n-0005uU-Qn
	for bug-bash@gnu.org; Thu, 03 May 2012 17:59:40 -0400
Received: from moweb002.kundenserver.de (moweb002.kundenserver.de
	[172.19.20.108])
	by fmmailgate01.web.de (Postfix) with ESMTP id EB13F1AD732B0
	for <bug-bash@gnu.org>; Thu,  3 May 2012 23:59:37 +0200 (CEST)
Received: from [192.168.178.49] ([77.13.116.115]) by smtp.web.de (mrweb002)
	with ESMTPA (Nemesis) id 0LhNWS-1RmHH72gbY-00ma1n;
	Thu, 03 May 2012 23:59:37 +0200
Message-ID: <4FA2FFC6.30906@web.de>
Date: Thu, 03 May 2012 23:59:34 +0200
From: John Kearney <dethrophes@web.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:12.0) Gecko/20120428 Thunderbird/12.0.1
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<CAMTFtYLo-sVb5XnfiyzsgxYgEQtaj5M-6jH9719vdhMKD79fRQ@mail.gmail.com>
	<4FA2E6A1.7090605@web.de> <20120503203057.GH1622@eeg.ccf.org>
	<4FA2F73F.7020003@web.de>
In-Reply-To: <4FA2F73F.7020003@web.de>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Provags-ID: V02:K0:iFbukD9l5bYPlbUig5GyBMTMtT0i39iGFMGINjMkA25
	Kq5C4qMPP6m9cLv8lxkXhuKY0JKml+uk7GV9nj0woEW/hzElWt
	PPOgw1QIFz6hguTrghINLebV64y1RlctfLYhlpBRVl5oV4qJiK
	CIiO/Re+RaOabwce9XmZMRDcXV8i9L7XXF/HUyYly2N1XDaPom
	URlLziiCl24oeBxabDnEQ==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-Received-From: 217.72.192.221
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, 03 May 2012 21:59:43 -0000

This version might be easier to follow. The last version was more for
being able to issue commands via a fifo to a job queue server.

  function check_valid_var_name {
    case "${1:?Missing Variable Name}" in
      [!a-zA-Z_]* | *[!a-zA-Z_0-9]* ) return 3;;
    esac
  }


  CNiceLevel=$(nice)
    declare -a JobArray
    function PushAdvancedCmd {
        local le="tmp_array${#JobArray[@]}"
        JobArray+=("${le}")
        eval "${le}"'=("${@}")'
    }
    function PushSimpleCmd {
        PushAdvancedCmd  WrapJob ${CNiceLevel} "${@}"
    }
    function PushNiceCmd {
        PushAdvancedCmd  WrapJob "${@}"
    }
    function UnpackCmd {
        check_valid_var_name ${1} || return $?
        eval _RETURN=('"${'"${1}"'[@]}"')
        unset "${1}[@]"
    }
    function runJobParrell {
        local mjobCnt=${1} && shift
        jcnt=0
        function WrapJob {
            [ ${1} -le ${CNiceLevel} ] || renice -n ${1}
            local Buffer=$("${@:2}")
            echo "${Buffer}"
            kill -s USR2 $$
        }
        function JobFinised {
            jcnt=$((${jcnt}-1))
        }
        trap JobFinised USR2
        while [ $# -gt 0 ] ; do
            while [ ${jcnt} -lt ${mjobCnt} ]; do
                jcnt=$((${jcnt}+1))
                if UnpackCmd "${1}" ; then
                    "${_RETURN[@]}" &
                else
                    continue
                fi
                shift
        done
        sleep 1
        done
    }





Am 03.05.2012 23:23, schrieb John Kearney:
> Am 03.05.2012 22:30, schrieb Greg Wooledge:
>> On Thu, May 03, 2012 at 10:12:17PM +0200, John Kearney wrote:
>>>     function runJobParrell {
>>>         local mjobCnt=${1} && shift
>>>         jcnt=0
>>>         function WrapJob {
>>>             "${@}"
>>>             kill -s USR2 $$
>>>         }
>>>         function JobFinised {
>>>             jcnt=$((${jcnt}-1))
>>>         }
>>>         trap JobFinised USR2
>>>         while [ $# -gt 0 ] ; do
>>>             while [ ${jcnt} -lt ${mjobCnt} ]; do
>>>                 jcnt=$((${jcnt}+1))
>>>                 echo WrapJob "${1}" "${2}"
>>>                 WrapJob "${1}" "${2}" &
>>>                 shift 2
>>>         done
>>>         sleep 1
>>>         done
>>>     }
>>>     function testProcess {
>>>         echo "${*}"
>>>         sleep 1
>>>     }
>>>     runJobParrell 2  testProcess "jiji#" testProcess "jiji#" testProcess
>>> "jiji#"
>>>
>>>     tends to work well enough.
>>> it gets a bit more complex if you want to recover output but not too much.
>> The real issue here is that there is no generalizable way to store an
>> arbitrary command for later execution.  Your example assumes that each
>> pair of arguments constitutes one simple command, which is fine if that's
>> all you need it to do.  But the next guy asking for this will want to
>> schedule arbitrarily complex shell pipelines and complex commands with
>> here documents and brace expansions and ....
>>
>
> :)
> A more complex/flexible example. More like what I actually use.
>
>
>
>
>   CNiceLevel=$(nice)
>     declare -a JobArray
>     function PushAdvancedCmd {
>         local IFS=$'\v'
>         JobArray+=("${*}")
>     }
>     function PushSimpleCmd {
>         PushAdvancedCmd  WrapJob ${CNiceLevel} "${@}"
>     }
>     function PushNiceCmd {
>         PushAdvancedCmd  WrapJob "${@}"
>     }
>     function UnpackCmd {
>         local IFS=$'\v'
>         set -o noglob
>         _RETURN=( .${1}. )  
>         set +o noglob
>         _RETURN[0]="${_RETURN[0]#.}"
>         local -i le=${#_RETURN[@]}-1
>         _RETURN[${le}]="${_RETURN[${le}]%.}"
>     }
>     function runJobParrell {
>         local mjobCnt=${1} && shift
>         jcnt=0
>         function WrapJob {
>             [ ${1} -le ${CNiceLevel} ] || renice -n ${1}
>             local Buffer=$("${@:2}")
>             echo "${Buffer}"
>             kill -s USR2 $$
>         }
>         function JobFinised {
>             jcnt=$((${jcnt}-1))
>         }
>         trap JobFinised USR2
>         while [ $# -gt 0 ] ; do
>             while [ ${jcnt} -lt ${mjobCnt} ]; do
>                 jcnt=$((${jcnt}+1))
>                 UnpackCmd "${1}"
>                 "${_RETURN[@]}" &
>                 shift
>         done
>         sleep 1
>         done
>     }
>
>
>
>     function testProcess {
>         echo "${*}"
>         sleep 1
>     }
>     #  So standard variable args can be handled in 2 ways 1
>     #  encode them as such
>     PushSimpleCmd testProcess "jiji#" dfds dfds dsfsd
>     PushSimpleCmd testProcess "jiji#" dfds dfds
>     PushNiceCmd 20 testProcess "jiji#" dfds
>     PushSimpleCmd testProcess "jiji#"
>     PushSimpleCmd testProcess "jiji#" "*" s
>     # more complex things just wrap them in a function and call it
>     function DoComplexMagicStuff1 {
>         echo "${@}" >&2
>     }
>     # Or more normally just do a hybrid of both.
>     PushSimpleCmd DoComplexMagicStuff1 "jiji#"
>
>     #
>    
>     runJobParrell 1 "${JobArray[@]}"
>
>
>
> Note there is another level of complexity where I start a JobQueue
> Process and issues it commands using a fifo.
>
>
>



From MAILER-DAEMON Thu May 03 18:00:17 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQ44P-0004Wz-TW
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 18:00:17 -0400
Received: from eggs.gnu.org ([208.118.235.92]:53186)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQ44N-0004WK-0T
	for bug-bash@gnu.org; Thu, 03 May 2012 18:00:16 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQ44L-0006Ns-8Z
	for bug-bash@gnu.org; Thu, 03 May 2012 18:00:14 -0400
Received: from smtp.gentoo.org ([140.211.166.183]:33297)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQ44L-0006Nk-2P
	for bug-bash@gnu.org; Thu, 03 May 2012 18:00:13 -0400
Received: from vapier.localnet (localhost [127.0.0.1])
	by smtp.gentoo.org (Postfix) with ESMTP id B1D001B4009
	for <bug-bash@gnu.org>; Thu,  3 May 2012 22:00:11 +0000 (UTC)
From: Mike Frysinger <vapier@gentoo.org>
Organization: wh0rd.org
To: bug-bash@gnu.org
Subject: Re: Parallelism a la make -j <n> / GNU parallel
Date: Thu, 3 May 2012 18:01:04 -0400
User-Agent: KMail/1.13.7 (Linux/3.3.4; KDE/4.6.5; x86_64; ; )
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<CAMTFtYLo-sVb5XnfiyzsgxYgEQtaj5M-6jH9719vdhMKD79fRQ@mail.gmail.com>
	<4FA2E6A1.7090605@web.de>
In-Reply-To: <4FA2E6A1.7090605@web.de>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart2029127.HH35jrrgnX";
	protocol="application/pgp-signature"; micalg=pgp-sha1
Content-Transfer-Encoding: 7bit
Message-Id: <201205031801.04978.vapier@gentoo.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 140.211.166.183
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, 03 May 2012 22:00:16 -0000

--nextPart2029127.HH35jrrgnX
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

On Thursday 03 May 2012 16:12:17 John Kearney wrote:
> I tend to do something more like this
>=20
>     function runJobParrell {
>         local mjobCnt=3D${1} && shift
>         jcnt=3D0
>         function WrapJob {
>             "${@}"
>             kill -s USR2 $$
>         }

neat trick.  all my parallel loops tend to have a fifo of depth N where i p=
ush=20
on pids and when it gets full, wait for the first one.  it works moderately=
=20
well, except for when a slow job in the pipe chokes and the parent doesn't=
=20
push anymore in until that clears.

>         function JobFinised {
>             jcnt=3D$((${jcnt}-1))

: $(( --jcnt ))

or a portable version:

: $(( jcnt -=3D 1 ))

>         while [ $# -gt 0 ] ; do
>             while [ ${jcnt} -lt ${mjobCnt} ]; do
>                 jcnt=3D$((${jcnt}+1))

same math suggestion as above
=2Dmike

--nextPart2029127.HH35jrrgnX
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

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

iQIcBAABAgAGBQJPowAgAAoJEEFjO5/oN/WBR5EQAOUkWBbe65jTORGnEumOr4yR
cwrbyboVv10TJmGd0MPvdOkagiywhl8lICle9qvzGmeCXaUQG47o3cEkf9PXZnvx
Mkmf8EmShJ74aQbvXz8etk/SZbPB83BIVTbFqBew6Z8rg8IEBnZfCHUPBetzd91+
1bhTrZ9bP4q76wWBRZ5W5cv8FhwrmaSW2cYxSHPX7o7/szn0snGPX81N8N4e9nme
Xa98LHjG/ZuaUcBYMchpZ8EpUejjvAxy7K7jA2/gcilqgMM6HBglDTHyvOZSzycP
lQQ2MRn14bpyVyu39urUsnaNo20yvMTJtIBVAnYRF80MHr9CNVNOHxUvrnAANYzW
Oq3DcbJHuuuhoEV8loN+JdhpvlUoXSUocJHfnxRCGvmqWdcsGgWj4MEBKau46UWp
hK2bv3H4GqMCoOL9H7ST0zqi3jO6itU4xfrsjPE99TV5ElgRCW+2VS2G7QiJny2e
OalLZ7V9DjccYV8dWCPUXKMNXQ/we4R4JTp/9E3dzLBjeRUE6LSkMznJee0+/Sgz
O8uR9fzFcyvcQiXGSOnEq4w2u21rZCK2daY2cY6IhyC6OHJHmtJgWcIJRVkebSRh
kQlfLpigeG6ZAd5+GKhY3OmHYbIp/g27wdSRMPeSYZ7ujleSikyKMsEVdOHxNo0G
Ag3o+WezIojOm82pxGyW
=Ou8X
-----END PGP SIGNATURE-----

--nextPart2029127.HH35jrrgnX--


From MAILER-DAEMON Thu May 03 22:02:37 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQ7qv-0005NY-TZ
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 22:02:37 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37537)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SQ7qs-0005Ka-Os
	for bug-bash@gnu.org; Thu, 03 May 2012 22:02:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SQ7qq-0007WM-AW
	for bug-bash@gnu.org; Thu, 03 May 2012 22:02:34 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:60542)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SQ7qq-0007WI-5h
	for bug-bash@gnu.org; Thu, 03 May 2012 22:02:32 -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 BKK51895;
	Thu, 3 May 2012 22:02:29 -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 AWV45131; Thu, 03 May 2012 22:02:29 -0400 (EDT)
Date: Thu, 3 May 2012 22:01:37 -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 25
Message-ID: <120504020137.AA98069.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: Fri, 04 May 2012 02:02:36 -0000

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

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

Bug-Reported-by:	Bill Gradwohl <bill@ycc.com>
Bug-Reference-ID:	<CAFyvKis-UfuOWr5THBRKh=vYHDoKEEgdW8hN1RviTuYQ00Lu5A@mail.gmail.com>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/help-bash/2012-03/msg00078.html

Bug-Description:

When used in a shell function, `declare -g -a array=(compound assignment)'
creates a local variable instead of a global one.

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/command.h	2010-08-02 19:36:51.000000000 -0400
--- command.h	2012-04-01 12:38:35.000000000 -0400
***************
*** 98,101 ****
--- 98,102 ----
  #define W_ASSIGNASSOC	0x400000	/* word looks like associative array assignment */
  #define W_ARRAYIND	0x800000	/* word is an array index being expanded */
+ #define W_ASSNGLOBAL	0x1000000	/* word is a global assignment to declare (declare/typeset -g) */
  
  /* Possible values for subshell_environment */
*** ../bash-4.2-patched/execute_cmd.c	2011-11-21 18:03:41.000000000 -0500
--- execute_cmd.c	2012-04-01 12:42:03.000000000 -0400
***************
*** 3581,3585 ****
    WORD_LIST *w;
    struct builtin *b;
!   int assoc;
  
    if (words == 0)
--- 3581,3585 ----
    WORD_LIST *w;
    struct builtin *b;
!   int assoc, global;
  
    if (words == 0)
***************
*** 3587,3591 ****
  
    b = 0;
!   assoc = 0;
  
    for (w = words; w; w = w->next)
--- 3587,3591 ----
  
    b = 0;
!   assoc = global = 0;
  
    for (w = words; w; w = w->next)
***************
*** 3604,3607 ****
--- 3604,3609 ----
  	if (assoc)
  	  w->word->flags |= W_ASSIGNASSOC;
+ 	if (global)
+ 	  w->word->flags |= W_ASSNGLOBAL;
  #endif
        }
***************
*** 3609,3613 ****
      /* Note that we saw an associative array option to a builtin that takes
         assignment statements.  This is a bit of a kludge. */
!     else if (w->word->word[0] == '-' && strchr (w->word->word, 'A'))
        {
  	if (b == 0)
--- 3611,3618 ----
      /* Note that we saw an associative array option to a builtin that takes
         assignment statements.  This is a bit of a kludge. */
!     else if (w->word->word[0] == '-' && (strchr (w->word->word+1, 'A') || strchr (w->word->word+1, 'g')))
! #else
!     else if (w->word->word[0] == '-' && strchr (w->word->word+1, 'g'))
! #endif
        {
  	if (b == 0)
***************
*** 3619,3626 ****
  	      words->word->flags |= W_ASSNBLTIN;
  	  }
! 	if (words->word->flags & W_ASSNBLTIN)
  	  assoc = 1;
        }
- #endif
  }
  
--- 3624,3632 ----
  	      words->word->flags |= W_ASSNBLTIN;
  	  }
! 	if ((words->word->flags & W_ASSNBLTIN) && strchr (w->word->word+1, 'A'))
  	  assoc = 1;
+ 	if ((words->word->flags & W_ASSNBLTIN) && strchr (w->word->word+1, 'g'))
+ 	  global = 1;
        }
  }
  
*** ../bash-4.2-patched/subst.c	2012-03-11 17:35:13.000000000 -0400
--- subst.c	2012-04-01 12:38:35.000000000 -0400
***************
*** 367,370 ****
--- 367,375 ----
        fprintf (stderr, "W_ASSNBLTIN%s", f ? "|" : "");
      }
+   if (f & W_ASSNGLOBAL)
+     {
+       f &= ~W_ASSNGLOBAL;
+       fprintf (stderr, "W_ASSNGLOBAL%s", f ? "|" : "");
+     }
    if (f & W_COMPASSIGN)
      {
***************
*** 2804,2808 ****
    else if (assign_list)
      {
!       if (word->flags & W_ASSIGNARG)
  	aflags |= ASS_MKLOCAL;
        if (word->flags & W_ASSIGNASSOC)
--- 2809,2813 ----
    else if (assign_list)
      {
!       if ((word->flags & W_ASSIGNARG) && (word->flags & W_ASSNGLOBAL) == 0)
  	aflags |= ASS_MKLOCAL;
        if (word->flags & W_ASSIGNASSOC)

*** ../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 24
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 25
  
  #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 Thu May 03 22:03:12 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQ7rU-0005So-2y
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 22:03:12 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37735)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SQ7rR-0005Sf-ET
	for bug-bash@gnu.org; Thu, 03 May 2012 22:03:10 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SQ7rP-0007cI-9n
	for bug-bash@gnu.org; Thu, 03 May 2012 22:03:09 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:53693)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SQ7rP-0007bn-4p
	for bug-bash@gnu.org; Thu, 03 May 2012 22:03:07 -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 BYG30378; Thu, 03 May 2012 22:03:05 -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 AWL44229; Thu, 03 May 2012 22:03:05 -0400 (EDT)
Date: Thu, 3 May 2012 22:02:32 -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 26
Message-ID: <120504020232.AA98069.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, 04 May 2012 02:03:10 -0000

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

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

Bug-Reported-by:	Greg Wooledge <wooledg@eeg.ccf.org>
Bug-Reference-ID:	<20120425180443.GO22241@eeg.ccf.org>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2012-04/msg00172.html

Bug-Description:

The `lastpipe' option does not behave correctly on machines where the
open file limit is less than 256.

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/execute_cmd.c	2011-11-21 12:04:47.000000000 -0500
--- execute_cmd.c	2012-04-26 11:09:30.000000000 -0400
***************
*** 2206,2210 ****
    if (lastpipe_opt && job_control == 0 && asynchronous == 0 && pipe_out == NO_PIPE && prev > 0)
      {
!       lstdin = move_to_high_fd (0, 0, 255);
        if (lstdin > 0)
  	{
--- 2325,2329 ----
    if (lastpipe_opt && job_control == 0 && asynchronous == 0 && pipe_out == NO_PIPE && prev > 0)
      {
!       lstdin = move_to_high_fd (0, 1, -1);
        if (lstdin > 0)
  	{
***************
*** 2252,2256 ****
--- 2371,2377 ----
      }
  
+ #if defined (JOB_CONTROL)
    discard_unwind_frame ("lastpipe-exec");
+ #endif
  
    return (exec_result);

*** ../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 25
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 26
  
  #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 Thu May 03 22:04:28 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQ7si-0005eL-9P
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 22:04:28 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37944)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SQ7sf-0005dS-GP
	for bug-bash@gnu.org; Thu, 03 May 2012 22:04:26 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SQ7sd-0000PZ-Ja
	for bug-bash@gnu.org; Thu, 03 May 2012 22:04:25 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:53886)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SQ7sd-0000P0-FV
	for bug-bash@gnu.org; Thu, 03 May 2012 22:04:23 -0400
Received: from mpv5.tis.CWRU.Edu (EHLO mpv5.cwru.edu) ([129.22.105.51])
	by mpv1.tis.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id BYG30432; Thu, 03 May 2012 22:04:22 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (HELO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with SMTP id AWV45224; Thu, 03 May 2012 22:04:22 -0400 (EDT)
Date: Thu, 3 May 2012 22:03:36 -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 27
Message-ID: <120504020336.AA98069.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, 04 May 2012 02:04:27 -0000

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

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

Bug-Reported-by:	Mike Frysinger <vapier@gentoo.org>
Bug-Reference-ID:	<201204211243.30163.vapier@gentoo.org>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2012-04/msg00134.html

Bug-Description:

When the `extglob' shell option is enabled, pattern substitution does not
work correctly in the presence of multibyte characters.

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/subst.c	2012-03-11 17:52:57.000000000 -0400
--- subst.c	2012-04-22 16:19:10.000000000 -0400
***************
*** 4167,4171 ****
  #if defined (EXTENDED_GLOB)
    if (extended_glob)
!     simple |= (wpat[1] != L'(' || (wpat[0] != L'*' && wpat[0] != L'?' && wpat[0] != L'+' && wpat[0] != L'!' && wpat[0] != L'@')); /*)*/
  #endif
  
--- 4167,4171 ----
  #if defined (EXTENDED_GLOB)
    if (extended_glob)
!     simple &= (wpat[1] != L'(' || (wpat[0] != L'*' && wpat[0] != L'?' && wpat[0] != L'+' && wpat[0] != L'!' && wpat[0] != L'@')); /*)*/
  #endif
  
*** ../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 26
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 27
  
  #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 Thu May 03 22:09:15 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQ7xL-0005wB-ON
	for mharc-bug-bash@gnu.org; Thu, 03 May 2012 22:09:15 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42153)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SQ7xI-0005vx-5j
	for bug-bash@gnu.org; Thu, 03 May 2012 22:09:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SQ7xG-0001eg-6A
	for bug-bash@gnu.org; Thu, 03 May 2012 22:09:11 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:32933)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SQ7xG-0001dg-14
	for bug-bash@gnu.org; Thu, 03 May 2012 22:09:10 -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 BYG30625; Thu, 03 May 2012 22:09:09 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (HELO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with SMTP id AWV45443; Thu, 03 May 2012 22:09:08 -0400 (EDT)
Date: Thu, 3 May 2012 22:04: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 28
Message-ID: <120504020427.AA98069.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, 04 May 2012 02:09:13 -0000

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

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

Bug-Reported-by:	Mark Edgar <medgar123@gmail.com>
Bug-Reference-ID:	<CABHMh_3d+ZgO_zaEtYXPwK4P7tC0ghZ4g=Ue_TRpsEMf5YDsqw@mail.gmail.com>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2012-03/msg00109.html

Bug-Description:

When using a word expansion for which the right hand side is evaluated,
certain expansions of quoted null strings include spurious ^? characters.

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/subst.c	2012-03-11 17:35:13.000000000 -0400
--- subst.c	2012-03-20 19:30:13.000000000 -0400
***************
*** 5810,5813 ****
--- 5810,5823 ----
        if (qdollaratp && ((hasdol && quoted) || l->next))
  	*qdollaratp = 1;
+       /* If we have a quoted null result (QUOTED_NULL(temp)) and the word is
+ 	 a quoted null (l->next == 0 && QUOTED_NULL(l->word->word)), the
+ 	 flags indicate it (l->word->flags & W_HASQUOTEDNULL), and the
+ 	 expansion is quoted (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
+ 	 (which is more paranoia than anything else), we need to return the
+ 	 quoted null string and set the flags to indicate it. */
+       if (l->next == 0 && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && QUOTED_NULL(temp) && QUOTED_NULL(l->word->word) && (l->word->flags & W_HASQUOTEDNULL))
+ 	{
+ 	  w->flags |= W_HASQUOTEDNULL;
+ 	}
        dispose_words (l);
      }

*** ../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 27
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 28
  
  #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 Fri May 04 08:55:58 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQI3C-000277-I9
	for mharc-bug-bash@gnu.org; Fri, 04 May 2012 08:55:58 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58743)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SQI36-000222-3g
	for bug-bash@gnu.org; Fri, 04 May 2012 08:55:56 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SQI2z-0004sm-Ec
	for bug-bash@gnu.org; Fri, 04 May 2012 08:55:51 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:24344)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SQI2z-0004sV-9a
	for bug-bash@gnu.org; Fri, 04 May 2012 08:55:45 -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 BYG54463; Fri, 04 May 2012 08:55:42 -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 AWL68655 (AUTH cpr);
	Fri, 04 May 2012 08:55:42 -0400 (EDT)
Message-ID: <4FA3D1CE.2090802@case.edu>
Date: Fri, 04 May 2012 08:55:42 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Colin McEwan <colin.mcewan@gmail.com>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
In-Reply-To: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 04 May 2012 12:55:56 -0000

On 5/3/12 2:49 PM, Colin McEwan wrote:

> What I would really *like* would be an extension to the shell which
> implements the same sort of parallelism-limiting / 'process pooling' found
> in make or 'parallel' via an operator in the shell language, similar to '&'
> which has semantics of *possibly* continuing asynchronously (like '&') if
> system resources allow, or waiting for the process to complete (';').

I think the combination of asynchronous jobs and `wait' provides most of
what you need.  The already-posted alternatives look like a good start to a
general solution.

If those aren't general enough, how would you specify the behavior of a
shell primitive -- operator or builtin -- that does what you want?

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 May 04 12:40:16 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQLYG-000348-6q
	for mharc-bug-bash@gnu.org; Fri, 04 May 2012 12:40:16 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49694)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQLY9-00033I-Vo
	for bug-bash@gnu.org; Fri, 04 May 2012 12:40:14 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQLY7-0001xI-Ph
	for bug-bash@gnu.org; Fri, 04 May 2012 12:40:09 -0400
Received: from smtp.gentoo.org ([140.211.166.183]:60703)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQLY7-0001v1-K0
	for bug-bash@gnu.org; Fri, 04 May 2012 12:40:07 -0400
Received: from vapier.localnet (localhost [127.0.0.1])
	by smtp.gentoo.org (Postfix) with ESMTP id AAB621B4050;
	Fri,  4 May 2012 16:40:05 +0000 (UTC)
From: Mike Frysinger <vapier@gentoo.org>
Organization: wh0rd.org
To: bug-bash@gnu.org,
 chet.ramey@case.edu
Subject: Re: Parallelism a la make -j <n> / GNU parallel
Date: Fri, 4 May 2012 12:41:03 -0400
User-Agent: KMail/1.13.7 (Linux/3.3.4; KDE/4.6.5; x86_64; ; )
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<4FA3D1CE.2090802@case.edu>
In-Reply-To: <4FA3D1CE.2090802@case.edu>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart1789036.r5DJVusMrB";
	protocol="application/pgp-signature"; micalg=pgp-sha1
Content-Transfer-Encoding: 7bit
Message-Id: <201205041241.04797.vapier@gentoo.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 140.211.166.183
Cc: Colin McEwan <colin.mcewan@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: Fri, 04 May 2012 16:40:14 -0000

--nextPart1789036.r5DJVusMrB
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

On Friday 04 May 2012 08:55:42 Chet Ramey wrote:
> On 5/3/12 2:49 PM, Colin McEwan wrote:
> > What I would really *like* would be an extension to the shell which
> > implements the same sort of parallelism-limiting / 'process pooling'
> > found in make or 'parallel' via an operator in the shell language,
> > similar to '&' which has semantics of *possibly* continuing
> > asynchronously (like '&') if system resources allow, or waiting for the
> > process to complete (';').
>=20
> I think the combination of asynchronous jobs and `wait' provides most of
> what you need.  The already-posted alternatives look like a good start to=
 a
> general solution.
>=20
> If those aren't general enough, how would you specify the behavior of a
> shell primitive -- operator or builtin -- that does what you want?

i wish there was a way to use `wait` that didn't block until all the pids=20
returned.  maybe a dedicated option, or a shopt to enable this, or a new=20
command.

for example, if i launched 10 jobs in the background, i usually want to wai=
t=20
for the first one to exit so i can queue up another one, not wait for all o=
f=20
them.
=2Dmike

--nextPart1789036.r5DJVusMrB
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

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

iQIcBAABAgAGBQJPpAagAAoJEEFjO5/oN/WBpNgQAIHEsnurDkRnQ+MNQp+k8n17
k2KOGDvbuT5Lm+WW4F9nO4YmOB7QG7gMOJoc7ZmtwwcZmJH1vInH9/LAofStVxWd
DcdZQTiyxoQQAGpYe3LREl7t+EbRZa9iT4D66WWGeVUPk6EQJGPxB1HUdXvr5dN4
PkkO6SgnVyqW4nPthbaAaLuUJxLRezpdFEqySnddeDVtX98jbhBjTFkD4Wf2gM4L
0KzJ6B3OPYLQ00EvZR6uZUdaDmHSq3RrFsjg7vOE5j2kasmG5qEq3h5ox2+0fblF
vIeU7i9AxlpGdd+iGyz2U8uVg7Jvkvec/YExnNkqqhccPXTsuUlUpkxBLmYNGMpJ
9no7BX9SerCzhOCPq2m5FeV244QyrFet9CGtv+cdyqIOre+ICtpe7OdRlxvYI+Io
2NJIWsnJqbF572HPPWrdQMbs/J42qR09qM3MfuJbUx43js7ugNhsbIGv/erAtOga
OvxUzTeoNkkj3KGLL3Po2y6OCySKinuOxpS3+BFTWd61ccVY1yzJSnXho1GLDZPR
RSpnOSU087YF/KmuM4Z06+oHatZYQmKswx8Geehmy3DmG9KcYOGkHq4Ud5ve3sSv
rpfQfaWXIUTEfIWzmNz00Wh85S3HxGqDHYnl5SqmEi9UbrietIne6dtq277A+4tS
XdTm7xZjd5Zl9jrHNzsS
=T2jq
-----END PGP SIGNATURE-----

--nextPart1789036.r5DJVusMrB--


From MAILER-DAEMON Fri May 04 12:45:07 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQLcx-0003TV-0E
	for mharc-bug-bash@gnu.org; Fri, 04 May 2012 12:45:07 -0400
Received: from eggs.gnu.org ([208.118.235.92]:56228)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SQLcp-0003QB-PJ
	for bug-bash@gnu.org; Fri, 04 May 2012 12:45:05 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SQLco-0003oV-2o
	for bug-bash@gnu.org; Fri, 04 May 2012 12:44:59 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:50079
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SQLcn-0003eS-SL
	for bug-bash@gnu.org; Fri, 04 May 2012 12:44:57 -0400
Received: (qmail 22769 invoked from network); 4 May 2012 16:44:33 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Fri, 04 May 2012 12:44:33 -0400
Received: (qmail 5404 invoked by uid 563); 4 May 2012 16:44:32 -0000
Date: Fri, 4 May 2012 12:44:32 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Mike Frysinger <vapier@gentoo.org>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
Message-ID: <20120504164432.GJ1622@eeg.ccf.org>
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<4FA3D1CE.2090802@case.edu> <201205041241.04797.vapier@gentoo.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201205041241.04797.vapier@gentoo.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: Fri, 04 May 2012 16:45:05 -0000

On Fri, May 04, 2012 at 12:41:03PM -0400, Mike Frysinger wrote:
> i wish there was a way to use `wait` that didn't block until all the pids 
> returned.  maybe a dedicated option, or a shopt to enable this, or a new 
> command.

wait takes arguments.

> for example, if i launched 10 jobs in the background, i usually want to wait 
> for the first one to exit so i can queue up another one, not wait for all of 
> them.

Do you mean "for *any* one of them", or literally "for the first one"?
The latter, you can do right now -- just pass the PID of the first one.
The former would require that you set up a SIGCHLD trap and do some work.

By the way, "help wait" is misleading; it says you can only pass a single
job ID argument.  The man page indicates that you can pass multiple
arguments.


From MAILER-DAEMON Fri May 04 12:55:28 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQLmy-00088n-GO
	for mharc-bug-bash@gnu.org; Fri, 04 May 2012 12:55:28 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49656)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQLmv-00082D-12
	for bug-bash@gnu.org; Fri, 04 May 2012 12:55:26 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQLmt-0008Ik-C3
	for bug-bash@gnu.org; Fri, 04 May 2012 12:55:24 -0400
Received: from smtp.gentoo.org ([140.211.166.183]:33543)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQLmt-0008IX-5v
	for bug-bash@gnu.org; Fri, 04 May 2012 12:55:23 -0400
Received: from vapier.localnet (localhost [127.0.0.1])
	by smtp.gentoo.org (Postfix) with ESMTP id 8B10F1B400C;
	Fri,  4 May 2012 16:55:21 +0000 (UTC)
From: Mike Frysinger <vapier@gentoo.org>
Organization: wh0rd.org
To: Greg Wooledge <wooledg@eeg.ccf.org>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
Date: Fri, 4 May 2012 12:56:19 -0400
User-Agent: KMail/1.13.7 (Linux/3.3.4; KDE/4.6.5; x86_64; ; )
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205041241.04797.vapier@gentoo.org>
	<20120504164432.GJ1622@eeg.ccf.org>
In-Reply-To: <20120504164432.GJ1622@eeg.ccf.org>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart1472456.XL6D8xEOzK";
	protocol="application/pgp-signature"; micalg=pgp-sha1
Content-Transfer-Encoding: 7bit
Message-Id: <201205041256.20493.vapier@gentoo.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 140.211.166.183
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, 04 May 2012 16:55:26 -0000

--nextPart1472456.XL6D8xEOzK
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

On Friday 04 May 2012 12:44:32 Greg Wooledge wrote:
> On Fri, May 04, 2012 at 12:41:03PM -0400, Mike Frysinger wrote:
> > i wish there was a way to use `wait` that didn't block until all the pi=
ds
> > returned.  maybe a dedicated option, or a shopt to enable this, or a new
> > command.
>=20
> wait takes arguments.

yes, and it'll wait for all the ones i specified before returning

> > for example, if i launched 10 jobs in the background, i usually want to
> > wait for the first one to exit so i can queue up another one, not wait
> > for all of them.
>=20
> Do you mean "for *any* one of them", or literally "for the first one"?

any.  maybe `wait -1` will translate into waitpid(-1, ...).
=2Dmike

--nextPart1472456.XL6D8xEOzK
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

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

iQIcBAABAgAGBQJPpAo0AAoJEEFjO5/oN/WBNhUQAJ/6UA7u1BfZnLMf4fvNkcYX
5yU/1IoiV5GjUhh/Wb1XhZuBuFy/6mdktqDVkZd3qKm5Y1YJU3KaZUOWFRlUhHOh
nggpHXzsRDazGMM1hUC6bWbx97JrW5oNCICM4mDqSrYTq5et/yitMlnZ2op9aMu3
vJ034lC7uWIV2ha7mgAuQX8FMdX3Myn+PHPGV+YrYoApcafYk0efCYaE8ETQokeq
CWqe8eJRA8NMVSlkR0b3fFyk4O2aOHC4WjYbA85sJXWDziNu8BHLHJPlKKrmPTnY
lA9XynKyFT0qsXMVYp/zwDZF9QI8nH2/Fuu48fTVh574J9E1CI89eHEShIHW2lWv
hRCI2323eEwzfOXsuOWcgsZQ3k/ZvmiSNveWZhV9K877pcFbVi3VCX0iZ8YUUGgr
GArAGMJiNxDUxl+cvfKMPtSpLfaQi3/rd4yQ2btGeozS6KngjsQWCYxGpran4XlK
031tBJoEkvkN24f2f+5hSy2IHSEzssRtyhMaVGPt2oz18TmbZhjf+8zPRrrFfU1Z
PqEYYPcjm+L7pUjSGaHPjBy8yn+5AxWGpthQJ9iX/agkMw0d+9KALJfGA3dDQrwY
eDiRZhL3/PSf1lcGdnqM2+vzNn4J82rggPl7Nezu8bZIlayRCLc7QH1xVMNV0ibS
+1vj/yV4OqqmqM4KYeDQ
=CvZn
-----END PGP SIGNATURE-----

--nextPart1472456.XL6D8xEOzK--


From MAILER-DAEMON Fri May 04 13:46:42 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQMaY-0006JE-Q6
	for mharc-bug-bash@gnu.org; Fri, 04 May 2012 13:46:42 -0400
Received: from eggs.gnu.org ([208.118.235.92]:53288)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SQMaV-0006It-Tf
	for bug-bash@gnu.org; Fri, 04 May 2012 13:46:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SQMaU-0002j1-6Y
	for bug-bash@gnu.org; Fri, 04 May 2012 13:46:39 -0400
Received: from mail-out.m-online.net ([212.18.0.9]:59479)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SQMaU-0002iO-0A
	for bug-bash@gnu.org; Fri, 04 May 2012 13:46:38 -0400
Received: from frontend1.mail.m-online.net (unknown [192.168.8.180])
	by mail-out.m-online.net (Postfix) with ESMTP id 3VkgdP4CHTz4Kn94;
	Fri,  4 May 2012 19:46:33 +0200 (CEST)
Received: from igel.home (ppp-88-217-117-227.dynamic.mnet-online.de
	[88.217.117.227])
	by mail.mnet-online.de (Postfix) with ESMTPA id 3VkgdP1Tyvz4KK5B;
	Fri,  4 May 2012 19:46:33 +0200 (CEST)
Received: by igel.home (Postfix, from userid 501)
	id 9D4A5CA2A9; Fri,  4 May 2012 19:46:32 +0200 (CEST)
From: Andreas Schwab <schwab@linux-m68k.org>
To: Mike Frysinger <vapier@gentoo.org>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<4FA3D1CE.2090802@case.edu> <201205041241.04797.vapier@gentoo.org>
X-Yow: I'm wet!  I'm wild!
Date: Fri, 04 May 2012 19:46:32 +0200
In-Reply-To: <201205041241.04797.vapier@gentoo.org> (Mike Frysinger's message
	of "Fri, 4 May 2012 12:41:03 -0400")
Message-ID: <m2txzvon47.fsf@igel.home>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.96 (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: Colin McEwan <colin.mcewan@gmail.com>, bug-bash@gnu.org,
	chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 04 May 2012 17:46:41 -0000

Mike Frysinger <vapier@gentoo.org> writes:

> i wish there was a way to use `wait` that didn't block until all the pids 
> returned.  maybe a dedicated option, or a shopt to enable this, or a new 
> command.
>
> for example, if i launched 10 jobs in the background, i usually want to wait 
> for the first one to exit so i can queue up another one, not wait for all of 
> them.

If you set -m you can trap on SIGCHLD while waiting.

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 May 04 14:52:38 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQNcM-0003qV-KU
	for mharc-bug-bash@gnu.org; Fri, 04 May 2012 14:52:38 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57571)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQNcK-0003qP-LH
	for bug-bash@gnu.org; Fri, 04 May 2012 14:52:37 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQNcJ-0003R3-1F
	for bug-bash@gnu.org; Fri, 04 May 2012 14:52:36 -0400
Received: from smtp.gentoo.org ([140.211.166.183]:44403)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQNcI-0003Qy-R8
	for bug-bash@gnu.org; Fri, 04 May 2012 14:52:34 -0400
Received: from vapier.localnet (localhost [127.0.0.1])
	by smtp.gentoo.org (Postfix) with ESMTP id 2AEB71B4026;
	Fri,  4 May 2012 18:52:33 +0000 (UTC)
From: Mike Frysinger <vapier@gentoo.org>
Organization: wh0rd.org
To: Andreas Schwab <schwab@linux-m68k.org>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
Date: Fri, 4 May 2012 14:53:31 -0400
User-Agent: KMail/1.13.7 (Linux/3.3.4; KDE/4.6.5; x86_64; ; )
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205041241.04797.vapier@gentoo.org> <m2txzvon47.fsf@igel.home>
In-Reply-To: <m2txzvon47.fsf@igel.home>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart1885706.TmQF83pTYN";
	protocol="application/pgp-signature"; micalg=pgp-sha1
Content-Transfer-Encoding: 7bit
Message-Id: <201205041453.32788.vapier@gentoo.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 140.211.166.183
Cc: Colin McEwan <colin.mcewan@gmail.com>, bug-bash@gnu.org,
	chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 04 May 2012 18:52:38 -0000

--nextPart1885706.TmQF83pTYN
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: quoted-printable

On Friday 04 May 2012 13:46:32 Andreas Schwab wrote:
> Mike Frysinger <vapier@gentoo.org> writes:
> > i wish there was a way to use `wait` that didn't block until all the pi=
ds
> > returned.  maybe a dedicated option, or a shopt to enable this, or a new
> > command.
> >=20
> > for example, if i launched 10 jobs in the background, i usually want to
> > wait for the first one to exit so i can queue up another one, not wait
> > for all of them.
>=20
> If you set -m you can trap on SIGCHLD while waiting.

awesome, that's a good mitigation

#!/bin/bash
set -m
cnt=3D0
trap ': $(( --cnt ))' SIGCHLD
for n in {0..20} ; do
	(
		d=3D$(( RANDOM % 10 ))
		echo $n sleeping $d
		sleep $d
	) &
	: $(( ++cnt ))
	if [[ ${cnt} -ge 10 ]] ; then
		echo going to wait
		wait
	fi
done
trap - SIGCHLD
wait

it might be a little racy (wrt checking cnt >=3D 10 and then doing a wait),=
 but=20
this is good enough for some things.  it does lose visibility into which pi=
ds=20
are live vs reaped, and their exit status, but i more often don't care abou=
t=20
that ...
=2Dmike

--nextPart1885706.TmQF83pTYN
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

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

iQIcBAABAgAGBQJPpCWsAAoJEEFjO5/oN/WBKBIQAKRXO9kcgCX+dY3/B7apsygW
KVvILnuK9ZC8nDF9SG5MhJ9w7fZ6C14MygTW5A6JnYXoZc9LBu8bi7am81thYWQS
CrOZCDDeYPvJQl9WcDDrZovWwvKwse9OEvF/46fP0ctFM+bBVHFqFpb7RM0jEZ9u
EI5LVH5Bm+k0njRyW5fOUq7gpbs+PDQDQJB80u5T0oPxd1Pz12kuh0BbnJv37mcR
erIq2wOQ6NpiFlDAHNKqtczNtTewHuUln554zYSyxVEU4uK3UQN8WTTwA58XQ7oF
AVW+H20jxMiL6dpHcbYk+cYAX0xsSSCzvsiQ8VDvZp64jggfQMnWyDs5gvM/lbl4
tTJxfkxM/R28KmfmTXfe8ZXgGSRgbzS9Nw11R4ASI1mVLBsngcO8ONoFll90k/NN
RipKL/eaKNkHVP5kbmH5WQgyLrFo+tXh3MHqWZEhIOMyKAYwIvghGhab3eXL6mzY
mrSp3mb6saBS4raWnShyNI1iCLcdvmZW2IbZuF/hpFgn/qOWDjys2ZaJkHi8rozv
FV/Sbg+d3pluZkax2uHlhO+6X9nngnHuHZIGZJ6ToVcjcuVVjejeHc3vjy4uqUTR
VAAPDWEPmlarvVQfazCVIq+sMLZ9XT761/lO7P2URcJ5Cc+ShgIlMMt9NDh/Nd6U
iii21tQj6GDUIXPVtmor
=5583
-----END PGP SIGNATURE-----

--nextPart1885706.TmQF83pTYN--


From MAILER-DAEMON Fri May 04 15:02:31 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQNlv-0004ST-S3
	for mharc-bug-bash@gnu.org; Fri, 04 May 2012 15:02:31 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49186)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQNlt-0004SN-Q0
	for bug-bash@gnu.org; Fri, 04 May 2012 15:02:31 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQNlr-0007DG-Ny
	for bug-bash@gnu.org; Fri, 04 May 2012 15:02:29 -0400
Received: from fmmailgate02.web.de ([217.72.192.227]:37714)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQNlr-0007Cj-Dl
	for bug-bash@gnu.org; Fri, 04 May 2012 15:02:27 -0400
Received: from moweb002.kundenserver.de (moweb002.kundenserver.de
	[172.19.20.108])
	by fmmailgate02.web.de (Postfix) with ESMTP id E8C4C1C43685C
	for <bug-bash@gnu.org>; Fri,  4 May 2012 21:02:24 +0200 (CEST)
Received: from [192.168.178.49] ([77.5.60.192]) by smtp.web.de (mrweb001) with
	ESMTPA (Nemesis) id 0MBkal-1SHGZL2sQJ-00Algk;
	Fri, 04 May 2012 21:02:24 +0200
Message-ID: <4FA427C3.8090304@web.de>
Date: Fri, 04 May 2012 21:02:27 +0200
From: John Kearney <dethrophes@web.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:12.0) Gecko/20120428 Thunderbird/12.0.1
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205041241.04797.vapier@gentoo.org> <m2txzvon47.fsf@igel.home>
	<201205041453.32788.vapier@gentoo.org>
In-Reply-To: <201205041453.32788.vapier@gentoo.org>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Provags-ID: V02:K0:TzEAVx0EmXhSroZomxz50/3S61PodysWTr1faqeMq2+
	FjZoEyjM3WWi0o79Bg2XvAZufZZDjdYQYD9dW45Hjx5xWfYHVt
	5oD9mC+HfXOF2IA1r3KNW6BA/P4dLKotG4HMijQMAth0aKfMq1
	jJidVPKH5CRg1TEhzsmWiDoanAebRzYTudFa4j/AOvMTUK8WBP
	LKo1JGO9EZaMF30iNX6fg==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-Received-From: 217.72.192.227
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, 04 May 2012 19:02:31 -0000

Am 04.05.2012 20:53, schrieb Mike Frysinger:
> On Friday 04 May 2012 13:46:32 Andreas Schwab wrote:
>> Mike Frysinger <vapier@gentoo.org> writes:
>>> i wish there was a way to use `wait` that didn't block until all the pids
>>> returned.  maybe a dedicated option, or a shopt to enable this, or a new
>>> command.
>>>
>>> for example, if i launched 10 jobs in the background, i usually want to
>>> wait for the first one to exit so i can queue up another one, not wait
>>> for all of them.
>> If you set -m you can trap on SIGCHLD while waiting.
> awesome, that's a good mitigation
>
> #!/bin/bash
> set -m
> cnt=0
> trap ': $(( --cnt ))' SIGCHLD
> for n in {0..20} ; do
> 	(
> 		d=$(( RANDOM % 10 ))
> 		echo $n sleeping $d
> 		sleep $d
> 	) &
> 	: $(( ++cnt ))
> 	if [[ ${cnt} -ge 10 ]] ; then
> 		echo going to wait
> 		wait
> 	fi
> done
> trap - SIGCHLD
> wait
>
> it might be a little racy (wrt checking cnt >= 10 and then doing a wait), but 
> this is good enough for some things.  it does lose visibility into which pids 
> are live vs reaped, and their exit status, but i more often don't care about 
> that ...
> -mike
That won't work I don't think.
I think you meant something more like this?

set -m
cnt=0
trap ': $(( --cnt ))' SIGCHLD
set -- {0..20}
while [ $# -gt 0 ]; do
	if [[ ${cnt} -lt 10 ]] ; then

  		(
			d=$(( RANDOM % 10 ))
			echo $n sleeping $d
			sleep $d
		) &
		: $(( ++cnt ))
		shift
	fi
	echo going to wait
	sleep 1
done


which is basically what I did in my earlier example except I used USR2
instead of SIGCHLD and put it in a function to make it easier to use.




From MAILER-DAEMON Fri May 04 15:11:49 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQNuv-00052s-EG
	for mharc-bug-bash@gnu.org; Fri, 04 May 2012 15:11:49 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49190)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SQNut-00052m-4d
	for bug-bash@gnu.org; Fri, 04 May 2012 15:11:48 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SQNur-0002jB-JP
	for bug-bash@gnu.org; Fri, 04 May 2012 15:11:46 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:50142
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SQNur-0002il-CG
	for bug-bash@gnu.org; Fri, 04 May 2012 15:11:45 -0400
Received: (qmail 24144 invoked from network); 4 May 2012 19:11:41 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Fri, 04 May 2012 15:11:41 -0400
Received: (qmail 5689 invoked by uid 563); 4 May 2012 19:11:41 -0000
Date: Fri, 4 May 2012 15:11:41 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: John Kearney <dethrophes@web.de>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
Message-ID: <20120504191141.GN1622@eeg.ccf.org>
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205041241.04797.vapier@gentoo.org> <m2txzvon47.fsf@igel.home>
	<201205041453.32788.vapier@gentoo.org> <4FA427C3.8090304@web.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4FA427C3.8090304@web.de>
User-Agent: Mutt/1.4.2.3i
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older,
	2)
X-Received-From: 139.137.100.1
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 04 May 2012 19:11:48 -0000

On Fri, May 04, 2012 at 09:02:27PM +0200, John Kearney wrote:
> set -m
> cnt=0
> trap ': $(( --cnt ))' SIGCHLD
> set -- {0..20}
> while [ $# -gt 0 ]; do
> 	if [[ ${cnt} -lt 10 ]] ; then
> 
>   		(
> 			d=$(( RANDOM % 10 ))
> 			echo $n sleeping $d
> 			sleep $d
> 		) &
> 		: $(( ++cnt ))
> 		shift
> 	fi
> 	echo going to wait
> 	sleep 1
> done

You're busy-looping with a 1-second sleep instead of using wait and the
signal handler, which was the whole purpose of the previous example (and
of the set -m that you kept in yours).  And $n should probably be $1 there.


From MAILER-DAEMON Fri May 04 15:13:03 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQNw7-0005C1-NQ
	for mharc-bug-bash@gnu.org; Fri, 04 May 2012 15:13:03 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49272)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQNw4-0005An-98
	for bug-bash@gnu.org; Fri, 04 May 2012 15:13:01 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQNw2-0002me-I5
	for bug-bash@gnu.org; Fri, 04 May 2012 15:12:59 -0400
Received: from smtp.gentoo.org ([140.211.166.183]:46330)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQNw2-0002mV-CO
	for bug-bash@gnu.org; Fri, 04 May 2012 15:12:58 -0400
Received: from vapier.localnet (localhost [127.0.0.1])
	by smtp.gentoo.org (Postfix) with ESMTP id E31861B4051
	for <bug-bash@gnu.org>; Fri,  4 May 2012 19:12:56 +0000 (UTC)
From: Mike Frysinger <vapier@gentoo.org>
Organization: wh0rd.org
To: bug-bash@gnu.org
Subject: Re: Parallelism a la make -j <n> / GNU parallel
Date: Fri, 4 May 2012 15:13:55 -0400
User-Agent: KMail/1.13.7 (Linux/3.3.4; KDE/4.6.5; x86_64; ; )
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205041453.32788.vapier@gentoo.org> <4FA427C3.8090304@web.de>
In-Reply-To: <4FA427C3.8090304@web.de>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart8367947.2qTT6fJWja";
	protocol="application/pgp-signature"; micalg=pgp-sha1
Content-Transfer-Encoding: 7bit
Message-Id: <201205041513.56696.vapier@gentoo.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 140.211.166.183
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, 04 May 2012 19:13:01 -0000

--nextPart8367947.2qTT6fJWja
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: quoted-printable

On Friday 04 May 2012 15:02:27 John Kearney wrote:
> Am 04.05.2012 20:53, schrieb Mike Frysinger:
> > On Friday 04 May 2012 13:46:32 Andreas Schwab wrote:
> >> Mike Frysinger <vapier@gentoo.org> writes:
> >>> i wish there was a way to use `wait` that didn't block until all the
> >>> pids returned.  maybe a dedicated option, or a shopt to enable this,
> >>> or a new command.
> >>>=20
> >>> for example, if i launched 10 jobs in the background, i usually want =
to
> >>> wait for the first one to exit so i can queue up another one, not wait
> >>> for all of them.
> >>=20
> >> If you set -m you can trap on SIGCHLD while waiting.
> >=20
> > awesome, that's a good mitigation
> >=20
> > #!/bin/bash
> > set -m
> > cnt=3D0
> > trap ': $(( --cnt ))' SIGCHLD
> > for n in {0..20} ; do
> >=20
> > 	(
> > =09
> > 		d=3D$(( RANDOM % 10 ))
> > 		echo $n sleeping $d
> > 		sleep $d
> > =09
> > 	) &
> > =09
> > 	: $(( ++cnt ))
> > =09
> > 	if [[ ${cnt} -ge 10 ]] ; then
> > =09
> > 		echo going to wait
> > 		wait
> > =09
> > 	fi
> >=20
> > done
> > trap - SIGCHLD
> > wait
> >=20
> > it might be a little racy (wrt checking cnt >=3D 10 and then doing a wa=
it),
> > but this is good enough for some things.  it does lose visibility into
> > which pids are live vs reaped, and their exit status, but i more often
> > don't care about that ...
>=20
> That won't work I don't think.

seemed to work fine for me

> I think you meant something more like this?

no.  i want to sleep the parent indefinitely and fork a child asap (hence t=
he=20
`wait`), not busy wait with a one second delay.  the `set -m` + SIGCHLD=20
interrupted the `wait` and allowed it to return.
=2Dmike

--nextPart8367947.2qTT6fJWja
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

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

iQIcBAABAgAGBQJPpCp0AAoJEEFjO5/oN/WB9qAQALKrz9k1jkC18chkVDasR/LI
mG+tGLHe7KP8OS8W9QxkxZQYScDkvJJ8597eDCiOSRCgHUcp9YhYPpWMCmCfPbGH
tPD6olGzHAP6LoKaYbJutRzwnlpgoePbx8qLGB0oQxqC2hOh0MfGktuAKky9lC62
+n7k+3hjXmHwWQu1u8jyRdpLn14IlRdVJO84BjUznR2yMycxaDnsL+fb2zLxkUJd
KM5F21BA6Sh2nlncsEoROmpETIShXceEKHRigRpV0DDwe7DPvFR9S8pXy0gAI0KZ
+uIYo+BtxyWewnD4T1/lkT1pD8rwabWgJ7aki+xhc2aGRIrhEJchZLcWgNcXLWGe
3U0/8C+EVlCGN1GxmcjSWokRUU/l2Tk42px2rbCv2a9/EmqUGTww597qOLvwd4d1
OHtOmoB9Vz8ksBnw+PMC1QgnKDJtEaGl+aWjlTY5ixDmRj+WIvvojuTtsyhaJOep
lCHfMagz0UOOlDBRbqZmvKDXbE0ROfBPVp2rJgNdD8V6m4KH7I8IaC7kZ4R+zEy/
GUsKm335MjFzz+LlFfFbW2RLkXMrnnKhdKr2Y54grOxAPwfhHQEXlQmvIyu17Er8
GiTvLkOR7JpugbDd4R8zcYzgZYVS3jPORvaja0BYQDfMJTPCFm61eN226NoSLT6E
SKt7tnHks20EHOlQPhN5
=bCRs
-----END PGP SIGNATURE-----

--nextPart8367947.2qTT6fJWja--


From MAILER-DAEMON Fri May 04 15:25:48 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQO8S-0006Pl-54
	for mharc-bug-bash@gnu.org; Fri, 04 May 2012 15:25:48 -0400
Received: from eggs.gnu.org ([208.118.235.92]:40601)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQO8P-0006PS-LR
	for bug-bash@gnu.org; Fri, 04 May 2012 15:25:47 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQO8N-00008x-JT
	for bug-bash@gnu.org; Fri, 04 May 2012 15:25:45 -0400
Received: from fmmailgate03.web.de ([217.72.192.234]:43219)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQO8N-00008g-9Z
	for bug-bash@gnu.org; Fri, 04 May 2012 15:25:43 -0400
Received: from moweb001.kundenserver.de (moweb001.kundenserver.de
	[172.19.20.114])
	by fmmailgate03.web.de (Postfix) with ESMTP id BBE311B43E098
	for <bug-bash@gnu.org>; Fri,  4 May 2012 21:25:23 +0200 (CEST)
Received: from [192.168.178.49] ([77.5.60.192]) by smtp.web.de (mrweb001) with
	ESMTPA (Nemesis) id 0LcPhu-1RhwUX1F1q-00jq8V;
	Fri, 04 May 2012 21:25:23 +0200
Message-ID: <4FA42D25.1000802@web.de>
Date: Fri, 04 May 2012 21:25:25 +0200
From: John Kearney <dethrophes@web.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:12.0) Gecko/20120428 Thunderbird/12.0.1
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205041453.32788.vapier@gentoo.org> <4FA427C3.8090304@web.de>
	<201205041513.56696.vapier@gentoo.org>
In-Reply-To: <201205041513.56696.vapier@gentoo.org>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Provags-ID: V02:K0:pfvWCZlQquYxVCSuXoKkcrlO4fy4SP3L2ERuWAZe+WY
	qgd8ictJE5t/7wcE9ELP/oszrc51O4ImrK2E1Sb14dwqYYTScO
	71Y6SfHd1OnVU0dxIggJR+CCsXoaSTq9+GITud3hDgV02ARASu
	jQpSRFZe2r1NNdTrmJuCi6w0CFXxJMY4/dy6FZP9zAb2+J0zFT
	Z6wLog9qE5tLx/knqgw1Q==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-Received-From: 217.72.192.234
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, 04 May 2012 19:25:47 -0000

Am 04.05.2012 21:13, schrieb Mike Frysinger:
> On Friday 04 May 2012 15:02:27 John Kearney wrote:
>> Am 04.05.2012 20:53, schrieb Mike Frysinger:
>>> On Friday 04 May 2012 13:46:32 Andreas Schwab wrote:
>>>> Mike Frysinger <vapier@gentoo.org> writes:
>>>>> i wish there was a way to use `wait` that didn't block until all the
>>>>> pids returned.  maybe a dedicated option, or a shopt to enable this,
>>>>> or a new command.
>>>>>
>>>>> for example, if i launched 10 jobs in the background, i usually want to
>>>>> wait for the first one to exit so i can queue up another one, not wait
>>>>> for all of them.
>>>> If you set -m you can trap on SIGCHLD while waiting.
>>> awesome, that's a good mitigation
>>>
>>> #!/bin/bash
>>> set -m
>>> cnt=0
>>> trap ': $(( --cnt ))' SIGCHLD
>>> for n in {0..20} ; do
>>>
>>> 	(
>>> 	
>>> 		d=$(( RANDOM % 10 ))
>>> 		echo $n sleeping $d
>>> 		sleep $d
>>> 	
>>> 	) &
>>> 	
>>> 	: $(( ++cnt ))
>>> 	
>>> 	if [[ ${cnt} -ge 10 ]] ; then
>>> 	
>>> 		echo going to wait
>>> 		wait
>>> 	
>>> 	fi
>>>
>>> done
>>> trap - SIGCHLD
>>> wait
>>>
>>> it might be a little racy (wrt checking cnt >= 10 and then doing a wait),
>>> but this is good enough for some things.  it does lose visibility into
>>> which pids are live vs reaped, and their exit status, but i more often
>>> don't care about that ...
>> That won't work I don't think.
> seemed to work fine for me
>
>> I think you meant something more like this?
> no.  i want to sleep the parent indefinitely and fork a child asap (hence the 
> `wait`), not busy wait with a one second delay.  the `set -m` + SIGCHLD 
> interrupted the `wait` and allowed it to return.
> -mike
The functionality of the code doesn't need SIGCHLD, it still waits till
all the 10 processes are finished before starting the next lot.

it only interrupts the wait to decrement the counter.

to do what your talking about you would have to start the new subprocess
in the SIGCHLD trap.


try this out it might make it clearer what I mean

set -m
cnt=0
trap ': $(( --cnt )); echo SIGCHLD' SIGCHLD
for n in {0..20} ; do
    (
        d=$(( RANDOM % 10 ))
        echo $n sleeping $d
        sleep $d
        echo $n exiting $d
    ) &
    : $(( ++cnt ))
    if [[ ${cnt} -ge 10 ]] ; then
        echo going to wait
        wait
    fi
done
trap - SIGCHLD
wait


From MAILER-DAEMON Fri May 04 15:41:54 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQOO2-0007ll-1H
	for mharc-bug-bash@gnu.org; Fri, 04 May 2012 15:41:54 -0400
Received: from eggs.gnu.org ([208.118.235.92]:50095)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQONy-0007lH-Sv
	for bug-bash@gnu.org; Fri, 04 May 2012 15:41:52 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQONx-00067A-3T
	for bug-bash@gnu.org; Fri, 04 May 2012 15:41:50 -0400
Received: from fmmailgate03.web.de ([217.72.192.234]:58103)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQONw-00066u-T2
	for bug-bash@gnu.org; Fri, 04 May 2012 15:41:49 -0400
Received: from moweb002.kundenserver.de (moweb002.kundenserver.de
	[172.19.20.108])
	by fmmailgate03.web.de (Postfix) with ESMTP id 4A0721B4416F4
	for <bug-bash@gnu.org>; Fri,  4 May 2012 21:41:47 +0200 (CEST)
Received: from [192.168.178.49] ([77.5.60.192]) by smtp.web.de (mrweb002) with
	ESMTPA (Nemesis) id 0MPY5x-1SV3DG0Oi9-004gah;
	Fri, 04 May 2012 21:41:47 +0200
Message-ID: <4FA430FD.9090203@web.de>
Date: Fri, 04 May 2012 21:41:49 +0200
From: John Kearney <dethrophes@web.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:12.0) Gecko/20120428 Thunderbird/12.0.1
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205041241.04797.vapier@gentoo.org> <m2txzvon47.fsf@igel.home>
	<201205041453.32788.vapier@gentoo.org>
	<4FA427C3.8090304@web.de> <20120504191141.GN1622@eeg.ccf.org>
In-Reply-To: <20120504191141.GN1622@eeg.ccf.org>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Provags-ID: V02:K0:PCZ1oBi7/aAYVk2pZbWRrtBU4tvLZrfoJgXlBg7JFxq
	reXvWW5xr8OaLWZBwYpU7rHp/91acAat3Vdwi9pegWqJ6QHRu2
	Roi7SMIHDSdyfQhEDwTiHaRf4pERA2r/wYli41JXPcDwmwwnGs
	mGf2BEreLLVORkGKA4sNdYifccc7kBgG+RDKHpijeuIiaehWlq
	6rcKryU3V4UCncyJjKUNA==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-Received-From: 217.72.192.234
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, 04 May 2012 19:41:52 -0000

Am 04.05.2012 21:11, schrieb Greg Wooledge:
> On Fri, May 04, 2012 at 09:02:27PM +0200, John Kearney wrote:
>> set -m
>> cnt=0
>> trap ': $(( --cnt ))' SIGCHLD
>> set -- {0..20}
>> while [ $# -gt 0 ]; do
>> 	if [[ ${cnt} -lt 10 ]] ; then
>>
>>   		(
>> 			d=$(( RANDOM % 10 ))
>> 			echo $n sleeping $d
>> 			sleep $d
>> 		) &
>> 		: $(( ++cnt ))
>> 		shift
>> 	fi
>> 	echo going to wait
>> 	sleep 1
>> done
> You're busy-looping with a 1-second sleep instead of using wait and the
> signal handler, which was the whole purpose of the previous example (and
> of the set -m that you kept in yours).  And $n should probably be $1 there.
>
see my response to mike.


what you are thinking about is either what I suggested or something like
this

function TestProcess_22 {
        local d=$(( RANDOM % 10 ))
        echo $1 sleeping $d
        sleep $d
        echo $1 exiting $d
}
function trap_SIGCHLD {
        echo "SIGCHLD";
        if [ $cnt -gt 0 ]; then
            : $(( --cnt ))
            TestProcess_22 $cnt  &
        fi
}
set -m
cnt=20
maxJobCnt=10
trap 'trap_SIGCHLD' SIGCHLD
for (( x=0; x<maxJobCnt ; x++ )); do
            : $(( --cnt ))
            TestProcess_22 $cnt  &
done
wait
trap - SIGCHLD





From MAILER-DAEMON Fri May 04 16:17:09 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQOw9-0003FB-Nz
	for mharc-bug-bash@gnu.org; Fri, 04 May 2012 16:17:09 -0400
Received: from eggs.gnu.org ([208.118.235.92]:34741)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SQOw7-0003EK-E2
	for bug-bash@gnu.org; Fri, 04 May 2012 16:17:08 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SQOw5-0004kJ-Ec
	for bug-bash@gnu.org; Fri, 04 May 2012 16:17:07 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:39139)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SQOw5-0004k4-A7
	for bug-bash@gnu.org; Fri, 04 May 2012 16:17:05 -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 BYG97904; Fri, 04 May 2012 16:17: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 AWM32607 (AUTH cpr);
	Fri, 04 May 2012 16:17:02 -0400 (EDT)
Message-ID: <4FA4393E.5050208@case.edu>
Date: Fri, 04 May 2012 16:17:02 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Mike Frysinger <vapier@gentoo.org>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205041241.04797.vapier@gentoo.org> <m2txzvon47.fsf@igel.home>
	<201205041453.32788.vapier@gentoo.org>
In-Reply-To: <201205041453.32788.vapier@gentoo.org>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: Colin McEwan <colin.mcewan@gmail.com>,
	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, 04 May 2012 20:17:09 -0000

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

On 5/4/12 2:53 PM, Mike Frysinger wrote:

> it might be a little racy (wrt checking cnt >= 10 and then doing a wait), but 
> this is good enough for some things.  it does lose visibility into which pids 
> are live vs reaped, and their exit status, but i more often don't care about 
> that ...

What version of bash did you test this on?  Bash-4.0 is a little different
in how it treats the SIGCHLD trap.

Would it be useful for bash to set a shell variable to the PID of the just-
reaped process that caused the SIGCHLD trap?  That way you could keep an
array of PIDs and, if you wanted, use that variable to keep track of live
and dead children.

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+kOT4ACgkQu1hp8GTqdKs0iACfdXujLn96piuZGbJaIVu22TZ0
x/EAoIZo01MQJTCsEGvU0zmDghEEPjrA
=DOKm
-----END PGP SIGNATURE-----


From MAILER-DAEMON Sat May 05 00:27:38 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQWao-0002b9-Qn
	for mharc-bug-bash@gnu.org; Sat, 05 May 2012 00:27:38 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38739)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQWal-0002b2-Rg
	for bug-bash@gnu.org; Sat, 05 May 2012 00:27:37 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQWak-0003Ba-5k
	for bug-bash@gnu.org; Sat, 05 May 2012 00:27:35 -0400
Received: from smtp.gentoo.org ([140.211.166.183]:51401)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQWaj-0003BM-W9
	for bug-bash@gnu.org; Sat, 05 May 2012 00:27:34 -0400
Received: from vapier.localnet (localhost [127.0.0.1])
	by smtp.gentoo.org (Postfix) with ESMTP id 2ED811B4020;
	Sat,  5 May 2012 04:27:31 +0000 (UTC)
From: Mike Frysinger <vapier@gentoo.org>
Organization: wh0rd.org
To: chet.ramey@case.edu
Subject: Re: Parallelism a la make -j <n> / GNU parallel
Date: Sat, 5 May 2012 00:28:32 -0400
User-Agent: KMail/1.13.7 (Linux/3.3.4; KDE/4.6.5; x86_64; ; )
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205041453.32788.vapier@gentoo.org> <4FA4393E.5050208@case.edu>
In-Reply-To: <4FA4393E.5050208@case.edu>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart9296066.qoMkbQmlpv";
	protocol="application/pgp-signature"; micalg=pgp-sha1
Content-Transfer-Encoding: 7bit
Message-Id: <201205050028.33774.vapier@gentoo.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 140.211.166.183
Cc: Andreas Schwab <schwab@linux-m68k.org>, bug-bash@gnu.org,
	Colin McEwan <colin.mcewan@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: Sat, 05 May 2012 04:27:37 -0000

--nextPart9296066.qoMkbQmlpv
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

On Friday 04 May 2012 16:17:02 Chet Ramey wrote:
> On 5/4/12 2:53 PM, Mike Frysinger wrote:
> > it might be a little racy (wrt checking cnt >=3D 10 and then doing a wa=
it),
> > but this is good enough for some things.  it does lose visibility into
> > which pids are live vs reaped, and their exit status, but i more often
> > don't care about that ...
>=20
> What version of bash did you test this on?  Bash-4.0 is a little different
> in how it treats the SIGCHLD trap.

bash-4.2_p28.  wait returns 145 (which is SIGCHLD).

> Would it be useful for bash to set a shell variable to the PID of the jus=
t-
> reaped process that caused the SIGCHLD trap?  That way you could keep an
> array of PIDs and, if you wanted, use that variable to keep track of live
> and dead children.

we've got associative arrays now ... we could have one which contains all t=
he=20
relevant info:
	declare -A BASH_CHILD_STATUS=3D(
		["pid"]=3D1234
		["status"]=3D1	# WEXITSTATUS()
		["signal"]=3D13	# WTERMSIG()
	)
makes it easy to add any other fields people might care about ...
=2Dmike

--nextPart9296066.qoMkbQmlpv
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

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

iQIcBAABAgAGBQJPpKxxAAoJEEFjO5/oN/WBcp0QALFkbrDYP/Hii5nAcvPOpzHP
xH9ZywIoqGaHIt6bIHXFYfkq52IaBLm/J/pX3W8giByPlmkqMV6bx5cdxsS7GhIU
xDFaiiPV2eVrmhcJK5TE52L9PrsbYCXI2lQSh+axkFAW6cWPJT2R5Wsryq1D4mmN
87iHstf3ZEA0j+3KlWN1qxoTxny+U9Osw61xjFNs54aEibNxYv39UPaTjCpMRg9z
Nz1RDwbpT2joaTbG19wmxdtenLORpTrQicXlAM6n3muTgDnt8W+P2ALn6NcliCeE
0LQ6mnaOREQ446DaYjdgq+oJzOTdAP/eOoRg+8+8lZPAo5jwMpB6YbtKORzvRbi6
RfM9Ms4zbynxcnff4HJ2+9/9XxVHYfq8Ig3VwZFj9qLLVHD3gFxApUZQT3zrCpGt
yPb3+a0w3rXXV87Zaq0nGpgxDoMYmk48ObdjOxMruZ50yTIohTN5DaYWSxXA8ga6
vIZjsY1XXdwkcaKRQ762Y8X1ID2cuUvrjnhW+ON0HmYynseQQMr9M9pIumFOwQCX
fbtW4Haa1YLAnoRFFndtLmnRPjfwaHT/+GvGwsmkzF3ax9etrorRBjGkaYQDfhJn
z6PklhLckZDzRxmltH7sO2QlFGMuKl2gr8jLQp0kURPGDVxMMgz7avdZVa64kM5K
1h3ZEZua9hgYPcWl7yjT
=KTtU
-----END PGP SIGNATURE-----

--nextPart9296066.qoMkbQmlpv--


From MAILER-DAEMON Sat May 05 00:34:52 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQWho-0002wU-UZ
	for mharc-bug-bash@gnu.org; Sat, 05 May 2012 00:34:52 -0400
Received: from eggs.gnu.org ([208.118.235.92]:43623)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQWhm-0002wL-6c
	for bug-bash@gnu.org; Sat, 05 May 2012 00:34:51 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQWhk-0006Qg-7B
	for bug-bash@gnu.org; Sat, 05 May 2012 00:34:49 -0400
Received: from smtp.gentoo.org ([140.211.166.183]:51616)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQWhj-0006Qa-UZ
	for bug-bash@gnu.org; Sat, 05 May 2012 00:34:48 -0400
Received: from vapier.localnet (localhost [127.0.0.1])
	by smtp.gentoo.org (Postfix) with ESMTP id 57BB41B4001
	for <bug-bash@gnu.org>; Sat,  5 May 2012 04:34:46 +0000 (UTC)
From: Mike Frysinger <vapier@gentoo.org>
Organization: wh0rd.org
To: bug-bash@gnu.org
Subject: Re: Parallelism a la make -j <n> / GNU parallel
Date: Sat, 5 May 2012 00:35:48 -0400
User-Agent: KMail/1.13.7 (Linux/3.3.4; KDE/4.6.5; x86_64; ; )
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205041513.56696.vapier@gentoo.org> <4FA42D25.1000802@web.de>
In-Reply-To: <4FA42D25.1000802@web.de>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart2014253.AGvEi5LcvK";
	protocol="application/pgp-signature"; micalg=pgp-sha1
Content-Transfer-Encoding: 7bit
Message-Id: <201205050035.49001.vapier@gentoo.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 140.211.166.183
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, 05 May 2012 04:34:51 -0000

--nextPart2014253.AGvEi5LcvK
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: quoted-printable

On Friday 04 May 2012 15:25:25 John Kearney wrote:
> Am 04.05.2012 21:13, schrieb Mike Frysinger:
> > On Friday 04 May 2012 15:02:27 John Kearney wrote:
> >> Am 04.05.2012 20:53, schrieb Mike Frysinger:
> >>> On Friday 04 May 2012 13:46:32 Andreas Schwab wrote:
> >>>> Mike Frysinger <vapier@gentoo.org> writes:
> >>>>> i wish there was a way to use `wait` that didn't block until all the
> >>>>> pids returned.  maybe a dedicated option, or a shopt to enable this,
> >>>>> or a new command.
> >>>>>=20
> >>>>> for example, if i launched 10 jobs in the background, i usually want
> >>>>> to wait for the first one to exit so i can queue up another one, not
> >>>>> wait for all of them.
> >>>>=20
> >>>> If you set -m you can trap on SIGCHLD while waiting.
> >>>=20
> >>> awesome, that's a good mitigation
> >>>=20
> >>> #!/bin/bash
> >>> set -m
> >>> cnt=3D0
> >>> trap ': $(( --cnt ))' SIGCHLD
> >>> for n in {0..20} ; do
> >>> 	(
> >>> 		d=3D$(( RANDOM % 10 ))
> >>> 		echo $n sleeping $d
> >>> 		sleep $d
> >>> 	) &
> >>> 	: $(( ++cnt ))
> >>> 	if [[ ${cnt} -ge 10 ]] ; then
> >>> 		echo going to wait
> >>> 		wait
> >>> 	fi
> >>> done
> >>> trap - SIGCHLD
> >>> wait
> >>>=20
> >>> it might be a little racy (wrt checking cnt >=3D 10 and then doing a
> >>> wait), but this is good enough for some things.  it does lose
> >>> visibility into which pids are live vs reaped, and their exit status,
> >>> but i more often don't care about that ...
> >>=20
> >> That won't work I don't think.
> >=20
> > seemed to work fine for me
> >=20
> >> I think you meant something more like this?
> >=20
> > no.  i want to sleep the parent indefinitely and fork a child asap (hen=
ce
> > the `wait`), not busy wait with a one second delay.  the `set -m` +
> > SIGCHLD interrupted the `wait` and allowed it to return.
>=20
> The functionality of the code doesn't need SIGCHLD, it still waits till
> all the 10 processes are finished before starting the next lot.

not on my system it doesn't.  maybe a difference in bash versions.  as soon=
 as=20
one process quits, the `wait` is interrupted, a new one is forked, and the=
=20
parent goes back to sleep until another child exits.  if i don't `set -m`,=
=20
then i see what you describe -- the wait doesn't return until all 10 childr=
en=20
exit.
=2Dmike

--nextPart2014253.AGvEi5LcvK
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

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

iQIcBAABAgAGBQJPpK4kAAoJEEFjO5/oN/WB8EQQAJxKN5tPizUak/quXOfe141M
U1369spUpd/RvYG4eP0xz7/j1Wp1yp2ddqL7krJ2aB97x8ZZDlunF3mCrkZut/Rq
YQh4E/FEylnuQLHufHVqRhS0xPN9IztMldhtTLVG8gsPVDWeXVNyywngl1ZgFq3q
2E8ILrU+NavLBgeIWCakJVWJL+8VGF04v3XESac78Y1HrfKMgh+olG32d1fQZFOC
isddxHK8dyasxcwu3HcVboAGLtG9wyWH3TwcR57y7KpUQCeKdPNgPSTMJYY/1CE9
k3Ex2mYlbHQJQIljQp2wvY9t4niu/QXQfJalqUv2XLcrm16WpsOhmQBEzZc40HPL
egWY24F8RQCn3d3M+bOPpzxjdxJd69lwOscNEhrga17bDXEPM4X9yHic4cq4KBaY
sioDSK49wKv40kv/HhiGJEFQJ1mRqCQjU1H76z3GOOkWX7VMlJN3+q8PJ1qL4kMk
PxhxoplW1fGUXXBbaw3yw1juA3I/hCDl7X4OYjUFekj0h/dLFrtS2cKMcOOQCtMX
uX2ZFUBScZLjCE647bnu8t3owsoCzDjgi0ImrvxIXV2tqjglBUL1RXkMd5yEGa8L
SsLM6e6Kqa9HlDt8mrhR0X75+3Y5tjh63Z7yP+Qx8bpAE756gZiuTjcfnvXdgwGh
YzW3Ul9pVA1/A0l0HVuY
=sCZ8
-----END PGP SIGNATURE-----

--nextPart2014253.AGvEi5LcvK--


From MAILER-DAEMON Sat May 05 02:37:47 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQYcl-0001ZQ-KF
	for mharc-bug-bash@gnu.org; Sat, 05 May 2012 02:37:47 -0400
Received: from eggs.gnu.org ([208.118.235.92]:36960)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SQYci-0001Z4-Px
	for bug-bash@gnu.org; Sat, 05 May 2012 02:37:45 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SQYch-0003v6-44
	for bug-bash@gnu.org; Sat, 05 May 2012 02:37:44 -0400
Received: from mail-out.m-online.net ([212.18.0.9]:44491)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SQYcg-0003uy-U7
	for bug-bash@gnu.org; Sat, 05 May 2012 02:37:43 -0400
Received: from frontend1.mail.m-online.net (unknown [192.168.8.180])
	by mail-out.m-online.net (Postfix) with ESMTP id 3Vl0l76lTcz4Kh2N;
	Sat,  5 May 2012 08:37:39 +0200 (CEST)
Received: from linux.local (ppp-88-217-105-204.dynamic.mnet-online.de
	[88.217.105.204])
	by mail.mnet-online.de (Postfix) with ESMTPA id 3Vl0l75qmhz4KK5R;
	Sat,  5 May 2012 08:37:39 +0200 (CEST)
Received: by linux.local (Postfix, from userid 501)
	id B0BE91E560C; Sat,  5 May 2012 08:37:45 +0200 (CEST)
From: Andreas Schwab <schwab@linux-m68k.org>
To: Mike Frysinger <vapier@gentoo.org>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205041513.56696.vapier@gentoo.org> <4FA42D25.1000802@web.de>
	<201205050035.49001.vapier@gentoo.org>
X-Yow: I'm changing the CHANNEL..  But all I get is commercials
	for ``RONCO MIRACLE BAMBOO STEAMERS''!
Date: Sat, 05 May 2012 08:37:45 +0200
In-Reply-To: <201205050035.49001.vapier@gentoo.org> (Mike Frysinger's message
	of "Sat, 5 May 2012 00:35:48 -0400")
Message-ID: <m2ipgbnneu.fsf@linux-m68k.org>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.96 (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: 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, 05 May 2012 06:37:46 -0000

Mike Frysinger <vapier@gentoo.org> writes:

> not on my system it doesn't.  maybe a difference in bash versions.  as soon as 
> one process quits, the `wait` is interrupted, a new one is forked, and the 
> parent goes back to sleep until another child exits.  if i don't `set -m`, 
> then i see what you describe -- the wait doesn't return until all 10 children 
> exit.

(bash) Bash POSIX Mode::

 46. The arrival of `SIGCHLD'  when a trap is set on `SIGCHLD' does not
     interrupt the `wait' builtin and cause it to return immediately.
     The trap command is run once for each child that exits.

(I think the description is backwards.)

Andreas.

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


From MAILER-DAEMON Sat May 05 04:28:58 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQaMM-00011s-IN
	for mharc-bug-bash@gnu.org; Sat, 05 May 2012 04:28:58 -0400
Received: from eggs.gnu.org ([208.118.235.92]:47391)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQaMI-00011W-BB
	for bug-bash@gnu.org; Sat, 05 May 2012 04:28:56 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQaMF-00075P-Ec
	for bug-bash@gnu.org; Sat, 05 May 2012 04:28:53 -0400
Received: from fmmailgate02.web.de ([217.72.192.227]:51887)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQaME-000725-Te
	for bug-bash@gnu.org; Sat, 05 May 2012 04:28:51 -0400
Received: from moweb002.kundenserver.de (moweb002.kundenserver.de
	[172.19.20.108])
	by fmmailgate02.web.de (Postfix) with ESMTP id 52AC31C416120
	for <bug-bash@gnu.org>; Sat,  5 May 2012 10:28:49 +0200 (CEST)
Received: from [192.168.178.49] ([93.135.139.85]) by smtp.web.de (mrweb001)
	with ESMTPA (Nemesis) id 0LjJaZ-1RtBLq06tb-00dU9E;
	Sat, 05 May 2012 10:28:49 +0200
Message-ID: <4FA4E4C2.1070202@web.de>
Date: Sat, 05 May 2012 10:28:50 +0200
From: John Kearney <dethrophes@web.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:12.0) Gecko/20120428 Thunderbird/12.0.1
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205041513.56696.vapier@gentoo.org> <4FA42D25.1000802@web.de>
	<201205050035.49001.vapier@gentoo.org>
In-Reply-To: <201205050035.49001.vapier@gentoo.org>
X-Provags-ID: V02:K0:sEtO9MOjx/vXv+Blizs1XYVAN0qDvW4SA4SNXnFUbhH
	4bLYff+ZfqQM3zS1xj/G0iSuiPaCX/C50Z8jn39Z2ssKrTSLQJ
	GmxW+K33HZQUAXIeNid2ejQVbEI6Mhf2dBiEseZ+olMWRlJUT/
	xA2cPuIMy39Q/aG8FE9CiymeWVP23VG52Ja3i8de22swoiKw4k
	rZs0OPotg7XEqg61VpHnA==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-Received-From: 217.72.192.227
Content-Type: text/plain; charset=UTF-8
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: Sat, 05 May 2012 08:28:57 -0000

Am 05.05.2012 06:35, schrieb Mike Frysinger:
> On Friday 04 May 2012 15:25:25 John Kearney wrote:
>> Am 04.05.2012 21:13, schrieb Mike Frysinger:
>>> On Friday 04 May 2012 15:02:27 John Kearney wrote:
>>>> Am 04.05.2012 20:53, schrieb Mike Frysinger:
>>>>> On Friday 04 May 2012 13:46:32 Andreas Schwab wrote:
>>>>>> Mike Frysinger <vapier@gentoo.org> writes:
>>>>>>> i wish there was a way to use `wait` that didn't block until all the
>>>>>>> pids returned.  maybe a dedicated option, or a shopt to enable this,
>>>>>>> or a new command.
>>>>>>>
>>>>>>> for example, if i launched 10 jobs in the background, i usually want
>>>>>>> to wait for the first one to exit so i can queue up another one, not
>>>>>>> wait for all of them.
>>>>>> If you set -m you can trap on SIGCHLD while waiting.
>>>>> awesome, that's a good mitigation
>>>>>
>>>>> #!/bin/bash
>>>>> set -m
>>>>> cnt=0
>>>>> trap ': $(( --cnt ))' SIGCHLD
>>>>> for n in {0..20} ; do
>>>>> 	(
>>>>> 		d=$(( RANDOM % 10 ))
>>>>> 		echo $n sleeping $d
>>>>> 		sleep $d
>>>>> 	) &
>>>>> 	: $(( ++cnt ))
>>>>> 	if [[ ${cnt} -ge 10 ]] ; then
>>>>> 		echo going to wait
>>>>> 		wait
>>>>> 	fi
>>>>> done
>>>>> trap - SIGCHLD
>>>>> wait
>>>>>
>>>>> it might be a little racy (wrt checking cnt >= 10 and then doing a
>>>>> wait), but this is good enough for some things.  it does lose
>>>>> visibility into which pids are live vs reaped, and their exit status,
>>>>> but i more often don't care about that ...
>>>> That won't work I don't think.
>>> seemed to work fine for me
>>>
>>>> I think you meant something more like this?
>>> no.  i want to sleep the parent indefinitely and fork a child asap (hence
>>> the `wait`), not busy wait with a one second delay.  the `set -m` +
>>> SIGCHLD interrupted the `wait` and allowed it to return.
>> The functionality of the code doesn't need SIGCHLD, it still waits till
>> all the 10 processes are finished before starting the next lot.
> not on my system it doesn't.  maybe a difference in bash versions.  as soon as 
> one process quits, the `wait` is interrupted, a new one is forked, and the 
> parent goes back to sleep until another child exits.  if i don't `set -m`, 
> then i see what you describe -- the wait doesn't return until all 10 children 
> exit.
> -mike
Just to clarify what I see with your code, with the extra echos from me
and less threads so its shorter.
set -m
cnt=0
trap ': $(( --cnt )); echo "SIGCHLD"' SIGCHLD
for n in {0..10} ; do
    (
        d=$(( RANDOM % 10 ))
        echo $n sleeping $d
        sleep $d
        echo $n exiting $d
    ) &
    : $(( ++cnt ))
    if [[ ${cnt} -ge 5 ]] ; then
        echo going to wait
        wait
        echo Back from wait
    fi
done
trap - SIGCHLD
wait
   
gives
0 sleeping 9
2 sleeping 4
going to wait
4 sleeping 7
3 sleeping 4
1 sleeping 6
2 exiting 4
SIGCHLD
3 exiting 4
SIGCHLD
1 exiting 6
SIGCHLD
4 exiting 7
SIGCHLD
0 exiting 9
SIGCHLD
Back from wait
5 sleeping 5
6 sleeping 5
going to wait
8 sleeping 1
9 sleeping 1
7 sleeping 3
9 exiting 1
8 exiting 1
SIGCHLD
SIGCHLD
7 exiting 3
SIGCHLD
6 exiting 5
SIGCHLD
5 exiting 5




now
this code
function TestProcess_22 {
        local d=$(( RANDOM % 10 ))
        echo $1 sleeping $d
        sleep $d
        echo $1 exiting $d
}
function trap_SIGCHLD {
        echo "SIGCHLD";
        if [ $cnt -gt 0 ]; then
            : $(( --cnt ))
            TestProcess_22 $cnt  &
        fi
}
set -m
cnt=10
maxJobCnt=5
trap 'trap_SIGCHLD' SIGCHLD
for (( x=0; x<maxJobCnt ; x++ )); do
            : $(( --cnt ))
            TestProcess_22 $cnt  &
done
wait
trap - SIGCHLD

9 sleeping 5
7 sleeping 0
5 sleeping 8
6 sleeping 5
8 sleeping 6
7 exiting 0
SIGCHLD
4 sleeping 9
9 exiting 5
SIGCHLD
3 sleeping 5
6 exiting 5
SIGCHLD
2 sleeping 8
8 exiting 6
SIGCHLD
1 sleeping 8
5 exiting 8
SIGCHLD
0 sleeping 6
4 exiting 9
SIGCHLD
3 exiting 5
SIGCHLD
2 exiting 8
SIGCHLD
0 exiting 6
SIGCHLD
1 exiting 8
SIGCHLD




bash --version
GNU bash, version 4.2.24(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

uname -a
Linux DETH00 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC
2012 x86_64 x86_64 x86_64 GNU/Linux


From MAILER-DAEMON Sat May 05 05:04:23 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQaud-0004Nv-83
	for mharc-bug-bash@gnu.org; Sat, 05 May 2012 05:04:23 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58031)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <lhunath@lyndir.com>) id 1SQauZ-0004Nc-DV
	for bug-bash@gnu.org; Sat, 05 May 2012 05:04:21 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <lhunath@lyndir.com>) id 1SQauX-00050E-0L
	for bug-bash@gnu.org; Sat, 05 May 2012 05:04:18 -0400
Received: from mail-bk0-f41.google.com ([209.85.214.41]:55244)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <lhunath@lyndir.com>) id 1SQauW-0004xm-IN
	for bug-bash@gnu.org; Sat, 05 May 2012 05:04:16 -0400
Received: by bkcjm19 with SMTP id jm19so3481161bkc.0
	for <bug-bash@gnu.org>; Sat, 05 May 2012 02:04:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lyndir.com; s=google;
	h=subject:mime-version:content-type:from:in-reply-to:date:cc
	:message-id:references:to:x-mailer;
	bh=HH6tdUzjy0ntZ6zksqxW8lEmM/MaQqrA83NOuLYU528=;
	b=AyXXO/xV4SpC+vF6e46n9ifPwPUHtI6Cj0O8Jwe1Uj5EJzKb3pbPTUJlYKiJx+YewC
	Sb5ExpI/1H5qiKDjN7OJ/1qppcHqc9+nIgM3L+0QARIKMZKTNneY4jEsgfF6KVlYqww+
	fLa5mN6J4A/SqWBiP1MqIXsDmCl2z9pYRSut4=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=google.com; s=20120113;
	h=subject:mime-version:content-type:from:in-reply-to:date:cc
	:message-id:references:to:x-mailer:x-gm-message-state;
	bh=HH6tdUzjy0ntZ6zksqxW8lEmM/MaQqrA83NOuLYU528=;
	b=ULe8lxeqKZs4fKTS+xrFkzgQCscrktMcZlqZl0LHq46sMZzryhHSZra5VBPxDZ3Bev
	XI0+UUIJgZKfq16xdUhdZ8Qwrz/WhxvGLh19NfKB1q8KzIBenQTeBXgnQPNFGnuR9+Ur
	6FvaKZFPgTcDCXQ/fZvjOxk9QxSpzWSt4Tai/canVc/0XQ0RdzwjzjvboDSfuyAg4fAo
	3ySzYPDr1n5SlL3KP3eRBoIat4dkbKc3BtzHvaKa5EqLeuVKNu1HPnXtQHuZGcnJ8o9x
	xYC3FfwPGqgyHka+l7rygBzC3ThW4mO1/C4r/6lOM/JUANlPK+KjzWiepS+p5WfkcE1Q
	HIFg==
Received: by 10.205.131.7 with SMTP id ho7mr1650820bkc.62.1336208653245;
	Sat, 05 May 2012 02:04:13 -0700 (PDT)
Received: from [10.9.10.18] (c253.adsl.inet-telecom.org. [83.170.109.115])
	by mx.google.com with ESMTPS id z14sm21205054bky.15.2012.05.05.02.04.11
	(version=TLSv1/SSLv3 cipher=OTHER);
	Sat, 05 May 2012 02:04:12 -0700 (PDT)
Subject: Re: Severe Bash Bug with Arrays
Mime-Version: 1.0 (Apple Message framework v1257)
Content-Type: multipart/signed;
	boundary="Apple-Mail=_94F8ABC9-1478-4046-A177-D86F56C883DF";
	protocol="application/pkcs7-signature"; micalg=sha1
From: Maarten Billemont <lhunath@lyndir.com>
In-Reply-To: <4F9AED42.2000100@tlinx.org>
Date: Sat, 5 May 2012 11:04:09 +0200
Message-Id: <5EB8BEAB-5753-4894-9A79-2DDB09790A68@lyndir.com>
References: <CAHtRY2xP7yXrs_utDdPjHPw=yy_1_tsJCvMxx2sF9MpAJgsKDg@mail.gmail.com>
	<4F98863D.7070005@tlinx.org>
	<7825D6C5-E66D-4EB3-80D3-8A525AC6434F@lyndir.com>
	<4F9A16DB.9010602@tlinx.org> <20120427122733.GB4278@eeg.ccf.org>
	<4F9AED42.2000100@tlinx.org>
To: Linda Walsh <bash@tlinx.org>
X-Mailer: Apple Mail (2.1257)
X-Gm-Message-State: ALoCoQmml4Oiz9g3Qz6be+WCtq3VNX1VSm7iz4Bxu5Sd35f9tVm7u03gWVQ2f2as0SbJlRp83Ehq
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.214.41
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: Sat, 05 May 2012 09:04:21 -0000


--Apple-Mail=_94F8ABC9-1478-4046-A177-D86F56C883DF
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

This mail has gone slightly off-topic.  Hit mark as read if you don't =
care for that sort of thing.

On 27 Apr 2012, at 21:02, Linda Walsh wrote:

> Greg Wooledge wrote:
>=20
>> NEVER use eval plus a brace expansion to generate a list.  That's =
just
>> freakin' evil.  And unsafe:
>=20
> But I _like_ evil sometimes!   >:->

I don't care if you like evil in your sexual play or in your vendettas.  =
When you write code, evil is nothing worth liking.  In programming, evil =
is defined as something that is stupid and not thought through. Doing =
evil has harmful side effects. It's not cool to be evil, it's =
short-sighted.

> But reality is things like that save me time in typing in stuff or =
writing
> maint scripts on my machine -- they aren't meant for handling user =
input.
>=20
> They take hand editing to gen the paths I want and don't take user =
input,
> so it's a specialized usage in that case....

It's fine to do short-sighted hacks on the prompt, where you know your =
input well and will notice breakage so that you can recover.

It's not fine to do said things in scripts that run on unpredictable =
input and where you don't always notice breakage until it's caused =
irreparable harm.  I don't really care what lame justifications you come =
up with to try and justify broken system code to yourself, just don't =
try to convince us with them.

> Maarten Billemont wrote:
>=20
>> On 26 Apr 2012, at 01:18, Linda Walsh wrote:
>>> Ishtar:> echo "${b[*]}"
>> Please note that expanding array elements using [*] is usually NOT =
what anyone wants.
>=20
> It was exactly what I wanted for my example to work.  Please don't =
suggest
> non-working solutions to the example code I provided.  ${b[@]}  Will =
NOT
> work as a replacement for [*].  It isn't not BETTER, it is DIFFERENT.
> That's why there are both.

I didn't say never to use "${b[*]}".  I said it's usually not what =
anyone wants.  It's mostly only useful for merging arrays into a single =
string such as for user display of said array.  I explained that.  You =
are correct, of course, there are two syntaxes, they both do something =
different (when quoted), and that's fine.  They each have their use =
case.

What I *did* say, is never to use ${b[*]}.  And it also so happens that =
${b[@]} is not different from ${b[*]}.  And I stick with that point.  =
Never use unquoted expansion of arrays, not with [*], not with [@].

>> your array like above, you then follow up by re-splitting the whole =
thing using standard wordsplitting, not to mention pathname expanding =
the resulting words.
>=20
> I followed up?  I don't understand this.

When you leave ${b[*]} unquoted, you expand each element of the array, =
then ask bash to split the whole thing, and then pathname expand the =
result.  Not only did you just throw away any distinction between the =
different array elements, you also made an entirely new distinction =
(whitespace), and then you're asking bash to search the filesystems for =
any pathnames that match each of the words.  Seriously, nobody, ever, =
wants, this.  If they did, they'd have used a string instead.  And even =
then I question the sanity behind it.  Word-splitting is useful in a =
primitive POSIX shell that has no concept like arrays etc. to =
compensate.  In bash, it is the major cause of bugs, and best avoided.

> I would assume they'd have the
> intelligence to know when to use * or @ and I wouldn't have to talk =
down to them
> and cover basics.

I can't help notice the slight irony in my having to explain to you the =
necessity of quotes with array expansion.

>> You should always recommend the "${b[@]}" variant.
>=20
> I shouldn't ALWAYS do anything.  It's dangerous.
> You can do so for your examples... It won't work in the next
> two any more than the last one of the previous...

What?

Anyway, think about this: An array holds elements in a way that each is =
separated from the other.  To put these elements in an array is to want =
each element to be distinct from the others.  Therefore, the default way =
of expanding these elements should preserve that distinction.

Only in rare cases is the actual INTENT of the author to MERGE these =
elements into a single unit, a single string, thus throwing away the =
distinction between the elements.  And in THOSE cases and those cases =
ALONE should the author use "${array[*]}".  So yes, always recommend =
"${b[@]}", unless you know for a fact that the author is looking to =
merge the elements.

> sort an arg list:
>=20
> > args=3D"-dpi -xinerama -clipboard -unixkill -nowinkill -ac +bs -fp =
-multiwindow"
>=20
> > readarray -t dflts< <( a=3D( $args ); IFS=3D$'\n'; echo =
"${a[*]#?}"|sort -k1.2 )
>=20
> > printf "  defaults=3D(%s)" "${dflts[*]}"
>=20
>  defaults=3D(-ac +bs -clipboard -dpi -fp -multiwindow -nowinkill =
-unixkill -xinerama)

... What are you trying to prove?  That with a very specific sent of =
input values you can do some ugly and hacky mangling involving arrays =
and wordsplitting to sort a word-list?  Why are you even USING arrays =
here at all?  There's no point.  Just to replace spaces with newlines?

Also, you're doing a lot of really bad stuff here.  The point of the =
array structure is to be able to differentiate elements that can hold =
things like spaces and newlines.  Building an array from wordsplitting =
is senseless: you might as well just wordsplit the string wherever you =
were planning to use the array instead.

This snippet completely breaks any arguments that contain spaces and =
newlines in several places.  That is unacceptable.  It works for =
conveniently chosen demo arguments.  But it's still broken code.  =
Arguments are by definition c-strings.  Any code that doesn't treat them =
as such violates that definition.

Might I point out that you're stripping the leading - and + from your =
arguments and not putting them back?  I don't know where you got the =
output you claim from, but the real output has lost the first character =
of each word.

> Want to create pathnames using bash's /path/{}/  feature and have the =
paths
> in an array (for simple paths):
>=20
> > a=3D(lib tmp bin share)
> > (export IFS=3D,;eval "echo /usr/{${a[*]}}")
> /usr/lib /usr/tmp /usr/bin /usr/share

Don't do this.  You're injecting strings into bash code, and then =
evaluating that code.  You're basically injecting data into code.  Given =
certain crafted filenames, this makes for arbitrary code execution.  I =
really don't care about what kind of justifications you're going to try =
to come up with for this.

Ignoring the security aspect, this code will break for elements that =
contain commas or braces or quotes or newlines.  And you know what, yes, =
it's perfectly fine for filenames to contain those.  It's not fine for =
your code to break on them.

Grow up, use a loop.  It really doesn't hurt that much.

for dir in "${dirs[@]}"; do
    whatever "/usr/$dir"
done

If you're really a fan of short, there's still options:

whatever "${dirs[@]/#//usr/}"

> But I was pointing out that [*] has its place ... I use [@] alot
> more often than [*], but will use [*]

I agree.

> , though a bit irregularly,
> when I want to get the # of items in an array (where either would =
work)..
> though I could make a case if it was worth anything to me that #..@ =
return
> # items and #...[*] return total length of all items...

Which is why I always use {#array[@]} and not ${#array[*]}.  While they =
do the same, the former gives me a warm fuzzy feeling, the latter makes =
me feel guilty.

> C'est la vi...

vie ;-)=

--Apple-Mail=_94F8ABC9-1478-4046-A177-D86F56C883DF
Content-Disposition: attachment;
	filename=smime.p7s
Content-Type: application/pkcs7-signature;
	name=smime.p7s
Content-Transfer-Encoding: base64

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIDujCCA7Yw
ggKeoAMCAQICAhAJMA0GCSqGSIb3DQEBBQUAMIGOMQswCQYDVQQGEwJCRTEYMBYGA1UECBMPT29z
dCBWbGFhbmRlcmVuMQ0wCwYDVQQHEwRHZW50MQ8wDQYDVQQKEwZMeW5kaXIxJTAjBgNVBAMTHEx5
bmRpciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHjAcBgkqhkiG9w0BCQEWD2luZm9AbHluZGlyLmNv
bTAeFw0xMTEyMTkxMDM1NTVaFw0xMjEyMTgxMDM1NTVaMGQxCzAJBgNVBAYTAkJFMRgwFgYDVQQI
Ew9Pb3N0IFZsYWFuZGVyZW4xDTALBgNVBAcTBEdlbnQxDzANBgNVBAoTBkx5bmRpcjEbMBkGA1UE
AxQSbGh1bmF0aEBseW5kaXIuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuWlkIn09T
3Q21oZau4Eg/sZinlXAeOt/LfH6iuDvfq9uyNkuIBDvuFVyXhZW06p32V6TGplJ/NFH9yBorri5K
tbI+haHz9BUqKWLQ4sfvS5ofAMOUUVSkMxd5zIsZAZzocQRhw5oArQntcWxF1cRI9Ts1Q4n/RaUl
jUg4D/iU+wIDAQABo4HKMIHHMAkGA1UdEwQCMAAwHQYDVR0OBBYEFP/K5sYiDjhhP3T21jlpXtx/
HnbXMB8GA1UdIwQYMBaAFAQZYDwDUZk4gQgebrI2O+oG8Jn7MB0GA1UdEQQWMBSBEmxodW5hdGhA
bHluZGlyLmNvbTAaBgNVHRIEEzARgQ9pbmZvQGx5bmRpci5jb20wPwYJYIZIAYb4QgEEBDIWMGh0
dHBzOi8vc3NsLmx5bmRpci5jb20vcGtpL2NybC9jYS5seW5kaXIuY29tLnBlbTANBgkqhkiG9w0B
AQUFAAOCAQEAUrQSsbacRMfs1aKNzO3cOvmPZzw/fSsSF0xnieD2Q+dOZeZlIq40Q/gzQylXBNeX
wOQD5KpTo0amoA5HACA5x7KT9/FPLiB+Er6fH7fSNbTDwSE1cPR7igRRGJKCy12ZCzlIpX7BhI/h
XEaFysf9I095crExLT8ouFCvXsj3FuvZOMhBBSZ90roQAxzU9MRz9BozBWfCqZQhP7/AV5yYEiJu
rmqx5fUk+cBmL29RVtoTQS9ebYPAsZsklmfHwcpsKD+QupxxCKmgv3vJCn7/+64zvg21MWGsNxw3
S4GjrC33LKqRSOyv7jHCUYuo6IAeoq9T2ZRIcC35AtY+mEtYfzGCAvEwggLtAgEBMIGVMIGOMQsw
CQYDVQQGEwJCRTEYMBYGA1UECBMPT29zdCBWbGFhbmRlcmVuMQ0wCwYDVQQHEwRHZW50MQ8wDQYD
VQQKEwZMeW5kaXIxJTAjBgNVBAMTHEx5bmRpciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHjAcBgkq
hkiG9w0BCQEWD2luZm9AbHluZGlyLmNvbQICEAkwCQYFKw4DAhoFAKCCAbEwGAYJKoZIhvcNAQkD
MQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTIwNTA1MDkwNDEwWjAjBgkqhkiG9w0BCQQx
FgQUC+r/eWeYew8CjWGaULa+gkcYZ5owgaYGCSsGAQQBgjcQBDGBmDCBlTCBjjELMAkGA1UEBhMC
QkUxGDAWBgNVBAgTD09vc3QgVmxhYW5kZXJlbjENMAsGA1UEBxMER2VudDEPMA0GA1UEChMGTHlu
ZGlyMSUwIwYDVQQDExxMeW5kaXIgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR4wHAYJKoZIhvcNAQkB
Fg9pbmZvQGx5bmRpci5jb20CAhAJMIGoBgsqhkiG9w0BCRACCzGBmKCBlTCBjjELMAkGA1UEBhMC
QkUxGDAWBgNVBAgTD09vc3QgVmxhYW5kZXJlbjENMAsGA1UEBxMER2VudDEPMA0GA1UEChMGTHlu
ZGlyMSUwIwYDVQQDExxMeW5kaXIgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR4wHAYJKoZIhvcNAQkB
Fg9pbmZvQGx5bmRpci5jb20CAhAJMA0GCSqGSIb3DQEBAQUABIGAqXO+xKOnImyLfoS9I1OacZ+e
TsXtABaXEQUIJvMrZx/fP7UNUeB9LU4YtuHw4aG5Ug91n9zWtuT5FIkZumiRssPH9YQASw72jcLr
MPPUd9H+mb6VvLVjIu+KpT1FXHYNeJkj28h8IZrUw/ZhNl3Thr9OwTuHRC8xiIjsa57793EAAAAA
AAA=

--Apple-Mail=_94F8ABC9-1478-4046-A177-D86F56C883DF--


From MAILER-DAEMON Sat May 05 07:17:52 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQczo-0004az-PS
	for mharc-bug-bash@gnu.org; Sat, 05 May 2012 07:17:52 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41280)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SQczl-0004Zp-EI
	for bug-bash@gnu.org; Sat, 05 May 2012 07:17:51 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SQczj-0006Na-DF
	for bug-bash@gnu.org; Sat, 05 May 2012 07:17:49 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:53861
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SQczi-0006Mh-EO
	for bug-bash@gnu.org; Sat, 05 May 2012 07:17:47 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q45BHcgi022737; Sat, 5 May 2012 04:17:40 -0700
Message-ID: <4FA50C52.2090807@tlinx.org>
Date: Sat, 05 May 2012 04:17:38 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: Maarten Billemont <lhunath@lyndir.com>
Subject: Re: Severe Bash Bug with Arrays
References: <CAHtRY2xP7yXrs_utDdPjHPw=yy_1_tsJCvMxx2sF9MpAJgsKDg@mail.gmail.com>
	<4F98863D.7070005@tlinx.org>
	<7825D6C5-E66D-4EB3-80D3-8A525AC6434F@lyndir.com>
	<4F9A16DB.9010602@tlinx.org> <20120427122733.GB4278@eeg.ccf.org>
	<4F9AED42.2000100@tlinx.org>
	<5EB8BEAB-5753-4894-9A79-2DDB09790A68@lyndir.com>
In-Reply-To: <5EB8BEAB-5753-4894-9A79-2DDB09790A68@lyndir.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 05 May 2012 11:17:51 -0000



Maarten Billemont wrote:

> This mail has gone slightly off-topic.  Hit mark as read if you don't

 care for that sort of thing.
> I don't care if you like evil in your sexual play or in your vendettas.

> When you write code, evil is nothing worth liking.  In programming, 

> evil is defined as something that is stupid and not thought through. Doing

 > evil has harmful side effects. It's not cool to be evil, it's short-sighted.
---
	You have a very twisted view of evil.


> code to yourself, just don't try to convince me with them.

---
	There is no need to convince someone with your views of anything.

> 
>> Maarten Billemont wrote:
>>> On 26 Apr 2012, at 01:18, Linda Walsh wrote:
>>>> Ishtar:> echo "${b[*]}"
>>> Please note that expanding array elements using [*] is usually NOT what anyone wants.


> I didn't say never to use "${b[*]}". 
> What I *did* say, is never to use ${b[*]}.

===
	Uh, why do you bother to write about the horrors of such usage, when the
purpose of my test cases, was to progressively show effects.

When I echoed out the unquoted part, the intervening white space was removed...
To get the original text (with embedded line feeds, proving the file was
stored in the var), one must quote it.


	


> 
> Anyway, think about this: An array holds elements in a way that each is separated 

from the other.  To put these elements in an array is to want each element to be 

distinct from the others.  Therefore, the default way of expanding these elements 

should preserve that distinction.

======

When I want to preserve that distinction, I usually try something like
printq save "$typeset -p arrayname)"..
then later
eval "$save" to recover the array.

That's not what the original author was asking about.


>>> args="-dpi -xinerama -clipboard -unixkill -nowinkill -ac +bs -fp -multiwindow"
>>> readarray -t dflts< <( a=( $args ); IFS=$'\n'; echo "${a[*]#?}"|sort -k1.2 )
>>> printf "  defaults=(%s)" "${dflts[*]}"
>>  defaults=(-ac +bs -clipboard -dpi -fp -multiwindow -nowinkill -unixkill -xinerama)
> 
> ... What are you trying to prove?  That with a very specific sent of input values you 

> can do some ugly and hacky mangling involving arrays and wordsplitting to sort a word-list?

>   Why are you even USING arrays here at all?  There's no point.  Just to replace spaces

> with newlines?

---
	The original args are in the format they were originally needed in to be passed 
to a program.  I wanted to sort them alphabetically regardless of +/-,   then 
pass them to the program.  I took the existing input, sorted it, then restored 
it to the order needed by the program.

	The point is you know nothing about code other people deal with -- presuming 
that your rules apply everywhere is insulting and invasive.  Such
behaviors need to be dealt with like invasive weeds or they take over the 
garden.  Examples are rampant.


> Also, you're doing a lot of really bad stuff here. 

---
	Then, from you, I know I am doing well.


> Might I point out that you're stripping the leading - and + from your 

> arguments and not putting them back?  I don't know where you got the output

> you claim from, but the real output has lost the first character of each word.

---
	Umm...no.. didn't you READ the output you idjit**!  The output didn't
lose information.  I sorted by -k1.2 (1st field second char), that doesn't 
strip. (**-Inuyasa-ism).


% args="-dpi -xinerama -clipboard -unixkill -nowinkill -ac +bs -fp -multiwindow"
% readarray -t dflts< <( a=( $args ); IFS=$'\n'; echo "${a[*]#?}"|sort -k1.2 )
% printf "  defaults=(%s)" "${dflts[*]}"
   defaults=(-ac +bs -clipboard -dpi -fp -multiwindow -nowinkill -unixkill 
-xinerama)
---
The output is staring you in the face... the "+" goes with "bs" --
hmmm...  it's backing store, honest!


>> Want to create pathnames using bash's /path/{}/  feature and have the paths
>> in an array (for simple paths):
>>
>>> a=(lib tmp bin share)
>>> (export IFS=,;eval "echo /usr/{${a[*]}}")
>> /usr/lib /usr/tmp /usr/bin /usr/share
> 
> Don't do this.  You're injecting strings into bash code, and then evaluating that code. 

---
	Oh my gawd,  you mean like DATA as OBJECTS??  The basis for object oriented 
code?  NOT THAT Mr. Wizard!  Anything but that!



> Ignoring the security aspect, this code will break for elements that contain commas 

> or braces or quotes or newlines.  And you know what, yes, it's perfectly fine for

> filenames to contain those.  It's not fine for your code to break on them.

----
I am a MAJOR user of those.. when my stuff doesn't work I eat the doodoo -- 
sometimes I go back to more primitive.



> Grow up, use a loop.  It really doesn't hurt that much.

---
	If you don't know how to do things and know all of their pitfalls, how will you 
grow up?  If you prevent people from making their own mistakes, how will they 
grow -- they don't.  Doesn't mean you don't tell them, but to go off and preach 
at them.... how patently absurd to think that will accomplish anything.

>> C'est la vi...
> 
> vie ;-)

Oui, I realized that just as I hit send... *busted*...;-)






From MAILER-DAEMON Sat May 05 12:36:31 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQhyB-0002eB-M8
	for mharc-bug-bash@gnu.org; Sat, 05 May 2012 12:36:31 -0400
Received: from eggs.gnu.org ([208.118.235.92]:54799)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <blp@cs.stanford.edu>) id 1SQhy9-0002e4-B9
	for bug-bash@gnu.org; Sat, 05 May 2012 12:36:30 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <blp@cs.stanford.edu>) id 1SQhy7-0000xE-HC
	for bug-bash@gnu.org; Sat, 05 May 2012 12:36:28 -0400
Received: from cs-smtp-1.stanford.edu ([171.64.64.25]:54863)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <blp@cs.stanford.edu>) id 1SQhy7-0000x1-B9
	for bug-bash@gnu.org; Sat, 05 May 2012 12:36:27 -0400
Received: from [76.14.48.202] (helo=blp.benpfaff.org)
	by cs-smtp-1.Stanford.EDU with esmtpsa (TLSv1:AES128-SHA:128)
	(Exim 4.76) (envelope-from <blp@cs.stanford.edu>)
	id 1SQhy5-000427-4F; Sat, 05 May 2012 09:36:25 -0700
From: Ben Pfaff <blp@cs.stanford.edu>
To: Colin McEwan <colin.mcewan@gmail.com>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
Date: Sat, 05 May 2012 09:36:21 -0700
In-Reply-To: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	(Colin McEwan's message of "Thu, 3 May 2012 19:49:37 +0100")
Message-ID: <874nruk2ka.fsf@blp.benpfaff.org>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Scan-Signature: 4c7a780eb20f40a19c8376fd8d8b00d5
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 171.64.64.25
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: blp@cs.stanford.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, 05 May 2012 16:36:30 -0000

Colin McEwan <colin.mcewan@gmail.com> writes:

> I frequently find myself these days writing shell scripts, to run on
> multi-core machines, which could easily exploit lots of parallelism (eg. a
> batch of a hundred independent simulations).
>
> The basic parallelism construct of '&' for async execution is highly
> expressive, but it's not useful for this sort of use-case: starting up 100
> jobs at once will leave them competing, and lead to excessive context
> switching and paging.

Autotest testsuites, which are written in Bourne shell, do this
if you pass in a make-like "-j<N>" option.  Have you had a look
at how they are implemented?


From MAILER-DAEMON Sat May 05 23:25:32 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQs6G-0003sj-SD
	for mharc-bug-bash@gnu.org; Sat, 05 May 2012 23:25:32 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58821)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQs6D-0003sc-S1
	for bug-bash@gnu.org; Sat, 05 May 2012 23:25:31 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQs6C-0001pm-2t
	for bug-bash@gnu.org; Sat, 05 May 2012 23:25:29 -0400
Received: from fmmailgate01.web.de ([217.72.192.221]:57184)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQs6B-0001pX-PM
	for bug-bash@gnu.org; Sat, 05 May 2012 23:25:28 -0400
Received: from moweb001.kundenserver.de (moweb001.kundenserver.de
	[172.19.20.114])
	by fmmailgate01.web.de (Postfix) with ESMTP id ED4621ADD1A1F
	for <bug-bash@gnu.org>; Sun,  6 May 2012 05:25:24 +0200 (CEST)
Received: from [192.168.178.49] ([93.135.129.215]) by smtp.web.de (mrweb001)
	with ESMTPA (Nemesis) id 0MHpOP-1SRgNd2UJB-003Zf0;
	Sun, 06 May 2012 05:25:24 +0200
Message-ID: <4FA5EF26.3060208@web.de>
Date: Sun, 06 May 2012 05:25:26 +0200
From: John Kearney <dethrophes@web.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:12.0) Gecko/20120428 Thunderbird/12.0.1
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205041453.32788.vapier@gentoo.org> <4FA4393E.5050208@case.edu>
	<201205050028.33774.vapier@gentoo.org>
In-Reply-To: <201205050028.33774.vapier@gentoo.org>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Provags-ID: V02:K0:JoYpCz9Fc7oj4cBT0BMu0ZoidjCsk42OoscgwuGBM9+
	ynX3CN94U8xkD/tvEQxrAxpMCSa/Cx8JXUTwgVMFoeU1ngOQfQ
	RluVU0Vug1p/JMz78D49HhNWaOaHsQQ524CawPVYXc0vMd16oa
	yNHXe6QfRhbv23uyEcONAoPAwGo30JmcZQvS7qsWjgQ8Wb8qAX
	0kasGLD9+uuqo0lBUMhyQ==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-Received-From: 217.72.192.221
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, 06 May 2012 03:25:31 -0000

Am 05.05.2012 06:28, schrieb Mike Frysinger:
> On Friday 04 May 2012 16:17:02 Chet Ramey wrote:
>> On 5/4/12 2:53 PM, Mike Frysinger wrote:
>>> it might be a little racy (wrt checking cnt >= 10 and then doing a wait),
>>> but this is good enough for some things.  it does lose visibility into
>>> which pids are live vs reaped, and their exit status, but i more often
>>> don't care about that ...
>> What version of bash did you test this on?  Bash-4.0 is a little different
>> in how it treats the SIGCHLD trap.
> bash-4.2_p28.  wait returns 145 (which is SIGCHLD).
>
>> Would it be useful for bash to set a shell variable to the PID of the just-
>> reaped process that caused the SIGCHLD trap?  That way you could keep an
>> array of PIDs and, if you wanted, use that variable to keep track of live
>> and dead children.
> we've got associative arrays now ... we could have one which contains all the 
> relevant info:
> 	declare -A BASH_CHILD_STATUS=(
> 		["pid"]=1234
> 		["status"]=1	# WEXITSTATUS()
> 		["signal"]=13	# WTERMSIG()
> 	)
> makes it easy to add any other fields people might care about ...
> -mike
Is there actually a guarantee that there will be 1 SIGCHLD for every
exited process.
Isn't it actually a race condition?
what happens if 2 subprocesses exit simultaneously.
or if a process exits while already in the SIGCHLD trap.
I mean my normal interpretation of a interrupt/event/trap is just a
notification that I need to check what has happened. Or that there was
an event not the extent of the event?
I keep feeling that the following is bad practice

trap ': $(( --cnt ))' SIGCHLD

and would be better something like this

trap 'cnt=$(jobs -p | wc -w)' SIGCHLD


as such you would need something more like.
declare -a BASH_CHILD_STATUS=([1234]=1 [1235]=1 [1236]=1)

declare -a BASH_CHILD_STATUS_SIGNAL=([1234]=13 [1235]=13 [1236]=13)






From MAILER-DAEMON Sun May 06 02:27:21 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQuwD-00064j-BO
	for mharc-bug-bash@gnu.org; Sun, 06 May 2012 02:27:21 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58278)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQuwA-00064Z-Ot
	for bug-bash@gnu.org; Sun, 06 May 2012 02:27:20 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQuw8-0008Dg-Ao
	for bug-bash@gnu.org; Sun, 06 May 2012 02:27:18 -0400
Received: from smtp.gentoo.org ([140.211.166.183]:36491)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQuw7-0008DN-W7
	for bug-bash@gnu.org; Sun, 06 May 2012 02:27:16 -0400
Received: from vapier.localnet (localhost [127.0.0.1])
	by smtp.gentoo.org (Postfix) with ESMTP id 94A081B4033;
	Sun,  6 May 2012 06:27:13 +0000 (UTC)
From: Mike Frysinger <vapier@gentoo.org>
Organization: wh0rd.org
To: bug-bash@gnu.org
Subject: Re: Parallelism a la make -j <n> / GNU parallel
Date: Sun, 6 May 2012 02:28:23 -0400
User-Agent: KMail/1.13.7 (Linux/3.3.4; KDE/4.6.5; x86_64; ; )
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205050035.49001.vapier@gentoo.org> <4FA4E4C2.1070202@web.de>
In-Reply-To: <4FA4E4C2.1070202@web.de>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart11636830.ZcyWqxX5a6";
	protocol="application/pgp-signature"; micalg=pgp-sha1
Content-Transfer-Encoding: 7bit
Message-Id: <201205060228.24280.vapier@gentoo.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 140.211.166.183
Cc: John Kearney <dethrophes@web.de>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 06 May 2012 06:27:20 -0000

--nextPart11636830.ZcyWqxX5a6
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: quoted-printable

On Saturday 05 May 2012 04:28:50 John Kearney wrote:
> Am 05.05.2012 06:35, schrieb Mike Frysinger:
> > On Friday 04 May 2012 15:25:25 John Kearney wrote:
> >> Am 04.05.2012 21:13, schrieb Mike Frysinger:
> >>> On Friday 04 May 2012 15:02:27 John Kearney wrote:
> >>>> Am 04.05.2012 20:53, schrieb Mike Frysinger:
> >>>>> On Friday 04 May 2012 13:46:32 Andreas Schwab wrote:
> >>>>>> Mike Frysinger writes:
> >>>>>>> i wish there was a way to use `wait` that didn't block until all
> >>>>>>> the pids returned.  maybe a dedicated option, or a shopt to enable
> >>>>>>> this, or a new command.
> >>>>>>>=20
> >>>>>>> for example, if i launched 10 jobs in the background, i usually
> >>>>>>> want to wait for the first one to exit so i can queue up another
> >>>>>>> one, not wait for all of them.
> >>>>>>=20
> >>>>>> If you set -m you can trap on SIGCHLD while waiting.
> >>>>>=20
> >>>>> awesome, that's a good mitigation
> >>>>>=20
> >>>>> #!/bin/bash
> >>>>> set -m
> >>>>> cnt=3D0
> >>>>> trap ': $(( --cnt ))' SIGCHLD
> >>>>> for n in {0..20} ; do
> >>>>>=20
> >>>>> 	(
> >>>>> =09
> >>>>> 		d=3D$(( RANDOM % 10 ))
> >>>>> 		echo $n sleeping $d
> >>>>> 		sleep $d
> >>>>> =09
> >>>>> 	) &
> >>>>> =09
> >>>>> 	: $(( ++cnt ))
> >>>>> =09
> >>>>> 	if [[ ${cnt} -ge 10 ]] ; then
> >>>>> =09
> >>>>> 		echo going to wait
> >>>>> 		wait
> >>>>> =09
> >>>>> 	fi
> >>>>>=20
> >>>>> done
> >>>>> trap - SIGCHLD
> >>>>> wait
> >>>>>=20
> >>>>> it might be a little racy (wrt checking cnt >=3D 10 and then doing a
> >>>>> wait), but this is good enough for some things.  it does lose
> >>>>> visibility into which pids are live vs reaped, and their exit statu=
s,
> >>>>> but i more often don't care about that ...
> >>>>=20
> >>>> That won't work I don't think.
> >>>=20
> >>> seemed to work fine for me
> >>>=20
> >>>> I think you meant something more like this?
> >>>=20
> >>> no.  i want to sleep the parent indefinitely and fork a child asap
> >>> (hence the `wait`), not busy wait with a one second delay.  the `set
> >>> -m` + SIGCHLD interrupted the `wait` and allowed it to return.
> >>=20
> >> The functionality of the code doesn't need SIGCHLD, it still waits till
> >> all the 10 processes are finished before starting the next lot.
> >=20
> > not on my system it doesn't.  maybe a difference in bash versions.  as
> > soon as one process quits, the `wait` is interrupted, a new one is
> > forked, and the parent goes back to sleep until another child exits.  if
> > i don't `set -m`, then i see what you describe -- the wait doesn't
> > return until all 10 children exit.
>=20
> Just to clarify what I see with your code, with the extra echos from me
> and less threads so its shorter.

that's not what i was getting.  as soon as i saw the echo of SIGCHLD, a new=
=20
"sleeping" would get launched.
=2Dmike

--nextPart11636830.ZcyWqxX5a6
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

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

iQIcBAABAgAGBQJPphoIAAoJEEFjO5/oN/WBRRsP/RM9g+7nBbNRAZHGzYJ2XpGj
vm2p3GCqmkG5C9ZaOj4prNyPLB7vj+99SrFGSVmJHk6E7VQBlYAHFw5DDnSS+/OK
+Xq4qKDYFu4Df6rKSP/LbLLHc4gpgGFwojRyeDyDoS34u+P0yW88OjZNKzmyHVLt
TfSxrGnO4Hjx1lmqGu8epn9VCHi5FeFdCdJx16/ekG13Fm7PJUduPCm7fbJbiw7T
0XQ3jbzjYiVMMrKJ/WQDTBtOoNtbVjzE0lVLKF0K2jGoFlny1tL7COEYPvOoFWG/
cIeLKzmsrpYEz4cP8rugLbeYmTlgEyfMjVaKMZKnFbVtIjl/VdMMRQTznaM9Gz6+
7XlLp9Yr3b/tJFke5rFlfF19h4so5as+9Cz8V05IxFDWFWmQfkleghOu/s1pTBY6
TDNYeqONErvnL+IfJ+/DD1uocW4nY8FW8Rs6Eb80r+q+adNI1N3qh5iJCTMekm9x
1OZyrH1JSNuNQDJkhY4Yh9FoJJAjAHMztZmrdtWwD1cCp+I2h9sTjs14GaetT/rP
KvAGn5g7CMPjmK7avFDzmg+/bvcg+DSnB0Tk3yHalc8yA/X6vzahSaj2qSaIxG/C
WZr9hFW1VG3LaJIfR+H0oK/8kwtaY9tufj5eBfqoNDgRXj0RYTlGpIImNvUBFF8u
ha42qVI4Ktw0qxZiYNiy
=PPdi
-----END PGP SIGNATURE-----

--nextPart11636830.ZcyWqxX5a6--


From MAILER-DAEMON Sun May 06 02:27:24 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQuwG-0006B1-Ei
	for mharc-bug-bash@gnu.org; Sun, 06 May 2012 02:27:24 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58295)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQuwC-00064h-J6
	for bug-bash@gnu.org; Sun, 06 May 2012 02:27:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQuwA-0008E4-QN
	for bug-bash@gnu.org; Sun, 06 May 2012 02:27:20 -0400
Received: from smtp.gentoo.org ([140.211.166.183]:36493)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQuwA-0008Dt-KY
	for bug-bash@gnu.org; Sun, 06 May 2012 02:27:18 -0400
Received: from vapier.localnet (localhost [127.0.0.1])
	by smtp.gentoo.org (Postfix) with ESMTP id 709F11B4033;
	Sun,  6 May 2012 06:27:17 +0000 (UTC)
From: Mike Frysinger <vapier@gentoo.org>
Organization: wh0rd.org
To: bug-bash@gnu.org
Subject: Re: Parallelism a la make -j <n> / GNU parallel
Date: Sun, 6 May 2012 02:28:26 -0400
User-Agent: KMail/1.13.7 (Linux/3.3.4; KDE/4.6.5; x86_64; ; )
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205050028.33774.vapier@gentoo.org> <4FA5EF26.3060208@web.de>
In-Reply-To: <4FA5EF26.3060208@web.de>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart2151596.ETJkhKeIEC";
	protocol="application/pgp-signature"; micalg=pgp-sha1
Content-Transfer-Encoding: 7bit
Message-Id: <201205060228.27937.vapier@gentoo.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 140.211.166.183
Cc: John Kearney <dethrophes@web.de>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 06 May 2012 06:27:23 -0000

--nextPart2151596.ETJkhKeIEC
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

On Saturday 05 May 2012 23:25:26 John Kearney wrote:
> Am 05.05.2012 06:28, schrieb Mike Frysinger:
> > On Friday 04 May 2012 16:17:02 Chet Ramey wrote:
> >> On 5/4/12 2:53 PM, Mike Frysinger wrote:
> >>> it might be a little racy (wrt checking cnt >=3D 10 and then doing a
> >>> wait), but this is good enough for some things.  it does lose
> >>> visibility into which pids are live vs reaped, and their exit status,
> >>> but i more often don't care about that ...
> >>=20
> >> What version of bash did you test this on?  Bash-4.0 is a little
> >> different in how it treats the SIGCHLD trap.
> >=20
> > bash-4.2_p28.  wait returns 145 (which is SIGCHLD).
> >=20
> >> Would it be useful for bash to set a shell variable to the PID of the
> >> just- reaped process that caused the SIGCHLD trap?  That way you could
> >> keep an array of PIDs and, if you wanted, use that variable to keep
> >> track of live and dead children.
> >=20
> > we've got associative arrays now ... we could have one which contains a=
ll
> > the relevant info:
> > 	declare -A BASH_CHILD_STATUS=3D(
> > 		["pid"]=3D1234
> > 		["status"]=3D1	# WEXITSTATUS()
> > 		["signal"]=3D13	# WTERMSIG()
> > 	)
> >=20
> > makes it easy to add any other fields people might care about ...
>=20
> Is there actually a guarantee that there will be 1 SIGCHLD for every
> exited process.
> Isn't it actually a race condition?

when SIGCHLD is delivered doesn't matter.  the child stays in a zombie stat=
e=20
until the parent calls wait() on it and gets its status.  so you can have=20
`wait` return one child's status at a time.
=2Dmike

--nextPart2151596.ETJkhKeIEC
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

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

iQIcBAABAgAGBQJPphoLAAoJEEFjO5/oN/WBQBkP/3oH9La7GK+WudpgXaF8tcz6
mfxUmv3W5W2pg+68KBCPqo1iQidAFYW7g0alPySaQbGTKnKyx82J06Y+FqEGqfjO
ITX2Ri+c7rcDbdjGQVQGrHhD0nAHDRpD/W966M4sYreiK7oJmTjzXZ+hKOTcCvI8
oKqyqRBsxsibEyg8vLGbNj/t1zPTe7+n8edbJ4ys2rzqcLLdFT7y1VEcOKhl55YI
dUfh6av6SUYTWc2O/G7voHCaGuCFiDJ+9OGE1Dmf/JA9yPhDOowK/7Tj6HIqWG/5
UbTAjfYbjLRAC0OU+GtupLDDC94G7wie//R/eOugGkgLwgJ6T7mFhTvtRWdexJOS
xqI2m/rlYXiDZ4O9on68/a7AAr3s9/rizwq7ceNq+Pke3QRDUqgDNY5/QaKx+8Fv
eH6YSEsLAJ/SGWJTiSCRIVHde7wG9cIHZE9E5q+xvoA2v3DAZ4HmT3ldzf1DmUNM
ykwoOarrJk6t1/ODAwK1WkivkwB11j1crymOvR4gITFpAUE48W4ZVDvl3qlxBrfE
v2XKmBIAciBz75LHnZ5IK8Yvr7xpeGrTskhUOm53AeV7n+tP0PIwtOntlz7C24zj
4cXQKrW3ibZfayjU0c7NGWV3x3TVCjpTyv33qaynzTOw6Kjg+1c7QORiBb0/Pfua
xkpEvFKWX4NqVtXKkJpl
=CN96
-----END PGP SIGNATURE-----

--nextPart2151596.ETJkhKeIEC--


From MAILER-DAEMON Sun May 06 03:25:35 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQvqZ-0002Gq-2a
	for mharc-bug-bash@gnu.org; Sun, 06 May 2012 03:25:35 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37931)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQvqW-0002Gk-O6
	for bug-bash@gnu.org; Sun, 06 May 2012 03:25:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQvqU-0007Lv-U4
	for bug-bash@gnu.org; Sun, 06 May 2012 03:25:32 -0400
Received: from fmmailgate03.web.de ([217.72.192.234]:49751)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQvqU-0007Li-Kb
	for bug-bash@gnu.org; Sun, 06 May 2012 03:25:30 -0400
Received: from moweb002.kundenserver.de (moweb002.kundenserver.de
	[172.19.20.108])
	by fmmailgate03.web.de (Postfix) with ESMTP id A4AE41B451BA4
	for <bug-bash@gnu.org>; Sun,  6 May 2012 09:25:26 +0200 (CEST)
Received: from [192.168.178.49] ([93.135.129.215]) by smtp.web.de (mrweb002)
	with ESMTPA (Nemesis) id 0LqlAw-1RvjlM0g7u-00eHxW;
	Sun, 06 May 2012 09:25:26 +0200
Message-ID: <4FA62767.4080402@web.de>
Date: Sun, 06 May 2012 09:25:27 +0200
From: John Kearney <dethrophes@web.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:12.0) Gecko/20120428 Thunderbird/12.0.1
MIME-Version: 1.0
To: Mike Frysinger <vapier@gentoo.org>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205050028.33774.vapier@gentoo.org> <4FA5EF26.3060208@web.de>
	<201205060228.27937.vapier@gentoo.org>
In-Reply-To: <201205060228.27937.vapier@gentoo.org>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Provags-ID: V02:K0:szaeWZtOaqKYtjQn1dTVqgXBCeHjnmzOOK2siuERDxq
	1vnr845b1yTUV0sXElzMi7Q/vZOISlZ3BzxaLKZyHv0Ahsvajn
	HoefvWYJmMEH/3Mep7LbHdNaByQrO8XN/fqXNVdfuGSPxTf0wf
	VbNcW0NGooJ470OTriZmAtnOGy97/BmajYQhsSt1vhcvfrJOaB
	F7dmWd3zJjrcTsaO+BKjA==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-Received-From: 217.72.192.234
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, 06 May 2012 07:25:34 -0000

Am 06.05.2012 08:28, schrieb Mike Frysinger:
> On Saturday 05 May 2012 23:25:26 John Kearney wrote:
>> Am 05.05.2012 06:28, schrieb Mike Frysinger:
>>> On Friday 04 May 2012 16:17:02 Chet Ramey wrote:
>>>> On 5/4/12 2:53 PM, Mike Frysinger wrote:
>>>>> it might be a little racy (wrt checking cnt >= 10 and then doing a
>>>>> wait), but this is good enough for some things.  it does lose
>>>>> visibility into which pids are live vs reaped, and their exit status,
>>>>> but i more often don't care about that ...
>>>> What version of bash did you test this on?  Bash-4.0 is a little
>>>> different in how it treats the SIGCHLD trap.
>>> bash-4.2_p28.  wait returns 145 (which is SIGCHLD).
>>>
>>>> Would it be useful for bash to set a shell variable to the PID of the
>>>> just- reaped process that caused the SIGCHLD trap?  That way you could
>>>> keep an array of PIDs and, if you wanted, use that variable to keep
>>>> track of live and dead children.
>>> we've got associative arrays now ... we could have one which contains all
>>> the relevant info:
>>> 	declare -A BASH_CHILD_STATUS=(
>>> 		["pid"]=1234
>>> 		["status"]=1	# WEXITSTATUS()
>>> 		["signal"]=13	# WTERMSIG()
>>> 	)
>>>
>>> makes it easy to add any other fields people might care about ...
>> Is there actually a guarantee that there will be 1 SIGCHLD for every
>> exited process.
>> Isn't it actually a race condition?
> when SIGCHLD is delivered doesn't matter.  the child stays in a zombie state 
> until the parent calls wait() on it and gets its status.  so you can have 
> `wait` return one child's status at a time.
> -mike
but I think my point still stands
trap ': $(( cnt-- ))' SIGCHLD
is a bad idea, you actually need to verify how many jobs are running not
just arbitrarily decrement a counter, because your not guaranteed a trap
for each process. I mean sure it will normally work, but its not
guaranteed to work.

Also I think the question would be is there any point in forcing bash to
issue 1 status at a time? It seems to make more sense to issue them in
bulk.
So bash could populate an array of all reaped processes in one trap
rather than having to execute multiple traps. This is what bash does
internally anyway?



From MAILER-DAEMON Sun May 06 03:35:19 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQvzz-0002lf-4B
	for mharc-bug-bash@gnu.org; Sun, 06 May 2012 03:35:19 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52037)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQvzw-0002lT-2q
	for bug-bash@gnu.org; Sun, 06 May 2012 03:35:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQvzu-0002nZ-7L
	for bug-bash@gnu.org; Sun, 06 May 2012 03:35:15 -0400
Received: from fmmailgate01.web.de ([217.72.192.221]:42398)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SQvzt-0002lu-Tg
	for bug-bash@gnu.org; Sun, 06 May 2012 03:35:14 -0400
Received: from moweb001.kundenserver.de (moweb001.kundenserver.de
	[172.19.20.114])
	by fmmailgate01.web.de (Postfix) with ESMTP id 389821ADD883E
	for <bug-bash@gnu.org>; Sun,  6 May 2012 09:35:12 +0200 (CEST)
Received: from [192.168.178.49] ([93.135.129.215]) by smtp.web.de (mrweb001)
	with ESMTPA (Nemesis) id 0MTxxp-1Sa2gQ30d7-00QnBO;
	Sun, 06 May 2012 09:35:12 +0200
Message-ID: <4FA629B1.7040808@web.de>
Date: Sun, 06 May 2012 09:35:13 +0200
From: John Kearney <dethrophes@web.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:12.0) Gecko/20120428 Thunderbird/12.0.1
MIME-Version: 1.0
To: Mike Frysinger <vapier@gentoo.org>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205050035.49001.vapier@gentoo.org> <4FA4E4C2.1070202@web.de>
	<201205060228.24280.vapier@gentoo.org>
In-Reply-To: <201205060228.24280.vapier@gentoo.org>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Provags-ID: V02:K0:fEPpvOuEU9joYY71dSjcDSGRQHZGpQRuQ/08khBHFRQ
	CR4KOYMysyDH4NKxkou5PSmX+cgMiR/jd68zbEYbXse/E3cwmH
	HxPVxRm2pHcLlC1NEzL2c4yyKiM5K65KD1bxrQFbkI2zymywn4
	rxV9HkrLeMRzUULKXI/CQ/NhdD4s1eKoazXWaXIBZ5UMNh0Euc
	CgBl+Oq478oF4RRRxoJ8w==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-Received-From: 217.72.192.221
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, 06 May 2012 07:35:17 -0000

Am 06.05.2012 08:28, schrieb Mike Frysinger:
> On Saturday 05 May 2012 04:28:50 John Kearney wrote:
>> Am 05.05.2012 06:35, schrieb Mike Frysinger:
>>> On Friday 04 May 2012 15:25:25 John Kearney wrote:
>>>> Am 04.05.2012 21:13, schrieb Mike Frysinger:
>>>>> On Friday 04 May 2012 15:02:27 John Kearney wrote:
>>>>>> Am 04.05.2012 20:53, schrieb Mike Frysinger:
>>>>>>> On Friday 04 May 2012 13:46:32 Andreas Schwab wrote:
>>>>>>>> Mike Frysinger writes:
>>>>>>>>> i wish there was a way to use `wait` that didn't block until all
>>>>>>>>> the pids returned.  maybe a dedicated option, or a shopt to enable
>>>>>>>>> this, or a new command.
>>>>>>>>>
>>>>>>>>> for example, if i launched 10 jobs in the background, i usually
>>>>>>>>> want to wait for the first one to exit so i can queue up another
>>>>>>>>> one, not wait for all of them.
>>>>>>>> If you set -m you can trap on SIGCHLD while waiting.
>>>>>>> awesome, that's a good mitigation
>>>>>>>
>>>>>>> #!/bin/bash
>>>>>>> set -m
>>>>>>> cnt=0
>>>>>>> trap ': $(( --cnt ))' SIGCHLD
>>>>>>> for n in {0..20} ; do
>>>>>>>
>>>>>>> 	(
>>>>>>> 	
>>>>>>> 		d=$(( RANDOM % 10 ))
>>>>>>> 		echo $n sleeping $d
>>>>>>> 		sleep $d
>>>>>>> 	
>>>>>>> 	) &
>>>>>>> 	
>>>>>>> 	: $(( ++cnt ))
>>>>>>> 	
>>>>>>> 	if [[ ${cnt} -ge 10 ]] ; then
>>>>>>> 	
>>>>>>> 		echo going to wait
>>>>>>> 		wait
>>>>>>> 	
>>>>>>> 	fi
>>>>>>>
>>>>>>> done
>>>>>>> trap - SIGCHLD
>>>>>>> wait
>>>>>>>
>>>>>>> it might be a little racy (wrt checking cnt >= 10 and then doing a
>>>>>>> wait), but this is good enough for some things.  it does lose
>>>>>>> visibility into which pids are live vs reaped, and their exit status,
>>>>>>> but i more often don't care about that ...
>>>>>> That won't work I don't think.
>>>>> seemed to work fine for me
>>>>>
>>>>>> I think you meant something more like this?
>>>>> no.  i want to sleep the parent indefinitely and fork a child asap
>>>>> (hence the `wait`), not busy wait with a one second delay.  the `set
>>>>> -m` + SIGCHLD interrupted the `wait` and allowed it to return.
>>>> The functionality of the code doesn't need SIGCHLD, it still waits till
>>>> all the 10 processes are finished before starting the next lot.
>>> not on my system it doesn't.  maybe a difference in bash versions.  as
>>> soon as one process quits, the `wait` is interrupted, a new one is
>>> forked, and the parent goes back to sleep until another child exits.  if
>>> i don't `set -m`, then i see what you describe -- the wait doesn't
>>> return until all 10 children exit.
>> Just to clarify what I see with your code, with the extra echos from me
>> and less threads so its shorter.
> that's not what i was getting.  as soon as i saw the echo of SIGCHLD, a new 
> "sleeping" would get launched.
> -mike
Ok then, thats weird because it doesn't really make sense to me why a
SIGCHLD would interrupt the wait command. Oh well.


From MAILER-DAEMON Sun May 06 03:48:08 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SQwCO-0003dn-LG
	for mharc-bug-bash@gnu.org; Sun, 06 May 2012 03:48:08 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41940)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQwCL-0003dh-Qv
	for bug-bash@gnu.org; Sun, 06 May 2012 03:48:07 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQwCJ-0007MU-Sl
	for bug-bash@gnu.org; Sun, 06 May 2012 03:48:05 -0400
Received: from smtp.gentoo.org ([140.211.166.183]:39140)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SQwCJ-0007M0-KM
	for bug-bash@gnu.org; Sun, 06 May 2012 03:48:03 -0400
Received: from vapier.localnet (localhost [127.0.0.1])
	by smtp.gentoo.org (Postfix) with ESMTP id A6BFA1B4033;
	Sun,  6 May 2012 07:48:00 +0000 (UTC)
From: Mike Frysinger <vapier@gentoo.org>
Organization: wh0rd.org
To: John Kearney <dethrophes@web.de>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
Date: Sun, 6 May 2012 03:49:10 -0400
User-Agent: KMail/1.13.7 (Linux/3.3.4; KDE/4.6.5; x86_64; ; )
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205060228.27937.vapier@gentoo.org> <4FA62767.4080402@web.de>
In-Reply-To: <4FA62767.4080402@web.de>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart5982537.snyICOFLxn";
	protocol="application/pgp-signature"; micalg=pgp-sha1
Content-Transfer-Encoding: 7bit
Message-Id: <201205060349.11773.vapier@gentoo.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 140.211.166.183
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, 06 May 2012 07:48:07 -0000

--nextPart5982537.snyICOFLxn
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

On Sunday 06 May 2012 03:25:27 John Kearney wrote:
> Am 06.05.2012 08:28, schrieb Mike Frysinger:
> > On Saturday 05 May 2012 23:25:26 John Kearney wrote:
> >> Am 05.05.2012 06:28, schrieb Mike Frysinger:
> >>> On Friday 04 May 2012 16:17:02 Chet Ramey wrote:
> >>>> On 5/4/12 2:53 PM, Mike Frysinger wrote:
> >>>>> it might be a little racy (wrt checking cnt >=3D 10 and then doing a
> >>>>> wait), but this is good enough for some things.  it does lose
> >>>>> visibility into which pids are live vs reaped, and their exit statu=
s,
> >>>>> but i more often don't care about that ...
> >>>>=20
> >>>> What version of bash did you test this on?  Bash-4.0 is a little
> >>>> different in how it treats the SIGCHLD trap.
> >>>=20
> >>> bash-4.2_p28.  wait returns 145 (which is SIGCHLD).
> >>>=20
> >>>> Would it be useful for bash to set a shell variable to the PID of the
> >>>> just- reaped process that caused the SIGCHLD trap?  That way you cou=
ld
> >>>> keep an array of PIDs and, if you wanted, use that variable to keep
> >>>> track of live and dead children.
> >>>=20
> >>> we've got associative arrays now ... we could have one which contains
> >>> all the relevant info:
> >>> 	declare -A BASH_CHILD_STATUS=3D(
> >>> 		["pid"]=3D1234
> >>> 		["status"]=3D1	# WEXITSTATUS()
> >>> 		["signal"]=3D13	# WTERMSIG()
> >>> 	)
> >>>=20
> >>> makes it easy to add any other fields people might care about ...
> >>=20
> >> Is there actually a guarantee that there will be 1 SIGCHLD for every
> >> exited process.
> >> Isn't it actually a race condition?
> >=20
> > when SIGCHLD is delivered doesn't matter.  the child stays in a zombie
> > state until the parent calls wait() on it and gets its status.  so you
> > can have `wait` return one child's status at a time.
>=20
> but I think my point still stands
> trap ': $(( cnt-- ))' SIGCHLD
> is a bad idea, you actually need to verify how many jobs are running not
> just arbitrarily decrement a counter, because your not guaranteed a trap
> for each process. I mean sure it will normally work, but its not
> guaranteed to work.

if `wait` setup BASH_CHILD_STATUS, then you wouldn't need the SIGCHLD trap =
at=20
all.  you could just do `wait`, get the info from BASH_CHILD_STATUS as to w=
hat=20
child exactly was just reaped, and then proceed.

as to the underlying question, since it's possible for bash itself to recei=
ve=20
stacked SIGCHLDs, there's no reason it wouldn't be able to execute the trap=
=20
the right number of times.
=2Dmike

--nextPart5982537.snyICOFLxn
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

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

iQIcBAABAgAGBQJPpiz3AAoJEEFjO5/oN/WB56cP/37dCT+w1QaRDG4b1Zm7G6FW
4wKuDR10hzo0XW0XeySaHSziZLfw07EKO0SBn2He4YSIVQGR/aR9bAW3O1B+9e+i
5v1239NxMgbtXOAgGn3Py///OoqiS/KGC0AQ9XskUVw20Za58xKf5Hb+iO0LaqUf
GPt0/bqLSk2V1EXYmyptpk/bontcJDMUyNJUdq5ttJirjeEZNYPSXsg2r+6bsfvu
Qun/OnIKnrH27p/IzmMuogbcylGpGv70DArVpQ5Oe1kSSeMDF4p0dFQFMGtWtLUM
9ZR6kLOA1F1JCkMQp/KxXz6Tap1T+MzQ7LLjXHKPy2pO3Ddjq1rZmfdJzLK8mMSZ
vSAdb1jh4Tc/fPezpUW3WdxTRJcLA7xOudJfUB4KH3qshaoGSvPxrvb6Wyo8GBqv
X/1WsiZHE1SASk73exdg33DV+SSK6p/SFwegrEe5xSQPPUrRzfMCkS05C6+gyzkC
1JsxaQ3m8oM/GHfEHcL1/cD9qI2aUuERe5wEnf7AIUh23f10PzBNTtFLOF1QFnM4
CNT61uNVacQZh8L1T4DBzDsGwPbJi5CknA4jrvYtIkZ3DNk1MYtmQiVWm4zjGg4j
QMIozkmL4nQ1yy4uY3weV6S+IToyXbGn8N8lUiTK2fOigxtJslfL/Hwb5BnePn/h
46LfbfWl/5E+1raT8Epv
=mSP+
-----END PGP SIGNATURE-----

--nextPart5982537.snyICOFLxn--


From MAILER-DAEMON Mon May 07 00:38:05 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SRFi1-0001N1-Ol
	for mharc-bug-bash@gnu.org; Mon, 07 May 2012 00:38:05 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46738)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1SRFhz-0001Mq-Ut
	for bug-bash@gnu.org; Mon, 07 May 2012 00:38:05 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1SRFhy-00053X-CZ
	for bug-bash@gnu.org; Mon, 07 May 2012 00:38:03 -0400
Received: from caiajhbdccah.dreamhost.com ([208.97.132.207]:36472
	helo=homiemail-a60.g.dreamhost.com)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1SRFhx-000538-W4
	for bug-bash@gnu.org; Mon, 07 May 2012 00:38:02 -0400
Received: from homiemail-a60.g.dreamhost.com (localhost [127.0.0.1])
	by homiemail-a60.g.dreamhost.com (Postfix) with ESMTP id 0B82E3BC06B
	for <bug-bash@gnu.org>; Sun,  6 May 2012 21:37:59 -0700 (PDT)
DomainKey-Signature: a=rsa-sha1; c=nofws; d=jidanni.org; h=from:to:subject
	:date:message-id:mime-version:content-type:
	content-transfer-encoding; q=dns; s=jidanni.org; b=j/pMC7Vn7JXCH
	V/r/pETcBlxlBNCi7bHcKMAwGILs284VezDD1Rwx+cQn66Q8xA0CWmD6lIjQ3iJU
	qyJSYvto3S0+gxhx5d6gVLNCrJfseiHD092UJFgbV6FiW7RqKWSCTTXWDBxN4E47
	hWcC/OvEXAheof0yt39QNjQEv6Whqs=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=jidanni.org; h=from:to
	:subject:date:message-id:mime-version:content-type:
	content-transfer-encoding; s=jidanni.org; bh=5ryjZKr/9u+PrBw+bRl
	L9c6kPDU=; b=WKy8o3dkzYtVJbgC7VGGASFMG5phYtOCPweOa5hHcuogX5cNTgK
	xoJm/cIw8tJ7ip5ZHqNO5/GiP+XHQZyt5aPkj1Dx7mPPJMRDDenHYbkWn+XxCDhm
	DkOl86/NaCr5kcLbN/q+bNtlbqeASLVTtFCd7zDHkvo7yPAFd3tahfXs=
Received: from jidanni.org (218-163-17-131.dynamic.hinet.net [218.163.17.131])
	(using TLSv1 with cipher AES256-SHA (256/256 bits))
	(No client certificate requested)
	(Authenticated sender: jidanni@jidanni.org)
	by homiemail-a60.g.dreamhost.com (Postfix) with ESMTPSA id BCCE23BC062
	for <bug-bash@gnu.org>; Sun,  6 May 2012 21:37:58 -0700 (PDT)
From: jidanni@jidanni.org
To: bug-bash@gnu.org
Subject: error messages should spit back out UTF-8
Date: Mon, 07 May 2012 12:37:50 +0800
Message-ID: <87zk9k1u8x.fsf@jidanni.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 208.97.132.207
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, 07 May 2012 04:38:05 -0000

$ LC_ALL=3Dzh_TW.UTF-8
$ =E5=93=BC
bash: $'\345\223\274'=EF=BC=9A=E5=91=BD=E4=BB=A4=E6=89=BE=E4=B8=8D=E5=88=B0

It really should spit out what it was given, not octal.


From MAILER-DAEMON Mon May 07 08:39:25 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SRNDp-0001aD-Bs
	for mharc-bug-bash@gnu.org; Mon, 07 May 2012 08:39:25 -0400
Received: from eggs.gnu.org ([208.118.235.92]:40059)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SRNDk-0001a4-0t
	for bug-bash@gnu.org; Mon, 07 May 2012 08:39:24 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SRNDd-0005A2-Nb
	for bug-bash@gnu.org; Mon, 07 May 2012 08:39:19 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:65269)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SRNDd-000595-Iz
	for bug-bash@gnu.org; Mon, 07 May 2012 08:39:13 -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 BYI10964; Mon, 07 May 2012 08:39:11 -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 AWN57314 (AUTH cpr);
	Mon, 07 May 2012 08:39:10 -0400 (EDT)
Message-ID: <4FA7C26E.5070203@case.edu>
Date: Mon, 07 May 2012 08:39:10 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Andreas Schwab <schwab@linux-m68k.org>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205041513.56696.vapier@gentoo.org> <4FA42D25.1000802@web.de>
	<201205050035.49001.vapier@gentoo.org>
	<m2ipgbnneu.fsf@linux-m68k.org>
In-Reply-To: <m2ipgbnneu.fsf@linux-m68k.org>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 07 May 2012 12:39:24 -0000

On 5/5/12 2:37 AM, Andreas Schwab wrote:

> (bash) Bash POSIX Mode::
> 
>  46. The arrival of `SIGCHLD'  when a trap is set on `SIGCHLD' does not
>      interrupt the `wait' builtin and cause it to return immediately.
>      The trap command is run once for each child that exits.
> 
> (I think the description is backwards.)

You're right; the description is backwards.  When in Posix mode, SIGCHLD
interrupts the wait builtin.

-- 
``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 May 07 08:57:08 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SRNUy-0008G9-Ky
	for mharc-bug-bash@gnu.org; Mon, 07 May 2012 08:57:08 -0400
Received: from eggs.gnu.org ([208.118.235.92]:45631)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SRNUr-0008CX-C8
	for bug-bash@gnu.org; Mon, 07 May 2012 08:57:07 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SRNUm-0006no-Ky
	for bug-bash@gnu.org; Mon, 07 May 2012 08:57:00 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:56136)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SRNUm-0006nO-GM
	for bug-bash@gnu.org; Mon, 07 May 2012 08:56:56 -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 BKM15387;
	Mon, 7 May 2012 08:56:54 -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 AWX59478 (AUTH cpr);
	Mon, 07 May 2012 08:56:54 -0400 (EDT)
Message-ID: <4FA7C696.1020106@case.edu>
Date: Mon, 07 May 2012 08:56:54 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: John Kearney <dethrophes@web.de>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205041453.32788.vapier@gentoo.org> <4FA4393E.5050208@case.edu>
	<201205050028.33774.vapier@gentoo.org> <4FA5EF26.3060208@web.de>
In-Reply-To: <4FA5EF26.3060208@web.de>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv2.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.37
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 07 May 2012 12:57:07 -0000

On 5/5/12 11:25 PM, John Kearney wrote:

> Is there actually a guarantee that there will be 1 SIGCHLD for every
> exited process.

The manual page says, under JOB CONTROL:

Any trap on SIGCHLD is executed for each child that exits.

> Isn't it actually a race condition?

No.  waitpid() returns once for each child that exits.  That's why you
loop calling waitpid() when you get a SIGCHLD.  It keeps returning PIDs
until there are no more unreaped children, then it returns -1.

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 May 07 09:00:45 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SRNYT-0001PU-A3
	for mharc-bug-bash@gnu.org; Mon, 07 May 2012 09:00:45 -0400
Received: from eggs.gnu.org ([208.118.235.92]:59220)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SRNYM-0001Ok-8u
	for bug-bash@gnu.org; Mon, 07 May 2012 09:00:43 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SRNYK-00010x-7u
	for bug-bash@gnu.org; Mon, 07 May 2012 09:00:37 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:32593)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SRNYK-00010M-32
	for bug-bash@gnu.org; Mon, 07 May 2012 09:00:36 -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 BYI12489; Mon, 07 May 2012 09:00:34 -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 AWN59585 (AUTH cpr);
	Mon, 07 May 2012 09:00:34 -0400 (EDT)
Message-ID: <4FA7C771.5060107@case.edu>
Date: Mon, 07 May 2012 09:00:33 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: John Kearney <dethrophes@web.de>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205050028.33774.vapier@gentoo.org> <4FA5EF26.3060208@web.de>
	<201205060228.27937.vapier@gentoo.org> <4FA62767.4080402@web.de>
In-Reply-To: <4FA62767.4080402@web.de>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 07 May 2012 13:00:43 -0000

On 5/6/12 3:25 AM, John Kearney wrote:
> Am 06.05.2012 08:28, schrieb Mike Frysinger:
>> On Saturday 05 May 2012 23:25:26 John Kearney wrote:
>>> Am 05.05.2012 06:28, schrieb Mike Frysinger:
>>>> On Friday 04 May 2012 16:17:02 Chet Ramey wrote:
>>>>> On 5/4/12 2:53 PM, Mike Frysinger wrote:
>>>>>> it might be a little racy (wrt checking cnt >= 10 and then doing a
>>>>>> wait), but this is good enough for some things.  it does lose
>>>>>> visibility into which pids are live vs reaped, and their exit status,
>>>>>> but i more often don't care about that ...
>>>>> What version of bash did you test this on?  Bash-4.0 is a little
>>>>> different in how it treats the SIGCHLD trap.
>>>> bash-4.2_p28.  wait returns 145 (which is SIGCHLD).
>>>>
>>>>> Would it be useful for bash to set a shell variable to the PID of the
>>>>> just- reaped process that caused the SIGCHLD trap?  That way you could
>>>>> keep an array of PIDs and, if you wanted, use that variable to keep
>>>>> track of live and dead children.
>>>> we've got associative arrays now ... we could have one which contains all
>>>> the relevant info:
>>>> 	declare -A BASH_CHILD_STATUS=(
>>>> 		["pid"]=1234
>>>> 		["status"]=1	# WEXITSTATUS()
>>>> 		["signal"]=13	# WTERMSIG()
>>>> 	)
>>>>
>>>> makes it easy to add any other fields people might care about ...
>>> Is there actually a guarantee that there will be 1 SIGCHLD for every
>>> exited process.
>>> Isn't it actually a race condition?
>> when SIGCHLD is delivered doesn't matter.  the child stays in a zombie state 
>> until the parent calls wait() on it and gets its status.  so you can have 
>> `wait` return one child's status at a time.
>> -mike
> but I think my point still stands
> trap ': $(( cnt-- ))' SIGCHLD
> is a bad idea, you actually need to verify how many jobs are running not
> just arbitrarily decrement a counter, because your not guaranteed a trap
> for each process. I mean sure it will normally work, but its not
> guaranteed to work.

It's certainly more robust to keep track of children that are running by
PID, but bash will run the SIGCHLD trap once for each child that exits.
(This doesn't work while using `wait' in Posix mode, since Posix requires
the trapped SIGCHLD to cause `wait' to return.)

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 May 07 09:08:50 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SRNgI-0003HA-Md
	for mharc-bug-bash@gnu.org; Mon, 07 May 2012 09:08:50 -0400
Received: from eggs.gnu.org ([208.118.235.92]:34690)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SRNgB-0003Fr-3q
	for bug-bash@gnu.org; Mon, 07 May 2012 09:08:48 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SRNg4-0005BD-N6
	for bug-bash@gnu.org; Mon, 07 May 2012 09:08:42 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:34796)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SRNg4-00057j-IM
	for bug-bash@gnu.org; Mon, 07 May 2012 09:08:36 -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 BKM16302;
	Mon, 7 May 2012 09: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 AWN60518 (AUTH cpr);
	Mon, 07 May 2012 09:08:34 -0400 (EDT)
Message-ID: <4FA7C951.5030901@case.edu>
Date: Mon, 07 May 2012 09:08:33 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Mike Frysinger <vapier@gentoo.org>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205041453.32788.vapier@gentoo.org> <4FA4393E.5050208@case.edu>
	<201205050028.33774.vapier@gentoo.org>
In-Reply-To: <201205050028.33774.vapier@gentoo.org>
X-Enigmail-Version: 1.4.1
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: Colin McEwan <colin.mcewan@gmail.com>,
	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: Mon, 07 May 2012 13:08:49 -0000

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

On 5/5/12 12:28 AM, Mike Frysinger wrote:
> On Friday 04 May 2012 16:17:02 Chet Ramey wrote:
>> On 5/4/12 2:53 PM, Mike Frysinger wrote:
>>> it might be a little racy (wrt checking cnt >= 10 and then doing a wait),
>>> but this is good enough for some things.  it does lose visibility into
>>> which pids are live vs reaped, and their exit status, but i more often
>>> don't care about that ...
>>
>> What version of bash did you test this on?  Bash-4.0 is a little different
>> in how it treats the SIGCHLD trap.
> 
> bash-4.2_p28.  wait returns 145 (which is SIGCHLD).

I wonder if you were running in Posix mode.  Posix says

"When the shell is waiting, by means of the wait utility, for asynchronous
commands to complete, the reception of a signal for which a trap has been
set shall cause the wait utility to return immediately with an exit status
>128, immediately after which the trap associated with that signal shall
be taken."

The trapped SIGCHLD has to force `wait' to return.

- -- 
``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+nyVEACgkQu1hp8GTqdKuKfgCgi1B9wyK1IbVGxWrmkIz4BgDj
+4EAn25jL8YlSjp3VWBseFqwjNWWpWxk
=/unM
-----END PGP SIGNATURE-----


From MAILER-DAEMON Mon May 07 16:47:22 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SRUq2-0006zH-65
	for mharc-bug-bash@gnu.org; Mon, 07 May 2012 16:47:22 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52583)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SRUpy-0006oZ-Hg
	for Bug-bash@gnu.org; Mon, 07 May 2012 16:47:19 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SRUpw-0007O9-Gy
	for Bug-bash@gnu.org; Mon, 07 May 2012 16:47:18 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:62818)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SRUpw-0007Nt-CH
	for Bug-bash@gnu.org; Mon, 07 May 2012 16:47:16 -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 BKM59063;
	Mon, 7 May 2012 16:46:46 -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 AWO31331 (AUTH cpr);
	Mon, 07 May 2012 16:46:40 -0400 (EDT)
Message-ID: <4FA834AF.4060100@case.edu>
Date: Mon, 07 May 2012 16:46:39 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Ruediger Kuhlmann <RKuhlmann@orga-systems.com>
Subject: Re: Bash bug interpolating delete characters
References: <OFDE975207.0C3622E5-ONC12579F3.00361A06-C12579F3.00365E39@orga-systems.com>
In-Reply-To: <OFDE975207.0C3622E5-ONC12579F3.00361A06-C12579F3.00365E39@orga-systems.com>
X-Enigmail-Version: 1.4.1
Content-Type: multipart/mixed; boundary="------------080104060404070603030203"
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>, John Kearney <dethrophes@web.de>,
	chet@case.edu, 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: Mon, 07 May 2012 20:47:20 -0000

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

On 5/3/12 5:53 AM, Ruediger Kuhlmann wrote:
> Hi,
> 
> please try the following bash script:
> 
> a=x
> del="$(echo -e "\\x7f")"
> 
> echo "$del${a#x}" | od -ta
> echo "$del ${a#x}" | od -ta
> echo " $del${a#x}" | od -ta
> 
> Using bash 3.2, the output is:
> 
> 0000000 del  nl
> 0000002
> 0000000 del  sp  nl
> 0000003
> 0000000  sp del  nl
> 0000003
> 
> however with bash 4.1 and bash 4.2.20, the output is only:
> 
> 0000000 del  nl
> 0000002
> 0000000  sp  nl
> 0000002
> 0000000  sp  nl
> 0000002
> 
> ... so in the second and third line, the delete character magically
> disappears. Neither OS nor locale seem to influence this. Using a delete
> character directly in the script instead of $del also has no impact, either.

It's a case of one part of the code violating assumptions made by (and
conditions imposed by) another.  Try the attached patch; it fixes the
issue for me.

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/

--------------080104060404070603030203
Content-Type: application/x-patch;
 name="del-expansion.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="del-expansion.patch"

KioqIC4uL2Jhc2gtMjAxMjA0Mjcvc3Vic3QuYwkyMDEyLTA0LTIyIDE2OjE5OjEwLjAwMDAw
MDAwMCAtMDQwMAotLS0gc3Vic3QuYwkyMDEyLTA1LTA3IDE2OjA2OjM1LjAwMDAwMDAwMCAt
MDQwMAoqKioqKioqKioqKioqKioKKioqIDgxNjAsODE2MyAqKioqCi0tLSA4MTYwLDgxNzEg
LS0tLQogIAkgIGRpc3Bvc2Vfd29yZF9kZXNjICh0d29yZCk7CiAgCisgCSAgLyogS2lsbCBx
dW90ZWQgbnVsbHM7IHdlIHdpbGwgYWRkIHRoZW0gYmFjayBhdCB0aGUgZW5kIG9mCisgCSAg
ICAgZXhwYW5kX3dvcmRfaW50ZXJuYWwgaWYgbm90aGluZyBlbHNlIGluIHRoZSBzdHJpbmcg
Ki8KKyAJICBpZiAoaGFkX3F1b3RlZF9udWxsICYmIHRlbXAgJiYgUVVPVEVEX05VTEwgKHRl
bXApKQorIAkgICAgeworIAkgICAgICBGUkVFICh0ZW1wKTsKKyAJICAgICAgdGVtcCA9IChj
aGFyICopTlVMTDsKKyAJICAgIH0KKyAKICAJICBnb3RvIGFkZF9zdHJpbmc7CiAgCSAgYnJl
YWs7CioqKioqKioqKioqKioqKgoqKiogODU2OCw4NTcyICoqKioKICAgICAgICBpZiAocXVv
dGVkICYgKFFfSEVSRV9ET0NVTUVOVHxRX0RPVUJMRV9RVU9URVMpKQogIAl0d29yZC0+Zmxh
Z3MgfD0gV19RVU9URUQ7CiEgICAgICAgaWYgKGhhZF9xdW90ZWRfbnVsbCkKICAJdHdvcmQt
PmZsYWdzIHw9IFdfSEFTUVVPVEVETlVMTDsKICAgICAgICBsaXN0ID0gbWFrZV93b3JkX2xp
c3QgKHR3b3JkLCAoV09SRF9MSVNUICopTlVMTCk7Ci0tLSA4NTc2LDg1ODAgLS0tLQogICAg
ICAgIGlmIChxdW90ZWQgJiAoUV9IRVJFX0RPQ1VNRU5UfFFfRE9VQkxFX1FVT1RFUykpCiAg
CXR3b3JkLT5mbGFncyB8PSBXX1FVT1RFRDsKISAgICAgICBpZiAoaGFkX3F1b3RlZF9udWxs
ICYmIFFVT1RFRF9OVUxMIChpc3RyaW5nKSkKICAJdHdvcmQtPmZsYWdzIHw9IFdfSEFTUVVP
VEVETlVMTDsKICAgICAgICBsaXN0ID0gbWFrZV93b3JkX2xpc3QgKHR3b3JkLCAoV09SRF9M
SVNUICopTlVMTCk7CioqKioqKioqKioqKioqKgoqKiogODU5OSw4NjAzICoqKioKICAJICBp
ZiAod29yZC0+ZmxhZ3MgJiBXX05PRVhQQU5EKQogIAkgICAgdHdvcmQtPmZsYWdzIHw9IFdf
Tk9FWFBBTkQ7CiEgCSAgaWYgKGhhZF9xdW90ZWRfbnVsbCkKICAJICAgIHR3b3JkLT5mbGFn
cyB8PSBXX0hBU1FVT1RFRE5VTEw7CS8qIFhYWCAqLwogIAkgIGxpc3QgPSBtYWtlX3dvcmRf
bGlzdCAodHdvcmQsIChXT1JEX0xJU1QgKilOVUxMKTsKLS0tIDg2MDcsODYxMSAtLS0tCiAg
CSAgaWYgKHdvcmQtPmZsYWdzICYgV19OT0VYUEFORCkKICAJICAgIHR3b3JkLT5mbGFncyB8
PSBXX05PRVhQQU5EOwohIAkgIGlmIChoYWRfcXVvdGVkX251bGwgJiYgUVVPVEVEX05VTEwg
KGlzdHJpbmcpKQogIAkgICAgdHdvcmQtPmZsYWdzIHw9IFdfSEFTUVVPVEVETlVMTDsJLyog
WFhYICovCiAgCSAgbGlzdCA9IG1ha2Vfd29yZF9saXN0ICh0d29yZCwgKFdPUkRfTElTVCAq
KU5VTEwpOwo=
--------------080104060404070603030203--



From MAILER-DAEMON Mon May 07 20:01:11 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SRXrb-0001r3-6L
	for mharc-bug-bash@gnu.org; Mon, 07 May 2012 20:01:11 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60717)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SRXrY-0001qv-3e
	for bug-bash@gnu.org; Mon, 07 May 2012 20:01:09 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SRXrW-0002Ie-FC
	for bug-bash@gnu.org; Mon, 07 May 2012 20:01:07 -0400
Received: from fmmailgate03.web.de ([217.72.192.234]:46728)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dethrophes@web.de>) id 1SRXrW-0002IP-5n
	for bug-bash@gnu.org; Mon, 07 May 2012 20:01:06 -0400
Received: from moweb001.kundenserver.de (moweb001.kundenserver.de
	[172.19.20.114])
	by fmmailgate03.web.de (Postfix) with ESMTP id 8FA501B47839E
	for <bug-bash@gnu.org>; Tue,  8 May 2012 02:01:03 +0200 (CEST)
Received: from [192.168.178.49] ([93.134.82.12]) by smtp.web.de (mrweb001)
	with ESMTPA (Nemesis) id 0MCZP8-1SJG7Z0yg6-009OzC;
	Tue, 08 May 2012 02:01:03 +0200
Message-ID: <4FA86241.6030700@web.de>
Date: Tue, 08 May 2012 02:01:05 +0200
From: John Kearney <dethrophes@web.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:12.0) Gecko/20120428 Thunderbird/12.0.1
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: Re: Bash bug interpolating delete characters
References: <OFDE975207.0C3622E5-ONC12579F3.00361A06-C12579F3.00365E39@orga-systems.com>
	<4FA834AF.4060100@case.edu>
In-Reply-To: <4FA834AF.4060100@case.edu>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Provags-ID: V02:K0:F320Rf69vQy+sz9ATcRfJqDB2S5cucoxUZbONDamTFx
	0oyJqFXNJN3wGBU6AVkUZqEpsu63lD7vcSoSElSAjo2YzBzDsv
	JQJo/utR1Ycf0BbBDXEmEOMiSlumCjFypQE2KJBzKKLoMjEnFX
	sPvlfag33llQpnhRN23Ry6kXl8ZHFUuDU626qhXgqFMJqT/iJJ
	A11N9jyl8yKAgDzIJduIw==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-Received-From: 217.72.192.234
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, 08 May 2012 00:01:09 -0000

Am 07.05.2012 22:46, schrieb Chet Ramey:
> On 5/3/12 5:53 AM, Ruediger Kuhlmann wrote:
>> Hi,
>>
>> please try the following bash script:
>>
>> a=x
>> del="$(echo -e "\\x7f")"
>>
>> echo "$del${a#x}" | od -ta
>> echo "$del ${a#x}" | od -ta
>> echo " $del${a#x}" | od -ta
>>
>> Using bash 3.2, the output is:
>>
>> 0000000 del  nl
>> 0000002
>> 0000000 del  sp  nl
>> 0000003
>> 0000000  sp del  nl
>> 0000003
>>
>> however with bash 4.1 and bash 4.2.20, the output is only:
>>
>> 0000000 del  nl
>> 0000002
>> 0000000  sp  nl
>> 0000002
>> 0000000  sp  nl
>> 0000002
>>
>> ... so in the second and third line, the delete character magically
>> disappears. Neither OS nor locale seem to influence this. Using a delete
>> character directly in the script instead of $del also has no impact, either.
> It's a case of one part of the code violating assumptions made by (and
> conditions imposed by) another.  Try the attached patch; it fixes the
> issue for me.
>
> Chet
>
It also works for me.

  "$del${a#x}"             =[$'\177']
  " $del${a%x}"            =[$' \177']
  " $del""${a:0:0}"        =[$' \177']
  " ${del}${a:0:0}"        =[$' \177']
  "${del:0:1}${a#d}"       =[$'\177x']
  "${del:0:1} ${a#d}"      =[$'\177 x']
  "${del:0:1} ${a:+}"      =[$'\177 ']
  "$del ${a#x}"            =[$'\177 ']
  " $del${a:0:0}"          =[$' \177']
  " $del${a}"              =[$' \177x']
  " ${del:0:1}${a:0:0}"    =[$' \177']
  "${del:0:1}${a#x}"       =[$'\177']
  "${del:0:1} ${a#x}"      =[$'\177 ']
  " $del${a#x}"            =[$' \177']
  " $del"${a:0:0}          =[$' \177']
  " $del"                  =[$' \177']
  " ${del:0:1}${a}"        =[$' \177x']
  "${del:0:1} ${a}"        =[$'\177 x']
  "${del:0:1} ${a:-}"      =[$'\177 x']



From MAILER-DAEMON Fri May 11 10:53:38 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SSrDt-0000MI-W3
	for mharc-bug-bash@gnu.org; Fri, 11 May 2012 10:53:37 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49250)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SSrDm-0000Lc-E5
	for bug-bash@gnu.org; Fri, 11 May 2012 10:53:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SSrDg-0005aD-Hz
	for bug-bash@gnu.org; Fri, 11 May 2012 10:53:29 -0400
Received: from smtp.gentoo.org ([140.211.166.183]:39334)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SSrDg-0005Zj-By
	for bug-bash@gnu.org; Fri, 11 May 2012 10:53:24 -0400
Received: from vapier.localnet (localhost [127.0.0.1])
	by smtp.gentoo.org (Postfix) with ESMTP id DAD6A1B4012;
	Fri, 11 May 2012 14:53:21 +0000 (UTC)
From: Mike Frysinger <vapier@gentoo.org>
Organization: wh0rd.org
To: chet.ramey@case.edu
Subject: Re: Parallelism a la make -j <n> / GNU parallel
Date: Fri, 11 May 2012 10:53:30 -0400
User-Agent: KMail/1.13.7 (Linux/3.4.0-rc6; KDE/4.6.5; x86_64; ; )
References: <CAG-_2Zx4ubUhQev03DniNysBSvmobA-uXSsmx_kCeR6Wi5tmoQ@mail.gmail.com>
	<201205050028.33774.vapier@gentoo.org> <4FA7C951.5030901@case.edu>
In-Reply-To: <4FA7C951.5030901@case.edu>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart2424414.aIZSWHPzgt";
	protocol="application/pgp-signature"; micalg=pgp-sha1
Content-Transfer-Encoding: 7bit
Message-Id: <201205111053.32821.vapier@gentoo.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 140.211.166.183
Cc: Andreas Schwab <schwab@linux-m68k.org>, bug-bash@gnu.org,
	Colin McEwan <colin.mcewan@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: Fri, 11 May 2012 14:53:36 -0000

--nextPart2424414.aIZSWHPzgt
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: quoted-printable

On Monday 07 May 2012 09:08:33 Chet Ramey wrote:
> On 5/5/12 12:28 AM, Mike Frysinger wrote:
> > On Friday 04 May 2012 16:17:02 Chet Ramey wrote:
> >> On 5/4/12 2:53 PM, Mike Frysinger wrote:
> >>> it might be a little racy (wrt checking cnt >=3D 10 and then doing a
> >>> wait), but this is good enough for some things.  it does lose
> >>> visibility into which pids are live vs reaped, and their exit status,
> >>> but i more often don't care about that ...
> >>=20
> >> What version of bash did you test this on?  Bash-4.0 is a little
> >> different in how it treats the SIGCHLD trap.
> >=20
> > bash-4.2_p28.  wait returns 145 (which is SIGCHLD).
>=20
> I wonder if you were running in Posix mode.  Posix says

yes, i think that is what i was doing `sh ./test.sh`
=2Dmike

--nextPart2424414.aIZSWHPzgt
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

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

iQIcBAABAgAGBQJPrSfsAAoJEEFjO5/oN/WBExkQAJDG+1wSeKX3H7d8HmQzpQYM
BWYOCJKfQGLEveAVnFqhPnAIxEUW4N/FPnOPj6j6n53GgRh8DuMSP3tLFWzdj6u7
B3bkHBNyPX+EQXVVKZKEjRSZKeKxJBqXvb1WW4TEt7/qXWBsx+jOWwmmayyT5ezL
28KP0GjcNfoH2B1enBP/DSKzVWCoe5EIwV2UthepOHyKVWVVmdgw+kIIUKjYRu8V
G3Pln4P0Iv9wr7CWCuSG3OsvAL6Nl0cXnLNDerBTuCMBsF34eh3MqaOfF4tUmqKl
ynzW0YYeNPvkFzcKVOgMf8va5Xgo29fVg+3G/J39lDRzB1VeWLgVKzrwnthp/fya
faTM2hHC2HptHc71RSftMLCoAQe831QvRFHZc/h12WKk9cKq54zQN8eCgR8ALxtj
pn+6DbP66NBNtK068gYa5BRrenKZiV3Tx4+MGjEqydbe6/zOPrBxTvhaZaL3XWTv
FSNWMRbMshsPeHTxVGicaTQ4/XCD/1vozJtqsA00kh5I3QQPkw9Xwlm1mRJKgmYV
zA4MYxB6PyI9yhMBvIjm6JTVoLNCGAZOjnHguCFcKXhxOLDgd02qEX8KW3FAnncI
beAnirXVYWwLR7PXt8PdYOkB7vbli7l+0AwIZmILs3h43PdV+n+51cQXXKChFxaq
QEWe4gcB7E4cg8TDA19j
=DAZf
-----END PGP SIGNATURE-----

--nextPart2424414.aIZSWHPzgt--


From MAILER-DAEMON Fri May 11 11:43:50 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SSs0U-00080I-8Y
	for mharc-bug-bash@gnu.org; Fri, 11 May 2012 11:43:50 -0400
Received: from eggs.gnu.org ([208.118.235.92]:39915)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SSs0R-0007y8-Su
	for bug-bash@gnu.org; Fri, 11 May 2012 11:43:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SSs0P-0000Vs-Ti
	for bug-bash@gnu.org; Fri, 11 May 2012 11:43:47 -0400
Received: from smtp.gentoo.org ([140.211.166.183]:42871)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SSs0P-0000Vf-LH
	for bug-bash@gnu.org; Fri, 11 May 2012 11:43:45 -0400
Received: from vapier.localnet (localhost [127.0.0.1])
	by smtp.gentoo.org (Postfix) with ESMTP id E736F1B4012
	for <bug-bash@gnu.org>; Fri, 11 May 2012 15:43:43 +0000 (UTC)
From: Mike Frysinger <vapier@gentoo.org>
Organization: wh0rd.org
To: bug-bash@gnu.org
Subject: bash crashes when forking jobs and dynamically switching posix mode
Date: Fri, 11 May 2012 11:43:54 -0400
User-Agent: KMail/1.13.7 (Linux/3.4.0-rc6; KDE/4.6.5; x86_64; ; )
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart2090440.iyC5YB43WE";
	protocol="application/pgp-signature"; micalg=pgp-sha1
Content-Transfer-Encoding: 7bit
Message-Id: <201205111143.55038.vapier@gentoo.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 140.211.166.183
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, 11 May 2012 15:43:49 -0000

--nextPart2090440.iyC5YB43WE
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

in light of the recent discussion, i thought i could switch posix mode on/o=
ff=20
on the fly so that i restricted myself to this mode only when using `wait`.=
 =20
unfortunately, that randomly crashes bash :).  simple test case:

$ cat test.sh
#!/bin/bash
max=3D20
num=3D0
set -m
#set -o posix
trap ': $(( --num ))' CHLD
while : ; do
	sleep 0.$(( $RANDOM % 10 ))s &
	: $(( ++num ))
	if [[ $num -ge $max ]] ; then
		set -o posix
		wait
		set +o posix
	fi
done

$ bash --version | head -1
GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)
$ ./test.sh
malloc: ../bash/execute_cmd.c:3555: assertion botched
free: called with already freed block argument
Aborting...Aborted (core dumped)

i've also seen various corruption like:
*** glibc detected *** /bin/bash: malloc(): memory corruption (fast):=20
0x0000000001a1ee90 ***

or:
*** glibc detected *** /bin/bash: double free or corruption (fasttop):=20
0x00000000013ea130 ***
=3D=3D=3D=3D=3D=3D=3D Backtrace: =3D=3D=3D=3D=3D=3D=3D=3D=3D
/lib64/libc.so.6(+0x773e5)[0x7fe20e8a03e5]
/bin/bash(pop_stream+0x5d)[0x419f8d]
/bin/bash[0x44e479]
/bin/bash(run_unwind_frame+0x22)[0x44e5e2]
/bin/bash(parse_string+0x131)[0x4677b1]
/bin/bash(xparse_dolparen+0x65)[0x424125]
/bin/bash[0x447938]
/bin/bash[0x448a26]
/bin/bash[0x449f5c]
/bin/bash(expand_string_assignment+0x6a)[0x44a0ca]
/bin/bash[0x44429a]
/bin/bash[0x44465f]
/bin/bash[0x44b2ed]
/bin/bash(execute_command_internal+0x1755)[0x42bff5]
/bin/bash(execute_command+0x4e)[0x42ee2e]
/bin/bash[0x42f4b4]
/bin/bash(execute_command_internal+0xa06)[0x42b2a6]
/bin/bash[0x42f593]
/bin/bash(execute_command_internal+0xa06)[0x42b2a6]
/bin/bash(execute_command+0x4e)[0x42ee2e]
/bin/bash[0x42f55e]
/bin/bash(execute_command_internal+0xa06)[0x42b2a6]
/bin/bash(execute_command+0x4e)[0x42ee2e]
/bin/bash[0x42f55e]
/bin/bash(execute_command_internal+0xa06)[0x42b2a6]
/bin/bash(execute_command+0x4e)[0x42ee2e]
/bin/bash[0x42f55e]
/bin/bash(execute_command_internal+0xa06)[0x42b2a6]
/bin/bash(execute_command+0x4e)[0x42ee2e]
/bin/bash(execute_command_internal+0x12bf)[0x42bb5f]
/bin/bash(execute_command+0x4e)[0x42ee2e]
/bin/bash(reader_loop+0x8c)[0x418fcc]
/bin/bash(main+0xdb9)[0x417919]
/lib64/libc.so.6(__libc_start_main+0xed)[0x7fe20e84a3ed]
/bin/bash[0x4181dd]
=2Dmike

--nextPart2090440.iyC5YB43WE
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

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

iQIcBAABAgAGBQJPrTO6AAoJEEFjO5/oN/WB7foQAIeI8HhUSpu8Gj3Qs9/DOwH5
2C6qG1QE3wi+WiqMg/BBeRk+bg6QuUJJhMtFzfE7OFKNawkVbC/VHQ24nzx1Uw/Q
ArGi+5s4KpqihizUeMEbgSVnoM2QXStUQrbWQ2FvPZ6orewwsK+NrYnywb+LrgAu
2EMY/ok9lheZe/vcit1tfNW8ne740pb5/Qghd3XUJs3rig48/DVdPORQ+Cm80G5a
nKfoo9YNojPkuqpGiKKfCvrGMZdD3kp9GZvfI7uP9mJzh8vwnl0RB7IRMshehKiM
agVo+1iaHJY5QRADkM+zRtEU5FvKZ53iggW6Zz2KtjEXYDNu2ZD/crLoTmEGXNmd
Iyk0QdQEk5uVlrqAjkIqh6kLQ5DY9qzIx1yq6LRHGDMwUXzcbnoPDvnaaMC6q+pu
fyHC+KGkHCRerErc7HeLxrPLrQl50/mocNdiRWu+XWt6sF5zvbxXKG4hvOFBZsRx
Arr50wIf/CWuvIqGonh1ytykMCBD9Ta1SUVwS5mokeoEX0zsgGwHKl00MB+/SJol
91jPsE19xuvbU+QUkg8SLMuATqP1PwZEsczg8C6JbE/mvFrZXWwzE4faX9Z0wuEM
o4QOMH7nfptem1yYxckfoMxEiisvuwkwjdKGMDOKT+XZzLLN0PvVgVG9mjHfmkLV
nTqJyRCEvG5+OJkoopim
=qxCq
-----END PGP SIGNATURE-----

--nextPart2090440.iyC5YB43WE--


From MAILER-DAEMON Fri May 11 13:38:06 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SStn4-0003uO-OR
	for mharc-bug-bash@gnu.org; Fri, 11 May 2012 13:38:06 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60371)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SStn1-0003p3-NW
	for bug-bash@gnu.org; Fri, 11 May 2012 13:38:05 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SStmz-00029a-MT
	for bug-bash@gnu.org; Fri, 11 May 2012 13:38:03 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:36364)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SStmz-00029M-IW
	for bug-bash@gnu.org; Fri, 11 May 2012 13:38:01 -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 BYM51582; Fri, 11 May 2012 13:37:59 -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 AWS97441 (AUTH cpr);
	Fri, 11 May 2012 13:37:58 -0400 (EDT)
Message-ID: <4FAD4E76.9060209@case.edu>
Date: Fri, 11 May 2012 13:37:58 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Mike Frysinger <vapier@gentoo.org>
Subject: Re: bash crashes when forking jobs and dynamically switching posix
	mode
References: <201205111143.55038.vapier@gentoo.org>
In-Reply-To: <201205111143.55038.vapier@gentoo.org>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 11 May 2012 17:38:05 -0000

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

On 5/11/12 11:43 AM, Mike Frysinger wrote:
> in light of the recent discussion, i thought i could switch posix mode on/off 
> on the fly so that i restricted myself to this mode only when using `wait`.  
> unfortunately, that randomly crashes bash :).  simple test case:

Did you try this with bash-4.2?

I've been running it for quite a while with the current development version
and, while it has to reallocate the jobs list a lot so it keeps track of
only the latest 1024 jobs, it hasn't crashed.  RHEL 5.

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+tTnYACgkQu1hp8GTqdKuqvwCbBek4ZOPrs83TRmai/6putYFq
p6cAoIuxoTUFSJBgA4YKmGAnROQu0sr1
=wi+6
-----END PGP SIGNATURE-----


From MAILER-DAEMON Fri May 11 14:15:16 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SSuN2-0002ut-Sc
	for mharc-bug-bash@gnu.org; Fri, 11 May 2012 14:15:16 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37258)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SSuMw-0002uQ-KQ
	for bug-bash@gnu.org; Fri, 11 May 2012 14:15:14 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SSuMu-0001yW-VN
	for bug-bash@gnu.org; Fri, 11 May 2012 14:15:10 -0400
Received: from smtp.gentoo.org ([140.211.166.183]:52571)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SSuMu-0001y3-PR
	for bug-bash@gnu.org; Fri, 11 May 2012 14:15:08 -0400
Received: from vapier.localnet (localhost [127.0.0.1])
	by smtp.gentoo.org (Postfix) with ESMTP id 5A0601B4033;
	Fri, 11 May 2012 18:15:07 +0000 (UTC)
From: Mike Frysinger <vapier@gentoo.org>
Organization: wh0rd.org
To: chet.ramey@case.edu
Subject: Re: bash crashes when forking jobs and dynamically switching posix
	mode
Date: Fri, 11 May 2012 14:15:18 -0400
User-Agent: KMail/1.13.7 (Linux/3.4.0-rc6; KDE/4.6.5; x86_64; ; )
References: <201205111143.55038.vapier@gentoo.org> <4FAD4E76.9060209@case.edu>
In-Reply-To: <4FAD4E76.9060209@case.edu>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart31098956.4PtgKCSdxb";
	protocol="application/pgp-signature"; micalg=pgp-sha1
Content-Transfer-Encoding: 7bit
Message-Id: <201205111415.19229.vapier@gentoo.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 140.211.166.183
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, 11 May 2012 18:15:14 -0000

--nextPart31098956.4PtgKCSdxb
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

On Friday 11 May 2012 13:37:58 Chet Ramey wrote:
> On 5/11/12 11:43 AM, Mike Frysinger wrote:
> > in light of the recent discussion, i thought i could switch posix mode
> > on/off on the fly so that i restricted myself to this mode only when
> > using `wait`.
> > unfortunately, that randomly crashes bash :).  simple test case:
>=20
> Did you try this with bash-4.2?

bash-4.2_p28 was where i first noticed the crashes (those tracebacks from=20
glibc).  the first crash was on an ubuntu bash-4.1.
=2Dmike

--nextPart31098956.4PtgKCSdxb
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

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

iQIcBAABAgAGBQJPrVc3AAoJEEFjO5/oN/WBzwUQAKGu7u+NzJULoIPk7XEsL8qM
b0oUCHkl6HdUi755+W1vrWQN90nntjfS4ZhMeLR8T7smcRY5JwO5lkpiRyUwi7iP
RCbo4Q562tlscFLF1LMDjDYGZZGnsZr0oO2uMg8UYl62iLdPDdPTKUHPWsk+AnRj
WRFJ2Uq+R+7apQnMP8Y/5zRxd/W/KJnPwfxODc2ju7AIojWiox0pktMvzas9884n
EsjhsPkFYpo3XtpiknTtWcOauBGrrMknJ+XBQSMKMWkoEqu3i9QT3IHm8geOB3a4
wR2hAVeviUCzQjcXTQA2pJ0cVH7YCEvzzhRFgRZq6mBiDXHfupPjYfI7ihIf1ETQ
otgzDaLy0cH4ClAKPy0mevTmRIapmHBoWHnpSg9dluLqewVGexMiKUOTIgX9+HAr
+OZ8sbgcWgI61+QcMEtZuxot5ABf4/EvpiVCOfVAoLIevCNNsk5V9DTQZMoYfwVF
iUX4DE6E9xfUXEIcnJqeaWracHe3ZIGRkMuxJ1WcuIMfGsndmjrwP1ZkU2qWN1q9
/yn/z0YZBcZDlhSijsyqzPUHANUrH0X2vZ6+/FmRtvS+v5pX53oAALUx+Fh6UGOb
1kks2JE3VLmBW0DRKXp95Rxz35zfL4auCKs6scUultEnuwbHJ6kBYBF7eIGnJCdA
9zFKOw/UGiEjbY/m5Zf/
=mVKH
-----END PGP SIGNATURE-----

--nextPart31098956.4PtgKCSdxb--


From MAILER-DAEMON Fri May 11 14:25:14 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SSuWg-00046t-Ud
	for mharc-bug-bash@gnu.org; Fri, 11 May 2012 14:25:14 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57841)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SSuWe-00046h-F3
	for bug-bash@gnu.org; Fri, 11 May 2012 14:25:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SSuWc-0004Km-FX
	for bug-bash@gnu.org; Fri, 11 May 2012 14:25:12 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:10460)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SSuWc-0004J6-BC
	for bug-bash@gnu.org; Fri, 11 May 2012 14:25:10 -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 BYM55342; Fri, 11 May 2012 14:25:08 -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 AWT03125 (AUTH cpr);
	Fri, 11 May 2012 14:25:08 -0400 (EDT)
Message-ID: <4FAD5984.4090808@case.edu>
Date: Fri, 11 May 2012 14:25:08 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Mike Frysinger <vapier@gentoo.org>
Subject: Re: bash crashes when forking jobs and dynamically switching posix
	mode
References: <201205111143.55038.vapier@gentoo.org>
In-Reply-To: <201205111143.55038.vapier@gentoo.org>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 11 May 2012 18:25:14 -0000

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

On 5/11/12 11:43 AM, Mike Frysinger wrote:
> in light of the recent discussion, i thought i could switch posix mode on/off 
> on the fly so that i restricted myself to this mode only when using `wait`.  
> unfortunately, that randomly crashes bash :).  simple test case:

I ran through around 20,000 children on RHEL5 before I quit, and it didn't
crash using bash-4.2.28.  However, there is a change in the development
branch that does a better job of not running the SIGCHLD trap in a signal
handling context.  That's the only change I can see, though it should not
matter because the posix mode toggling means that code isn't executed.

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+tWYMACgkQu1hp8GTqdKtjjwCfdf25kdV6xSHhJrU75IBDQuEN
lxkAnRbqGJDljZTCPD6oApBXKS602KIp
=PvTQ
-----END PGP SIGNATURE-----


From MAILER-DAEMON Fri May 11 14:49:44 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SSuuO-0002Gp-6b
	for mharc-bug-bash@gnu.org; Fri, 11 May 2012 14:49:44 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42716)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SSuuL-0002Gj-Hv
	for bug-bash@gnu.org; Fri, 11 May 2012 14:49:42 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SSuuJ-0000vt-L9
	for bug-bash@gnu.org; Fri, 11 May 2012 14:49:41 -0400
Received: from smtp.gentoo.org ([140.211.166.183]:54682)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1SSuuJ-0000vY-F1
	for bug-bash@gnu.org; Fri, 11 May 2012 14:49:39 -0400
Received: from vapier.localnet (localhost [127.0.0.1])
	by smtp.gentoo.org (Postfix) with ESMTP id BECF81B4033;
	Fri, 11 May 2012 18:49:37 +0000 (UTC)
From: Mike Frysinger <vapier@gentoo.org>
Organization: wh0rd.org
To: chet.ramey@case.edu
Subject: Re: bash crashes when forking jobs and dynamically switching posix
	mode
Date: Fri, 11 May 2012 14:49:48 -0400
User-Agent: KMail/1.13.7 (Linux/3.4.0-rc6; KDE/4.6.5; x86_64; ; )
References: <201205111143.55038.vapier@gentoo.org> <4FAD5984.4090808@case.edu>
In-Reply-To: <4FAD5984.4090808@case.edu>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart1680378.2Ix1ZrLzUQ";
	protocol="application/pgp-signature"; micalg=pgp-sha1
Content-Transfer-Encoding: 7bit
Message-Id: <201205111449.49836.vapier@gentoo.org>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 140.211.166.183
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, 11 May 2012 18:49:42 -0000

--nextPart1680378.2Ix1ZrLzUQ
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

On Friday 11 May 2012 14:25:08 Chet Ramey wrote:
> On 5/11/12 11:43 AM, Mike Frysinger wrote:
> > in light of the recent discussion, i thought i could switch posix mode
> > on/off on the fly so that i restricted myself to this mode only when
> > using `wait`.
>=20
> > unfortunately, that randomly crashes bash :).  simple test case:
> I ran through around 20,000 children on RHEL5 before I quit, and it didn't
> crash using bash-4.2.28.  However, there is a change in the development
> branch that does a better job of not running the SIGCHLD trap in a signal
> handling context.  That's the only change I can see, though it should not
> matter because the posix mode toggling means that code isn't executed.

hrm, i'll see if i can't get something that crashes better for me
=2Dmike

--nextPart1680378.2Ix1ZrLzUQ
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

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

iQIcBAABAgAGBQJPrV9NAAoJEEFjO5/oN/WBcFkQAJ8+vvidYHCcyM2s08r2s4jp
t5tYD9aBOke9+LSC1G/gBtnPF9y7NRXQCdLqJnTESq+Gk57fsvko6kS9hgtnwiN8
Itt8Y6YIWzvljYbc40q05+51a9eyzh6/xPIehfGGokW85RF7f1PqZdwCuwSWYTo0
dtFBhzrx89GEgACpQne1MbP+3AEFVanIcDRYwUlKv4qwQZeQvIHPd2aILg+nyGvZ
nXDsRckCynVIfiHvd0iNv6APGq5pH4UkSkam5yQATjms8lRrMstptyueEDDnM7ek
7F/Bg9KNybIoZ2Vs3biuz7YMi0L4QIkW9BtLrEbyYy5CJDWdmIqZv2ybqS/aTrsJ
j0VHFeRrZ8RMgXd3yZQu1IRpCeUdKUSyP0s1uGWtOODgRJWsCAfS4d0UxQvKqeVL
VHH37MF5ATF2Kp8u1mnxqlo4ZItI7dJFKaW3hWkFhzyuWPElyoA4ObFYMSMioB8j
gbz1X+3IUJaAYxBc7+V/XV6FQaUfUrqUc/Ie4h/PmtjZhblLxDbm58qP34B3sTn9
Zk1Ox1IeC24psIkFHtVZ6f3KmpT8ep5o0q9WigfJQNe+PI8oaRROfrG7S4bsQbuV
72MsQPo3brXUHfj53MhrupzxY3/1YH+W+m/FQCkQy95RZCHNyo584cmWYkFkGSjZ
NGC4ol2FMOqDPdpEgVxg
=brX0
-----END PGP SIGNATURE-----

--nextPart1680378.2Ix1ZrLzUQ--


From MAILER-DAEMON Fri May 11 17:58:01 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SSxqb-0008Dx-HC
	for mharc-bug-bash@gnu.org; Fri, 11 May 2012 17:58:01 -0400
Received: from eggs.gnu.org ([208.118.235.92]:55554)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ole.tange@gmail.com>) id 1SSxqY-0008Cw-JW
	for bug-bash@gnu.org; Fri, 11 May 2012 17:57:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ole.tange@gmail.com>) id 1SSxqW-0004rg-E9
	for bug-bash@gnu.org; Fri, 11 May 2012 17:57:58 -0400
Received: from mail-ob0-f169.google.com ([209.85.214.169]:36189)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ole.tange@gmail.com>) id 1SSxqW-0004rc-6G
	for bug-bash@gnu.org; Fri, 11 May 2012 17:57:56 -0400
Received: by obbwd18 with SMTP id wd18so4739958obb.0
	for <bug-bash@gnu.org>; Fri, 11 May 2012 14:57:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:sender:in-reply-to:references:from:date
	:x-google-sender-auth:message-id:subject:to:content-type;
	bh=KM4iJF0J7bGfk0yP/r3sETA5esEBfrQmZoeFDcwZD+o=;
	b=cIjzRAvSCimvWXfjoRWB99cLO0cru8IdWbsvDiLr6+siZKTUWBaBlGFAYcHpUHp6mJ
	SnJpCmsSRyHPnVItvXmGdVoIhG1gettWvpWlzoTUcP2iIHDBPWLWwkialeF9fh9WfiIM
	jsbG5H+nVjWjvDaW2sOexcz7IkbcYldoCF2ufK2H8VkkQ4n0XEpdS2Wu30klnNTcesTo
	Ti2UYG2dyykfgS3urCNEtTRlwpRpsPBnYWg+IrePfpG8AOFpSBogncMAE874AYcXfyyV
	BHm5smFNhyOegxhgyvqeD0gon7HiY+QWFtW923xZ0Lbzuk/wFVvKgZjftm4W9i/EZ8X7
	dwJQ==
Received: by 10.182.117.39 with SMTP id kb7mr7704307obb.37.1336773473331; Fri,
	11 May 2012 14:57:53 -0700 (PDT)
MIME-Version: 1.0
Sender: ole.tange@gmail.com
Received: by 10.182.101.194 with HTTP; Fri, 11 May 2012 14:57:33 -0700 (PDT)
In-Reply-To: <CA+4vN7z0E2nXArKn6-qN2jfr4gvM6-Fzx_5F_5e_Eje=y9XneQ@mail.gmail.com>
References: <CA+4vN7z0E2nXArKn6-qN2jfr4gvM6-Fzx_5F_5e_Eje=y9XneQ@mail.gmail.com>
From: Ole Tange <tange@gnu.org>
Date: Fri, 11 May 2012 23:57:33 +0200
X-Google-Sender-Auth: UnCzfHswpyLXK-ajqGwECXKE0P8
Message-ID: <CA+4vN7wHNaub_FV1eVi2scEdBFNA1ALD+edCjZRd+_2FKBZsHw@mail.gmail.com>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
To: bug-bash@gnu.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: 209.85.214.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: Fri, 11 May 2012 21:58:00 -0000

On Thu, 3 May 2012 19:49:37, Colin McEwan wrote:

> I frequently find myself these days writing shell scripts, to run on
> multi-core machines, which could easily exploit lots of parallelism (eg. a
> batch of a hundred independent simulations).
>
> The basic parallelism construct of '&' for async execution is highly
> expressive, but it's not useful for this sort of use-case: starting up 100
> jobs at once will leave them competing, and lead to excessive context
> switching and paging.
>
> So for practical purposes, I find myself reaching for 'make -j<n>' or GNU
> parallel, both of which destroy the expressiveness of the shell script as I
> have to redirect commands and parameters to Makefiles or stdout, and
> wrestle with appropriate levels of quoting.
>
> What I would really *like* would be an extension to the shell which
> implements the same sort of parallelism-limiting / 'process pooling' found
> in make or 'parallel' via an operator in the shell language, similar to '&'
> which has semantics of *possibly* continuing asynchronously (like '&') if
> system resources allow, or waiting for the process to complete (';').
>
> Any thoughts, anyone?

Can you explain how that idea would differ from sem (Part of GNU Parallel)?

Example from the man page:

       Run one gzip process per CPU core. Block until a CPU core
becomes available.

        for i in `ls *.log` ; do
           echo $i
           sem -j+0 gzip $i ";" echo done
         done
         sem --wait

For quoting --shellquote in GNU Parallel may be of help.

/Ole
-- 
Did you get your GNU Parallel merchandise?
https://www.gnu.org/software/parallel/merchandise.html


From MAILER-DAEMON Sat May 12 03:35:00 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ST6qy-0005jg-7s
	for mharc-bug-bash@gnu.org; Sat, 12 May 2012 03:35:00 -0400
Received: from eggs.gnu.org ([208.118.235.92]:34258)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1ST6qw-0005jZ-BB
	for bug-bash@gnu.org; Sat, 12 May 2012 03:34:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1ST6qu-0003rC-H5
	for bug-bash@gnu.org; Sat, 12 May 2012 03:34:57 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:52138
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>)
	id 1ST6qu-0003qs-6c; Sat, 12 May 2012 03:34:56 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q4C7YmjY011975; Sat, 12 May 2012 00:34:50 -0700
Message-ID: <4FAE1298.7080300@tlinx.org>
Date: Sat, 12 May 2012 00:34:48 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CA+4vN7z0E2nXArKn6-qN2jfr4gvM6-Fzx_5F_5e_Eje=y9XneQ@mail.gmail.com>
	<CA+4vN7wHNaub_FV1eVi2scEdBFNA1ALD+edCjZRd+_2FKBZsHw@mail.gmail.com>
In-Reply-To: <CA+4vN7wHNaub_FV1eVi2scEdBFNA1ALD+edCjZRd+_2FKBZsHw@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Cc: Ole Tange <tange@gnu.org>, bug-bash <bug-bash@gnu.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 12 May 2012 07:34:59 -0000



Ole Tange wrote:

> Can you explain how that idea would differ from sem (Part of GNU Parallel)?

----
	Because gnu parallel is written in perl?  And well, writing it in
perl.... that's near easy... did that about ... 8 years ago? in perl...
to encode albums in FLAC or LAME -- about 35-45 seconds/album...on my old 
machine.  But perl broke the script, multiple times .. (upgrades in perl)...

So am rewriting it...

	Doing it in shell... that would be a 'new' challenge... ;-)

	And people called me masochistic for trying to write complex
progs in shell ...

	Actually my first parallel encode was about 20 lines of shell...
but it just delayed launch of each job by some constant 'k', Wasn't too
efficient, as it usually ran too many jobs at once.

	I think I switched one using job control and keeping track of
the outstanding jobs using the jobs command.  With arrays and hashes (assoc 
arrays), it would be easier to be more flexible...

	maybe 'par' or something similar needs to be ported into a
"dll", that could be dropped into bash as an extension..?

	Hey... for that matter... um.. perl.dll... hmmmm...



From MAILER-DAEMON Sat May 12 08:14:02 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1STBD0-00049e-Kj
	for mharc-bug-bash@gnu.org; Sat, 12 May 2012 08:14:02 -0400
Received: from eggs.gnu.org ([208.118.235.92]:43201)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ole.tange@gmail.com>) id 1STBCx-00048s-Pn
	for bug-bash@gnu.org; Sat, 12 May 2012 08:14:01 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ole.tange@gmail.com>) id 1STBCv-00054f-Pt
	for bug-bash@gnu.org; Sat, 12 May 2012 08:13:59 -0400
Received: from mail-ob0-f169.google.com ([209.85.214.169]:48076)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ole.tange@gmail.com>) id 1STBCv-00054H-I6
	for bug-bash@gnu.org; Sat, 12 May 2012 08:13:57 -0400
Received: by obbwd18 with SMTP id wd18so5764913obb.0
	for <bug-bash@gnu.org>; Sat, 12 May 2012 05:13:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:sender:in-reply-to:references:from:date
	:x-google-sender-auth:message-id:subject:to:cc:content-type
	:content-transfer-encoding;
	bh=3QtaAGu7Gaijpq4O7nzcKYw2dPgH4cZ9KXfhWZ9DwE8=;
	b=D2XDlubiRp04MY2QRojvhJVt6CVJbymyH0gPYR7OT2Z/aIqjr+h//fonQAO0IxpzLz
	WWDscFrQ3yRRGH0fWefgsuqXdmqMGwQY1xGzlEhWgifY/qKNonisLqhTpFUXVuyTGToL
	jnEaO0Zwaitt7+luSEOYokyPmJbknMvRkXGZTPHY44kpQ2weVWXYFb2lbwISdzwA4Kn9
	JMbItIDOUe7ZkY80Xs/QJFe+SfD3H3QE5YnKQzxi68LfwHSNNH7decTJH67+Fxtd1qy9
	v9/xbnR0ga1acnHDgrmsRuqDb4aJ2uasvrSB6azA2pXywLDsR8bk/bDAzMzsVMtXdzgs
	HQaw==
Received: by 10.182.152.72 with SMTP id uw8mr2354630obb.73.1336824835854; Sat,
	12 May 2012 05:13:55 -0700 (PDT)
MIME-Version: 1.0
Sender: ole.tange@gmail.com
Received: by 10.182.101.194 with HTTP; Sat, 12 May 2012 05:06:09 -0700 (PDT)
In-Reply-To: <4FAE1298.7080300@tlinx.org>
References: <CA+4vN7z0E2nXArKn6-qN2jfr4gvM6-Fzx_5F_5e_Eje=y9XneQ@mail.gmail.com>
	<CA+4vN7wHNaub_FV1eVi2scEdBFNA1ALD+edCjZRd+_2FKBZsHw@mail.gmail.com>
	<4FAE1298.7080300@tlinx.org>
From: Ole Tange <tange@gnu.org>
Date: Sat, 12 May 2012 14:06:09 +0200
X-Google-Sender-Auth: 2lCPlp36MzFNs0D39XjMQO8XX7k
Message-ID: <CA+4vN7w462sMistrWDsPBF4=_V=Tti5CjGZNp2_rmvcMrWNq-A@mail.gmail.com>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
To: Linda Walsh <bash@tlinx.org>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.214.169
Cc: bug-bash <bug-bash@gnu.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 12 May 2012 12:14:01 -0000

On Sat, May 12, 2012 at 9:34 AM, Linda Walsh <bash@tlinx.org> wrote:
>
> Ole Tange wrote:
>
>> Can you explain how that idea would differ from sem (Part of GNU
>> Parallel)?
>
> =A0 =A0 =A0 =A0Because gnu parallel is written in perl? =A0And well, writ=
ing it in
> perl.... that's near easy... did that about ... 8 years ago? in perl...
> to encode albums in FLAC or LAME -- about 35-45 seconds/album...on my old
> machine. =A0But perl broke the script, multiple times .. (upgrades in per=
l)...

I have been the maintainer of GNU Parallel for the past 11 years. It
has cost years of work to get it to work on all platforms for all
versions for all corner cases. It has never broken because of a perl
upgrade. So I am quite baffled when you say it is near easy.

Maybe you really mean that it is easy to get it to work for some
platforms for some versions for some corner cases? I will agree to
that, but I would never characterize that as production quality code.

> So am rewriting it...
>
> =A0 =A0 =A0 =A0Doing it in shell... that would be a 'new' challenge... ;-=
)

I fully understand the thrill in doing something again that has
already been done - especially if it can be done better (Case in
point: GNU Parallel vs. xargs). I also understand the concept of doing
something that has already been done - just to see if you can do it
yourself (e.g. I wrote a quine just to see if I could).

What I do not understand is wanting help to do something that has
already been done better.

In the GNU Project we have several projects that could benefit from help:
https://www.fsf.org/campaigns/priority-projects/ so I would find it
wasteful to spend time doing something again - especially if the goal
is not to solve the problem better. I would encourage you to spend
your time doing something that has not been done before, or improve
existing code.


/Ole
--=20
Did you get your GNU Parallel merchandise?
https://www.gnu.org/software/parallel/merchandise.html


From MAILER-DAEMON Sat May 12 11:35:46 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1STEME-0000fY-6Z
	for mharc-bug-bash@gnu.org; Sat, 12 May 2012 11:35:46 -0400
Received: from eggs.gnu.org ([208.118.235.92]:43836)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1STEMA-0000fO-Ty
	for bug-bash@gnu.org; Sat, 12 May 2012 11:35:44 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1STEM8-00053s-LB
	for bug-bash@gnu.org; Sat, 12 May 2012 11:35:42 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:60361
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>)
	id 1STEM8-00053h-5X; Sat, 12 May 2012 11:35:40 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q4CFZZ03007239; Sat, 12 May 2012 08:35:37 -0700
Message-ID: <4FAE8347.1020704@tlinx.org>
Date: Sat, 12 May 2012 08:35:35 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: Ole Tange <tange@gnu.org>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
References: <CA+4vN7z0E2nXArKn6-qN2jfr4gvM6-Fzx_5F_5e_Eje=y9XneQ@mail.gmail.com>
	<CA+4vN7wHNaub_FV1eVi2scEdBFNA1ALD+edCjZRd+_2FKBZsHw@mail.gmail.com>
	<4FAE1298.7080300@tlinx.org>
	<CA+4vN7w462sMistrWDsPBF4=_V=Tti5CjGZNp2_rmvcMrWNq-A@mail.gmail.com>
In-Reply-To: <CA+4vN7w462sMistrWDsPBF4=_V=Tti5CjGZNp2_rmvcMrWNq-A@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by Ishtar.sc.tlinx.org id
	q4CFZZ03007239
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Cc: bug-bash <bug-bash@gnu.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 12 May 2012 15:35:44 -0000

Ole Tange wrote:

> On Sat, May 12, 2012 at 9:34 AM, Linda Walsh <bash@tlinx.org> wrote:
>> Ole Tange wrote:
>>
>>> Can you explain how that idea would differ from sem (Part of GNU
>>> Parallel)?
>> =EF=BF=BD =EF=BF=BD =EF=BF=BD =EF=BF=BDBecause gnu parallel is written=
 in perl? =EF=BF=BDAnd well, writing it in
>> perl.... that's near easy... did that about ... 8 years ago? in perl...
>> to encode albums in FLAC or LAME -- about 35-45 seconds/album...on my =
old
>> machine. =EF=BF=BDBut perl broke the script, multiple times .. (upgrad=
es in perl)...
>=20
> I have been the maintainer of GNU Parallel for the past 11 years. It
> has cost years of work to get it to work on all platforms for all
> versions for all corner cases. It has never broken because of a perl
> upgrade. So I am quite baffled when you say it is near easy.
>=20
> Maybe you really mean that it is easy to get it to work for some
> platforms for some versions for some corner cases? I will agree to
> that, but I would never characterize that as production quality code.
>=20
>> So am rewriting it...
>>
>> =EF=BF=BD =EF=BF=BD =EF=BF=BD =EF=BF=BDDoing it in shell... that would=
 be a 'new' challenge... ;-)
>=20
> I fully understand the thrill in doing something again that has

----
	I think you missed the 'wink'... and the following comment:

     "And people called me masochistic for trying to write complex
    progs in shell ... "
=09
	Notice the original adjective before the word 'easy'.  It's vital in=20
understanding, it's a classic example of the relative definition of "near=
".

	Example: Travel to the nearest solar system outside ours is near easy co=
mpared=20
to travel to the next galaxy...  *ahem*...*cough* *cough*.


	Sorry, but I'm sure it WASN'T easy to get it to work natively on all pla=
tforms,=20
especially if Win32 or strawberry perl is included in that "all".

	Even getting it to work correctly on 1 platform is less than trivial --
as mine runs jobs based on #cpus, a simple check of /proc/cpuinfo won't w=
ork so
well on non-*nix compat's...  so there was no attempt at comparison, and =
mine
isn't even working right now....(didn't start in perl...mostly due to usa=
ge
of 'use Exporter/EXPORTS' and multiple packages in same file -- and seman=
tics in=20
those areas changing quite a bit.

	If you did it all in 1 package OR did it in straight OO (no 'Export/Impo=
rts),=20
you would like have avoided most of the problems I ran into.

	As was suggested by others -- I also found a need to use HASH's to
map exit status values from each job, back to their original caller to po=
int to
which job failed (if one failed).

	Also one would want to trap Control-C, so one can terminate outstanding
jobs.

	I had no need for a semaphore -- and was able to use sleep without fear =
of=20
waking up multiple jobs, as I only scheduled as many jobs as desired at o=
ne time=20
-- i.e. say running 20 convert jobs, but my cpu count=3D2 & extra loading=
 factor=20
was 2, allowing for 4 jobs to run at once.  The first foure would run=20
immediately, but the next 16 wouldn't get scheduled for execution until o=
ne of=20
the first ones exited, then they are scheduled 1-by-1 as done processes f=
inish.

	So for me, my 'semaphore' count was 'k1+k2', where k1 was based on # cpu=
's in=20
system and k2 was specific to how much overlap the particular machine I w=
as=20
running on needed to keep the cpu's @ 100% ...Once I decide on those  I j=
ust=20
have to simple accounting for number of launched procs & # of child death=
s to=20
maintain a running score.  So my limiting semaphore was based on outstand=
ing=20
children -- if I wanted something not based on outstanding children, I mi=
ght=20
have to use a semaphore...  But my algorithm didn't require an arbitrary =
number,
so no need for that added complexity.



> already been done - especially if it can be done better (Case in
> point: GNU Parallel vs. xargs). I also understand the concept of doing
> something that has already been done - just to see if you can do it
> yourself (e.g. I wrote a quine just to see if I could).
>=20
> What I do not understand is wanting help to do something that has
> already been done better.

----
	Huh?

	I think people were discussing ways it might be done in shell, not
asking for help for any specific implementation -- or some were asking th=
at
something like parallel be a built-in (my suggestion of a ".dll" (or .so)=
).

	They challenge would be writing something as complex as 'parallel' in
shell...  which is being discussed, in more primitive forms -- beyond whi=
ch, I=20
think is left as an exercise for the reader...

	And of course, seeing yours was written in perl, I couldn't help but mus=
e a bit=20
on having a "perl builtin" keyword as, most installations having perl alr=
eady=20
have it built as a dynamic lib.  However, not knowing how or why it would=
 be=20
beneficial/useful to do that of the top of my head, I left that idea with=
 "..."...

	Does that make my idiosyncratic and culturally-"contexted"-obfuscating=20
statement(s) more clear?   ;-)


Linda



From MAILER-DAEMON Sun May 13 00:06:39 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1STQ4t-0007bp-2k
	for mharc-bug-bash@gnu.org; Sun, 13 May 2012 00:06:39 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48570)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1STQ4q-0007bQ-1N
	for bug-bash@gnu.org; Sun, 13 May 2012 00:06:37 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1STQ4o-0006fS-3z
	for bug-bash@gnu.org; Sun, 13 May 2012 00:06:35 -0400
Received: from plane.gmane.org ([80.91.229.3]:60929)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1STQ4n-0006fJ-U6
	for bug-bash@gnu.org; Sun, 13 May 2012 00:06:34 -0400
Received: from list by plane.gmane.org with local (Exim 4.69)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1STQ4l-0001q7-QA
	for bug-bash@gnu.org; Sun, 13 May 2012 06:06:31 +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>; Sun, 13 May 2012 06:06:31 +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>; Sun, 13 May 2012 06:06:31 +0200
X-Injected-Via-Gmane: http://gmane.org/
To: bug-bash@gnu.org
From: "John E. Malmberg" <wb8tyw@qsl.net>
Subject: obsolete vms specific code in lib/glob/ndir.h
Date: Sat, 12 May 2012 23:05:45 -0500
Lines: 13
Message-ID: <jonbvt$jr7$1@dough.gmane.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: usenet@dough.gmane.org
X-Gmane-NNTP-Posting-Host: 173-19-202-206.client.mchsi.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:10.0) Gecko/20120129 Thunderbird/10.0
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 80.91.229.3
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 13 May 2012 04:06:38 -0000

The lib/glob/ndir.h file has some VMS specific code in it.

That header file is not used by VMS in building bash.

Even if it where to be used, the code is out of date and would not work 
on current versions of VMS.

I recommend removing the VMS specific code from that file.

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



From MAILER-DAEMON Mon May 14 08:32:03 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1STuRX-00037X-Sx
	for mharc-bug-bash@gnu.org; Mon, 14 May 2012 08:32:03 -0400
Received: from eggs.gnu.org ([208.118.235.92]:36547)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1STuRR-00036f-Fq
	for bug-bash@gnu.org; Mon, 14 May 2012 08:32:01 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1STuRL-0003qy-C2
	for bug-bash@gnu.org; Mon, 14 May 2012 08:31:57 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:37126
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1STuRL-0003oc-63
	for bug-bash@gnu.org; Mon, 14 May 2012 08:31:51 -0400
Received: (qmail 24679 invoked from network); 14 May 2012 12:31:25 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Mon, 14 May 2012 08:31:25 -0400
Received: (qmail 18747 invoked by uid 563); 14 May 2012 12:31:25 -0000
Date: Mon, 14 May 2012 08:31:25 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Ole Tange <tange@gnu.org>
Subject: Re: Parallelism a la make -j <n> / GNU parallel
Message-ID: <20120514123125.GK1622@eeg.ccf.org>
References: <CA+4vN7z0E2nXArKn6-qN2jfr4gvM6-Fzx_5F_5e_Eje=y9XneQ@mail.gmail.com>
	<CA+4vN7wHNaub_FV1eVi2scEdBFNA1ALD+edCjZRd+_2FKBZsHw@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CA+4vN7wHNaub_FV1eVi2scEdBFNA1ALD+edCjZRd+_2FKBZsHw@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, 14 May 2012 12:32:02 -0000

On Fri, May 11, 2012 at 11:57:33PM +0200, Ole Tange wrote:
> Example from the man page:
> 
>        Run one gzip process per CPU core. Block until a CPU core
> becomes available.
> 
>         for i in `ls *.log` ; do
>            echo $i
>            sem -j+0 gzip $i ";" echo done
>          done
>          sem --wait

If this example is in the man page, then it should be fixed:

	for i in *.log ; do
	   echo "$i"
	   sem -j+0 gzip "$i" ";" echo done
	done
	sem --wait


From MAILER-DAEMON Mon May 14 21:29:56 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SU6aK-0005jp-Bl
	for mharc-bug-bash@gnu.org; Mon, 14 May 2012 21:29:56 -0400
Received: from eggs.gnu.org ([208.118.235.92]:45199)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mikel@mikelward.com>) id 1SU6aH-0005iA-2O
	for bug-bash@gnu.org; Mon, 14 May 2012 21:29:54 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <mikel@mikelward.com>) id 1SU6aF-0005YH-8r
	for bug-bash@gnu.org; Mon, 14 May 2012 21:29:52 -0400
Received: from mail-bk0-f41.google.com ([209.85.214.41]:62985)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mikel@mikelward.com>) id 1SU6aE-0005YD-OV
	for bug-bash@gnu.org; Mon, 14 May 2012 21:29:51 -0400
Received: by bkcjm19 with SMTP id jm19so5359245bkc.0
	for <bug-bash@gnu.org>; Mon, 14 May 2012 18:29:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=mikelward.com; s=google;
	h=mime-version:x-originating-ip:date:message-id:subject:from:to
	:content-type; bh=D1yUo0XhNtOs9pTTsvanGS9iO/Mlaa+Ne0cM1WrzyGI=;
	b=KFgzuP52Aj29ZwOn4rCTf9KGW4vuchBvmXKbIGT1aAP9uHa/SJlKc72YGKqJjekSk+
	RIY3IGkr3Xqxi5vsHJMXPfxHcKuRa/EGc91kH7R3APPyPiYyG0fE+I5ckTFJECCWvP3j
	RT1fZD1tvZxsRC/CdV9KVclECNRCMKQBuvXBk=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=google.com; s=20120113;
	h=mime-version:x-originating-ip:date:message-id:subject:from:to
	:content-type:x-gm-message-state;
	bh=D1yUo0XhNtOs9pTTsvanGS9iO/Mlaa+Ne0cM1WrzyGI=;
	b=VUoU+AbUuq1tmYu7EUgm9WczSnxPSI6jn0xy84YjdzzbnbKFGk8VUXVkpisQqUc30L
	UMRs48gvhsLyymcU7dNjvTckflL1JXaEHijE1M3yzGaYRyZW+P5N1R36SBue2BXixct4
	p2B6Vn1hWxzA8LkDBVEF4sKZz6Lui6juIbfjvlnu7iMtIHNsNRzAxMf1tgaXJvGOg3cI
	/ifZDOzAgdvq0H+xFWj6owJH+usGlRijSaiKvT9oIbY0JCGegQhfrlmtPL7fvKDDo9DG
	p8GM177Bi4/zo3ajta1Yv0Zk+YiqUHcM4zAMpjDRpLvuL6LDx2tKTmFT54fNEaYonbeq
	GL4Q==
MIME-Version: 1.0
Received: by 10.204.152.22 with SMTP id e22mr3981629bkw.8.1337045388233; Mon,
	14 May 2012 18:29:48 -0700 (PDT)
Received: by 10.205.139.6 with HTTP; Mon, 14 May 2012 18:29:48 -0700 (PDT)
X-Originating-IP: [50.78.104.166]
Date: Mon, 14 May 2012 18:29:48 -0700
Message-ID: <CACVmprfHsz-viDeWm=1sctY-nN4nv+neZ5MSrb4FrqNeVBBUYA@mail.gmail.com>
Subject: extglob not matching explicit leading dot
From: Mikel Ward <mikel@mikelward.com>
To: bug-bash@gnu.org
Content-Type: text/plain; charset=UTF-8
X-Gm-Message-State: ALoCoQkcMgCTB0GmfZ0IRSBpKLrAAXbdxzcc4COpQX5lcgARnyuVTBCfXQYNOYhytTuouf5yDHEC
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.214.41
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 15 May 2012 01:29:54 -0000

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu'
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share/locale'
-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include
-I./lib   -g -O2
uname output: Linux mikel-dev 3.3.2-6.fc16.x86_64 #1 SMP Sat Apr 21
12:43:20 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

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

Description:
A leading dot in extglob pattern fails to expand as expected.

Repeat-By:
    cd $(mktemp -d)
    touch .Xdefaults
    shopt -s extglob
    echo @(.Xdefaults)

should print .Xdefaults
but it prints @(.Xdefaults)

works in ksh93 Version JM 93u+ 2011-06-22


From MAILER-DAEMON Tue May 15 14:50:36 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SUMpQ-0005mk-Ar
	for mharc-bug-bash@gnu.org; Tue, 15 May 2012 14:50:36 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57428)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SUMpN-0005bc-18
	for bug-bash@gnu.org; Tue, 15 May 2012 14:50:35 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SUMpK-00025D-GA
	for bug-bash@gnu.org; Tue, 15 May 2012 14:50:32 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:59828)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SUMpK-00024j-72
	for bug-bash@gnu.org; Tue, 15 May 2012 14:50:30 -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 BKS68293;
	Tue, 15 May 2012 14:50:27 -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 AXH04671 (AUTH cpr);
	Tue, 15 May 2012 14:50:27 -0400 (EDT)
Message-ID: <4FB2A573.4050202@case.edu>
Date: Tue, 15 May 2012 14:50:27 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Mikel Ward <mikel@mikelward.com>
Subject: Re: extglob not matching explicit leading dot
References: <CACVmprfHsz-viDeWm=1sctY-nN4nv+neZ5MSrb4FrqNeVBBUYA@mail.gmail.com>
In-Reply-To: <CACVmprfHsz-viDeWm=1sctY-nN4nv+neZ5MSrb4FrqNeVBBUYA@mail.gmail.com>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at 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: Tue, 15 May 2012 18:50:35 -0000

On 5/14/12 9:29 PM, Mikel Ward wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu'
> -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share/locale'
> -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include
> -I./lib   -g -O2
> uname output: Linux mikel-dev 3.3.2-6.fc16.x86_64 #1 SMP Sat Apr 21
> 12:43:20 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
> Machine Type: x86_64-unknown-linux-gnu
> 
> Bash Version: 4.2
> Patch Level: 28
> Release Status: release
> 
> Description:
> A leading dot in extglob pattern fails to expand as expected.

Thanks for the report.  This was reported previously and has already been
fixed for the next version.

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 May 17 01:25:09 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SUtD3-0007PS-5t
	for mharc-bug-bash@gnu.org; Thu, 17 May 2012 01:25:09 -0400
Path: usenet.stanford.edu!postnews.google.com!h10g2000pbi.googlegroups.com!not-for-mail
From: Richy Boy <1richyboy@gmail.com>
Newsgroups: gnu.bash.bug
Subject: Make money working at home in India
Date: Wed, 16 May 2012 22:22:52 -0700 (PDT)
Organization: http://groups.google.com
Lines: 35
Message-ID: <17b30c49-f6db-4e0e-b2f6-2391dfe9dd08@h10g2000pbi.googlegroups.com>
NNTP-Posting-Host: 27.106.86.48
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1337232258 6944 127.0.0.1 (17 May 2012 05:24:18
	GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 17 May 2012 05:24:18 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: h10g2000pbi.googlegroups.com; posting-host=27.106.86.48;
	posting-account=lDnCbAoAAABgZJBwRFnOxm9G93q2ugF_
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.1;
	rv:12.0) Gecko/20100101 Firefox/12.0,gzip(gfe)
Xref: usenet.stanford.edu gnu.bash.bug:24664
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, 17 May 2012 05:25:08 -0000


Pay per Click

Create and place your ads on thousands of relevant websites run your
ad on our pay per click advertising network and start receiving new
targeted and easy-to-convert prospects in less than 5 minutes. Pay per
click (PPC) (also called Cost per click) is an Internet advertising
model used to direct traffic to websites, where advertisers pay the
publisher. PPC Ads is largest and most popular form of Internet
advertising in which advertiser pay only for those who click on your
listings which means pays per click, each clicks on their ad and links
to the landing page. It is used on search engines, advertising
networks, and content sites, blogs, forums

Advertisers

Advertise across thousands of websites on a pay per click basis.
=95	Browse our categorized directory of websites.
=95	Select the appropriate channels for your business.
=95	Set your pay per click bids.
=95	Your ads are up and running

Publishers

Make money online by adding ads to your site or blog and get paid for
clicks. You get paid for every visitor that clicks on an ad. It enable
you to make money as much as possible from your advertising space. We
pay monthly, either by check, wire minimum of only Rs. 1000/-
Referral Income
Referral a text link on your site and you will start to earn money
when a user clicks on your button or link and signs as an advertiser
or a publisher. When any publisher or Advertise spend money you get 5%
revenue.

http://www.ways2work.in/make-money-working-at-home-in-india/

From MAILER-DAEMON Fri May 18 14:09:28 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SVRcG-0004Ts-6M
	for mharc-bug-bash@gnu.org; Fri, 18 May 2012 14:09:28 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44483)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SVRcC-0004Tk-PR
	for bug-bash@gnu.org; Fri, 18 May 2012 14:09:26 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SVRcA-0001Lb-N4
	for bug-bash@gnu.org; Fri, 18 May 2012 14:09:24 -0400
Received: from mail-gg0-f169.google.com ([209.85.161.169]:61508)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SVRcA-0001LM-Ej
	for bug-bash@gnu.org; Fri, 18 May 2012 14:09:22 -0400
Received: by ggm4 with SMTP id 4so3795948ggm.0
	for <bug-bash@gnu.org>; Fri, 18 May 2012 11:09:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=from:to:subject:date:message-id:user-agent:mime-version
	:content-type:content-transfer-encoding;
	bh=FJjLA4hTMEOU1shrXaUKfc/0L48zvUY/Pv7DyjjWESA=;
	b=nSGwQFsO5BwonlFjGidwoSnyUQ6kJeZZEPBs1Y14FILhkhmrjzOkY9c6sf20VhUUR/
	WsXYlboR+PiMn4QZc9Dq+N7aMj7xA6TObEQS5zVDg9S632ctuY+kCD+3Mcvc+XKnvCme
	P1OZwUJlxwf3MzNAgN4urSmkxKIZHPzyYtLSxR8sJ8mRE2MfEMoc+rLYZqJkaf10m2E7
	D5IqoI/iGXT27eIzS20H99/FYuKWeboXXSGzHPf1UdhhKLd0ipIfNFno+FY9ZFdh+PFl
	n+q17O0O6KZU4VkNVvXUdGIo6MeOASm3Kf250ydZl3d+U5ct0LUyrNyPQiXHCV34SoV/
	MhFQ==
Received: by 10.60.32.113 with SMTP id h17mr101455oei.40.1337364559779;
	Fri, 18 May 2012 11:09:19 -0700 (PDT)
Received: from smorgbox.localnet (174-20-97-208.mpls.qwest.net.
	[174.20.97.208])
	by mx.google.com with ESMTPS id y9sm6500097oea.1.2012.05.18.11.09.18
	(version=SSLv3 cipher=OTHER); Fri, 18 May 2012 11:09:18 -0700 (PDT)
From: Dan Douglas <ormaaj@gmail.com>
To: bug-bash@gnu.org
Subject: Segfault on compound assignment to a variable whose name is set in
	the environment of a declaration builtin.
Date: Fri, 18 May 2012 13:08:51 -0500
Message-ID: <1430566.bsMcg8UFsV@smorgbox>
User-Agent: KMail/4.8.3 (Linux/3.3.4-pf+; KDE/4.8.3; x86_64; ; )
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart2975633.XDCIN1ouhr";
	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.161.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: Fri, 18 May 2012 18:09:26 -0000


--nextPart2975633.XDCIN1ouhr
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"

Hi Chet, segfault occurs during array assignment if an attempt is made to modify a
variable of the same name from the environment. It appears to only occur in the global scope.
I imagine the expected result should be either an error, or to evaluate in a mannar similar to
`x=1 let "x[x++]=x"', for example.

One way to reproduce below:

 ~ $ ( rm core; ulimit -c unlimited; bash -c 'x=1 declare -a x=( [x++]= )'; gdb -q "$(type -P bash)" -c core )
Reading symbols from /bin/bash...Reading symbols from /usr/lib64/debug/bin/bash.debug...done.
done.
[New LWP 20493]

warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
Core was generated by `bash -c x=1 declare -a x=( [x++]= )'.
Program terminated with signal 11, Segmentation fault.
#0  0x00000000004630a0 in array_insert (a=0x8e03c0, i=0, v=0x8dfe50 "") at array.c:633
633             for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae)) {
(gdb) bt full
#0  0x00000000004630a0 in array_insert (a=0x8e03c0, i=0, v=0x8dfe50 "") at array.c:633
        new = 0x8e0240
        ae = 0x8e0070
#1  0x00000000004640fe in bind_array_var_internal (entry=0x8dff30, ind=0, key=0x0, value=0x8e0306 "", flags=0) at arrayfunc.c:163
        dentry = 0x1f333b550
        newval = 0x8dfe50 ""
#2  0x0000000000464b86 in assign_compound_array_list (var=0x8dff30, nlist=0x8dfe70, flags=0) at arrayfunc.c:529
        a = 0x8e01e0
        h = 0x0
        list = 0x8dfe70
        w = 0x8e0300 "[x++]="
        val = 0x8e0306 ""
        nval = 0x8dfff0 "x=([x++]=)"
        len = 4
        iflags = 0
        ind = 0
        last_ind = 0
        akey = 0x0
#3  0x0000000000464bfb in assign_array_var_from_string (var=0x8dff30, value=0x8dfcd2 "([x++]=)", flags=0) at arrayfunc.c:548
        nlist = 0x8dfe70
#4  0x000000000047cbd7 in declare_internal (list=0x8e0070, local_var=0) at ./declare.def:509
        value = 0x8dfcd2 "([x++]=)"
        aflags = 0
        compound_array_assign = 1
        name = 0x8dfcd0 "x"
        offset = 1
        making_array_special = 0
        simple_array_assign = 0
        flags_on = 4
        flags_off = 0
        flags = 0x7ffff333b654
        any_failed = 0
        assign_error = 0
        pflag = 0
        nodefs = 0
        opt = -1
        mkglobal = 0
        t = 0x0
        subscript_start = 0x0
        var = 0x8dff30
        shell_fn = 0x0
#5  0x000000000047c004 in declare_builtin (list=0x21) at ./declare.def:98
No locals.
#6  0x0000000000433278 in execute_builtin (builtin=0x47bff0 <declare_builtin>, words=0x8dffb0, flags=64, subshell=0) at execute_cmd.c:4113
        old_e_flag = 0
        result = 0
        eval_unwind = 0
        isbltinenv = 0
        error_trap = 0x0
#7  0x0000000000433eb8 in execute_builtin_or_function (words=0x8dffb0, builtin=0x47bff0 <declare_builtin>, var=0x0, redirects=0x0,
    fds_to_close=0x8dfbc0, flags=64) at execute_cmd.c:4538
        result = 0
        saved_undo_list = 0x0
        ofifo = 0
        nfifo = 0
        osize = 0
        ofifo_list = 0x0
#8  0x0000000000432d8f in execute_simple_command (simple_command=0x8ddd30, pipe_in=-1, pipe_out=-1, async=0, fds_to_close=0x8dfbc0)
    at execute_cmd.c:3948
        words = 0x8dffb0
        lastword = 0x8e0070
        command_line = 0x0
        lastarg = 0x8dfff0 "x=([x++]=)"
        temp = 0x0
        first_word_quoted = 0
        result = 0
        builtin_is_special = 0
        already_forked = 0
        dofork = 0
        old_last_async_pid = -1
        builtin = 0x47bff0 <declare_builtin>
        func = 0x0
        old_builtin = 0
        old_command_builtin = 0
#9  0x000000000042d26f in execute_command_internal (command=0x8ddd00, asynchronous=0, pipe_in=-1, pipe_out=-1, fds_to_close=0x8dfbc0)
    at execute_cmd.c:735
        exec_result = 0
        user_subshell = 0
        invert = 0
        ignore_return = 0
        was_error_trap = 0
        my_undo_list = 0x0
        exec_undo_list = 0x0
        last_pid = -1
        save_line_number = 0
#10 0x000000000047ec83 in parse_and_execute (string=0x8dd630 "x=1 declare -a x=( [x++]= )", from_file=0x49ff30 "-c", flags=4) at evalstring.c:319
        bitmap = 0x8dfbc0
        code = 0
---Type <return> to continue, or q <return> to quit---
        lreset = 0
        should_jump_to_top_level = 0
        last_result = 0
        command = 0x8ddd00
#11 0x0000000000417f9b in run_one_command (command=0x7ffff333d820 "x=1 declare -a x=( [x++]= )") at shell.c:1315
        code = 0
#12 0x00000000004172a9 in main (argc=3, argv=0x7ffff333bb38, env=0x7ffff333bb58) at shell.c:688
        i = 0
        code = 0
        old_errexit_flag = 0
        saverst = 0
        locally_skip_execution = 0
        arg_index = 3
        top_level_arg_index = 3
(gdb) q
 $ echo $BASH_VERSION
4.2.28(1)-release

Thanks again. (not overly anxious for a fix.)
-- 
Dan Douglas
--nextPart2975633.XDCIN1ouhr
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+2kDoACgkQMmyDamdg+MzlfwCfQ6bEPvT0zSNOm97BaJRcnd/W
lR0AoIzEsTYm1/pKxdHfzcClWO45fjze
=lK3d
-----END PGP SIGNATURE-----

--nextPart2975633.XDCIN1ouhr--



From MAILER-DAEMON Sun May 20 13:01:40 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SW9Vk-0005pI-NM
	for mharc-bug-bash@gnu.org; Sun, 20 May 2012 13:01:40 -0400
Received: from eggs.gnu.org ([208.118.235.92]:56962)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <deletesoftware@yandex.ru>) id 1SW9Vi-0005ot-KC
	for bug-bash@gnu.org; Sun, 20 May 2012 13:01:39 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <deletesoftware@yandex.ru>) id 1SW9Vg-0000f8-JN
	for bug-bash@gnu.org; Sun, 20 May 2012 13:01:38 -0400
Received: from forward13.mail.yandex.net ([95.108.130.120]:60096)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <deletesoftware@yandex.ru>) id 1SW9Vg-0000et-5j
	for bug-bash@gnu.org; Sun, 20 May 2012 13:01:36 -0400
Received: from smtp13.mail.yandex.net (smtp13.mail.yandex.net [95.108.130.68])
	by forward13.mail.yandex.net (Yandex) with ESMTP id 498AD14106B
	for <bug-bash@gnu.org>; Sun, 20 May 2012 21:01:33 +0400 (MSK)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail;
	t=1337533293; bh=FGJEl/I2PFKnltmEfDgaUWFe3paLSfPe9KPvaMXsem0=;
	h=Message-ID:Date:From:MIME-Version:To:Subject:Content-Type:
	Content-Transfer-Encoding;
	b=KVN84tU+zWU+qneBhCRlRHyzWewJ+Z3pAC5BhmrmUylwNmGGpk6s0FjYnJBjgnB7N
	OdEp9jdMGJLsh2rx9IdiinhZwNvRgC9GhfwTOK2H71j2SVUH3HG1c/CmhXyMP/URBO
	aGx1q6BTBOCrpODRlFhCdw5ZWB8uM6628I3k/P3s=
Received: from smtp13.mail.yandex.net (localhost [127.0.0.1])
	by smtp13.mail.yandex.net (Yandex) with ESMTP id 2E4CFE40557
	for <bug-bash@gnu.org>; Sun, 20 May 2012 21:01:33 +0400 (MSK)
Received: from 128-68-75-51.broadband.corbina.ru
	(128-68-75-51.broadband.corbina.ru [128.68.75.51])
	by smtp13.mail.yandex.net (nwsmtp/Yandex) with ESMTP id
	1Qc45ZLL-1WcGxip8; Sun, 20 May 2012 21:01:32 +0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail;
	t=1337533293; bh=FGJEl/I2PFKnltmEfDgaUWFe3paLSfPe9KPvaMXsem0=;
	h=Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:
	Content-Type:Content-Transfer-Encoding;
	b=Heq/6Wy7jf2UUg1osf3R2XdAMfzJQlLjRH/Hg2d3QvIay0tIhO/prtm9D/5UqJl7F
	rN381DvonndNhWDGHBdO0Q64hiN11KDnHR6aT8RY65fJVx/bI8Bs6pyUSk9Os7vYsc
	UUxoaL8B3ot1B9bJafrUnaamc3ZzMmoW3ji2iSb8=
Message-ID: <4FB92365.20105@yandex.ru>
Date: Sun, 20 May 2012 21:01:25 +0400
From: Aleksej Serdjukov <deletesoftware@yandex.ru>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:10.0.3) Gecko/20120329 Icedove/10.0.3
MIME-Version: 1.0
To: bug-bash@gnu.org
Subject: A small error in the Russian translation
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 95.108.130.120
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, 20 May 2012 17:01:39 -0000

Hello.


http://git.savannah.gnu.org/cgit/bash.git/plain/po/ru.po?h=3Ddevel

=3D=3D=3D
#: builtins/common.c:282
#, c-format
msgid "%s: no such job"
msgstr "%s: =D0=BD=D0=B5 =D1=82=D0=B0=D0=BA=D0=BE=D0=B9 =D0=B7=D0=B0=D0=B4=
=D0=B0=D1=87=D0=B8"
=3D=3D=3D

(appears e.g. when running =E2=80=9Cfg=E2=80=9D with no result)

Must be =E2=80=9C%s: =D0=BD=D0=B5=D1=82 =D1=82=D0=B0=D0=BA=D0=BE=D0=B9 =D0=
=B7=D0=B0=D0=B4=D0=B0=D1=87=D0=B8=E2=80=9D.


Also, the second line of the file should begin with =E2=80=9C# =D0=A0=D1=83=
=D1=81=D1=81=D0=BA=D0=B8=D0=B5=20
=D0=BF=D0=B5=D1=80=D0=B5=D0=B2=D0=BE=D0=B4=D1=8B=E2=80=9D, not =E2=80=9C=D0=
=90=D0=BD=D0=B3=D0=BB=D0=B8=D0=B9=D1=81=D0=BA=D0=B8=D0=B5 =D0=BF=D0=B5=D1=
=80=D0=B5=D0=B2=D0=BE=D0=B4=D1=8B=E2=80=9D.


From MAILER-DAEMON Sun May 20 14:36:46 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWAzm-0007Qd-Is
	for mharc-bug-bash@gnu.org; Sun, 20 May 2012 14:36:46 -0400
Received: from eggs.gnu.org ([208.118.235.92]:54120)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWAzk-0007Pm-7p
	for bug-bash@gnu.org; Sun, 20 May 2012 14:36:45 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWAzi-0002dq-IY
	for bug-bash@gnu.org; Sun, 20 May 2012 14:36:43 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:48538
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWAzi-0002dQ-7n
	for bug-bash@gnu.org; Sun, 20 May 2012 14:36:42 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q4KIaZ8I020815
	for <bug-bash@gnu.org>; Sun, 20 May 2012 11:36:37 -0700
Message-ID: <4FB939B3.1010804@tlinx.org>
Date: Sun, 20 May 2012 11:36:35 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: bug-bash <bug-bash@gnu.org>
Subject: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 20 May 2012 18:36:45 -0000




As the perl folks are about to release another version with yet more 
major unicode corrections (apparently they have had to redo alot of 
namespace and unicode stuff in every major version since 5.6 due to the 
changing of the guard (amongst other reasons).

But perl has the ability in the new version to specify how chars shall 
be handled in a search, for example --
locale specific, unicode specific, ascii rules(C I think), and a 
'd'epends mode that handles most things like Unicode, except for bytes 
between 128-255, where they will default to staying with Latin1 (as I 
understand it -- they aren't especially forth coming with explanations).

I tried to ask, under what circumstances would I get the collating order 
that bash now defaults to in the en_US locale -- and was told NONE.   I 
asked them why -- how did they justify that behavior -- what documents 
were they following and was told that to ask for technical 
justifications was rude, with no one volunteering an answer.  Sounds a 
bit sketchy to me... like they have no reasons....but that could be a 
projection. 

I told them I thought that them taking such technical questions as 
'rudeness' was their personal trip, and not related to the engineering 
task(s) at hand.   A few understood, a few other loud ones joined in 
with those who had no answer, and said asking for any sort of reason or 
justification as to why perl is the way it is, argumentative and 
rude...etc....blah blah blah...  (bunch of self-absorbed prima donna's - 
worse than me on a bad day!)...

Anyway... so WHY does bash collate this way?   Under what rules is bash 
operating?  I.e. justification?
If other programs claim to have locale specific sorting & character 
collation,  should they be sorting the same way? 

So far, i've seen Microsoft do the a<A<z<Z collation, in win7 and above, 
BUT.. I hardly think Bash did it to follow windows....  So.. where did 
this come from and how should it apply to other "locale honoring" programs?

Thanks!
Linda




From MAILER-DAEMON Sun May 20 16:59:55 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWDEI-0006fE-Vm
	for mharc-bug-bash@gnu.org; Sun, 20 May 2012 16:59:54 -0400
Received: from eggs.gnu.org ([208.118.235.92]:43082)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWDEG-0006eM-5x
	for bug-bash@gnu.org; Sun, 20 May 2012 16:59:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWDEE-0004bH-1W
	for bug-bash@gnu.org; Sun, 20 May 2012 16:59:51 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:45222)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWDED-0004b9-TG
	for bug-bash@gnu.org; Sun, 20 May 2012 16:59:49 -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 BYT64985; Sun, 20 May 2012 16:59:48 -0400 (EDT)
Received: from h191.11.172.72.dynamic.ip.windstream.net (EHLO z4.local)
	([72.172.11.191]) by mpv7.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id TXI68930 (AUTH cpr);
	Sun, 20 May 2012 16:59:47 -0400 (EDT)
Message-ID: <4FB95B43.7070100@case.edu>
Date: Sun, 20 May 2012 16:59:47 -0400
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Aleksej Serdjukov <deletesoftware@yandex.ru>
Subject: Re: A small error in the Russian translation
References: <4FB92365.20105@yandex.ru>
In-Reply-To: <4FB92365.20105@yandex.ru>
X-Enigmail-Version: 1.4
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: Sun, 20 May 2012 20:59:53 -0000

On 5/20/12 1:01 PM, Aleksej Serdjukov wrote:
> Hello.
> 
> 
> http://git.savannah.gnu.org/cgit/bash.git/plain/po/ru.po?h=devel
> 
> ===
> #: builtins/common.c:282
> #, c-format
> msgid "%s: no such job"
> msgstr "%s: �½�µ Ñ�°�ş���ı �·�°�´�°Ñ�¸"
> ===
> 
> (appears e.g. when running âfgâ with no result)
> 
> Must be â%s: �½�µÑ Ñ�°�ş���ı �·�°�´�°Ñ�¸â.
> 
> 
> Also, the second line of the file should begin with â# � ÑÑÑ�ş�¸�µ �ż�µÑ�µ�²���´Ñâ,
> not â��½�³�ğ�¸�ıÑ�ş�¸�µ �ż�µÑ�µ�²���´Ñâ.

Thanks.  Please submit corrections to the translations to the GNU
Translation project.

-- 
``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 May 21 08:38:55 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWRt1-0005RJ-68
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 08:38:55 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35754)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SWRsy-0005R9-SB
	for bug-bash@gnu.org; Mon, 21 May 2012 08:38:54 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SWRss-0000YV-J8
	for bug-bash@gnu.org; Mon, 21 May 2012 08:38:52 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:45933
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SWRss-0000Wl-ES
	for bug-bash@gnu.org; Mon, 21 May 2012 08:38:46 -0400
Received: (qmail 25161 invoked from network); 21 May 2012 12:38:20 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Mon, 21 May 2012 08:38:20 -0400
Received: (qmail 28578 invoked by uid 563); 21 May 2012 12:38:19 -0000
Date: Mon, 21 May 2012 08:38:19 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Linda Walsh <bash@tlinx.org>
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
Message-ID: <20120521123819.GA1622@eeg.ccf.org>
References: <4FB939B3.1010804@tlinx.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <4FB939B3.1010804@tlinx.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 <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, 21 May 2012 12:38:54 -0000

On Sun, May 20, 2012 at 11:36:35AM -0700, Linda Walsh wrote:
> Anyway... so WHY does bash collate this way?

It doesn't.  The operating system does.  Bash just calls upon the C
library's strcoll(3) routine.

The results vary across operating systems, and even potentially across
locale definitions within a given OS implementation.

> Under what rules is bash 
> operating?  I.e. justification?

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html

In particular, LC_COLLATE starts at
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_02

> If other programs claim to have locale specific sorting & character 
> collation,  should they be sorting the same way? 

Yes.  ls(1) for example sorts filenames according to the collation
order defined in the current locale (LC_ALL or LC_COLLATE or LANG).
You should get the same sorting from both ls and *.

For instance, on HP-UX 10.20, in the en_US.iso88591 locale:

imadev:~$ mkdir /tmp/greg && cd "$_"
imadev:/tmp/greg$ touch a A á Á à À â Â ä Ä b B
imadev:/tmp/greg$ ls
A  a  Á  á  À  à  Â  â  Ä  ä  B  b
imadev:/tmp/greg$ echo *
A a Á á À à Â â Ä ä B b
imadev:/tmp/greg$ LC_COLLATE=C ls
A  B  a  b  À  Á  Â  Ä  à  á  â  ä
imadev:/tmp/greg$ LC_COLLATE=C; echo *; unset LC_COLLATE
A B a b À Á Â Ä à á â ä

Meanwhile, on Debian 6.0, in the en_US.iso88591 locale:

arc3:~$ mkdir /tmp/greg && cd "$_"
arc3:/tmp/greg$ touch a A á Á à À â Â ä Ä b B
arc3:/tmp/greg$ echo *
a A á Á à À â Â ä Ä b B

As you can see, the two en_US.iso88591 implementations are not the same.

See http://mywiki.wooledge.org/locale or myriad other resources (including
the POSIX page linked earlier) for further explanations.


From MAILER-DAEMON Mon May 21 15:19:52 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWY92-0003CK-TL
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 15:19:52 -0400
Received: from eggs.gnu.org ([208.118.235.92]:47892)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWY90-00032Y-0v
	for bug-bash@gnu.org; Mon, 21 May 2012 15:19:51 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWY8x-0004jW-RV
	for bug-bash@gnu.org; Mon, 21 May 2012 15:19:49 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:52065
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWY8v-0004ie-SR
	for bug-bash@gnu.org; Mon, 21 May 2012 15:19:47 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q4LJJQtO032142; Mon, 21 May 2012 12:19:30 -0700
Message-ID: <4FBA953E.7040708@tlinx.org>
Date: Mon, 21 May 2012 12:19:26 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: Greg Wooledge <wooledg@eeg.ccf.org>
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
References: <4FB939B3.1010804@tlinx.org> <20120521123819.GA1622@eeg.ccf.org>
In-Reply-To: <20120521123819.GA1622@eeg.ccf.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Cc: bug-bash <bug-bash@gnu.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 May 2012 19:19:51 -0000



Greg Wooledge wrote:

> On Sun, May 20, 2012 at 11:36:35AM -0700, Linda Walsh wrote:

> For instance, on HP-UX 10.20, in the en_US.iso88591 locale:
>     A  a  ...  B  b
> Meanwhile, on Debian 6.0, in the en_US.iso88591 locale:
>     a A   ...  b B
> 
> As you can see, the two en_US.iso88591 implementations are not the same.

----
	Great!...

So which is correct?

Anyone wanting to reference an upper or lower case range
[a-z] or [A-Z], is gonna hurt from this.

My OS uses "en_US.UTF-8".

You'd think unicode would have something to say about collation
order that wouldn't allow such randomness, but maybe not.





From MAILER-DAEMON Mon May 21 15:24:17 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWYDJ-0004mR-7R
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 15:24:17 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49224)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chris@cfajohnson.com>) id 1SWYDG-0004lf-VB
	for bug-bash@gnu.org; Mon, 21 May 2012 15:24:16 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chris@cfajohnson.com>) id 1SWYDF-00062T-5Z
	for bug-bash@gnu.org; Mon, 21 May 2012 15:24:14 -0400
Received: from ironport-out.teksavvy.com ([206.248.143.162]:44130)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chris@cfajohnson.com>) id 1SWYDF-00061b-1X
	for bug-bash@gnu.org; Mon, 21 May 2012 15:24:13 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AlAPAOMAh09FxI2q/2dsb2JhbAA3gX+hQ4EIgXUBAQQBOAIcKAsLGC45HgYuh2WiEYwbVQODPgODcASeboR1hFg
X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; 
   d="scan'208";a="181626294"
Received: from 69-196-141-170.dsl.teksavvy.com (HELO linux-2.local)
	([69.196.141.170])
	by ironport2-out.teksavvy.com with ESMTP; 21 May 2012 15:24:09 -0400
Date: Mon, 21 May 2012 15:21:26 -0400 (EDT)
From: "Chris F.A. Johnson" <chris@cfajohnson.com>
To: bug-bash <bug-bash@gnu.org>
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
In-Reply-To: <4FBA953E.7040708@tlinx.org>
Message-ID: <alpine.LMD.2.00.1205211521060.20522@localhost.localdomain>
References: <4FB939B3.1010804@tlinx.org> <20120521123819.GA1622@eeg.ccf.org>
	<4FBA953E.7040708@tlinx.org>
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.143.162
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, 21 May 2012 19:24:16 -0000

On Mon, 21 May 2012, Linda Walsh wrote:

>
>
> Greg Wooledge wrote:
>
>> On Sun, May 20, 2012 at 11:36:35AM -0700, Linda Walsh wrote:
>
>> For instance, on HP-UX 10.20, in the en_US.iso88591 locale:
>>     A  a  ...  B  b
>> Meanwhile, on Debian 6.0, in the en_US.iso88591 locale:
>>     a A   ...  b B
>> 
>> As you can see, the two en_US.iso88591 implementations are not the same.
>
> ----
> 	Great!...
>
> So which is correct?
>
> Anyone wanting to reference an upper or lower case range
> [a-z] or [A-Z], is gonna hurt from this.

    Use the correct references: [:upper:] and [:lower:] or (as I do)
    always use LC_ALL=C in your scripts.

> My OS uses "en_US.UTF-8".

    My OS uses whatever I tell it to (which is C).

> You'd think unicode would have something to say about collation
> order that wouldn't allow such randomness, but maybe not.

-- 
    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 Mon May 21 15:27:45 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWYGf-0006vf-PZ
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 15:27:45 -0400
Received: from eggs.gnu.org ([208.118.235.92]:55557)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SWYGd-0006v9-2R
	for bug-bash@gnu.org; Mon, 21 May 2012 15:27:44 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SWYGb-000771-Fw
	for bug-bash@gnu.org; Mon, 21 May 2012 15:27:42 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:46066
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SWYGb-00076s-9K
	for bug-bash@gnu.org; Mon, 21 May 2012 15:27:41 -0400
Received: (qmail 28326 invoked from network); 21 May 2012 19:27:38 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Mon, 21 May 2012 15:27:38 -0400
Received: (qmail 28984 invoked by uid 563); 21 May 2012 19:27:38 -0000
Date: Mon, 21 May 2012 15:27:38 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Linda Walsh <bash@tlinx.org>
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
Message-ID: <20120521192737.GB1622@eeg.ccf.org>
References: <4FB939B3.1010804@tlinx.org> <20120521123819.GA1622@eeg.ccf.org>
	<4FBA953E.7040708@tlinx.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <4FBA953E.7040708@tlinx.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 <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, 21 May 2012 19:27:44 -0000

On Mon, May 21, 2012 at 12:19:26PM -0700, Linda Walsh wrote:
> Greg Wooledge wrote:
> >For instance, on HP-UX 10.20, in the en_US.iso88591 locale:
> >    A  a  ...  B  b
> >Meanwhile, on Debian 6.0, in the en_US.iso88591 locale:
> >    a A   ...  b B

> So which is correct?

Both.  Locale collating order is determined by the OS.  You cannot
rely on it, unless you set the LC_COLLATE variable to "C" or "POSIX",
in which case you get ASCII behavior (accented letters are not part
of the character set at all).

> Anyone wanting to reference an upper or lower case range
> [a-z] or [A-Z], is gonna hurt from this.

Correct.

imadev:~$ echo Hello World | tr 'A-Z' 'a-z'
hÉMMÓ wÓSM�
imadev:~$ echo Hello World | tr '[:upper:]' '[:lower:]'
hello world

You *cannot* use [a-z] or [A-Z] any more, except in the C/POSIX locale.
If you want to match lowercase characters, you should be using [[:lower:]],
and for uppercase characters, [[:upper:]].


From MAILER-DAEMON Mon May 21 15:30:23 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWYJD-0008Ve-8u
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 15:30:23 -0400
Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!colt.net!newsfeed-out.coltfrance.com!feeds.phibee-telecom.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From: arnold@skeeve.com (Aharon Robbins)
Newsgroups: gnu.bash.bug
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
Date: Mon, 21 May 2012 19:27:14 +0000 (UTC)
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <jpe4ui$qg1$1@dont-email.me>
References: <4FB939B3.1010804@tlinx.org> <20120521123819.GA1622@eeg.ccf.org>
	<mailman.1485.1337627992.855.bug-bash@gnu.org>
Injection-Date: Mon, 21 May 2012 19:27:14 +0000 (UTC)
Injection-Info: mx04.eternal-september.org;
	posting-host="/LmAQ1Ox82wxMRZbT4Vs2g"; 
	logging-data="27137"; mail-complaints-to="abuse@eternal-september.org";
	posting-account="U2FsdGVkX18x8PMECXICtyvZQb6KjpSodz7Qs14r+yA="
Originator: arnold@skeeve.com (Aharon Robbins)
X-Newsreader: trn 4.0-test76 (Apr 2, 2001)
Cancel-Lock: sha1:YM2qKBLx+MLdwKe6+lfBaNlINFw=
Xref: usenet.stanford.edu gnu.bash.bug:24672
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: Mon, 21 May 2012 19:30:19 -0000

In article <mailman.1485.1337627992.855.bug-bash@gnu.org>,
Linda Walsh  <bash@tlinx.org> wrote:
>Greg Wooledge wrote:
>
>> On Sun, May 20, 2012 at 11:36:35AM -0700, Linda Walsh wrote:
>
>> For instance, on HP-UX 10.20, in the en_US.iso88591 locale:
>>     A  a  ...  B  b
>> Meanwhile, on Debian 6.0, in the en_US.iso88591 locale:
>>     a A   ...  b B
>> 
>> As you can see, the two en_US.iso88591 implementations are not the same.
>
>----
>	Great!...
>
>So which is correct?

Both!  Isn't this fun!  Current POSIX leaves this up to the implementation.
I believe that the Debian order is what earlier POSIX required.

>Anyone wanting to reference an upper or lower case range
>[a-z] or [A-Z], is gonna hurt from this.

This is why I started the Campaign For Rational Range Interpretation,
now part of gawk and I believe in the most recent grep also, which
returns us to the sane days of yesteryear, where [a-z] got only lowercase
letters and [A-Z] got only uppercase ones.

>My OS uses "en_US.UTF-8".

I personally have had

	export LC_ALL=C

in my .profile / .bashrc for many years now, to keep the behavior G-d
intended.

>You'd think unicode would have something to say about collation
>order that wouldn't allow such randomness, but maybe not.

It actually makes sense that it doesn't, since Unicode is more or less
a mapping of code points to glyphs, which is language independant. The
rules for collating depend upon the language.
-- 
Aharon (Arnold) Robbins 			arnold AT skeeve DOT com
P.O. Box 354		Home Phone: +972  8 979-0381
Nof Ayalon		Cell Phone: +972 50 729-7545
D.N. Shimshon 99785	ISRAEL

From MAILER-DAEMON Mon May 21 15:37:51 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWYQR-0004ty-9o
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 15:37:51 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52552)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWYQO-0004pM-JY
	for bug-bash@gnu.org; Mon, 21 May 2012 15:37:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWYQM-0001Oj-PE
	for bug-bash@gnu.org; Mon, 21 May 2012 15:37:48 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:52412
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWYQK-0001NZ-Pt
	for bug-bash@gnu.org; Mon, 21 May 2012 15:37:46 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q4LJbQdK002953; Mon, 21 May 2012 12:37:30 -0700
Message-ID: <4FBA9976.5070502@tlinx.org>
Date: Mon, 21 May 2012 12:37:26 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: Greg Wooledge <wooledg@eeg.ccf.org>
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
References: <4FB939B3.1010804@tlinx.org>
	<20120521123819.GA1622@eeg.ccf.org>	<4FBA953E.7040708@tlinx.org>
	<20120521192737.GB1622@eeg.ccf.org>
In-Reply-To: <20120521192737.GB1622@eeg.ccf.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Cc: bug-bash <bug-bash@gnu.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 May 2012 19:37:50 -0000



Greg Wooledge wrote:

> On Mon, May 21, 2012 at 12:19:26PM -0700, Linda Walsh wrote:
>> Greg Wooledge wrote:
>>> For instance, on HP-UX 10.20, in the en_US.iso88591 locale:
>>>    A  a  ...  B  b
>>> Meanwhile, on Debian 6.0, in the en_US.iso88591 locale:
>>>    a A   ...  b B
> 
>> So which is correct?
> 
> Both.  Locale collating order is determined by the OS.  You cannot
> rely on it, unless you set the LC_COLLATE variable to "C" or "POSIX",
> in which case you get ASCII behavior (accented letters are not part
> of the character set at all).
> 
>> Anyone wanting to reference an upper or lower case range
>> [a-z] or [A-Z], is gonna hurt from this.
> 
> Correct.

----
	This is a prime example of Posix being stupid and bad for
computer science.

	They take a deterministic behavior and define it to be
non-deterministic and break 1000's of programs.

	They cannot justify this... as they are supposed to document
current practice -- which has never been to consider the interpretation
of a-z/A-Z as random!

	Thus they are violating their own rules!    How can anyone follow
such lame directions?  Who in their right mind would have voted to
make ranges "worthless"....i.e. -- established, standard practice has never
been for such ranges to be worthless -- yet that is exactly what they
voted for.

	How is posix following it's own rules?   If they don't follow
their own rules -- how can anyone be following these new specifications
which are obviously in conflict with established implementation?






From MAILER-DAEMON Mon May 21 15:41:12 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWYTg-00070S-L0
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 15:41:12 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37388)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWYTd-0006zP-Ub
	for bug-bash@gnu.org; Mon, 21 May 2012 15:41:11 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWYTc-0002YA-9i
	for bug-bash@gnu.org; Mon, 21 May 2012 15:41:09 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:24010)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWYTc-0002WB-5M
	for bug-bash@gnu.org; Mon, 21 May 2012 15:41:08 -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 BKY24663;
	Mon, 21 May 2012 15:41:06 -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 AXN33495 (AUTH cpr);
	Mon, 21 May 2012 15:41:06 -0400 (EDT)
Message-ID: <4FBA9A52.4050605@case.edu>
Date: Mon, 21 May 2012 15:41:06 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Aharon Robbins <arnold@skeeve.com>
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
References: <4FB939B3.1010804@tlinx.org> <20120521123819.GA1622@eeg.ccf.org>
	<mailman.1485.1337627992.855.bug-bash@gnu.org>
	<jpe4ui$qg1$1@dont-email.me>
In-Reply-To: <jpe4ui$qg1$1@dont-email.me>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv2.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.37
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 May 2012 19:41:11 -0000

On 5/21/12 3:27 PM, Aharon Robbins wrote:

>> So which is correct?
> 
> Both!  Isn't this fun!  

What's most fun is having this discussion over and over again, each time as
if it were the first.

-- 
``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 May 21 15:42:49 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWYVF-0007pT-2U
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 15:42:49 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37670)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWYVC-0007oY-Ax
	for bug-bash@gnu.org; Mon, 21 May 2012 15:42:47 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWYVA-0002us-FS
	for bug-bash@gnu.org; Mon, 21 May 2012 15:42:45 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:24349)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWYVA-0002uf-Bt
	for bug-bash@gnu.org; Mon, 21 May 2012 15:42:44 -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 BKY24797;
	Mon, 21 May 2012 15:42:43 -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 AXN33669 (AUTH cpr);
	Mon, 21 May 2012 15:42:43 -0400 (EDT)
Message-ID: <4FBA9AB3.2090505@case.edu>
Date: Mon, 21 May 2012 15:42:43 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Aharon Robbins <arnold@skeeve.com>
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
References: <4FB939B3.1010804@tlinx.org> <20120521123819.GA1622@eeg.ccf.org>
	<mailman.1485.1337627992.855.bug-bash@gnu.org>
	<jpe4ui$qg1$1@dont-email.me>
In-Reply-To: <jpe4ui$qg1$1@dont-email.me>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv2.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.37
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 May 2012 19:42:48 -0000

On 5/21/12 3:27 PM, Aharon Robbins wrote:

> This is why I started the Campaign For Rational Range Interpretation,
> now part of gawk and I believe in the most recent grep also, which
> returns us to the sane days of yesteryear, where [a-z] got only lowercase
> letters and [A-Z] got only uppercase ones.

The next version of bash will have a shell option to enable this behavior.
It's in the development snapshots if anyone wants to try it out now.

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


From MAILER-DAEMON Mon May 21 15:46:07 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWYYR-000156-35
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 15:46:07 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37381)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWYYO-000147-By
	for bug-bash@gnu.org; Mon, 21 May 2012 15:46:05 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWYYM-00041q-M2
	for bug-bash@gnu.org; Mon, 21 May 2012 15:46:03 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:32172)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWYYM-0003zK-IA
	for bug-bash@gnu.org; Mon, 21 May 2012 15:46:02 -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 BYU75832; Mon, 21 May 2012 15:46:01 -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 AXH24422 (AUTH cpr);
	Mon, 21 May 2012 15:46:00 -0400 (EDT)
Message-ID: <4FBA9B78.1040406@case.edu>
Date: Mon, 21 May 2012 15:46:00 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Linda Walsh <bash@tlinx.org>
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
References: <4FB939B3.1010804@tlinx.org>
	<20120521123819.GA1622@eeg.ccf.org>	<4FBA953E.7040708@tlinx.org>
	<20120521192737.GB1622@eeg.ccf.org> <4FBA9976.5070502@tlinx.org>
In-Reply-To: <4FBA9976.5070502@tlinx.org>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: Greg Wooledge <wooledg@eeg.ccf.org>, bug-bash <bug-bash@gnu.org>,
	chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 May 2012 19:46:05 -0000

On 5/21/12 3:37 PM, Linda Walsh wrote:

> ----
>     This is a prime example of Posix being stupid and bad for
> computer science.
> 
>     They take a deterministic behavior and define it to be
> non-deterministic and break 1000's of programs.

Try being a little less English-centric.  Collating order varies by
language.

Posix says that ranges work the way you are used to if you force the
traditional ordering using the `C' or `Posix' locale.  Take a deep
breath and use LC_ALL=C in your scripts to avoid depending on whatever
your OS uses as the default.

-- 
``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 May 21 15:52:20 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWYeS-0004El-Cw
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 15:52:20 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44932)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWYeP-00044d-7M
	for bug-bash@gnu.org; Mon, 21 May 2012 15:52:18 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWYeN-0005Q3-IK
	for bug-bash@gnu.org; Mon, 21 May 2012 15:52:16 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:52680
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWYeL-0005P5-91
	for bug-bash@gnu.org; Mon, 21 May 2012 15:52:15 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q4LJpenO004531; Mon, 21 May 2012 12:51:43 -0700
Message-ID: <4FBA9CCC.5030205@tlinx.org>
Date: Mon, 21 May 2012 12:51:40 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
References: <4FB939B3.1010804@tlinx.org>	<20120521123819.GA1622@eeg.ccf.org>	<4FBA953E.7040708@tlinx.org>	<20120521192737.GB1622@eeg.ccf.org>
	<4FBA9976.5070502@tlinx.org> <4FBA9B78.1040406@case.edu>
In-Reply-To: <4FBA9B78.1040406@case.edu>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Cc: Greg Wooledge <wooledg@eeg.ccf.org>, bug-bash <bug-bash@gnu.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 May 2012 19:52:19 -0000



Chet Ramey wrote:

> On 5/21/12 3:37 PM, Linda Walsh wrote:
> 
>> ----
>>     This is a prime example of Posix being stupid and bad for
>> computer science.
>>
>>     They take a deterministic behavior and define it to be
>> non-deterministic and break 1000's of programs.
> 
> Try being a little less English-centric.  Collating order varies by
> language.
> 
> Posix says that ranges work the way you are used to if you force the
> traditional ordering using the `C' or `Posix' locale.  Take a deep
> breath and use LC_ALL=C in your scripts to avoid depending on whatever
> your OS uses as the default.



FWIW, I put LC_COLLATE='C' in my System startup scripts...

So I'm NOT being bitten by this problem directly... I'm trying to
figure out how the heck this got voted on in POSIX, to be a correct
standard such that it would break current programs...

POSIX is not supposed to be prescriptive -- but **descriptive**...

I can't think of anywhere that a-z or A-Z would have included letters
from the opposite case... so how did POSIX come to *prescribe* that this
be the case... since I can't see that as being descriptive.




From MAILER-DAEMON Mon May 21 15:55:29 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWYhV-0000V6-LZ
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 15:55:29 -0400
Received: from eggs.gnu.org ([208.118.235.92]:40624)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mascheck@in-ulm.de>) id 1SWYhT-0000U3-5T
	for bug-bash@gnu.org; Mon, 21 May 2012 15:55:28 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <mascheck@in-ulm.de>) id 1SWYhR-0006Gg-M1
	for bug-bash@gnu.org; Mon, 21 May 2012 15:55:26 -0400
Received: from mail.in-ulm.de ([217.10.8.10]:36738)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <mascheck@in-ulm.de>) id 1SWYhR-0006GM-Bs
	for bug-bash@gnu.org; Mon, 21 May 2012 15:55:25 -0400
Received: (qmail 3265 invoked by uid 11025); 21 May 2012 19:55:22 -0000
Date: Mon, 21 May 2012 21:55:22 +0200
From: Sven Mascheck <mascheck@in-ulm.de>
To: bug-bash <bug-bash@gnu.org>
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
Message-ID: <20120521195522.GB16700@lisa.in-ulm.de>
References: <4FB939B3.1010804@tlinx.org> <20120521123819.GA1622@eeg.ccf.org>
	<4FBA953E.7040708@tlinx.org> <20120521192737.GB1622@eeg.ccf.org>
	<4FBA9976.5070502@tlinx.org> <4FBA9B78.1040406@case.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4FBA9B78.1040406@case.edu>
X-URL: http://www.in-ulm.de/~mascheck/
Organization: united xpiloteers
User-Agent: Mutt/1.5.20 (2009-06-14)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 217.10.8.10
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: mascheck@in-ulm.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, 21 May 2012 19:55:28 -0000

On Mon, May 21, 2012 at 03:46:00PM -0400, Chet Ramey wrote:

> Posix says that ranges work the way you are used to if you force the
> traditional ordering using the `C' or `Posix' locale.  Take a deep
> breath and use LC_ALL=C in your scripts to avoid depending on whatever
> your OS uses as the default.

I'd suggest to use "only" LC_COLLATE=C to keep other important features
like e.g. printability (LC_CTYPE) or localized messages (LC_MESSAGES).
Or has anybody ever noticed problems with this approach?

Sven


From MAILER-DAEMON Mon May 21 15:56:47 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWYil-0001Q7-Fu
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 15:56:47 -0400
Received: from eggs.gnu.org ([208.118.235.92]:40841)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWYih-0001EK-OD
	for bug-bash@gnu.org; Mon, 21 May 2012 15:56:46 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWYif-0006hY-SV
	for bug-bash@gnu.org; Mon, 21 May 2012 15:56:43 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:52747
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWYie-0006gi-EK
	for bug-bash@gnu.org; Mon, 21 May 2012 15:56:41 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q4LJuYi2005114; Mon, 21 May 2012 12:56:36 -0700
Message-ID: <4FBA9DF2.503@tlinx.org>
Date: Mon, 21 May 2012 12:56:34 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: Aharon Robbins <arnold@skeeve.com>
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
References: <4FB939B3.1010804@tlinx.org>
	<20120521123819.GA1622@eeg.ccf.org>	<mailman.1485.1337627992.855.bug-bash@gnu.org>
	<jpe4ui$qg1$1@dont-email.me>
In-Reply-To: <jpe4ui$qg1$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 May 2012 19:56:46 -0000



Aharon Robbins wrote:


>> You'd think unicode would have something to say about collation
>> order that wouldn't allow such randomness, but maybe not.
> 
> It actually makes sense that it doesn't, since Unicode is more or less
> a mapping of code points to glyphs, which is language independant. The
> rules for collating depend upon the language.

----
	Actually it makes sense that it would... and it DOES.

Bash and POSIX would appear to violate Unicode ordering.

Algorithm reference: http://www.unicode.org/reports/tr10/tr10-24.html

Collation order chart:
http://www.unicode.org/Public/UCA/latest/allkeys.txt

----
It shows that cap A-Z come before a-z.

If a sort order is set (as mine used to be) to
en_US.UTF-8

then the Unicode sort order should have been used.

In bash, it was not.

It sounds like this is a bug rooted in the C libraries?





From MAILER-DAEMON Mon May 21 16:39:51 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWZOR-0004Qj-A2
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 16:39:51 -0400
Received: from eggs.gnu.org ([208.118.235.92]:55758)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SWZOL-0004Le-9f
	for bug-bash@gnu.org; Mon, 21 May 2012 16:39:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SWZOG-0000xP-SJ
	for bug-bash@gnu.org; Mon, 21 May 2012 16:39:44 -0400
Received: from mx1.redhat.com ([209.132.183.28]:15506)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SWZOG-0000xB-KQ
	for bug-bash@gnu.org; Mon, 21 May 2012 16:39:40 -0400
Received: from int-mx02.intmail.prod.int.phx2.redhat.com
	(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4LKd56t023640
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Mon, 21 May 2012 16:39:05 -0400
Received: from [10.3.113.14] ([10.3.113.14])
	by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
	id q4LKd4ic002614; Mon, 21 May 2012 16:39:04 -0400
Message-ID: <4FBAA7E7.9050805@redhat.com>
Date: Mon, 21 May 2012 14:39:03 -0600
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:12.0) Gecko/20120430 Thunderbird/12.0.1
MIME-Version: 1.0
To: Linda Walsh <bash@tlinx.org>
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
References: <4FB939B3.1010804@tlinx.org>	<20120521123819.GA1622@eeg.ccf.org>	<4FBA953E.7040708@tlinx.org>	<20120521192737.GB1622@eeg.ccf.org>
	<4FBA9976.5070502@tlinx.org> <4FBA9B78.1040406@case.edu>
	<4FBA9CCC.5030205@tlinx.org>
In-Reply-To: <4FBA9CCC.5030205@tlinx.org>
X-Enigmail-Version: 1.4.1
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="------------enig934D52E88D785E7C6AC782E4"
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.132.183.28
Cc: Greg Wooledge <wooledg@eeg.ccf.org>, bug-bash <bug-bash@gnu.org>,
	chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 May 2012 20:39:49 -0000

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

On 05/21/2012 01:51 PM, Linda Walsh wrote:

> POSIX is not supposed to be prescriptive -- but **descriptive**...
>=20
> I can't think of anywhere that a-z or A-Z would have included letters
> from the opposite case... so how did POSIX come to *prescribe* that thi=
s
> be the case... since I can't see that as being descriptive.

POSIX 1992 was the culprit that proscribed that [A-Z] must be in
collation order across all locales, but without giving good guidance on
how to write a collation sequence, and without defining a C function to
easily get at that collation ordering.  And remember, 20 years ago when
POSIX 1992 was written, there was very little implementation experience
with internationalization, compared to what has happened in the meantime
(that was back when Unicode was brand new, and most users still had
single-byte locales or used shift-lock encodings like Big5).  It is
possible to write a locale definition where [A-Z] gives only upper-case
letters while still providing case-insensitive sorting, but not all
locale writes know how to do this (even now in 2012, while most glibc
locales have been corrected in this manner, there still exist several
glibc locales that aren't written very well - the complication stems
from the fact that your locale file becomes exponentially harder to
write: instead of having a single upper and lower case rule, you have to
have one rule per letter, with rules intermixed in a different order).
As soon as people started obeying POSIX 1992 to the letter, and
realizing that range expressions had unusual semantics as a result of
the 1992 specification, POSIX 2001 quickly reverted things, but by then,
the cat was out of the bag.  POSIX 2001 had to continue to allow
existing implementations, by stating that range expressions in anything
but the C locale are explicitly undefined.

There is currently a movement under way to introduce 'Rational Range
Intepretation' (RRI), where [A-Z] means the 26 uppercase letters across
ALL locales, by omitting all accented letters and ignoring collation
ordering.  Since POSIX 2001 and later allow this behavior, it is gaining
traction - already, GNU sed, GNU grep, and GNU awk have had patches
applied or under consideration to introduce this consistent behavior.
Search those mailing list archives if you want more details.  Gnulib has
already had patches as part of this movement, and GNU coreutils and bash
should be picking up on these improvements in a future version; we also
hope to get glibc to agree to them.  In other words, we recognize that
this is an issue, and eventually, we _do_ want to reach the point where
all GNU tools use RRI, since POSIX 2001 already allows RRI as part of
its recognition that the decision made in POSIX 1992 causes pain when
coupled with poorly-written locale definitions.

For example, here is an RRI patch for gnulib:
https://lists.gnu.org/archive/html/bug-gnulib/2012-04/msg00185.html

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


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

iQEcBAEBCAAGBQJPuqfoAAoJEKeha0olJ0Nqp5MH/RQ7FR/9R2gyB+S96Z8WAPyY
eEZMG4Mc3MOvSHix56QKGCx+pg5khsIgU1iGqCEw0/EO7vKV9I+V8l12KVuYqlnC
7IRsFG1XNCJjMzuS9DaZ6RuD9K+esXPZIYIBLJp6AgUuBtg5KY79Z0fBhRzwhllt
0idlcuUfYwMq/fAgcQ/Hy4p5fG+dq4i349dn4ebmaMq/R6K6vCmGlLuRRN3CcM4p
mR/tK4nZB6Cwh2KCxqskxvd14PNRWqlbaCga1kmhMcJb5dnuk82ijGCwFGyhnt4E
K8Yz2fWAib9DNWHLzK15jlHiIFMaVqpjKxnTG/89mhawyL6Z0mDM3ajpc19rKWQ=
=usyd
-----END PGP SIGNATURE-----

--------------enig934D52E88D785E7C6AC782E4--


From MAILER-DAEMON Mon May 21 17:03:17 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWZl7-0001nA-NH
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 17:03:17 -0400
Received: from eggs.gnu.org ([208.118.235.92]:40327)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWZl5-0001ll-4t
	for bug-bash@gnu.org; Mon, 21 May 2012 17:03:16 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWZl3-0001Rj-Ey
	for bug-bash@gnu.org; Mon, 21 May 2012 17:03:14 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:53921
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWZl1-0001Ot-LU
	for bug-bash@gnu.org; Mon, 21 May 2012 17:03:13 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q4LL2xoP016146
	for <bug-bash@gnu.org>; Mon, 21 May 2012 14:03:03 -0700
Message-ID: <4FBAAD83.7050904@tlinx.org>
Date: Mon, 21 May 2012 14:02:59 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: bug-bash <bug-bash@gnu.org>
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
References: <4FB939B3.1010804@tlinx.org>	<20120521123819.GA1622@eeg.ccf.org>	<4FBA953E.7040708@tlinx.org>	<20120521192737.GB1622@eeg.ccf.org>
	<4FBA9976.5070502@tlinx.org> <4FBA9B78.1040406@case.edu>
	<4FBA9CCC.5030205@tlinx.org> <4FBAA7E7.9050805@redhat.com>
In-Reply-To: <4FBAA7E7.9050805@redhat.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 May 2012 21:03:16 -0000



Eric Blake wrote:

> On 05/21/2012 01:51 PM, Linda Walsh wrote:
> 
>> POSIX is not supposed to be prescriptive -- but **descriptive**...
>>
>> I can't think of anywhere that a-z or A-Z would have included letters
>> from the opposite case... so how did POSIX come to *prescribe* that this
>> be the case... since I can't see that as being descriptive.
> 
> POSIX 1992 was the culprit that proscribed that [A-Z] must be in
> collation order across all locales,.....



> realizing that range expressions had unusual semantics as a result of
> the 1992 specification, POSIX 2001 quickly

---
[quickly?!  9 years later?!   *cough*]

 reverted things, but by then,
> the cat was out of the bag.  POSIX 2001 had to continue to allow
> existing implementations, by stating that range expressions in anything
> but the C locale are explicitly undefined.

---------------------


	Explicitly undefined?   Or locale dependent?

	I.e. Unicode does specify ordering, so if your locale is set
to UTF-8 character encoding, then it is explicitly defined.  This would
seem to be in conflict with unicode -- and any implementation claiming
to be unicode compatible MUST use unicode ordering when the local character
set is defined to be Unicode.

	This doesn't conflict with Posix, as Posix doesn't define an order
for such -- but a different standard, (Unicode) does specify a standard.  So
for those using UTF-8, shouldn't that have made the order randomization 'moot'?



From MAILER-DAEMON Mon May 21 17:12:59 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWZuV-0006bL-5h
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 17:12:59 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35673)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWZuS-0006ap-Sd
	for bug-bash@gnu.org; Mon, 21 May 2012 17:12:58 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWZuR-0004Qn-0R
	for bug-bash@gnu.org; Mon, 21 May 2012 17:12:56 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:4207)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWZuQ-0004QR-S2
	for bug-bash@gnu.org; Mon, 21 May 2012 17:12:54 -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 BKY34276;
	Mon, 21 May 2012 17:12:52 -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 AXH40380 (AUTH cpr);
	Mon, 21 May 2012 17:12:52 -0400 (EDT)
Message-ID: <4FBAAFD4.3050508@case.edu>
Date: Mon, 21 May 2012 17:12:52 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Linda Walsh <bash@tlinx.org>
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
References: <4FB939B3.1010804@tlinx.org>	<20120521123819.GA1622@eeg.ccf.org>	<4FBA953E.7040708@tlinx.org>	<20120521192737.GB1622@eeg.ccf.org>
	<4FBA9976.5070502@tlinx.org> <4FBA9B78.1040406@case.edu>
	<4FBA9CCC.5030205@tlinx.org> <4FBAA7E7.9050805@redhat.com>
	<4FBAAD83.7050904@tlinx.org>
In-Reply-To: <4FBAAD83.7050904@tlinx.org>
X-Enigmail-Version: 1.4.1
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 <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, 21 May 2012 21:12:58 -0000

On 5/21/12 5:02 PM, Linda Walsh wrote:

>     I.e. Unicode does specify ordering, so if your locale is set
> to UTF-8 character encoding, then it is explicitly defined.  This would
> seem to be in conflict with unicode -- and any implementation claiming
> to be unicode compatible MUST use unicode ordering when the local character
> set is defined to be Unicode.
> 

Then write the locale definitions that way -- that's Eric's point.

-- 
``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 May 21 17:14:15 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWZvj-00079W-K4
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 17:14:15 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35967)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SWZvh-00078y-DE
	for bug-bash@gnu.org; Mon, 21 May 2012 17:14:14 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SWZvf-0004ds-Az
	for bug-bash@gnu.org; Mon, 21 May 2012 17:14:12 -0400
Received: from mx1.redhat.com ([209.132.183.28]:59167)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SWZvf-0004dS-2X
	for bug-bash@gnu.org; Mon, 21 May 2012 17:14:11 -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 q4LLE7ue002425
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Mon, 21 May 2012 17:14:09 -0400
Received: from [10.3.113.14] ([10.3.113.14])
	by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
	id q4LLE7aX032328; Mon, 21 May 2012 17:14:07 -0400
Message-ID: <4FBAB01E.1060101@redhat.com>
Date: Mon, 21 May 2012 15:14:06 -0600
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:12.0) Gecko/20120430 Thunderbird/12.0.1
MIME-Version: 1.0
To: Linda Walsh <bash@tlinx.org>
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
References: <4FB939B3.1010804@tlinx.org>	<20120521123819.GA1622@eeg.ccf.org>	<4FBA953E.7040708@tlinx.org>	<20120521192737.GB1622@eeg.ccf.org>
	<4FBA9976.5070502@tlinx.org> <4FBA9B78.1040406@case.edu>
	<4FBA9CCC.5030205@tlinx.org> <4FBAA7E7.9050805@redhat.com>
	<4FBAAD83.7050904@tlinx.org>
In-Reply-To: <4FBAAD83.7050904@tlinx.org>
X-Enigmail-Version: 1.4.1
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="------------enig97E4CD18D182F0F7D65BB654"
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.132.183.28
Cc: bug-bash <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, 21 May 2012 21:14:14 -0000

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

On 05/21/2012 03:02 PM, Linda Walsh wrote:

>> the cat was out of the bag.  POSIX 2001 had to continue to allow
>> existing implementations, by stating that range expressions in anythin=
g
>> but the C locale are explicitly undefined.
>=20
> ---------------------
>=20
>=20
>     Explicitly undefined?   Or locale dependent?

POSIX explicitly undefined ranges for all but the C locale.  _Other
standards_, such as Unicode, are free to add range requirements on top
of what POSIX requires, but alas, Unicode collation order does NOT
currently specify anything about regular expression or glob range
matching, so it is out of scope for Unicode to say what [A-Z] expands to.=


>=20
>     I.e. Unicode does specify ordering, so if your locale is set
> to UTF-8 character encoding, then it is explicitly defined.  This would=

> seem to be in conflict with unicode -- and any implementation claiming
> to be unicode compatible MUST use unicode ordering when the local chara=
cter
> set is defined to be Unicode.

Unicode may specify collation ordering, but it does NOT specify regular
expression range ordering.

>=20
>     This doesn't conflict with Posix, as Posix doesn't define an order
> for such -- but a different standard, (Unicode) does specify a
> standard.  So
> for those using UTF-8, shouldn't that have made the order randomization=

> 'moot'?

Wishing doesn't make it so.  The fact is that regular expression ranges
are currently unspecified in all but the C locale; the RRI project is
attempting to make it sane across all locales within the scope of GNU
programs, but it takes time to write and approve the patches necessary
to get to that point.

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


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

iQEcBAEBCAAGBQJPurAeAAoJEKeha0olJ0Nq+30IAJ2i/Xer5yPpTvawDpVDq7Pu
racL6P0rAsKSdfwmHEO42wNCu/t+soFsPmQN2NWmm3ksNoe842OhDwv3tfeTVMYr
01cKXQCcuBRohaPTe8ZpLjY+u8zvZik2Z1R+855vrDZHoIoyd45HcaDPWF0cr05g
wwDpHn0OLn+e5rnbqfcjuj/36OCdW9cFScFvgN6BkB9hh8Oan+1z5tcxfpfVNxLM
wyFy0qo2uBp7v6p4HxKpBFhBEERN+myiwhuHr+9LWW7meC3JxnlFanJdp1wxqLNz
I7PPdChFNwfSTlKFqwZMef5lOQr7ojR7+QDeytOSUaeFemC8QxLX2LnfCzlpSIE=
=bCS/
-----END PGP SIGNATURE-----

--------------enig97E4CD18D182F0F7D65BB654--


From MAILER-DAEMON Mon May 21 19:42:35 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWcFH-0006FD-IK
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 19:42:35 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37685)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWcFE-0006Ee-FP
	for bug-bash@gnu.org; Mon, 21 May 2012 19:42:33 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWcFC-0003XB-Tu
	for bug-bash@gnu.org; Mon, 21 May 2012 19:42:32 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:56677
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWcFB-0003V8-6J
	for bug-bash@gnu.org; Mon, 21 May 2012 19:42:30 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q4LNgJVU032259
	for <bug-bash@gnu.org>; Mon, 21 May 2012 16:42:23 -0700
Message-ID: <4FBAD2DB.2050100@tlinx.org>
Date: Mon, 21 May 2012 16:42:19 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: bug-bash <bug-bash@gnu.org>
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
References: <4FB939B3.1010804@tlinx.org>	<20120521123819.GA1622@eeg.ccf.org>	<4FBA953E.7040708@tlinx.org>	<20120521192737.GB1622@eeg.ccf.org>	<4FBA9976.5070502@tlinx.org>
	<4FBA9B78.1040406@case.edu>	<4FBA9CCC.5030205@tlinx.org>
	<4FBAA7E7.9050805@redhat.com>	<4FBAAD83.7050904@tlinx.org>
	<4FBAB01E.1060101@redhat.com>
In-Reply-To: <4FBAB01E.1060101@redhat.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 May 2012 23:42:34 -0000



Eric Blake wrote:

> On 05/21/2012 03:02 PM, Linda Walsh wrote:
> 
>>> the cat was out of the bag.  POSIX 2001 had to continue to allow
>>> existing implementations, by stating that range expressions in anything
>>> but the C locale are explicitly undefined.
>> ---------------------
>>
>>
>>     Explicitly undefined?   Or locale dependent?
> 
> POSIX explicitly undefined ranges for all but the C locale.  _Other
> standards_, such as Unicode, are free to add range requirements on top
> of what POSIX requires, but alas, Unicode collation order does NOT
> currently specify anything about regular expression or glob range
> matching, so it is out of scope for Unicode to say what [A-Z] expands to.


----

I think this is the problem.

A-Z in regular expressions is defined to expand to those characters
that are _in collating order_, >A, and <Z...

Without a collating order that expression in RE's would never have made any
sense.  It requires a collating order and is dependent on it.

If there is no collating order, then you cannot expand A-Z, but if there
is, you expand it to the values between A-Z that are in the collating order.

The regex(7) man page says that [xx-xx] uses ***collating order**::

        If two characters  in  the  list
        are  separated  by '-', this is shorthand for the full range of charac-
        ters between those two (inclusive) in the collating sequence, for exam-
        ple,  "[0-9]" in ASCII matches any decimal digit.

----
Seems pretty clear -- regex's aren't exempt from collating order, they depend on 
it...






From MAILER-DAEMON Mon May 21 20:06:51 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWccl-0001MG-5K
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 20:06:51 -0400
Received: from eggs.gnu.org ([208.118.235.92]:39603)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWcci-0001M4-4j
	for bug-bash@gnu.org; Mon, 21 May 2012 20:06:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWccg-00016b-0R
	for bug-bash@gnu.org; Mon, 21 May 2012 20:06:47 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:57014
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWccd-00015W-Jl
	for bug-bash@gnu.org; Mon, 21 May 2012 20:06:45 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q4M06Rbn003726; Mon, 21 May 2012 17:06:33 -0700
Message-ID: <4FBAD884.7070603@tlinx.org>
Date: Mon, 21 May 2012 17:06:28 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: Andreas Schwab <schwab@linux-m68k.org>
Subject: Re: Possible bug: Race condition when calling external
	commands	during trap handling
References: <E76DF6102FDBC04BA291EAE9A3BAECB501381DBD8583@HE111540.emea1.cds.t-internal.com>	<20120503070750.GA23091@hysteria.proulx.com>
	<m2bom54rke.fsf@igel.home>
In-Reply-To: <m2bom54rke.fsf@igel.home>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Cc: Tillmann.Crueger@telekom.de, 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, 22 May 2012 00:06:49 -0000



Andreas Schwab wrote:

> Bob Proulx <bob@proulx.com> writes:
> 
>> And lastly I will comment that you are doing quite a bit inside of an
>> interrupt routine.  Typically in a C program it is not safe to perform
>> any operation that may call malloc() within an interupt service
>> routine since malloc isn't reentrant.  Bash is a C program and I
>> assume the same restriction would apply.
> 
> Traps are executed only at command boundaries.  Executing them in a
> signal handler would make them completely unusable, of course.
> 
> Andreas.

---
	But a trap HAS to be executed in the trap handler
to reset it self, otherwise you risk losing a signal.

	As soon as you exit your trap handler,
your trap handler had better already be in place.
If it isn't and trap comes in before you catch it,
you've lost it.

the "perlipc" manpage explains some of the details
behind this problem.  Their suggested handler:

            use POSIX ":sys_wait_h";
            sub REAPER {
                my $child;
                # If a second child dies while in the signal handler caused by the
                # first death, we won't get another signal. So must loop here else
                # we will leave the unreaped child as a zombie. And the next time
                # two children die we get another zombie. And so on.
                while (($child = waitpid(-1, WNOHANG)) > 0) {
                    $Kid_Status{$child} = $?;
                }
                $SIG{CHLD} = \&REAPER;  # still loathe SysV
            }
            $SIG{CHLD} = \&REAPER;
            # do something that forks...

---
I think it was sysV compat libs that are unsafe (you have to reset
handler each signal)...



From MAILER-DAEMON Mon May 21 22:03:00 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWeRA-0006g1-RK
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 22:03:00 -0400
Received: from eggs.gnu.org ([208.118.235.92]:45403)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SWeR7-0006eW-K3
	for bug-bash@gnu.org; Mon, 21 May 2012 22:02:58 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SWeR5-0005HT-HO
	for bug-bash@gnu.org; Mon, 21 May 2012 22:02:57 -0400
Received: from mx1.redhat.com ([209.132.183.28]:60222)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SWeR5-0005HC-9B
	for bug-bash@gnu.org; Mon, 21 May 2012 22:02:55 -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 q4M22rN3021433
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Mon, 21 May 2012 22:02:53 -0400
Received: from [10.3.113.14] ([10.3.113.14])
	by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
	id q4M22qfq016782; Mon, 21 May 2012 22:02:52 -0400
Message-ID: <4FBAF3CC.7030009@redhat.com>
Date: Mon, 21 May 2012 20:02:52 -0600
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:12.0) Gecko/20120430 Thunderbird/12.0.1
MIME-Version: 1.0
To: Linda Walsh <bash@tlinx.org>
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
References: <4FB939B3.1010804@tlinx.org>	<20120521123819.GA1622@eeg.ccf.org>	<4FBA953E.7040708@tlinx.org>	<20120521192737.GB1622@eeg.ccf.org>	<4FBA9976.5070502@tlinx.org>
	<4FBA9B78.1040406@case.edu>	<4FBA9CCC.5030205@tlinx.org>
	<4FBAA7E7.9050805@redhat.com>	<4FBAAD83.7050904@tlinx.org>
	<4FBAB01E.1060101@redhat.com> <4FBAD2DB.2050100@tlinx.org>
In-Reply-To: <4FBAD2DB.2050100@tlinx.org>
X-Enigmail-Version: 1.4.1
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="------------enig2FBC3CC7E3FADD22EF2CCF19"
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.132.183.28
Cc: bug-bash <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, 22 May 2012 02:02:59 -0000

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

On 05/21/2012 05:42 PM, Linda Walsh wrote:

>> POSIX explicitly undefined ranges for all but the C locale.  _Other
>> standards_, such as Unicode, are free to add range requirements on top=

>> of what POSIX requires, but alas, Unicode collation order does NOT
>> currently specify anything about regular expression or glob range
>> matching, so it is out of scope for Unicode to say what [A-Z] expands =
to.
>=20
>=20
> ----
>=20
> I think this is the problem.
>=20
> A-Z in regular expressions is defined to expand to those characters
> that are _in collating order_, >A, and <Z...

Only in POSIX 1992 or in the C locale.  In POSIX 2001 and POSIX 2008,
and non-C locales, [A-Z] is explicitly undefined, because the definition
of characters in collating order between A and Z did not work out.

>=20
> Without a collating order that expression in RE's would never have made=
 any
> sense.  It requires a collating order and is dependent on it.

They still don't make any sense in any locale except C, because POSIX no
longer requires collating order.

> The regex(7) man page says that [xx-xx] uses ***collating order**::

The regex(7) man page _of which system_?  Just because _some_ systems
(like glibc, picking the POSIX 1992 semantics) have well-defined
semantics, doesn't mean that all systems have those same semantics.
According to POSIX, you cannot portably assume ANY semantics for ranges
except in the C locale.  And if RRI gains traction, that means that you
can assume ASCII collation, across ALL locales, but this is a different
order than collation of a specific locale, and it is also a GNU
extension not guaranteed by POSIX.

> ----
> Seems pretty clear -- regex's aren't exempt from collating order, they
> depend on it...

Only on platforms where libc has chosen to provide an extension beyond
POSIX, and where GNU programs have not further overridden things to
avoid the unexpected glibc semantics.

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


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

iQEcBAEBCAAGBQJPuvPMAAoJEKeha0olJ0Nq9M0H/3JxVQajRNd2vVrA7YuKmKga
Oc7Z6ZOVtGzyl5uu72Byb5VzDZ/eaCY+XmjYMEccpMEPjdSW7k1E0wxp8ZShqBUn
JXaFh5hAloq0JKeYWPhAhhi3Z9Yikc27sWVp8OXXzaA2wdKwjUjAw1KcUXBqS4nV
GyXIn3ylWrFuI0p1ttgn8K49+z4li0hXVBsh5febjCE0fyRDRoXt9I5ZVOFkj8zO
chbkCFWYUAr8NatVZY3w+IMmLKYYVk/fqT85+Ter/m1KRLV7b+iNG78bTNhjTMQw
7UmgD5s1iT/XTYGXT3GJSz8mJGImZJ+2bnn8MJNNpHi98ifi8VDTTg4/SefGCwA=
=lO87
-----END PGP SIGNATURE-----

--------------enig2FBC3CC7E3FADD22EF2CCF19--


From MAILER-DAEMON Mon May 21 23:15:38 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWfZS-0007u5-9C
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 23:15:38 -0400
Received: from eggs.gnu.org ([208.118.235.92]:55461)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWfZP-0007tz-Nr
	for bug-bash@gnu.org; Mon, 21 May 2012 23:15:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWfZO-0005BN-6o
	for bug-bash@gnu.org; Mon, 21 May 2012 23:15:35 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:60334
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWfZM-0005Al-1b
	for bug-bash@gnu.org; Mon, 21 May 2012 23:15:34 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q4M3FLNM018963
	for <bug-bash@gnu.org>; Mon, 21 May 2012 20:15:25 -0700
Message-ID: <4FBB04C9.4090104@tlinx.org>
Date: Mon, 21 May 2012 20:15:21 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: bug-bash <bug-bash@gnu.org>
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
References: <4FB939B3.1010804@tlinx.org>	<20120521123819.GA1622@eeg.ccf.org>	<4FBA953E.7040708@tlinx.org>	<20120521192737.GB1622@eeg.ccf.org>	<4FBA9976.5070502@tlinx.org>
	<4FBA9B78.1040406@case.edu>	<4FBA9CCC.5030205@tlinx.org>
	<4FBAA7E7.9050805@redhat.com>	<4FBAAD83.7050904@tlinx.org>
	<4FBAB01E.1060101@redhat.com> <4FBAD2DB.2050100@tlinx.org>
	<4FBAF3CC.7030009@redhat.com>
In-Reply-To: <4FBAF3CC.7030009@redhat.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 22 May 2012 03:15:37 -0000



Eric Blake wrote:

> On 05/21/2012 05:42 PM, Linda Walsh wrote:
> 

> Only in POSIX 1992 or in the C locale.  In POSIX 2001 and POSIX 2008,
> and non-C locales, [A-Z] is explicitly undefined,

==============
ONLY under POSIX...

You may not believe this, but there are other standards than POSIX.

More than one distro and company claims unicode compliance, to V6.x.

Any programs or collections that do claim compat, need to adhere to the
stricter of the standards, which is Unicode, in this case.

POSIX only applies if you are going for the bottom of the barrel in this
case.




From MAILER-DAEMON Mon May 21 23:19:44 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWfdQ-0008Fh-OI
	for mharc-bug-bash@gnu.org; Mon, 21 May 2012 23:19:44 -0400
Received: from eggs.gnu.org ([208.118.235.92]:56142)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWfdN-0008F4-8v
	for bug-bash@gnu.org; Mon, 21 May 2012 23:19:42 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWfdL-0005vR-LD
	for bug-bash@gnu.org; Mon, 21 May 2012 23:19:40 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:60397
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWfdJ-0005v2-8P
	for bug-bash@gnu.org; Mon, 21 May 2012 23:19:39 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q4M3JVaJ019055
	for <bug-bash@gnu.org>; Mon, 21 May 2012 20:19:33 -0700
Message-ID: <4FBB05C3.6030609@tlinx.org>
Date: Mon, 21 May 2012 20:19:31 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: bug-bash <bug-bash@gnu.org>
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
References: <4FB939B3.1010804@tlinx.org>	<20120521123819.GA1622@eeg.ccf.org>	<4FBA953E.7040708@tlinx.org>	<20120521192737.GB1622@eeg.ccf.org>	<4FBA9976.5070502@tlinx.org>
	<4FBA9B78.1040406@case.edu>	<4FBA9CCC.5030205@tlinx.org>
	<4FBAA7E7.9050805@redhat.com>	<4FBAAD83.7050904@tlinx.org>
	<4FBAB01E.1060101@redhat.com> <4FBAD2DB.2050100@tlinx.org>
	<4FBAF3CC.7030009@redhat.com>
In-Reply-To: <4FBAF3CC.7030009@redhat.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 22 May 2012 03:19:42 -0000



Eric Blake wrote:

> They still don't make any sense in any locale except C, because POSIX no
> longer requires collating order.
> 
>> The regex(7) man page says that [xx-xx] uses ***collating order**::
> 
> The regex(7) man page _of which system_?  Just because _some_ systems
> (like glibc, picking the POSIX 1992 semantics) have well-defined
> semantics, doesn't mean that all systems have those same semantics.
> According to POSIX, you cannot portably assume ANY semantics for ranges
> except in the C locale.  And if RRI gains traction, that means that you
> can assume ASCII collation, across ALL locales, but this is a different
> order than collation of a specific locale, and it is also a GNU
> extension not guaranteed by POSIX.

===
	Well, that would be nice, but if Unicode takes off, *cough*,
and anyone claims unicode compliance (isn't UTF-8 the standard for HTML5
and XML?), they are also guaranteed ordering -- full ordering for the full
Unicode character set.

	It would be VERY GOOD if RRI didn't come up with an order that
was DIFFERENT from that prescribed by Unicode -- otherwise that could open
another can of worms.







From MAILER-DAEMON Tue May 22 03:46:32 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWjnc-0004hT-6E
	for mharc-bug-bash@gnu.org; Tue, 22 May 2012 03:46:32 -0400
Received: from eggs.gnu.org ([208.118.235.92]:36280)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SWjnZ-0004fK-31
	for bug-bash@gnu.org; Tue, 22 May 2012 03:46:30 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SWjnT-0005i0-HN
	for bug-bash@gnu.org; Tue, 22 May 2012 03:46:28 -0400
Received: from mail-out.m-online.net ([212.18.0.10]:58404)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SWjnT-0005hl-BN
	for bug-bash@gnu.org; Tue, 22 May 2012 03:46:23 -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 3VxTSX6lDGz3hhct;
	Tue, 22 May 2012 09:46:20 +0200 (CEST)
Received: from igel.home (ppp-93-104-146-156.dynamic.mnet-online.de
	[93.104.146.156])
	by mail.mnet-online.de (Postfix) with ESMTPA id 3VxTSY02H0z4KKHt;
	Tue, 22 May 2012 09:46:20 +0200 (CEST)
Received: by igel.home (Postfix, from userid 501)
	id 41CF2CA2A4; Tue, 22 May 2012 09:46:19 +0200 (CEST)
From: Andreas Schwab <schwab@linux-m68k.org>
To: Linda Walsh <bash@tlinx.org>
Subject: Re: Possible bug: Race condition when calling external
	commands	during trap handling
References: <E76DF6102FDBC04BA291EAE9A3BAECB501381DBD8583@HE111540.emea1.cds.t-internal.com>
	<20120503070750.GA23091@hysteria.proulx.com>
	<m2bom54rke.fsf@igel.home> <4FBAD884.7070603@tlinx.org>
X-Yow: I want to dress you up as TALLULAH BANKHEAD and cover you with
	VASELINE and WHEAT THINS..
Date: Tue, 22 May 2012 09:46:19 +0200
In-Reply-To: <4FBAD884.7070603@tlinx.org> (Linda Walsh's message of "Mon, 21
	May 2012 17:06:28 -0700")
Message-ID: <m2txz8zmic.fsf@igel.home>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.97 (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: Tillmann.Crueger@telekom.de, 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, 22 May 2012 07:46:30 -0000

A trap is not a signal.  It doesn't "come in".  A trap handler is
executed because some condition is true at a command boundary.

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 Tue May 22 07:47:20 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWnYe-0001jD-G7
	for mharc-bug-bash@gnu.org; Tue, 22 May 2012 07:47:20 -0400
Received: from eggs.gnu.org ([208.118.235.92]:56744)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWnYX-0001gd-LT
	for bug-bash@gnu.org; Tue, 22 May 2012 07:47:19 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWnYR-0000am-AA
	for bug-bash@gnu.org; Tue, 22 May 2012 07:47:13 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:42770
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SWnYQ-0000a7-V0
	for bug-bash@gnu.org; Tue, 22 May 2012 07:47:07 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q4MBl01C007636; Tue, 22 May 2012 04:47:03 -0700
Message-ID: <4FBB7CB5.20009@tlinx.org>
Date: Tue, 22 May 2012 04:47:01 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: Andreas Schwab <schwab@linux-m68k.org>
Subject: Re: Possible bug: Race condition when calling external
	commands	during trap handling
References: <E76DF6102FDBC04BA291EAE9A3BAECB501381DBD8583@HE111540.emea1.cds.t-internal.com>	<20120503070750.GA23091@hysteria.proulx.com>	<m2bom54rke.fsf@igel.home>
	<4FBAD884.7070603@tlinx.org> <m2txz8zmic.fsf@igel.home>
In-Reply-To: <m2txz8zmic.fsf@igel.home>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Cc: Tillmann.Crueger@telekom.de, 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, 22 May 2012 11:47:19 -0000



Andreas Schwab wrote:

> A trap is not a signal.  It doesn't "come in".  A trap handler is
> executed because some condition is true at a command boundary.
> 
> Andreas.
> 

That still begs the question...

If you are in your trap handler, and you don't reset the signal --
how can you guarantee that your signal handler will be reset
before another even that would cause a trap occurs -- say a child
dying.  If you don't have a trap in place and a child dies, do you
lose the indication that a child died?  Suppose 2 die and now you install your
trap handler, will you get a second call to your trap handler immediately upon
exit from the first?

     I honestly don't know how bash would handle some of these things.

I do know that the input subsystem can drop keys when it switches
from raw to cooked.  I don't know if it should, but it happens if
you use something like  drops keys when you switch modes alot
like calling
 > more testin
#!/bin/bash
stty raw
if read -n1 -t0 char; then
   stty cooked
   read -n1 -t1 char
   echo "($char)"
else
   stty cooked
   echo "(undef)"
fi
repetitively from a perl script (perl's mechanism for doing this never times out
and returns if a  sigwinch comes in...)...so amusingly, it's safer (though a bit 
flakey) to periodically call a shell script to poll the keyboard...  ;-)...

But the point is, real time events are a pain to get right -- if you don't want 
to lose traps corresponding to interrupts, in perl and C, at least, you need to 
reset the event handler before returning from processing the current event.

But bash may be different...I was just warning of the possibility of their being 
a problem NOT doing it in the handler, as such exists in many other similar 
handlers.





From MAILER-DAEMON Tue May 22 08:29:06 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWoD4-0005Bl-TY
	for mharc-bug-bash@gnu.org; Tue, 22 May 2012 08:29:06 -0400
Received: from eggs.gnu.org ([208.118.235.92]:55145)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SWoD2-0005Bf-Fh
	for bug-bash@gnu.org; Tue, 22 May 2012 08:29:05 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SWoCw-00050q-9s
	for bug-bash@gnu.org; Tue, 22 May 2012 08:29:04 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:46535
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SWoCw-00050M-3H
	for bug-bash@gnu.org; Tue, 22 May 2012 08:28:58 -0400
Received: (qmail 1236 invoked from network); 22 May 2012 12:28:53 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Tue, 22 May 2012 08:28:53 -0400
Received: (qmail 139 invoked by uid 563); 22 May 2012 12:28:52 -0000
Date: Tue, 22 May 2012 08:28:52 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Linda Walsh <bash@tlinx.org>
Subject: Re: Possible bug: Race condition when calling external
	commands	during trap handling
Message-ID: <20120522122852.GD1622@eeg.ccf.org>
References: <E76DF6102FDBC04BA291EAE9A3BAECB501381DBD8583@HE111540.emea1.cds.t-internal.com>
	<20120503070750.GA23091@hysteria.proulx.com>
	<m2bom54rke.fsf@igel.home> <4FBAD884.7070603@tlinx.org>
	<m2txz8zmic.fsf@igel.home> <4FBB7CB5.20009@tlinx.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4FBB7CB5.20009@tlinx.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: Tue, 22 May 2012 12:29:05 -0000

On Tue, May 22, 2012 at 04:47:01AM -0700, Linda Walsh wrote:
> If you are in your trap handler, and you don't reset the signal --
> how can you guarantee that your signal handler will be reset
> before another even that would cause a trap occurs

You are using the wrong words for everything.

A signal is an asynchronous event, potentially sent by another process.

A signal handler is a bit of code that you write, and then register to
be executed when you receive a signal.

A trap is the same as a signal handler.  ''trap'' is the name of the
bash command to register a signal handler (assigning it to a set of
signals).

I do not know the answers to "How does bash implement traps?  Is there
a guarantee that no signals will be lost?"  Hopefully someone else does.

The man page has only a partial answer.  Under JOB CONTROL:

   Any trap on SIGCHLD is executed for each child that exits.


From MAILER-DAEMON Tue May 22 08:42:19 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWoPr-00025k-4x
	for mharc-bug-bash@gnu.org; Tue, 22 May 2012 08:42:19 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49389)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1SWoPh-00022u-1W
	for bug-bash@gnu.org; Tue, 22 May 2012 08:42:18 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1SWoPa-0002G4-U9
	for bug-bash@gnu.org; Tue, 22 May 2012 08:42:08 -0400
Received: from mx1.redhat.com ([209.132.183.28]:15630)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1SWoPa-0002Et-Lj
	for bug-bash@gnu.org; Tue, 22 May 2012 08:42:02 -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 q4MCg03k028392
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
	for <bug-bash@gnu.org>; Tue, 22 May 2012 08:42:00 -0400
Received: from [10.36.4.80] (vpn1-4-80.ams2.redhat.com [10.36.4.80])
	by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id q4MCfvjQ024691
	for <bug-bash@gnu.org>; Tue, 22 May 2012 08:41:59 -0400
Message-ID: <4FBB8995.7000201@redhat.com>
Date: Tue, 22 May 2012 14:41:57 +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: Possible bug: Race condition when calling external commands	during
	trap handling
References: <E76DF6102FDBC04BA291EAE9A3BAECB501381DBD8583@HE111540.emea1.cds.t-internal.com>
	<20120503070750.GA23091@hysteria.proulx.com>
	<m2bom54rke.fsf@igel.home> <4FBAD884.7070603@tlinx.org>
	<m2txz8zmic.fsf@igel.home> <4FBB7CB5.20009@tlinx.org>
	<20120522122852.GD1622@eeg.ccf.org>
In-Reply-To: <20120522122852.GD1622@eeg.ccf.org>
Content-Type: text/plain; charset=ISO-8859-1; 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: Tue, 22 May 2012 12:42:18 -0000

On 05/22/2012 02:28 PM, Greg Wooledge wrote:
> I do not know the answers to "How does bash implement traps?  Is there
> a guarantee that no signals will be lost?"  Hopefully someone else does.
I can just imagine a situation when the bash is reading trap from the 
source (is going through the script and is on line where trap is) or not 
read it yet and the signal is received. Then, of course, your trap 
handler is not installed yet.
Another situation: You had previous trap handler and you are installing 
new one. The received signals are "paused" for a while and are processed 
right after the installation of new trap handler. There was a bug report 
against this, I'm not sure if it is fixed.

RR


From MAILER-DAEMON Tue May 22 09:02:17 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWojB-0004k2-9a
	for mharc-bug-bash@gnu.org; Tue, 22 May 2012 09:02:17 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46662)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWoj0-0004g3-Cg
	for bug-bash@gnu.org; Tue, 22 May 2012 09:02:15 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWoiv-00031g-HS
	for bug-bash@gnu.org; Tue, 22 May 2012 09:02:05 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:40810)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWoiv-00030q-DD
	for bug-bash@gnu.org; Tue, 22 May 2012 09:02:01 -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 BYV57293 (AUTH cpr);
	Tue, 22 May 2012 09:01:59 -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 AXN81509 (AUTH cpr);
	Tue, 22 May 2012 09:01:58 -0400 (EDT)
Message-ID: <4FBB8E46.70705@case.edu>
Date: Tue, 22 May 2012 09:01:58 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Roman Rakus <rrakus@redhat.com>
Subject: Re: Possible bug: Race condition when calling external commands during
	trap handling
References: <E76DF6102FDBC04BA291EAE9A3BAECB501381DBD8583@HE111540.emea1.cds.t-internal.com>
	<20120503070750.GA23091@hysteria.proulx.com>
	<m2bom54rke.fsf@igel.home> <4FBAD884.7070603@tlinx.org>
	<m2txz8zmic.fsf@igel.home> <4FBB7CB5.20009@tlinx.org>
	<20120522122852.GD1622@eeg.ccf.org> <4FBB8995.7000201@redhat.com>
In-Reply-To: <4FBB8995.7000201@redhat.com>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 22 May 2012 13:02:15 -0000

On 5/22/12 8:41 AM, Roman Rakus wrote:

> Another situation: You had previous trap handler and you are installing new
> one. The received signals are "paused" for a while and are processed right
> after the installation of new trap handler. There was a bug report against
> this, I'm not sure if it is fixed.

Can you provide a reference to that report?


-- 
``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 May 22 10:08:18 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWpl4-0007cJ-Py
	for mharc-bug-bash@gnu.org; Tue, 22 May 2012 10:08:18 -0400
Received: from eggs.gnu.org ([208.118.235.92]:50126)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1SWpkx-0007HG-UV
	for bug-bash@gnu.org; Tue, 22 May 2012 10:08:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1SWpks-0007Ik-2u
	for bug-bash@gnu.org; Tue, 22 May 2012 10:08:11 -0400
Received: from mx1.redhat.com ([209.132.183.28]:5896)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rrakus@redhat.com>) id 1SWpkr-0007IQ-Qm
	for bug-bash@gnu.org; Tue, 22 May 2012 10:08:05 -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 q4ME84p8019759
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
	for <bug-bash@gnu.org>; Tue, 22 May 2012 10:08:04 -0400
Received: from [10.36.4.80] (vpn1-4-80.ams2.redhat.com [10.36.4.80])
	by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
	id q4MDGXxY003121
	for <bug-bash@gnu.org>; Tue, 22 May 2012 09:16:34 -0400
Message-ID: <4FBB91B1.5030206@redhat.com>
Date: Tue, 22 May 2012 15:16:33 +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: Possible bug: Race condition when calling external commands during
	trap handling
References: <E76DF6102FDBC04BA291EAE9A3BAECB501381DBD8583@HE111540.emea1.cds.t-internal.com>
	<20120503070750.GA23091@hysteria.proulx.com>
	<m2bom54rke.fsf@igel.home> <4FBAD884.7070603@tlinx.org>
	<m2txz8zmic.fsf@igel.home> <4FBB7CB5.20009@tlinx.org>
	<20120522122852.GD1622@eeg.ccf.org>
	<4FBB8995.7000201@redhat.com> <4FBB8E46.70705@case.edu>
In-Reply-To: <4FBB8E46.70705@case.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.132.183.28
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 22 May 2012 14:08:17 -0000

On 05/22/2012 03:01 PM, Chet Ramey wrote:
> On 5/22/12 8:41 AM, Roman Rakus wrote:
>
>> Another situation: You had previous trap handler and you are installing new
>> one. The received signals are "paused" for a while and are processed right
>> after the installation of new trap handler. There was a bug report against
>> this, I'm not sure if it is fixed.
> Can you provide a reference to that report?
>
>
http://lists.gnu.org/archive/html/bug-bash/2011-04/msg00045.html

RR


From MAILER-DAEMON Tue May 22 11:16:14 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SWqoo-00078E-Le
	for mharc-bug-bash@gnu.org; Tue, 22 May 2012 11:16:14 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49759)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWqoh-00076j-7J
	for bug-bash@gnu.org; Tue, 22 May 2012 11:16:12 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWqoa-00078E-S4
	for bug-bash@gnu.org; Tue, 22 May 2012 11:16:06 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:49603)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SWqoa-00077c-NM
	for bug-bash@gnu.org; Tue, 22 May 2012 11:16:00 -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 BKZ17784;
	Tue, 22 May 2012 11:15:58 -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 AXI73206 (AUTH cpr);
	Tue, 22 May 2012 11:15:57 -0400 (EDT)
Message-ID: <4FBBADAD.2060909@case.edu>
Date: Tue, 22 May 2012 11:15:57 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Roman Rakus <rrakus@redhat.com>
Subject: Re: Possible bug: Race condition when calling external commands during
	trap handling
References: <E76DF6102FDBC04BA291EAE9A3BAECB501381DBD8583@HE111540.emea1.cds.t-internal.com>
	<20120503070750.GA23091@hysteria.proulx.com>
	<m2bom54rke.fsf@igel.home> <4FBAD884.7070603@tlinx.org>
	<m2txz8zmic.fsf@igel.home> <4FBB7CB5.20009@tlinx.org>
	<20120522122852.GD1622@eeg.ccf.org>
	<4FBB8995.7000201@redhat.com> <4FBB8E46.70705@case.edu>
	<4FBB91B1.5030206@redhat.com>
In-Reply-To: <4FBB91B1.5030206@redhat.com>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv2.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.37
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 22 May 2012 15:16:13 -0000

On 5/22/12 9:16 AM, Roman Rakus wrote:
> On 05/22/2012 03:01 PM, Chet Ramey wrote:
>> On 5/22/12 8:41 AM, Roman Rakus wrote:
>>
>>> Another situation: You had previous trap handler and you are installing new
>>> one. The received signals are "paused" for a while and are processed right
>>> after the installation of new trap handler. There was a bug report against
>>> this, I'm not sure if it is fixed.
>> Can you provide a reference to that report?
>>
>>
> http://lists.gnu.org/archive/html/bug-bash/2011-04/msg00045.html

According to the bash change log, it was fixed three days later.

-- 
``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 May 23 12:20:49 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SXEIr-0001gx-NF
	for mharc-bug-bash@gnu.org; Wed, 23 May 2012 12:20:49 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35649)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vincent@vinc17.net>) id 1SX9Tb-0001Im-PB
	for bug-bash@gnu.org; Wed, 23 May 2012 07:11:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vincent@vinc17.net>) id 1SX9TW-0007Oi-N2
	for bug-bash@gnu.org; Wed, 23 May 2012 07:11:35 -0400
Received: from ypig.lip.ens-lyon.fr ([140.77.13.48]:44489)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vincent@vinc17.net>) id 1SX9TW-0007O8-GL
	for bug-bash@gnu.org; Wed, 23 May 2012 07:11:30 -0400
Received: from vlefevre by ypig.lip.ens-lyon.fr with local (Exim 4.77)
	(envelope-from <vincent@vinc17.net>)
	id 1SX9TT-0008Ku-L1; Wed, 23 May 2012 13:11:27 +0200
Date: Wed, 23 May 2012 13:11:27 +0200
From: Vincent Lefevre <vincent@vinc17.net>
To: bug-bash@gnu.org
Subject: in completion, $COMP_WORDBREAKS should be ignored, unless there are
	no matches
Message-ID: <20120523111127.GA4208@ypig.lip.ens-lyon.fr>
Mail-Followup-To: Vincent Lefevre <vincent@vinc17.net>, bug-bash@gnu.org
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
X-Mailer-Info: http://www.vinc17.net/mutt/
User-Agent: Mutt/1.5.21-6203-vl-r48020 (2012-04-29)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 140.77.13.48
X-Mailman-Approved-At: Wed, 23 May 2012 12:20:47 -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, 23 May 2012 11:11:41 -0000

It seems that $COMP_WORDBREAKS annoys users when filenames contain
one of its characters:
  http://lists.gnu.org/archive/html/bug-bash/2005-07/msg00034.html
  http://lists.gnu.org/archive/html/bug-bash/2006-09/msg00019.html
  http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00163.html
and my bug report:
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=674084

Unsetting $COMP_WORDBREAKS is not a solution, as completion would no
longer work in contexts where such characters are word separators.

How about the following behavior when the user types [TAB]?

1. Try to complete the whole word, ignoring $COMP_WORDBREAKS.
2. If there are no matches, take $COMP_WORDBREAKS into account
   like now.

I suppose that false positives for (1) are rare enough, so that this
heuristic would work well in practice.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


From MAILER-DAEMON Wed May 23 22:48:13 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SXO61-0002MV-CZ
	for mharc-bug-bash@gnu.org; Wed, 23 May 2012 22:48:13 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60884)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <greg@whitleymott.net>) id 1SXO5x-0002KS-Au
	for bug-bash@gnu.org; Wed, 23 May 2012 22:48:11 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <greg@whitleymott.net>) id 1SXO5v-0006UQ-C6
	for bug-bash@gnu.org; Wed, 23 May 2012 22:48:08 -0400
Received: from mail-ob0-f169.google.com ([209.85.214.169]:39808)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <greg@whitleymott.net>) id 1SXO5v-0006TU-7M
	for bug-bash@gnu.org; Wed, 23 May 2012 22:48:07 -0400
Received: by obbwd18 with SMTP id wd18so15159275obb.0
	for <bug-bash@gnu.org>; Wed, 23 May 2012 19:48:03 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=google.com; s=20120113;
	h=mime-version:sender:from:date:x-google-sender-auth:message-id
	:subject:to:content-type:x-gm-message-state;
	bh=iPKsYLTxHxJarHMLMpapT9fKlNXd3HbfaAoAeCrQZRg=;
	b=OjlDJ94tSvdW9Inmj3zVvpuyMKaxyXsdJDMJGs1lVUYjwX/Jem0+8JSwP41UkHaQI4
	gVtHjG7uGM9baSWzXRUfAGISVjIJOhoeI0O22jyrPqG+SFtVGiJOVa6iaVZfP4tDDnKP
	fTQC5Mvm0k9e1s4rAD7yznoDSyhsLD66EKg2+E8o8/AFdJmVoMY5zQzobzVT0YyLwaPC
	ERbi7KeTesDX8gL831BmpxO+aOfRBVba5qr3PmiufX4FJx0ecyP2ue8jsdV8zd8KYsfs
	DzL6uo8is54DtVbMvbaJm5POqLPF9WX9bIhAE6tpokquJEmLHmiVjFpeZ6CsTP1npd3C
	CmFw==
Received: by 10.60.24.7 with SMTP id q7mr28561399oef.50.1337827683777; Wed, 23
	May 2012 19:48:03 -0700 (PDT)
MIME-Version: 1.0
Sender: greg@whitleymott.net
Received: by 10.76.173.65 with HTTP; Wed, 23 May 2012 19:47:33 -0700 (PDT)
From: gregrwm <backuppc-users@whitleymott.net>
Date: Wed, 23 May 2012 21:47:33 -0500
X-Google-Sender-Auth: T1y1Y9MrmkY-HtdNj-vqNt2RAE8
Message-ID: <CAD+dB9B4JG+qUwZBQUwiQmVt0j6NDn=DDTxr9R+nkA8DL4KLJA@mail.gmail.com>
Subject: quoted and concatenated positional parameters
To: bug-bash@gnu.org
Content-Type: text/plain; charset=ISO-8859-1
X-Gm-Message-State: ALoCoQk+gq1541BVK8ou7F03JvUOEVZryknbMW8DgRR7ZHnd+ewpQ8aBTGLAI10fXxhtqnXs0dxS
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.214.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: Thu, 24 May 2012 02:48:11 -0000

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale'
-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include
-I./lib  -D_GNU_SOURCE -DRECYCLES_PIDS  -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic -fwrapv
uname output: Linux okra.fo4.net 2.6.32-042stab053.5 #1 SMP Tue Mar 27
11:42:17 MSD 2012 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

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

Description:
        expansion anomaly with quoted and concatenated positional parameters

Repeat-By:
a(){ echo
     echo '"${@:2}a3 a2" a$1    #works as long as $1 and 3 are swapped'
     echo  "${@:2}a3 a2" a$1
           "${@:2}a3 a2" a$1
     echo   $?
        a=("${@}");}
b(){ echo
     echo '"${@:2}b$1 b2" b3    #fails!  why?'
     echo  "${@:2}b$1 b2" b3
           "${@:2}b$1 b2" b3
     echo   $?
        b=("${@}");}
c(){ echo
     echo  '${@:2}c$1 c2 c3     #works as long as quoting omitted'
     echo   ${@:2}c$1 c2 c3
            ${@:2}c$1 c2 c3
     echo   $?
        c=("${@}");}
a x set y z;declare -p a
b x set y z;declare -p b
c x set y z;declare -p c

#output:

#"${@:2}a3 a2" a$1    #works as long as $1 and 3 are swapped
#set y za3 a2 ax
#0
#declare -a a='([0]="y" [1]="za3 a2" [2]="ax")'

#"${@:2}b$1 b2" b3    #fails!  why?
#set y zbx b2 b3
#bash: set y zbx b2: command not found
#127
#declare -a b='([0]="x" [1]="set" [2]="y" [3]="z")'

#${@:2}c$1 c2 c3     #works as long as quoting omitted
#set y zcx c2 c3
#0
#declare -a c='([0]="y" [1]="zcx" [2]="c2" [3]="c3")'


From MAILER-DAEMON Thu May 24 01:34:12 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SXQge-0004dU-8t
	for mharc-bug-bash@gnu.org; Thu, 24 May 2012 01:34:12 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33366)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SXQgZ-0004ci-S4
	for bug-bash@gnu.org; Thu, 24 May 2012 01:34:10 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SXQgW-0008Sj-NJ
	for bug-bash@gnu.org; Thu, 24 May 2012 01:34:07 -0400
Received: from mail-yw0-f41.google.com ([209.85.213.41]:51013)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SXQgW-0008S6-Fj
	for bug-bash@gnu.org; Thu, 24 May 2012 01:34:04 -0400
Received: by yhr47 with SMTP id 47so8950727yhr.0
	for <bug-bash@gnu.org>; Wed, 23 May 2012 22:34:01 -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=xUqm5+dg3ucoO+d25QXOmiTwrcytrZTeNOVFDKYziSA=;
	b=zPk8PP95NLoiv3wA50kM9xHnymYyym9QKpAVLCzP1cfbEpRo0RurVOCtGoyHTcKrHF
	U80CfYNq5efrqevCEJCJkKGyYkIhkZpUFdNobs04KglOX6m0de7ulJ9X3hTr/i5VIDlG
	AtZb99onlxHHZCJGNlToxdg+fTQ7fUM+loIouZcRuVeJ+9xqLsdv+nE5XCQWfPEgAZZe
	VjOA7YCiUg9pZoKI9PkB/xr5ll3U8Zr7Wl068CWaQ3J6Lz/KobS4vIwtjSwU8bwVJnFM
	u0K38e6ekU2SQc+2sjtBdimlxQSKjWvIH9yBq2/6LlFE+lqmyCIVruMc+2s6+X/T6ZPg
	b00g==
Received: by 10.50.181.164 with SMTP id dx4mr15577706igc.1.1337837641769;
	Wed, 23 May 2012 22:34:01 -0700 (PDT)
Received: from smorgbox.localnet (65-128-181-111.mpls.qwest.net.
	[65.128.181.111])
	by mx.google.com with ESMTPS id f8sm11247187ign.0.2012.05.23.22.34.00
	(version=SSLv3 cipher=OTHER); Wed, 23 May 2012 22:34:01 -0700 (PDT)
From: Dan Douglas <ormaaj@gmail.com>
To: bug-bash@gnu.org
Subject: Re: quoted and concatenated positional parameters
Date: Thu, 24 May 2012 00:33:48 -0500
Message-ID: <7986321.WidHYTaCZ6@smorgbox>
User-Agent: KMail/4.8.3 (Linux/3.3.6-pf+; KDE/4.8.3; x86_64; ; )
In-Reply-To: <CAD+dB9B4JG+qUwZBQUwiQmVt0j6NDn=DDTxr9R+nkA8DL4KLJA@mail.gmail.com>
References: <CAD+dB9B4JG+qUwZBQUwiQmVt0j6NDn=DDTxr9R+nkA8DL4KLJA@mail.gmail.com>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart9647733.aSC8K3ENRC";
	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: gregrwm <backuppc-users@whitleymott.net>
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, 24 May 2012 05:34:11 -0000


--nextPart9647733.aSC8K3ENRC
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"

On Wednesday, May 23, 2012 09:47:33 PM gregrwm wrote:
> expansion anomaly with quoted and concatenated positional parameters

Also reproducible in 4.2.28(1)-release

This occurs when any expansion is adjacent to or contained within a word that
is adjacent to an expansion of the from "$@" or "${a[@]}", and within the same
double-quotes. Bash mistakenly treats "${@}${x}" and "${@}""$x" differently.

> echo  '${@:2}c$1 c2 c3     #works as long as quoting omitted'

Because you're applying word-splitting to the result.  You'll see that there is
only one word if IFS is set to null.  It's impossible to test whether the
unquoted case is correct. The manpage says that only a quoted "$@" is split
into words for reasons other than word-splitting. Bash, mksh, and dash all
disagree about the unquoted cases, while Bash is the only shell to take issue
with the adjacent expansion in all cases.

 ~ $ for sh in {{,m}k,{d,b}a,z}sh; do printf '%s\n' "${sh}:" "$("$sh" -c "$(</dev/stdin)" -- {1..5})"; echo; done <<"EOF"                                                                                                                                           
args() { printf '<%s> ' "$@"; echo; }                                                                                                                                                                                                                                             
args "${@}${1}"
args "${@}foo" 
args ${@}${1}                                                                                                                                                                                                                                                                     
args ${@}foo                                                                                                                                                                                                                                                                      
IFS=                                                                                                                                                                                                                                                                              
args ${@}${1}                                                                                                                                                                                                                                                                     
args ${@}foo                                                                                                                                                                                                                                                                      
EOF                                                                                                                                                                                                                                                                               

ksh:
<1> <2> <3> <4> <51> 
<1> <2> <3> <4> <5foo> 
<1> <2> <3> <4> <51> 
<1> <2> <3> <4> <5foo> 
<1> <2> <3> <4> <51> 
<1> <2> <3> <4> <5foo> 

mksh:
<1> <2> <3> <4> <51> 
<1> <2> <3> <4> <5foo> 
<1> <2> <3> <4> <51> 
<1> <2> <3> <4> <5foo> 
<1 2 3 4 51> 
<1 2 3 4 5foo> 

dash:
<1> <2> <3> <4> <51> 
<1> <2> <3> <4> <5foo> 
<1> <2> <3> <4> <51> 
<1> <2> <3> <4> <5foo> 
<123451> 
<12345foo> 

bash:
<1 2 3 4 51> 
<1> <2> <3> <4> <5foo> 
<1> <2> <3> <4> <51> 
<1> <2> <3> <4> <5foo> 
<1 2 3 4 51> 
<1> <2> <3> <4> <5foo> 

zsh:
<1> <2> <3> <4> <51> 
<1> <2> <3> <4> <5foo> 
<1> <2> <3> <4> <51> 
<1> <2> <3> <4> <5foo> 
<1> <2> <3> <4> <51> 
<1> <2> <3> <4> <5foo> 
-- 
Dan Douglas
--nextPart9647733.aSC8K3ENRC
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+9yEEACgkQMmyDamdg+MxKRwCgqS6hjNYkpwyzI8+Jy5kguDsD
exsAoJ6y6IpvRvwy9PAwPH30UESlxYbV
=WzhL
-----END PGP SIGNATURE-----

--nextPart9647733.aSC8K3ENRC--



From MAILER-DAEMON Thu May 24 01:53:23 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SXQzD-0001No-To
	for mharc-bug-bash@gnu.org; Thu, 24 May 2012 01:53:23 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41154)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SXQz9-0001NE-JD
	for bug-bash@gnu.org; Thu, 24 May 2012 01:53:22 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SXQz7-0007jt-TS
	for bug-bash@gnu.org; Thu, 24 May 2012 01:53:19 -0400
Received: from mail-gg0-f169.google.com ([209.85.161.169]:33733)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SXQz7-0007jL-NM
	for bug-bash@gnu.org; Thu, 24 May 2012 01:53:17 -0400
Received: by ggm4 with SMTP id 4so8893255ggm.0
	for <bug-bash@gnu.org>; Wed, 23 May 2012 22:53:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=from:to:subject:date:message-id:user-agent:in-reply-to:references
	:mime-version:content-transfer-encoding:content-type;
	bh=IEGTsy5RBiCXqxFwOXWJyktvULGvR4EWJ2Zss0dAn8A=;
	b=PmXj97u3CoNsXvRYzRsEQ/Y3rIo6fnDeHD37DOwaNu+VEJ76aLay3SbqOEFNM3VgLr
	PPFrdiHkLtNGRJtyJbqXR3j9cn+mAwk/fZ5L8SiyTf2ti9NcfC4jffHBjQniEphFPZWC
	bftyEl2JDBZKPidT90l7lF0HJnE4EmTp7+wqJfJCvN6QhhTOTaMXt4D0gW17qWYCR1fY
	yGsearEICaajejEcnIO8gjUaere5ZUFZDzLfe+GNR5RjJEiQU3XbeE5Kd3Q8FQbZ3/Na
	ictaWYhd5rmchvegNdTWAq3GKAVQho8S8cFqt4+ZneerJlc6TIVsB5q2FXxzIklzwF7S
	oxUg==
Received: by 10.42.10.73 with SMTP id p9mr16115314icp.43.1337838795691;
	Wed, 23 May 2012 22:53:15 -0700 (PDT)
Received: from smorgbox.localnet (65-128-181-111.mpls.qwest.net.
	[65.128.181.111])
	by mx.google.com with ESMTPS id gw4sm1698455igb.6.2012.05.23.22.53.14
	(version=SSLv3 cipher=OTHER); Wed, 23 May 2012 22:53:15 -0700 (PDT)
From: Dan Douglas <ormaaj@gmail.com>
To: bug-bash@gnu.org
Subject: Re: quoted and concatenated positional parameters
Date: Thu, 24 May 2012 00:53:08 -0500
Message-ID: <1875964.PRdkkohppf@smorgbox>
User-Agent: KMail/4.8.3 (Linux/3.3.6-pf+; KDE/4.8.3; x86_64; ; )
In-Reply-To: <7986321.WidHYTaCZ6@smorgbox>
References: <CAD+dB9B4JG+qUwZBQUwiQmVt0j6NDn=DDTxr9R+nkA8DL4KLJA@mail.gmail.com>
	<7986321.WidHYTaCZ6@smorgbox>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.161.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: Thu, 24 May 2012 05:53:22 -0000

Ugh, Sorry, I forgot to strip trailing whitespace. If that wasn't 
comprehensible for anyone, the heredoc in the preceeding the testcase was:

args() { printf '<%s> ' "$@"; echo; }
args "${@}${1}"
args "${@}foo"
args ${@}${1}
args ${@}foo
IFS=
args ${@}${1}
args ${@}foo
EOF

-- 
Dan Douglas


From MAILER-DAEMON Thu May 24 15:16:47 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SXdWh-0007Q0-GL
	for mharc-bug-bash@gnu.org; Thu, 24 May 2012 15:16:47 -0400
Received: from eggs.gnu.org ([208.118.235.92]:50355)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SXdWf-0007Pt-1N
	for bug-bash@gnu.org; Thu, 24 May 2012 15:16:46 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SXdWd-0007Cv-3n
	for bug-bash@gnu.org; Thu, 24 May 2012 15:16:44 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:5067)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SXdWc-0007CV-Vp
	for bug-bash@gnu.org; Thu, 24 May 2012 15:16:43 -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 BLC01694;
	Thu, 24 May 2012 15:16:41 -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 AXR62664 (AUTH cpr);
	Thu, 24 May 2012 15:16:40 -0400 (EDT)
Message-ID: <4FBE8918.7080306@case.edu>
Date: Thu, 24 May 2012 15:16:40 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Vincent Lefevre <vincent@vinc17.net>, bug-bash@gnu.org
Subject: Re: in completion, $COMP_WORDBREAKS should be ignored, unless there
	are no matches
References: <20120523111127.GA4208@ypig.lip.ens-lyon.fr>
In-Reply-To: <20120523111127.GA4208@ypig.lip.ens-lyon.fr>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv2.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.37
Cc: 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, 24 May 2012 19:16:46 -0000

On 5/23/12 7:11 AM, Vincent Lefevre wrote:
> It seems that $COMP_WORDBREAKS annoys users when filenames contain
> one of its characters:
>   http://lists.gnu.org/archive/html/bug-bash/2005-07/msg00034.html
>   http://lists.gnu.org/archive/html/bug-bash/2006-09/msg00019.html
>   http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00163.html
> and my bug report:
>   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=674084
> 
> Unsetting $COMP_WORDBREAKS is not a solution, as completion would no
> longer work in contexts where such characters are word separators.
> 
> How about the following behavior when the user types [TAB]?
> 
> 1. Try to complete the whole word, ignoring $COMP_WORDBREAKS.

"The whole word" implies some default hidden value for COMP_WORDBREAKS
that the user can't touch or modify.  The whole raison d'etre for having
it in the first place is to allow the user to specify these things.  It's
easy enough to have COMP_WORDBREAKS only contain whitespace and shell
metacharacters.  Maybe there should be a shell option to set 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/


From MAILER-DAEMON Fri May 25 02:26:30 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SXnyo-0001Oo-8N
	for mharc-bug-bash@gnu.org; Fri, 25 May 2012 02:26:30 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44547)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <root@gouch.ihate.ms>) id 1SXlQ0-0000np-0o
	for bug-bash@gnu.org; Thu, 24 May 2012 23:42:25 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <root@gouch.ihate.ms>) id 1SXlPx-0000i7-U4
	for bug-bash@gnu.org; Thu, 24 May 2012 23:42:23 -0400
Received: from [184.82.206.97] (port=57355 helo=gouch.ihate.ms)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <root@gouch.ihate.ms>) id 1SXlPx-0000hj-OQ
	for bug-bash@gnu.org; Thu, 24 May 2012 23:42:21 -0400
Received: by gouch.ihate.ms (Postfix, from userid 0)
	id 6B0084F8916; Fri, 25 May 2012 03:05:00 +0000 (UTC)
From: root@gouch.ihate.ms
To: bug-bash@gnu.org,bash@packages.debian.org
Subject: Space or multiple spaces before command causes it to not get logged
Message-Id: <20120525030500.6B0084F8916@gouch.ihate.ms>
Date: Fri, 25 May 2012 03:05:00 +0000 (UTC)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 184.82.206.97
X-Mailman-Approved-At: Fri, 25 May 2012 02:26:28 -0400
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 03:42:25 -0000

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/lib  -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -Wall
uname output: Linux gouch.ihate.ms 3.2.0-24-virtual #38-Ubuntu SMP Tue May 1 16:38:34 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

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

Description:

Putting a space or multiple spaces before a command and executing it causes the command to not get logged to bash history file.


Repeat-By:

user@server:~$ pwd
/root
user@server:~$ history
    1  pwd
    2  history
user@server:~$  ls  <------ Note the space before the command
user@server:~$ date
Fri May 25 02:59:43 UTC 2012
user@server:~$ history
    1  pwd
    2  history
    3  date
    4  history


From MAILER-DAEMON Fri May 25 02:32:54 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SXo50-0006Ra-P4
	for mharc-bug-bash@gnu.org; Fri, 25 May 2012 02:32:54 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52631)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SXo4y-0006RQ-02
	for bug-bash@gnu.org; Fri, 25 May 2012 02:32:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SXo4w-0006x8-4Z
	for bug-bash@gnu.org; Fri, 25 May 2012 02:32:51 -0400
Received: from mail-we0-f169.google.com ([74.125.82.169]:60083)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1SXo4v-0006wq-R5
	for bug-bash@gnu.org; Fri, 25 May 2012 02:32:50 -0400
Received: by wefh52 with SMTP id h52so450553wef.0
	for <bug-bash@gnu.org>; Thu, 24 May 2012 23:32:47 -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=nzeBH17CjHOYz3A4DWvJdEHCMztV73eeG2tu+l45/7k=;
	b=NKfJzwvwCcj86oe4UlUIDddKQa2QNNkI2rHwBCarv0LZcfzOq1jL/wILfVkWzsHdHl
	AD3whEch/5gOafhzfnctAc45COD5ETNgz2wNtbbjQiqTJWSsRfD/A03YPchsgs6JQ8Q0
	dhE+/zt3wjqtUIdUrlR4bguRlQj6CoPG7Hn/CllE3ZXpRPlsIO9fXobxh1RyklpqMeM+
	tAq4NRskrwwDX9tR8myaF9Y3WgOAevJYfmH/IvCWochCCvgvNZK79XB+Kx6yNgCzq0Bg
	fLyiWQGLCpiZy+6iTdEyaUFrPjp33RbC5TOYbODclXsYeJVs2CslQzOxfB/0tImD03Yk
	gaHA==
Received: by 10.180.104.231 with SMTP id gh7mr4512789wib.10.1337927565143;
	Thu, 24 May 2012 23:32:45 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.194.6.98 with HTTP; Thu, 24 May 2012 23:32:25 -0700 (PDT)
In-Reply-To: <20120525030500.6B0084F8916@gouch.ihate.ms>
References: <20120525030500.6B0084F8916@gouch.ihate.ms>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Fri, 25 May 2012 09:32:25 +0300
Message-ID: <CAPSX3sTfBhOqD4sf1SZoce4WQr9JzZ1p32-n2R-J0FZqXTok1g@mail.gmail.com>
Subject: Re: Space or multiple spaces before command causes it to not get
	logged
To: root@gouch.ihate.ms
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.82.169
Cc: bug-bash@gnu.org, bash@packages.debian.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2012 06:32:53 -0000

On Fri, May 25, 2012 at 6:05 AM,  <root@gouch.ihate.ms> wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS: =A0-DPROGRAM=3D'bash' -DCONF_HOSTTYPE=3D'x86_64' -DCO=
NF_OSTYPE=3D'linux-gnu' -DCONF_MACHTYPE=3D'x86_64-pc-linux-gnu' -DCONF_VEND=
OR=3D'pc' -DLOCALEDIR=3D'/usr/share/locale' -DPACKAGE=3D'bash' -DSHELL -DHA=
VE_CONFIG_H =A0 -I. =A0-I../bash -I../bash/include -I../bash/lib =A0-D_FORT=
IFY_SOURCE=3D2 -g -O2 -fstack-protector --param=3Dssp-buffer-size=3D4 -Wfor=
mat -Wformat-security -Werror=3Dformat-security -Wall
> uname output: Linux gouch.ihate.ms 3.2.0-24-virtual #38-Ubuntu SMP Tue Ma=
y 1 16:38:34 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
> Machine Type: x86_64-pc-linux-gnu
>
> Bash Version: 4.2
> Patch Level: 24
> Release Status: release
>
> Description:
>
> Putting a space or multiple spaces before a command and executing it caus=
es the command to not get logged to bash history file.
>
>
> Repeat-By:
>
> user@server:~$ pwd
> /root
> user@server:~$ history
> =A0 =A01 =A0pwd
> =A0 =A02 =A0history
> user@server:~$ =A0ls =A0<------ Note the space before the command
> user@server:~$ date
> Fri May 25 02:59:43 UTC 2012
> user@server:~$ history
> =A0 =A01 =A0pwd
> =A0 =A02 =A0history
> =A0 =A03 =A0date
> =A0 =A04 =A0history

Probably a feature, check if the variable HISTCONTROL contains
"ignorespace" and the value of HISTIGNORE (printf %q\\n "$HISTIGNORE")


From MAILER-DAEMON Fri May 25 02:55:12 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SXoQa-0002zW-DG
	for mharc-bug-bash@gnu.org; Fri, 25 May 2012 02:55:12 -0400
Path: usenet.stanford.edu!postnews.google.com!oy3g2000pbc.googlegroups.com!not-for-mail
From: Richy Boy <1richyboy@gmail.com>
Newsgroups: gnu.bash.bug
Subject: Apply for a Job
Date: Thu, 24 May 2012 23:54:37 -0700 (PDT)
Organization: http://groups.google.com
Lines: 13
Message-ID: <45380ac6-8b73-4248-b303-2c479b97fc84@oy3g2000pbc.googlegroups.com>
NNTP-Posting-Host: 27.106.31.35
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: posting.google.com 1337928877 18869 127.0.0.1 (25 May 2012 06:54:37
	GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 25 May 2012 06:54:37 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: oy3g2000pbc.googlegroups.com; posting-host=27.106.31.35;
	posting-account=lDnCbAoAAABgZJBwRFnOxm9G93q2ugF_
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.1;
	rv:12.0) Gecko/20100101 Firefox/12.0,gzip(gfe)
Xref: usenet.stanford.edu gnu.bash.bug:24705
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, 25 May 2012 06:55:11 -0000

Apply for a Job

 Apply for a Job?

 Three Steps to apply for a Job:

 1.         A Resume

 2.         Cover letter

3.         Company research

http://www.ways2work.in/apply-for-a-job/

From MAILER-DAEMON Fri May 25 04:10:59 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SXpbv-0005Mo-Au
	for mharc-bug-bash@gnu.org; Fri, 25 May 2012 04:10:59 -0400
Received: from eggs.gnu.org ([208.118.235.92]:45669)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <raphael.droz@gmail.com>) id 1SXpbl-0005Kf-Hd
	for bug-bash@gnu.org; Fri, 25 May 2012 04:10:56 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <raphael.droz@gmail.com>) id 1SXpbf-0002ds-1R
	for bug-bash@gnu.org; Fri, 25 May 2012 04:10:49 -0400
Received: from mail-ee0-f41.google.com ([74.125.83.41]:43541)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <raphael.droz@gmail.com>) id 1SXpbe-0002dg-JK
	for bug-bash@gnu.org; Fri, 25 May 2012 04:10:42 -0400
Received: by eekb47 with SMTP id b47so145995eek.0
	for <bug-bash@gnu.org>; Fri, 25 May 2012 01:10:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=date:from:to:cc:subject:message-id:references:mime-version
	:content-type:content-disposition:in-reply-to:user-agent;
	bh=YmCwI96vFn5WzOa7DcN+sgbnYjmKuqb4/XeTZfs4l9s=;
	b=wOCC1tqeH6kLBVpe9swbfhK9L+Si4UB2AQtC0krrFw/j4jBiSY+ml836Cdgo7BGNLe
	tozUuEKD5J7epWJ3H2hbIzCjvBIEgvAHD0RSletpDNcjnajHBjpyx+ljv7d9v3kMFWkW
	T/x5k9yZvIBGbrf2QSdH6Y4pHueGbOkd2Cx41RB3TrK6y8LbacbuJvFJyOCV3WiIGVxZ
	qPLE8YdYMDjO39CR9LMIlS+5o9qNOXFGB+BIu/OUX5cNyBoLn6LlDC2ZCQ51BHix30iy
	eTx58UUoel85PDy6h20zxco8CqPWRNzLUS118zWk+M1+f/orTKo1r1+ronniMQUEtDGh
	FDvg==
Received: by 10.14.27.136 with SMTP id e8mr442157eea.156.1337933439827;
	Fri, 25 May 2012 01:10:39 -0700 (PDT)
Received: from localhost ([2a01:e35:8ad1:c570:208:74ff:feef:a421])
	by mx.google.com with ESMTPS id m5sm4292040eeh.17.2012.05.25.01.10.38
	(version=TLSv1/SSLv3 cipher=OTHER);
	Fri, 25 May 2012 01:10:38 -0700 (PDT)
Date: Fri, 25 May 2012 10:10:37 +0200
From: "=?iso-8859-1?Q?Rapha=EBl?= Droz" <raphael.droz@gmail.com>
To: bug-bash@gnu.org
Subject: Re: in completion, $COMP_WORDBREAKS should be ignored, unless there
	are no matches
Message-ID: <20120525081035.GA13195@drzraf>
References: <20120523111127.GA4208@ypig.lip.ens-lyon.fr>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20120523111127.GA4208@ypig.lip.ens-lyon.fr>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.83.41
Cc: Vincent Lefevre <vincent@vinc17.net>
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, 25 May 2012 08:10:57 -0000

On Wed, May 23, 2012 at 01:11:27PM +0200, Vincent Lefevre wrote:
> It seems that $COMP_WORDBREAKS annoys users when filenames contain
> one of its characters:

[...]
> Unsetting $COMP_WORDBREAKS is not a solution, as completion would no
> longer work in contexts where such characters are word separators.

indeed, it's not


On Thu, May 24, 2012 at 03:16:40PM -0400, Chet Ramey wrote:
> The whole raison d'etre for having
> it in the first place is to allow the user to specify these things.  It's
> easy enough to have COMP_WORDBREAKS only contain whitespace and shell
> metacharacters.

of course but COMP_WORDBREAKS is used in the context of different
completion which are kind enough to not alter main user environment.
That's why COMP_WORDBREAKS would need to apply in a given "context"
( like the scope of a function being used as a completion :) )

On Wed, May 23, 2012 at 01:11:27PM +0200, Vincent Lefevre wrote:
> How about the following behavior when the user types [TAB]?
> 
> 1. Try to complete the whole word, ignoring $COMP_WORDBREAKS.
> 2. If there are no matches, take $COMP_WORDBREAKS into account
>    like now.

See:
https://lists.gnu.org/archive/html/bug-bash/2011-05/msg00148.html
[thread follow-up]:
https://lists.gnu.org/archive/html/bug-bash/2011-06/msg00032.html

The patch in the above thread allowed COMP_WORDBREAKS to be set on a
completion basis using a newly created `complete` -B switch.

It uses the proper hook for this task but as been considered (probably
rightfully) "heavyweight". It would needs a strong knowledge of the
codebase (and hook definition) in order to add such a feature in an
elegant manner. 



regards


From MAILER-DAEMON Fri May 25 04:41:32 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SXq5U-0004ol-Tw
	for mharc-bug-bash@gnu.org; Fri, 25 May 2012 04:41:32 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58064)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <raphael.droz@gmail.com>) id 1SXq5P-0004o0-IK
	for bug-bash@gnu.org; Fri, 25 May 2012 04:41:31 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <raphael.droz@gmail.com>) id 1SXq5I-0001jn-2M
	for bug-bash@gnu.org; Fri, 25 May 2012 04:41:27 -0400
Received: from mail-ee0-f41.google.com ([74.125.83.41]:52315)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <raphael.droz@gmail.com>) id 1SXq5H-0001jO-Q6
	for bug-bash@gnu.org; Fri, 25 May 2012 04:41:19 -0400
Received: by eekb47 with SMTP id b47so156689eek.0
	for <bug-bash@gnu.org>; Fri, 25 May 2012 01:41:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=date:from:to:subject:message-id:references:mime-version
	:content-type:content-disposition:in-reply-to:user-agent;
	bh=rz8On6x5jCJ++F5sf4I+dKE0XhpkHYVT1CEPuPbQ2aI=;
	b=jPStZUk8HNvCweRZmLXrwaSRlV8J/6kv738CXTmheLpI51yx7qs6RI0wLK3ygpSbtA
	jfvI3YsXxHhvyKpkPmWItiougGN5sqecpnZ1VswoZrCitoLhjTMb3oZlpmJrtTcXjGGk
	Hr0R+/PZHsN/niIk9yw03OlU1nq8o68IbyhXno7RfOpYxrKk/aSOIqHBNL2MTYH/5dfS
	R1Zn3JOs6lILA3Y3Psz4njZOmg5GUkjH/NpARkX21DHD/2liuyA06WETbmUrcsvdbY3w
	JcvAybn0bnGjk9HY+rtSd72AbAVndYjYyN41jZUxKbinhD2azA8lgwmBXvUxj3ACMI0T
	a8gw==
Received: by 10.14.119.142 with SMTP id n14mr489305eeh.20.1337935277755;
	Fri, 25 May 2012 01:41:17 -0700 (PDT)
Received: from localhost ([2a01:e35:8ad1:c570:208:74ff:feef:a421])
	by mx.google.com with ESMTPS id u10sm4650454eem.1.2012.05.25.01.41.16
	(version=TLSv1/SSLv3 cipher=OTHER);
	Fri, 25 May 2012 01:41:16 -0700 (PDT)
Date: Fri, 25 May 2012 10:41:14 +0200
From: "=?iso-8859-1?Q?Rapha=EBl?= Droz" <raphael.droz@gmail.com>
To: bug-bash@gnu.org
Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
Message-ID: <20120525084112.GB13195@drzraf>
References: <4FB939B3.1010804@tlinx.org> <20120521123819.GA1622@eeg.ccf.org>
	<4FBA953E.7040708@tlinx.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4FBA953E.7040708@tlinx.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.83.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: Fri, 25 May 2012 08:41:31 -0000

On Mon, May 21, 2012 at 12:19:26PM -0700, Linda Walsh wrote:
> So which is correct?
> 
> Anyone wanting to reference an upper or lower case range
> [a-z] or [A-Z], is gonna hurt from this.
> 
> My OS uses "en_US.UTF-8".

I don't remember this bug having been cited here:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/120687

About $ export LC_COLLATE=C >> /etc/skel/.bashrc & co


From MAILER-DAEMON Fri May 25 16:24:51 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SY147-0003F4-2G
	for mharc-bug-bash@gnu.org; Fri, 25 May 2012 16:24:51 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33787)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gorzarg@gmail.com>) id 1SY143-0003CV-DR
	for bug-bash@gnu.org; Fri, 25 May 2012 16:24:48 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gorzarg@gmail.com>) id 1SY141-0007aQ-2L
	for bug-bash@gnu.org; Fri, 25 May 2012 16:24:46 -0400
Received: from mail-wg0-f67.google.com ([74.125.82.67]:50532)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gorzarg@gmail.com>) id 1SY140-0007Ze-Pg
	for bug-bash@gnu.org; Fri, 25 May 2012 16:24:44 -0400
Received: by wgbdt10 with SMTP id dt10so213850wgb.6
	for <bug-bash@gnu.org>; Fri, 25 May 2012 13:24:42 -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:content-transfer-encoding;
	bh=/3cF/ECj222yfpXo8a8XtmT1vxuTWVjoCstMLtUFOW4=;
	b=0ZhPdKCQmQ5nwTluf0H9k72BshkV7bNYrPWkEvL19kudRtYTy8iai6abeTWYdVaCCH
	vSIIb9F0VyzBoKU1RVLjAcshkPn/3ngmho3jaoYZRoBljwC7XO8tPz7ADIcjzL/Dq0Bt
	+53FsRxox3GVn8eCS3vtR1nVS8PQ95PuhQqjWLbZpYphEtwj0pf1thPLtoBoZWtPRk8O
	EpQqJVJtoIIuGnrbgOi5WRNYrlrkLEZljTerckKs7FnnXB/cp8XDFBjmP4FcGeJ2A8YR
	Y7UK0OXC5pXJ/T/X50XQF6HcMJ4BoPg70tmGNHKty+fiFtTSMdPvEi0uag9MBrMyd6Hn
	I5uw==
MIME-Version: 1.0
Received: by 10.180.109.197 with SMTP id hu5mr517047wib.8.1337977482336; Fri,
	25 May 2012 13:24:42 -0700 (PDT)
Received: by 10.216.195.170 with HTTP; Fri, 25 May 2012 13:24:42 -0700 (PDT)
In-Reply-To: <4D7F84B4.90400@case.edu>
References: <AANLkTinLYrA2s70SjN5Axu5JoaAnMw+YBkfCB5nWCU47@mail.gmail.com>
	<4D7F6A8A.4030701@case.edu>
	<AANLkTimYL70BReRmXmdDGwukuEusNSgMPBOAKpybUa0n@mail.gmail.com>
	<4D7F84B4.90400@case.edu>
Date: Fri, 25 May 2012 16:24:42 -0400
Message-ID: <CAG-qkP3f4Sdf5YFpJLymXVePACeMqf_-MvbUmGr8P3T035vK9g@mail.gmail.com>
Subject: Re: old-menu-complete behavior in bash v4 / readline v6
From: Alan <gorzarg@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: 74.125.82.67
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, 25 May 2012 20:24:48 -0000

By the way, if anyone wants a fix for this bug, here it is:

In lib/readline/funmap.c, around line 107, make "menu-complete" map to
rl_old_menu_complete:

{ "menu-complete", rl_old_menu_complete },

In lib/readline/complete.c, around line 2443, comment out the if-loop:

/*if (match_list_size > 1 && _rl_complete_show_all)
    display_matches (matches);*/

Then compile and install. Works great now.


On Tue, Mar 15, 2011 at 11:24 AM, Chet Ramey <chet.ramey@case.edu> wrote:
> On 3/15/11 11:13 AM, Alan wrote:
>> Thanks for the response!
>>
>> The problem is, if I turn off 'show-all-if-ambiguous', hitting tab
>> won't display all the possible completions. I like the old behavior of
>> 'menu-complete' because if I wanted to display the completions, I
>> could always hit tab before purely cycling through the choices with
>> 'menu-complete.' So it gives more flexibility in my opinion.
>>
>> Plus, I expected something with the name, 'old-menu-complete,' to
>> behave like the old 'menu-complete' did, but I digress...
>
> Sure, modulo any bug fixes. =A0It was, as I said, a bug that the menu
> completion function didn't behave like other completion functions and
> honor the setting of show-all-if-ambiguous. =A0That was changed in the
> readline-6.2 development cycle before I changed the behavior more
> radically and split the old from the new.
>
>> What would be the best way for me to make old-menu-complete behave
>> like menu-complete did pre-readline-6.0? (In other words, behave like
>> 'show-all-if-ambiguous' is off, while it is really on for other stuff
>> like tab.) Would it be best to write some sort of bash function? Or
>> would it be better to just modify the source code?
>
> You'll have to modify the source code.
>
> Chet
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, ITS, CWRU =A0 =A0chet@case.edu =A0 =A0http://cnswww.cns.cwru.=
edu/~chet/


From MAILER-DAEMON Sun May 27 03:15:54 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SYXhi-0002Te-Pi
	for mharc-bug-bash@gnu.org; Sun, 27 May 2012 03:15:54 -0400
Received: from eggs.gnu.org ([208.118.235.92]:40446)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SYXhg-0002TM-4Y
	for bug-bash@gnu.org; Sun, 27 May 2012 03:15:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SYXhe-00006v-BB
	for bug-bash@gnu.org; Sun, 27 May 2012 03:15:51 -0400
Received: from mail-wg0-f49.google.com ([74.125.82.49]:36267)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SYXhe-00006i-2H
	for bug-bash@gnu.org; Sun, 27 May 2012 03:15:50 -0400
Received: by wgbds1 with SMTP id ds1so1604143wgb.30
	for <bug-bash@gnu.org>; Sun, 27 May 2012 00:15:47 -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=pXOCTb6ZSb6A/aBuXOY06zxp+LpdNzbzxjBr9O7BCvU=;
	b=jdJUdSJ/K4V9kLkWi1XftwGZs3a1TKrapX+1iQWL6z83njsUryiQYsjSJ8Vl/u6git
	+/aX3crxG4/IABjiq6uvJ9yUFSEvyD5AAodBynjcy5pp6MSCg1DJjY45eOF4M9dCB0Gq
	JzxFoOH/2AN7yP0lRcRPYzY4wGX3ECRx7X0dZQi2b5cWaYkr8VeuInF0CrujEGKSzaQP
	V5wtmuB/yZbWiL4jSZUUixJY/O3QJv4CyjCkWDMMNwO+aFLctpNNX0m+NHx+kVTy2MFl
	j351mXqyX8CsqoRpHZacCYxoUZ4cX+IwW1jGDyfQtpPbwAI5EjnBDPE59tfUg9aq0Sed
	3N/w==
MIME-Version: 1.0
Received: by 10.216.216.148 with SMTP id g20mr2233733wep.187.1338102947441;
	Sun, 27 May 2012 00:15:47 -0700 (PDT)
Received: by 10.180.146.166 with HTTP; Sun, 27 May 2012 00:15:47 -0700 (PDT)
Date: Sun, 27 May 2012 17:15:47 +1000
Message-ID: <CAH3AnrrXCFu2DOofWYfxj8HXZ-P1OPiv9Kt9fnwDED8A-Xm2tQ@mail.gmail.com>
Subject: handling of test == by BASH's POSIX mode
From: Jon Seymour <jon.seymour@gmail.com>
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-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, 27 May 2012 07:15:53 -0000

Is there a reason why bash doesn't treat == as an illegal test
operator when running in POSIX mode?

This is problematic because use of test == in scripts that should be
POSIX isn't getting caught when I run them under bash's POSIX mode.
The scripts then fail when run under dash which seems to be stricter
about this.

I have reconfigured my system's default /bin/sh back to /bin/dash to
ensure better POSIX compliance, but it would be nice if I didn't have
to do that.

I am running Ubuntu's distribution of bash, per:

jseymour@ubuntu:~/tracked/git$ uname -a
Linux ubuntu 2.6.32-41-generic #88-Ubuntu SMP Thu Mar 29 13:10:32 UTC
2012 x86_64 GNU/Linux
jseymour@ubuntu:~/tracked/git$ bash --version
GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

jon.


From MAILER-DAEMON Sun May 27 03:39:49 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SYY4r-0005DA-Ut
	for mharc-bug-bash@gnu.org; Sun, 27 May 2012 03:39:49 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35786)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <geir.hauge@gmail.com>) id 1SYY4p-0005CO-4o
	for bug-bash@gnu.org; Sun, 27 May 2012 03:39:48 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <geir.hauge@gmail.com>) id 1SYY4n-00041X-8y
	for bug-bash@gnu.org; Sun, 27 May 2012 03:39:46 -0400
Received: from mail-qa0-f48.google.com ([209.85.216.48]:41141)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <geir.hauge@gmail.com>) id 1SYY4n-00041Q-1y
	for bug-bash@gnu.org; Sun, 27 May 2012 03:39:45 -0400
Received: by qady23 with SMTP id y23so472073qad.14
	for <bug-bash@gnu.org>; Sun, 27 May 2012 00:39:43 -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=enTOb/KjCA8mNGzwv7PtGok2M6fH4aZ32s+KfdEoCMk=;
	b=FOhD6dGVCHPFFNGP6tvi2DpkvRMsTB+X4DJqRdR9O+HZAIdExxXLEKaIwwQpCjl6T1
	b7Tumpdnkca/Qe/0bxpwl6QOSK7hpW158spF6k8VYUyG44I7cCFjAiGPByi5XLtHMCPu
	pnwJDMRw2Cn1SGchi+g0wi0qQ9AuXVnql3rV+AkyK8T7DNMuSG8ptJhuojAx6ETW8KcG
	R+0WhPin0s3P/C1Tg+KvMh3QNURrsO2w5JraZwdX8aEmXwWegYg729KFWJOYz5UbjOB5
	Y7dlHLhBMpq0kvuKobfml+24kB1huesy4XqRVCCyoPTvoIeOaIcq2XtfQARQSAE3Btk7
	XH+g==
MIME-Version: 1.0
Received: by 10.224.110.70 with SMTP id m6mr4351057qap.69.1338104383244; Sun,
	27 May 2012 00:39:43 -0700 (PDT)
Received: by 10.229.220.16 with HTTP; Sun, 27 May 2012 00:39:43 -0700 (PDT)
In-Reply-To: <CAH3AnrrXCFu2DOofWYfxj8HXZ-P1OPiv9Kt9fnwDED8A-Xm2tQ@mail.gmail.com>
References: <CAH3AnrrXCFu2DOofWYfxj8HXZ-P1OPiv9Kt9fnwDED8A-Xm2tQ@mail.gmail.com>
Date: Sun, 27 May 2012 09:39:43 +0200
Message-ID: <CAO-BiTKNoesWfXmdyFtf14d7-OMx+2E0PGo9U+VXTx-P40CX-g@mail.gmail.com>
Subject: Re: handling of test == by BASH's POSIX mode
From: Geir Hauge <geir.hauge@gmail.com>
To: bug-bash@gnu.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: 209.85.216.48
Cc: Jon Seymour <jon.seymour@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, 27 May 2012 07:39:48 -0000

2012/5/27 Jon Seymour <jon.seymour@gmail.com>:
> Is there a reason why bash doesn't treat == as an illegal test
> operator when running in POSIX mode?

POSIX does not say == is not allowed.

POSIX tells you what the shell should at least be able to do. A POSIX
compliant shell can have whatever other features it likes, as long as
the POSIX features are covered.


> This is problematic because use of test == in scripts that should be
> POSIX isn't getting caught when I run them under bash's POSIX mode.
> The scripts then fail when run under dash which seems to be stricter
> about this.

Don't use non-POSIX features in a POSIX script, and you'll be fine.
http://www.opengroup.org/onlinepubs/9699919799/utilities/contents.html

-- 
Geir Hauge


From MAILER-DAEMON Sun May 27 06:43:56 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SYax2-00038a-RM
	for mharc-bug-bash@gnu.org; Sun, 27 May 2012 06:43:56 -0400
Received: from eggs.gnu.org ([208.118.235.92]:54843)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SYawz-00036r-Lj
	for bug-bash@gnu.org; Sun, 27 May 2012 06:43:55 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SYawx-0000Wt-K5
	for bug-bash@gnu.org; Sun, 27 May 2012 06:43:53 -0400
Received: from mail-pb0-f41.google.com ([209.85.160.41]:64172)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SYawx-0000Wn-Bd
	for bug-bash@gnu.org; Sun, 27 May 2012 06:43:51 -0400
Received: by pbbrp2 with SMTP id rp2so3628661pbb.0
	for <bug-bash@gnu.org>; Sun, 27 May 2012 03:43:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=references:in-reply-to:mime-version:content-transfer-encoding
	:content-type:message-id:cc:x-mailer:from:subject:date:to;
	bh=DL+AgIqyN65RaG5kctEJDmjCwarW4aNRkE1bKM29aj0=;
	b=RakuImoz92CtZwOygrSYS2k2o/V1CYniOGj0s5SBy+3+ypO7Za4uUqJXB8BfvBrt5M
	XKRHrgx2pT2dUejlqo0UOLi6hyzgIhkxInojLT/gQ8b4ZFEFd5q0xoJpIXossvkUvF/j
	bLp0bE1WvpFzS6UqNOubgc1Gki9Sr58LXQp93230dMpqfWufIkdu/GSagW6rkphNUvF1
	OjMLhWgBPVjVCIWaVgp94wgrloO3SddjamiG1d0iySo8xAcau7+w6L7/VMv4Uyfk0Reu
	mTLzHDm598ixVv8xQVhH5xaX6wyrEReD5ygx83ks3GOWMWqUib3UuhaqkekevDxEDVXN
	A7+A==
Received: by 10.68.227.5 with SMTP id rw5mr16422046pbc.32.1338115428815;
	Sun, 27 May 2012 03:43:48 -0700 (PDT)
Received: from [172.20.10.2] ([110.144.242.23])
	by mx.google.com with ESMTPS id rv5sm15474291pbc.56.2012.05.27.03.43.44
	(version=TLSv1/SSLv3 cipher=OTHER);
	Sun, 27 May 2012 03:43:47 -0700 (PDT)
References: <CAH3AnrrXCFu2DOofWYfxj8HXZ-P1OPiv9Kt9fnwDED8A-Xm2tQ@mail.gmail.com>
	<CAO-BiTKNoesWfXmdyFtf14d7-OMx+2E0PGo9U+VXTx-P40CX-g@mail.gmail.com>
In-Reply-To: <CAO-BiTKNoesWfXmdyFtf14d7-OMx+2E0PGo9U+VXTx-P40CX-g@mail.gmail.com>
Mime-Version: 1.0 (1.0)
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii
Message-Id: <D365ADA4-7D32-463F-9410-44ED70468FAD@gmail.com>
X-Mailer: iPad Mail (9A405)
From: Jon Seymour <jon.seymour@gmail.com>
Subject: Re: handling of test == by BASH's POSIX mode
Date: Sun, 27 May 2012 20:45:46 +1000
To: Geir Hauge <geir.hauge@gmail.com>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.160.41
Cc: "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, 27 May 2012 10:43:55 -0000

On 27/05/2012, at 17:39, Geir Hauge <geir.hauge@gmail.com> wrote:

> 2012/5/27 Jon Seymour <jon.seymour@gmail.com>:
>> Is there a reason why bash doesn't treat =3D=3D as an illegal test
>> operator when running in POSIX mode?
>=20
> POSIX does not say =3D=3D is not allowed.
>=20
> POSIX tells you what the shell should at least be able to do. A POSIX
> compliant shell can have whatever other features it likes, as long as
> the POSIX features are covered.
>=20

I guess the question is better phrased thus: what use case is usefully serve=
d by having bash's POSIX mode support a superset of test operators than othe=
r compliant POSIX shells?  As it stands, I can't use bash's POSIX mode to ve=
rify the validity or otherwise of a POSIX script because bash won't report t=
hese kinds of errors - even when running in POSIX mode.

There is an --enable-strict-posix (?) configuration option. Will this do wha=
t I expect?

>=20
>> This is problematic because use of test =3D=3D in scripts that should be
>> POSIX isn't getting caught when I run them under bash's POSIX mode.
>> The scripts then fail when run under dash which seems to be stricter
>> about this.
>=20
> Don't use non-POSIX features in a POSIX script, and you'll be fine.
> http://www.opengroup.org/onlinepubs/9699919799/utilities/contents.html
>=20

Which is the exactly the point. Practically speaking when I write scripts I e=
xpect an interpreter that claims to be running in POSIX mode to give me some=
 help to flag usage of non POSIX idioms. Yes, I can second guess the interpr=
eter by reading the spec, but is this really the most efficient way to catch=
 these kinds of errors?

Jon.=


From MAILER-DAEMON Sun May 27 07:24:42 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SYbaU-0006yb-Kg
	for mharc-bug-bash@gnu.org; Sun, 27 May 2012 07:24:42 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42804)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SYbaR-0006yO-Kh
	for bug-bash@gnu.org; Sun, 27 May 2012 07:24:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SYbaP-000108-Il
	for bug-bash@gnu.org; Sun, 27 May 2012 07:24:39 -0400
Received: from mail-ob0-f169.google.com ([209.85.214.169]:61321)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SYbaP-0000zt-Aw
	for bug-bash@gnu.org; Sun, 27 May 2012 07:24:37 -0400
Received: by obbwd18 with SMTP id wd18so4782335obb.0
	for <bug-bash@gnu.org>; Sun, 27 May 2012 04:24:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=from:to:subject:date:message-id:user-agent:in-reply-to:references
	:mime-version:content-type:content-transfer-encoding;
	bh=CiFG7gtbwWQ9C11jzP/Oe/BGsvdWIirCe2hoYd0fENw=;
	b=0GDllPEeuhP2R0CTw/qrUdGL7hYltSaWtyH3d8t9VJr21z+ooZhWlOkiwgDWCYUBik
	0phEcvJbJRCs36CPZ7hgxpYClKgxhkr1NmSNIubs9EDAII80rHvzAke8HfUGRcqNICU4
	0QZEaaozBq9PQyreFxVK2JhIlc9argpw++19oP878vf3N7bUgJD4K0fSHEIfOTjZVA82
	7V8RaHf219SIcodqDCAWKeH4GX9X5jzV0AI8jLVMVbaw+bpI9o7IxDmU93I4LfdK2nLU
	N7o7EHDC2Rm3WR8iGyoVUExE90cXrmk5HD2F2zyjreAZwy7/3EOR8su3oJK5a3VUerGP
	qmFg==
Received: by 10.50.222.202 with SMTP id qo10mr2432340igc.0.1338117875246;
	Sun, 27 May 2012 04:24:35 -0700 (PDT)
Received: from smorgbox.localnet (65-128-181-111.mpls.qwest.net.
	[65.128.181.111])
	by mx.google.com with ESMTPS id if4sm3440395igc.10.2012.05.27.04.24.34
	(version=SSLv3 cipher=OTHER); Sun, 27 May 2012 04:24:34 -0700 (PDT)
From: Dan Douglas <ormaaj@gmail.com>
To: bug-bash@gnu.org
Subject: Re: handling of test == by BASH's POSIX mode
Date: Sun, 27 May 2012 06:24:08 -0500
Message-ID: <63724026.qYO6SSlUZ3@smorgbox>
User-Agent: KMail/4.8.3 (Linux/3.4.1-pf+; KDE/4.8.3; x86_64; ; )
In-Reply-To: <D365ADA4-7D32-463F-9410-44ED70468FAD@gmail.com>
References: <CAH3AnrrXCFu2DOofWYfxj8HXZ-P1OPiv9Kt9fnwDED8A-Xm2tQ@mail.gmail.com>
	<CAO-BiTKNoesWfXmdyFtf14d7-OMx+2E0PGo9U+VXTx-P40CX-g@mail.gmail.com>
	<D365ADA4-7D32-463F-9410-44ED70468FAD@gmail.com>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart1614379.iiWuDhXVP5";
	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.214.169
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 27 May 2012 11:24:41 -0000


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

On Sunday, May 27, 2012 08:45:46 PM Jon Seymour wrote:
> On 27/05/2012, at 17:39, Geir Hauge <geir.hauge@gmail.com> wrote:
> 
> > 2012/5/27 Jon Seymour <jon.seymour@gmail.com>:
> >> Is there a reason why bash doesn't treat == as an illegal test
> >> operator when running in POSIX mode?
> > 
> > POSIX does not say == is not allowed.
> > 
> > POSIX tells you what the shell should at least be able to do. A POSIX
> > compliant shell can have whatever other features it likes, as long as
> > the POSIX features are covered.
> > 
> 
> I guess the question is better phrased thus: what use case is usefully 
served by having bash's POSIX mode support a superset of test operators than 
other compliant POSIX shells?  As it stands, I can't use bash's POSIX mode to 
verify the validity or otherwise of a POSIX script because bash won't report 
these kinds of errors - even when running in POSIX mode.
> 
> There is an --enable-strict-posix (?) configuration option. Will this do what 
I expect?
> 
> > 
> >> This is problematic because use of test == in scripts that should be
> >> POSIX isn't getting caught when I run them under bash's POSIX mode.
> >> The scripts then fail when run under dash which seems to be stricter
> >> about this.
> > 
> > Don't use non-POSIX features in a POSIX script, and you'll be fine.
> > http://www.opengroup.org/onlinepubs/9699919799/utilities/contents.html
> > 
> 
> Which is the exactly the point. Practically speaking when I write scripts I 
expect an interpreter that claims to be running in POSIX mode to give me some 
help to flag usage of non POSIX idioms. Yes, I can second guess the interpreter 
by reading the spec, but is this really the most efficient way to catch these 
kinds of errors?
> 
> Jon.

There are no shells in existence that can do what you want. All major shells 
claiming to be POSIX compatible include some superset that can't be disabled. 
The only shell I have installed not supporting == in [ is dash, and there are 
so many scripts in the wild using == with [ it would be a miracle if your 
system didn't break because of it. Even the coreutils /usr/bin/[ supports ==.

Performing that kind of checking, rigorously, in a shell, would be impossible 
to do statically anyway. Any such lint tool is limited to lexical analysis 
which makes it not very useful for testing unless your script is perfectly 
free of side-efffects. And who writes side-effect free shell scripts?

How would the shell check for the correctness of:

"$(rm -rf somepath; echo '[')" x == x ]
-- 
Dan Douglas
--nextPart1614379.iiWuDhXVP5
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/CDt0ACgkQMmyDamdg+Mz7PQCfaAmuA8GyB4IbXMWICsshDisg
1kcAnjLBW0TfRutRGHOrSLova4Nt5jkm
=O3C3
-----END PGP SIGNATURE-----

--nextPart1614379.iiWuDhXVP5--



From MAILER-DAEMON Sun May 27 07:31:57 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SYbhV-0007aC-QS
	for mharc-bug-bash@gnu.org; Sun, 27 May 2012 07:31:57 -0400
Received: from eggs.gnu.org ([208.118.235.92]:50530)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SYbhT-0007Zj-WB
	for bug-bash@gnu.org; Sun, 27 May 2012 07:31:57 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SYbhR-0002Yc-0Z
	for bug-bash@gnu.org; Sun, 27 May 2012 07:31:55 -0400
Received: from mail-out.m-online.net ([212.18.0.9]:41539)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SYbhQ-0002TN-Pp
	for bug-bash@gnu.org; Sun, 27 May 2012 07:31:52 -0400
Received: from frontend1.mail.m-online.net (unknown [192.168.8.180])
	by mail-out.m-online.net (Postfix) with ESMTP id 3W0fDN4809z4Kn98;
	Sun, 27 May 2012 13:31:48 +0200 (CEST)
Received: from igel.home (ppp-88-217-109-188.dynamic.mnet-online.de
	[88.217.109.188])
	by mail.mnet-online.de (Postfix) with ESMTPA id 3W0fDN3hxbz4KK3l;
	Sun, 27 May 2012 13:31:48 +0200 (CEST)
Received: by igel.home (Postfix, from userid 501)
	id E2AEDCA2A2; Sun, 27 May 2012 13:31:47 +0200 (CEST)
From: Andreas Schwab <schwab@linux-m68k.org>
To: Jon Seymour <jon.seymour@gmail.com>
Subject: Re: handling of test == by BASH's POSIX mode
References: <CAH3AnrrXCFu2DOofWYfxj8HXZ-P1OPiv9Kt9fnwDED8A-Xm2tQ@mail.gmail.com>
	<CAO-BiTKNoesWfXmdyFtf14d7-OMx+2E0PGo9U+VXTx-P40CX-g@mail.gmail.com>
	<D365ADA4-7D32-463F-9410-44ED70468FAD@gmail.com>
X-Yow: I was making donuts and now I'm on a bus!
Date: Sun, 27 May 2012 13:31:47 +0200
In-Reply-To: <D365ADA4-7D32-463F-9410-44ED70468FAD@gmail.com> (Jon Seymour's
	message of "Sun, 27 May 2012 20:45:46 +1000")
Message-ID: <m27gvxn9lo.fsf@igel.home>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.97 (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: "bug-bash@gnu.org" <bug-bash@gnu.org>, Geir Hauge <geir.hauge@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, 27 May 2012 11:31:57 -0000

Jon Seymour <jon.seymour@gmail.com> writes:

> As it stands, I can't use bash's POSIX mode to verify the validity or
> otherwise of a POSIX script because bash won't report these kinds of
> errors - even when running in POSIX mode.

You can't do that anyway: POSIX mode does not disable proper extensions
to POSIX, only those that conflict with POSIX.  Specifically, in the
case of the test utility, POSIX makes the behaviour unspecified when a
three argument invocation does not match the POSIX-defined binary
operators.

> There is an --enable-strict-posix (?) configuration option. Will this do
> what I expect?

That just switches the default for POSIX mode.

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 May 27 08:54:07 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SYcz1-0000oa-7n
	for mharc-bug-bash@gnu.org; Sun, 27 May 2012 08:54:07 -0400
Received: from eggs.gnu.org ([208.118.235.92]:47694)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SYcyy-0000mS-0I
	for bug-bash@gnu.org; Sun, 27 May 2012 08:54:05 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SYcyw-0003ro-4F
	for bug-bash@gnu.org; Sun, 27 May 2012 08:54:03 -0400
Received: from mail-we0-f169.google.com ([74.125.82.169]:38250)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SYcyv-0003rg-ON
	for bug-bash@gnu.org; Sun, 27 May 2012 08:54:02 -0400
Received: by wefh52 with SMTP id h52so1861124wef.0
	for <bug-bash@gnu.org>; Sun, 27 May 2012 05:53: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
	:cc:content-type:content-transfer-encoding;
	bh=Ii9m61NNOvLcHjEZxakUg+Ku/xdFs7wnzXNqj1uPsRY=;
	b=KNlDmUlqiNpgjilhEUoi19bf2637Hg9lSkMoMKkXP1DZm4mZks54siJ6lam/GZoocX
	sOytExpZWkuPEeh65uijaMEd7bdXryn1w5DbNbK7qhhBgrQkluozzUQFO8Ed4P7aHns2
	/Ohn2UyepWGTrQl9dSiMv5TXDe1BR0/K9ke+/PN7rtp24eSpACW/RG0jdQFc+CH+BOS5
	T7ObOZHmbloZF9tG2pIM8qO9edB7uoG2oRq/Q7q7QbyZR7/YbjmbrSk3F7p9vieyP1na
	ipjNDnewfCACEVACnHZBxnY6Xl0STyFYMCVtp+JRQ6M+TFDGlssd9CedDyZfvscsVh6R
	4ONA==
MIME-Version: 1.0
Received: by 10.180.82.161 with SMTP id j1mr8839678wiy.21.1338123239394; Sun,
	27 May 2012 05:53:59 -0700 (PDT)
Received: by 10.180.146.166 with HTTP; Sun, 27 May 2012 05:53:59 -0700 (PDT)
In-Reply-To: <63724026.qYO6SSlUZ3@smorgbox>
References: <CAH3AnrrXCFu2DOofWYfxj8HXZ-P1OPiv9Kt9fnwDED8A-Xm2tQ@mail.gmail.com>
	<CAO-BiTKNoesWfXmdyFtf14d7-OMx+2E0PGo9U+VXTx-P40CX-g@mail.gmail.com>
	<D365ADA4-7D32-463F-9410-44ED70468FAD@gmail.com>
	<63724026.qYO6SSlUZ3@smorgbox>
Date: Sun, 27 May 2012 22:53:59 +1000
Message-ID: <CAH3AnrqO7r9hEYZTvy6-_jW8Q9f1EC0c11AkPfrWHcKoiQ_iPA@mail.gmail.com>
Subject: Re: handling of test == by BASH's POSIX mode
From: Jon Seymour <jon.seymour@gmail.com>
To: Dan Douglas <ormaaj@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.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, 27 May 2012 12:54:05 -0000

On Sun, May 27, 2012 at 9:24 PM, Dan Douglas <ormaaj@gmail.com> wrote:
> On Sunday, May 27, 2012 08:45:46 PM Jon Seymour wrote:
>> On 27/05/2012, at 17:39, Geir Hauge <geir.hauge@gmail.com> wrote:
>>
>> I guess the question is better phrased thus: what use case is usefully
> served by having bash's POSIX mode support a superset of test operators t=
han
> other compliant POSIX shells? =C2=A0As it stands, I can't use bash's POSI=
X mode to
> verify the validity or otherwise of a POSIX script because bash won't rep=
ort
> these kinds of errors - even when running in POSIX mode.
>>
>
> There are no shells in existence that can do what you want. All major she=
lls
> claiming to be POSIX compatible include some superset that can't be disab=
led.
> The only shell I have installed not supporting =3D=3D in [ is dash, and t=
here are
> so many scripts in the wild using =3D=3D with [ it would be a miracle if =
your
> system didn't break because of it. Even the coreutils /usr/bin/[ supports=
 =3D=3D.
>

I take your point that this isn't really a bash problem, but a POSIX
problem - POSIX hasn't provided a way to validate whether a script
only uses features that are required to be supported by POSIX
compliant interpreters. An example of this is the failure to prohibit
support for additional test operators which ultimately results in the
creation of interoperability problems between bash and dash - surely
not a good thing.

However, I think my question still remains unanswered - even if bash
is technically compliant with POSIX, what use case is usefully served
by having bash support a superset of the POSIX test operators while
executing in POSIX mode?

Yes, doing allows bash to execute an ill-defined superset of valid
POSIX scripts, but why is that useful - surely POSIX compliant mode
should only be required to execute strictly compliant POSIX scripts
and if we want to execute a superset, then we should explicitly
specify which superset we want to use, not hope that the POSIX
compliant interpreter installed on a machine happens to support that
superset.

You point about scripts failing when running under dash is a good one.
This is exactly my problem: I replaced /bin/sh -> dash with /bin/sh ->
bash because a 3rd party product installation script failed when dash
was the "POSIX" shell. Which is good - I fixed my installation
problem. Better would have been if the original developer had never
released the non-POSIX script in the first place, something that might
not have happened if the bash POSIX implementation was more
conservative. The fact that I didn't switch back to dash after I
installed the product eventually caused me to inject a non-POSIX test
=3D=3D operator into some scripts I was working on for the git project -
again, something that would not have happened if bash's POSIX mode was
more conservative.

> Performing that kind of checking, rigorously, in a shell, would be imposs=
ible
> to do statically anyway. Any such lint tool is limited to lexical analysi=
s
> which makes it not very useful for testing unless your script is perfectl=
y
> free of side-efffects. And who writes side-effect free shell scripts?
>

> How would the shell check for the correctness of:
>
> "$(rm -rf somepath; echo '[')" x =3D=3D x ]

I wasn't claiming that static checking would be viable. In fact, the
impossibility of static checking is precisely why it would be useful
to have real POSIX "compliant" interpreters that were as conservative
as possible in the syntax and commands they accepted at least in their
so-called POSIX mode. Currently, for example, if I want to test git sh
scripts, I need to ensure that /bin/sh is pointing at dash, because if
I use bash, errors of this kind can slip through. There really isn't a
more effective way for me to fix address this problem than by
abandoning bash as my POSIX shell and using dash instead since it's
POSIX mode does seem to be more conservative.

Given your example:

jseymour@ubuntu:~/tracked/git$ bash --posix -c '$(rm -rf "/tmp/foo";
echo "[")  x =3D=3D x ] && echo yes'
yes

jseymour@ubuntu:~/tracked/git$ dash -c '$(rm -rf "/tmp/foo"; echo "[")
 x =3D=3D x ] && echo yes'
[: 1: x: unexpected operator

bash --posix doesn't give me any clue that =3D=3D isn't required to be
supported POSIX interpreters, but at least dash does.

jon.


From MAILER-DAEMON Sun May 27 09:09:10 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SYdDa-0002Z7-4K
	for mharc-bug-bash@gnu.org; Sun, 27 May 2012 09:09:10 -0400
Received: from eggs.gnu.org ([208.118.235.92]:39001)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SYdDY-0002Z1-2U
	for bug-bash@gnu.org; Sun, 27 May 2012 09:09:09 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SYdDW-0006wd-63
	for bug-bash@gnu.org; Sun, 27 May 2012 09:09:07 -0400
Received: from mail-wg0-f49.google.com ([74.125.82.49]:35891)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SYdDV-0006wZ-T7
	for bug-bash@gnu.org; Sun, 27 May 2012 09:09:06 -0400
Received: by wgbds1 with SMTP id ds1so1715989wgb.30
	for <bug-bash@gnu.org>; Sun, 27 May 2012 06:09:04 -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=rAfw5Un4FAt5BsPx986RaCwrXjF7caKmCZk1yQ0sZEw=;
	b=oI65ZTRrK9JoQCxrUzIUJx4d1qlnHgdMQQNnHbGftzfmAf4KVWiQDok46ZoaUMjfrr
	s3j00Cp5L0GOip4JsMXM4CLpfs9ARDNwFS0WZXQoLKwpJtkv7buICa9nQL0pH0w7rAdk
	rmTviKIru9DI0VPSMxvNauxDodiIbPeqvBwyYqpw7jFvTPt7QV+FTWcVmWWD1zYo6+e9
	0PDENCaUCtEGC8iCl2KQgGu4ONbqjnWBxaKKkdXz1orksgbfg8GuDi4iDty/xB/QU9ri
	1Vffdloz3gDuWc6HTkYEunUs5LjK5jxvAoMh2/1nCr8aOLH/J3aE5OdSU1bL4XSVvMTM
	Q6Zw==
MIME-Version: 1.0
Received: by 10.180.102.9 with SMTP id fk9mr10393181wib.1.1338124143951; Sun,
	27 May 2012 06:09:03 -0700 (PDT)
Received: by 10.180.146.166 with HTTP; Sun, 27 May 2012 06:09:03 -0700 (PDT)
In-Reply-To: <m27gvxn9lo.fsf@igel.home>
References: <CAH3AnrrXCFu2DOofWYfxj8HXZ-P1OPiv9Kt9fnwDED8A-Xm2tQ@mail.gmail.com>
	<CAO-BiTKNoesWfXmdyFtf14d7-OMx+2E0PGo9U+VXTx-P40CX-g@mail.gmail.com>
	<D365ADA4-7D32-463F-9410-44ED70468FAD@gmail.com>
	<m27gvxn9lo.fsf@igel.home>
Date: Sun, 27 May 2012 23:09:03 +1000
Message-ID: <CAH3AnrrX=yKsqdVABLADtUb9AzeLMJGkf8em0Vvhe4=7B1YGng@mail.gmail.com>
Subject: Re: handling of test == by BASH's POSIX mode
From: Jon Seymour <jon.seymour@gmail.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 74.125.82.49
Cc: "bug-bash@gnu.org" <bug-bash@gnu.org>, Geir Hauge <geir.hauge@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, 27 May 2012 13:09:09 -0000

On Sun, May 27, 2012 at 9:31 PM, Andreas Schwab <schwab@linux-m68k.org> wro=
te:
> Jon Seymour <jon.seymour@gmail.com> writes:
>
>> As it stands, I can't use bash's POSIX mode to verify the validity or
>> otherwise of a POSIX script because bash won't report these kinds of
>> errors - even when running in POSIX mode.
>
> You can't do that anyway: POSIX mode does not disable proper extensions
> to POSIX, only those that conflict with POSIX. =C2=A0Specifically, in the
> case of the test utility, POSIX makes the behaviour unspecified when a
> three argument invocation does not match the POSIX-defined binary
> operators.

I understand that the behaviour is unspecitied by POSIX - I didn't
know that before, but I know that now - thanks.

That said, from the point of view of promoting interoperable scripts,
my view is that it (in an ideal world**) would be better if bash chose
to fail, while executing in POSIX mode, in this case.

Yes, it would be annoying to the script writer who has to replace =3D=3D
with =3D, but at least the script eco-system as a whole would benefit
from a more conservative understanding of what it means to be a valid
POSIX script. As it stands now, it is well nigh impossible to avoid
undefined behaviour when the interpreter chooses to gracefully glosses
over the fact that the script is utiising.

** I guess I can except that current bash behaviour is, on balance,
the correct pragmatic decision since there would no doubt be
widespread carnage in the scripting universe if bash was suddenly to
become pickier about how it supports POSIX mode. Is there a case, I
wonder, for enabling more conservative interpretation of test
operators via a shell option of some kind?

>
>> There is an --enable-strict-posix (?) configuration option. Will this do
>> what I expect?
>
> That just switches the default for POSIX mode.

Thanks.

jon.


From MAILER-DAEMON Sun May 27 09:09:32 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SYdDw-0002i7-9H
	for mharc-bug-bash@gnu.org; Sun, 27 May 2012 09:09:32 -0400
Received: from eggs.gnu.org ([208.118.235.92]:39056)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SYdDt-0002i1-LP
	for bug-bash@gnu.org; Sun, 27 May 2012 09:09:31 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SYdDr-0006yV-PK
	for bug-bash@gnu.org; Sun, 27 May 2012 09:09:29 -0400
Received: from mail-we0-f169.google.com ([74.125.82.169]:42802)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SYdDr-0006yO-Gi
	for bug-bash@gnu.org; Sun, 27 May 2012 09:09:27 -0400
Received: by wefh52 with SMTP id h52so1866606wef.0
	for <bug-bash@gnu.org>; Sun, 27 May 2012 06:09:25 -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=Vbcftm/C0iQ8ueSwtwrIlfkY6JInnIwCX2XFgM1kHuw=;
	b=dUNwreoFNgilIVW0M0n2NXvfUQUGjE7ipGfA1W1IRLVIo/10vVF/1w7yBynjN8UFEb
	31xDe5R4EVioi6M3aSVJbRsPXqBexF5GjhNShAf5rDqnThUzF3Jjq0MKNvE2/mi2+40a
	1qMv8DrEXLq3v2g70G4Hqna0P1KrLr3OYrRSATbqAfBM53EAgBHHCsc85esK83ePnZiV
	2MxHn8f9x9gKETu5Dt6NW+X4GwT833HnH2yfdhVkndwHUAVryCRweatzn1lZzwBqh8N3
	VVt07HB0zFWSF1bPCRJsfeurXAxl9WdnNNhfs0U7rpoUO+435rqCR9VXiENc7+b+r4sJ
	h9Gg==
MIME-Version: 1.0
Received: by 10.180.84.6 with SMTP id u6mr1222771wiy.11.1338124165513; Sun, 27
	May 2012 06:09:25 -0700 (PDT)
Received: by 10.180.146.166 with HTTP; Sun, 27 May 2012 06:09:25 -0700 (PDT)
In-Reply-To: <CAH3AnrrX=yKsqdVABLADtUb9AzeLMJGkf8em0Vvhe4=7B1YGng@mail.gmail.com>
References: <CAH3AnrrXCFu2DOofWYfxj8HXZ-P1OPiv9Kt9fnwDED8A-Xm2tQ@mail.gmail.com>
	<CAO-BiTKNoesWfXmdyFtf14d7-OMx+2E0PGo9U+VXTx-P40CX-g@mail.gmail.com>
	<D365ADA4-7D32-463F-9410-44ED70468FAD@gmail.com>
	<m27gvxn9lo.fsf@igel.home>
	<CAH3AnrrX=yKsqdVABLADtUb9AzeLMJGkf8em0Vvhe4=7B1YGng@mail.gmail.com>
Date: Sun, 27 May 2012 23:09:25 +1000
Message-ID: <CAH3AnroX9riDX_2xvXedYu0EJno67UxRSd_KBYMUeoWhDjFR6g@mail.gmail.com>
Subject: Re: handling of test == by BASH's POSIX mode
From: Jon Seymour <jon.seymour@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: 74.125.82.169
Cc: "bug-bash@gnu.org" <bug-bash@gnu.org>, Geir Hauge <geir.hauge@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, 27 May 2012 13:09:31 -0000

On Sun, May 27, 2012 at 11:09 PM, Jon Seymour <jon.seymour@gmail.com> wrote:
> On Sun, May 27, 2012 at 9:31 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>> Jon Seymour <jon.seymour@gm>
> ** I guess I can except that current bash behaviour is, on balance,

except -> accept


From MAILER-DAEMON Sun May 27 12:08:56 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SYg1Y-0004Me-9n
	for mharc-bug-bash@gnu.org; Sun, 27 May 2012 12:08:56 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58226)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SYg1U-0004LS-M9
	for bug-bash@gnu.org; Sun, 27 May 2012 12:08:54 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SYg1S-0007ck-F2
	for bug-bash@gnu.org; Sun, 27 May 2012 12:08:52 -0400
Received: from mail-ob0-f169.google.com ([209.85.214.169]:65265)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SYg1S-0007cU-72
	for bug-bash@gnu.org; Sun, 27 May 2012 12:08:50 -0400
Received: by obbwd18 with SMTP id wd18so5122369obb.0
	for <bug-bash@gnu.org>; Sun, 27 May 2012 09:08:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=from:to:subject:date:message-id:user-agent:in-reply-to:references
	:mime-version:content-type:content-transfer-encoding;
	bh=KOX9NOs5XfmsKhMU4wh8YNADKaTLvjsBocwXOrRiLDo=;
	b=MEbyn4eSTRnsLQw/2YLwpqnulkT7Vg/9T6hMOFjlPLpRFCWENFaMX4t1HjrF0RKDwy
	xM9ZuooMHC0UOFyCLxNlSAONgPKsoYWCsya+REAy1DVp9AvZQyor2khg+iCGmLzOIUyJ
	Wc5INhC95jkyRofSPNdSTZ3itNXddj96jWH443LJ07/IC2PEPEWd7z+vuA5iLEg0WMXZ
	FPLV0Q9mRzqq9Iw6gKqR5FSqcd+XZ+F7Eeaekwl/dyV1jgraf/KGG1ysgH9kWVIyh0qh
	fY0MvTgHPNZCjrjMJRcvMN332wZVaRcAl6GC8lkGiNB/YnC15e1gAj7SQarJ6jOH8XLt
	vs0w==
Received: by 10.50.156.133 with SMTP id we5mr2690632igb.62.1338134928482;
	Sun, 27 May 2012 09:08:48 -0700 (PDT)
Received: from smorgbox.localnet (65-128-181-111.mpls.qwest.net.
	[65.128.181.111])
	by mx.google.com with ESMTPS id b16sm3640711igp.3.2012.05.27.09.08.47
	(version=SSLv3 cipher=OTHER); Sun, 27 May 2012 09:08:47 -0700 (PDT)
From: Dan Douglas <ormaaj@gmail.com>
To: bug-bash@gnu.org
Subject: Re: handling of test == by BASH's POSIX mode
Date: Sun, 27 May 2012 11:08:38 -0500
Message-ID: <3213085.zg0emHYDO5@smorgbox>
User-Agent: KMail/4.8.3 (Linux/3.4.1-pf+; KDE/4.8.3; x86_64; ; )
In-Reply-To: <CAH3AnrrX=yKsqdVABLADtUb9AzeLMJGkf8em0Vvhe4=7B1YGng@mail.gmail.com>
References: <CAH3AnrrXCFu2DOofWYfxj8HXZ-P1OPiv9Kt9fnwDED8A-Xm2tQ@mail.gmail.com>
	<m27gvxn9lo.fsf@igel.home>
	<CAH3AnrrX=yKsqdVABLADtUb9AzeLMJGkf8em0Vvhe4=7B1YGng@mail.gmail.com>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart2925820.vZFtWkpqOd";
	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.214.169
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 27 May 2012 16:08:54 -0000


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

> POSIX hasn't provided a way to validate whether a script
> only uses features that are required to be supported by POSIX
> compliant interpreters.

I believe that was someone else's point, but yes that would be a problem for 
anyone who wanted to implement compliance check warnings.

> even if bash is technically compliant with POSIX, what use case is usefully 
> served by having bash support a superset of the POSIX test operators while 
executing in POSIX mode?

It's a matter of practicality and the fact that nobody has written it yet. If 
you wanted to implement conformance checks without making Bash even bigger and 
slower, and harder to maintain, I don't think there would be objections. Bash 
just modifies conflicting features to the minimal extent necessary to bring it 
into compliance, which seems to be the path of least resistance.

This would be a big job, I think, and not quite at the top of my wish-list. 
Right now you can increase the number of things that fail by explicitly 
disabling non-POSIX built-ins using the Bash "enable" builtin.

> I wasn't claiming that static checking would be viable. In fact, the
> impossibility of static checking is precisely why it would be useful
> to have real POSIX "compliant" interpreters that were as conservative
> as possible in the syntax and commands they accepted at least in their
> so-called POSIX mode.

Dash is useful for testing. The Bash answer is [[, which CAN do a lot of 
special error handling on due to it being a compound command. I wrote a bit 
about this here:

http://mywiki.wooledge.org/BashFAQ/031/#Theory

In reality, [[ is one of the very most portable non-POSIX features available. 
Most people shouldn't have to worry about avoiding it.

On Sunday, May 27, 2012 11:09:03 PM Jon Seymour wrote:
> That said, from the point of view of promoting interoperable scripts,
> my view is that it (in an ideal world**) would be better if bash chose
> to fail, while executing in POSIX mode, in this case.

In an ideal world, POSIX would define [[, Dash wouldn't exist, and we would 
have some resource other than POSIX that specifies what's ACTUALLY portable 
between modern shells, so that the only people who have to worry are those 
targeting Busybox and Solaris Heirloom, or stubborn curmudgeons who insist on 
Dash... some of these things feel like supporting IE6 - it's better to just 
not.

> This is exactly my problem: I replaced /bin/sh -> dash with /bin/sh ->
> bash because a 3rd party product installation script failed when dash
> was the "POSIX" shell.

If you need a fast small shell, use mksh. It supports some of the more 
essential features of both Bash and Ksh (arrays, ((, [[), and some of its own, 
without all the draconian restrictions of dash.

(Note this is querying my package manager, including symbols and source files)

# equery s dash
 * app-shells/dash-0.5.7.1
         Total files : 73
         Total size  : 1.14 MiB
 # equery s mksh
 * app-shells/mksh-9999
         Total files : 39
         Total size  : 1.61 MiB
 # equery s bash
 * app-shells/bash-4.2_p28
         Total files : 464
         Total size  : 6.33 MiB

-- 
Dan Douglas
--nextPart2925820.vZFtWkpqOd
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/CUYkACgkQMmyDamdg+MyAywCfSePZYqKLXyc8iDL5E2Wc33Dc
NxEAoLUza+Cgf1AFkuCBKEjcEm9zJAEW
=mezx
-----END PGP SIGNATURE-----

--nextPart2925820.vZFtWkpqOd--



From MAILER-DAEMON Sun May 27 14:58:52 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SYig0-0000Tj-2s
	for mharc-bug-bash@gnu.org; Sun, 27 May 2012 14:58:52 -0400
Received: from eggs.gnu.org ([208.118.235.92]:36730)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SYifx-0000Tc-2C
	for bug-bash@gnu.org; Sun, 27 May 2012 14:58:50 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SYifv-0000lt-4G
	for bug-bash@gnu.org; Sun, 27 May 2012 14:58:48 -0400
Received: from mail-wg0-f49.google.com ([74.125.82.49]:47618)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SYifu-0000lf-Rp
	for bug-bash@gnu.org; Sun, 27 May 2012 14:58:47 -0400
Received: by wgbds1 with SMTP id ds1so1838474wgb.30
	for <bug-bash@gnu.org>; Sun, 27 May 2012 11:58:44 -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=IL42beii6m59WnH015i8khVx/j5TjTp/ogmANSqV0gM=;
	b=LzhXcTtIGZbyfGp3QSA2hLZ9EN0K4sk1GL8Y5oCfE5lUZc3+YcfCeqJTLpA4uwsPNP
	OY3MCks3u2oP5PbeegJQjB1/WQ2U1lz7udQ866747KG/lHEY/YJ9iTrOkYjkstwvycKf
	+9mfgNiPFkvh50WXZrGKvQd4JW2/i9kAdkXDKbNS/Tla2HY085ywBq1Lni0wBJCS4JEt
	XQN0/QtmD2/ZosWMR4xyV7iemGBlpEzaib0wntglM5dKr0YRPk0IBZ9aJb8npeW09Znm
	V8iSplFHg/GjEvGwg1BCwtKgGWCHSAslWjNAKwu0noBjpS81B07kp2oUGsaKP8RjUi9N
	iVug==
MIME-Version: 1.0
Received: by 10.180.93.196 with SMTP id cw4mr10264172wib.11.1338145124369;
	Sun, 27 May 2012 11:58:44 -0700 (PDT)
Received: by 10.180.146.166 with HTTP; Sun, 27 May 2012 11:58:44 -0700 (PDT)
In-Reply-To: <3213085.zg0emHYDO5@smorgbox>
References: <CAH3AnrrXCFu2DOofWYfxj8HXZ-P1OPiv9Kt9fnwDED8A-Xm2tQ@mail.gmail.com>
	<m27gvxn9lo.fsf@igel.home>
	<CAH3AnrrX=yKsqdVABLADtUb9AzeLMJGkf8em0Vvhe4=7B1YGng@mail.gmail.com>
	<3213085.zg0emHYDO5@smorgbox>
Date: Mon, 28 May 2012 04:58:44 +1000
Message-ID: <CAH3Anro1SoucCE4pcBLuHgcNYaCsOdgBgDy1-ze0WqZYmCx0uQ@mail.gmail.com>
Subject: Re: handling of test == by BASH's POSIX mode
From: Jon Seymour <jon.seymour@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: 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: Sun, 27 May 2012 18:58:50 -0000

On Mon, May 28, 2012 at 2:08 AM, Dan Douglas <ormaaj@gmail.com> wrote:
> ... Bash
> just modifies conflicting features to the minimal extent necessary to bring it
> into compliance, which seems to be the path of least resistance.
>

Sure. I understand that this is a reasonable philosophy given that
aiming for complete avoidance of unspecified behaviour in the POSIX
spec would probably lead to a completely unusable shell.

That said, it is a shame from the point of view of interoperable scripts.

Perhaps I should just accept that dash, being more minimal, does a
better job of being that conformance testing shell?


> This would be a big job, I think, and not quite at the top of my wish-list.
> Right now you can increase the number of things that fail by explicitly
> disabling non-POSIX built-ins using the Bash "enable" builtin.
>

Thanks for that tip.

>
> Dash is useful for testing. The Bash answer is [[, which CAN do a lot of
> special error handling on due to it being a compound command. I wrote a bit
> about this here:
>
> http://mywiki.wooledge.org/BashFAQ/031/#Theory
>
> In reality, [[ is one of the very most portable non-POSIX features available.
> Most people shouldn't have to worry about avoiding it.
>

Thanks, I'll have a read.

jon.


From MAILER-DAEMON Mon May 28 11:03:37 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZ1Tt-0008N0-Ir
	for mharc-bug-bash@gnu.org; Mon, 28 May 2012 11:03:37 -0400
Received: from eggs.gnu.org ([208.118.235.92]:50455)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SZ1Tm-0008Ms-Ju
	for bug-bash@gnu.org; Mon, 28 May 2012 11:03:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SZ1Th-0007bO-L0
	for bug-bash@gnu.org; Mon, 28 May 2012 11:03:30 -0400
Received: from mx1.redhat.com ([209.132.183.28]:44069)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SZ1Th-0007bE-DC
	for bug-bash@gnu.org; Mon, 28 May 2012 11:03:25 -0400
Received: from int-mx02.intmail.prod.int.phx2.redhat.com
	(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4SF3IE4016498
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Mon, 28 May 2012 11:03:18 -0400
Received: from [10.3.113.71] (ovpn-113-71.phx2.redhat.com [10.3.113.71])
	by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
	id q4SF3HLb006136; Mon, 28 May 2012 11:03:17 -0400
Message-ID: <4FC393B4.1000700@redhat.com>
Date: Mon, 28 May 2012 09:03:16 -0600
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:12.0) Gecko/20120430 Thunderbird/12.0.1
MIME-Version: 1.0
To: Jon Seymour <jon.seymour@gmail.com>
Subject: Re: handling of test == by BASH's POSIX mode
References: <CAH3AnrrXCFu2DOofWYfxj8HXZ-P1OPiv9Kt9fnwDED8A-Xm2tQ@mail.gmail.com>
In-Reply-To: <CAH3AnrrXCFu2DOofWYfxj8HXZ-P1OPiv9Kt9fnwDED8A-Xm2tQ@mail.gmail.com>
X-Enigmail-Version: 1.4.1
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="------------enigA97002D49F31E0151C15A3BD"
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
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, 28 May 2012 15:03:36 -0000

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

On 05/27/2012 01:15 AM, Jon Seymour wrote:
> Is there a reason why bash doesn't treat =3D=3D as an illegal test
> operator when running in POSIX mode?

Because POSIX doesn't forbid extensions.  Furthermore, POSIX is
considering the standardization of =3D=3D:

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

at which point, the use of =3D=3D would be required to work.

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


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

iQEcBAEBCAAGBQJPw5O1AAoJEKeha0olJ0Nq04gH/RwL4buU9waCsXFqQuwJEzO5
/Es5dY2gNMAS2dDmib7mA7A46iDQpnKLE2YxM/0hsifuIvD20YVyMuU8Tbo+WilA
ONkejWws2kNJ9Gzasvs/NHRKnYpMSjEPB/5s1xKysFcW6x4WVJNzKoXoH+weS0js
Dkqv05ANkjXDzXlJovlOa925zK2oP3WT3nqTvBYIrHHfp7gkzDWJTJXOZWpql+uv
kFUztq/8x/mq/MWENwRE7q5IE2OoML3He/CeJW6HJ/S4PMf7RQlRaSFESnNOIf5G
OFHf/W3CTZ8Q39XwdsvwwNbjHL4TfFqkoN7WwjzOgv6BPyPflFIsxZ/Rx8aI2Ns=
=pAXb
-----END PGP SIGNATURE-----

--------------enigA97002D49F31E0151C15A3BD--


From MAILER-DAEMON Mon May 28 11:08:31 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZ1Yd-0000IH-7p
	for mharc-bug-bash@gnu.org; Mon, 28 May 2012 11:08:31 -0400
Received: from eggs.gnu.org ([208.118.235.92]:56178)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SZ1Ya-0000Hz-V8
	for bug-bash@gnu.org; Mon, 28 May 2012 11:08:30 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SZ1YT-0008WH-Fx
	for bug-bash@gnu.org; Mon, 28 May 2012 11:08:28 -0400
Received: from mx1.redhat.com ([209.132.183.28]:56067)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1SZ1YT-0008Vq-8T
	for bug-bash@gnu.org; Mon, 28 May 2012 11:08:21 -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 q4SF8IAO013723
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Mon, 28 May 2012 11:08:18 -0400
Received: from [10.3.113.71] (ovpn-113-71.phx2.redhat.com [10.3.113.71])
	by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id q4SF8HFC000869; Mon, 28 May 2012 11:08:17 -0400
Message-ID: <4FC394E0.4030007@redhat.com>
Date: Mon, 28 May 2012 09:08:16 -0600
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:12.0) Gecko/20120430 Thunderbird/12.0.1
MIME-Version: 1.0
To: Jon Seymour <jon.seymour@gmail.com>
Subject: Re: handling of test == by BASH's POSIX mode
References: <CAH3AnrrXCFu2DOofWYfxj8HXZ-P1OPiv9Kt9fnwDED8A-Xm2tQ@mail.gmail.com>
	<CAO-BiTKNoesWfXmdyFtf14d7-OMx+2E0PGo9U+VXTx-P40CX-g@mail.gmail.com>
	<D365ADA4-7D32-463F-9410-44ED70468FAD@gmail.com>
	<m27gvxn9lo.fsf@igel.home>
	<CAH3AnrrX=yKsqdVABLADtUb9AzeLMJGkf8em0Vvhe4=7B1YGng@mail.gmail.com>
In-Reply-To: <CAH3AnrrX=yKsqdVABLADtUb9AzeLMJGkf8em0Vvhe4=7B1YGng@mail.gmail.com>
X-Enigmail-Version: 1.4.1
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="------------enigE121F5A440424191037C92D0"
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: Andreas Schwab <schwab@linux-m68k.org>,
	"bug-bash@gnu.org" <bug-bash@gnu.org>, Geir Hauge <geir.hauge@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: Mon, 28 May 2012 15:08:30 -0000

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

On 05/27/2012 07:09 AM, Jon Seymour wrote:

> I understand that the behaviour is unspecitied by POSIX - I didn't
> know that before, but I know that now - thanks.
>=20
> That said, from the point of view of promoting interoperable scripts,
> my view is that it (in an ideal world**) would be better if bash chose
> to fail, while executing in POSIX mode, in this case.

Sounds like you want debian's 'posh', which is even stricter than
'dash', and excellent for pointing out use of extensions by failing
loudly at any encountered extension, including =3D=3D under test.

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


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

iQEcBAEBCAAGBQJPw5ThAAoJEKeha0olJ0NqMskH/iY4HW/qty9bCtRsHjHSL3jt
oD1d6fSFkAfE44ubRwA3XAgtO9y12K2C6K9/v35kiCN4Yb0WGRgQaCV0KqDOKNpq
k9Lll5FUrklkni0g5bzqaKIQABX3YRTi2ij0Afp5UBVFseStZ9zrwauJ9QF0DQ8M
ewB0oTgQ3EybTwXikRCsEu9yZ5poccTeMjpfsp2vmluR28rRRGErdIqcJrnQper9
I5ZcSxziia7G4BUApA2X3Q4LEcQejknAa3RVAyDDfS2DBt1C5g6AyIMlzv0Nr5ga
u2wIrbI2IDrXrOd1NpWdSZXHDLz4Mqsmn+0awy8eXpZ3aQEo+MRMOfUZYW9ASco=
=H4nN
-----END PGP SIGNATURE-----

--------------enigE121F5A440424191037C92D0--


From MAILER-DAEMON Mon May 28 11:33:25 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZ1wj-0005e4-AQ
	for mharc-bug-bash@gnu.org; Mon, 28 May 2012 11:33:25 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60527)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1SZ1wh-0005df-Cs
	for bug-bash@gnu.org; Mon, 28 May 2012 11:33: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 1SZ1wf-0006cO-KB
	for bug-bash@gnu.org; Mon, 28 May 2012 11:33:22 -0400
Received: from plane.gmane.org ([80.91.229.3]:42307)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1SZ1wf-0006cG-C2
	for bug-bash@gnu.org; Mon, 28 May 2012 11:33:21 -0400
Received: from list by plane.gmane.org with local (Exim 4.69)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1SZ1wc-0000yU-V8
	for bug-bash@gnu.org; Mon, 28 May 2012 17:33:18 +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, 28 May 2012 17:33:18 +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, 28 May 2012 17:33:18 +0200
X-Injected-Via-Gmane: http://gmane.org/
To: bug-bash@gnu.org
From: "John E. Malmberg" <wb8tyw@qsl.net>
Subject: Red-Hat Bug 825751 - bash-completion fails on environment variables
Date: Mon, 28 May 2012 10:32:32 -0500
Lines: 21
Message-ID: <jq05rk$nd7$1@dough.gmane.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: usenet@dough.gmane.org
X-Gmane-NNTP-Posting-Host: 173-19-202-206.client.mchsi.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:10.0) Gecko/20120129 Thunderbird/10.0
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 80.91.229.3
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 28 May 2012 15:33:24 -0000

https://bugzilla.redhat.com/show_bug.cgi?id=825751

bash-4.2.24-1.fc16.i686

Steps to Reproduce:
1. Activate a terminal running a bash shell
2. ls $HOME/<TAB>
3.

Actual results:
ls \$HOME/

I get the directory get expanded result on Bash 1.4.8 (VMS special 
build) and on Bash 3.2.25(1)-release.

Regards,
-John







From MAILER-DAEMON Mon May 28 22:13:10 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZBvq-0003M7-C4
	for mharc-bug-bash@gnu.org; Mon, 28 May 2012 22:13:10 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48974)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dearvoid@gmail.com>) id 1SZBvn-0003Ju-Us
	for bug-bash@gnu.org; Mon, 28 May 2012 22:13:09 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dearvoid@gmail.com>) id 1SZBvm-00082r-1q
	for bug-bash@gnu.org; Mon, 28 May 2012 22:13:07 -0400
Received: from mail-ob0-f169.google.com ([209.85.214.169]:56420)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dearvoid@gmail.com>) id 1SZBvl-00082h-QA
	for bug-bash@gnu.org; Mon, 28 May 2012 22:13:05 -0400
Received: by obbwd18 with SMTP id wd18so7711445obb.0
	for <bug-bash@gnu.org>; Mon, 28 May 2012 19:13:03 -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=/IdeqhDTJDVdO9N1smncGa6Oi4dhfsOeKMHBAqLCYpc=;
	b=n43xpMMza2kCjyh86szFiaubaBn0pADVoN1C3Rdpfja673onEST9C8Vq2osZi1M8dB
	ULXtwD/6m7PF6x1xavmJw5TdDnZB26P7qOp9QzKo9t3CcRwmtDprxwmQsMxLJuevpfmS
	HSkaN1VIkC4t3zG1KZLgCxIU6Oe9TE4SpLwuhmpNXXCyO/J80RssRcB6JVmZ/rPidbd3
	53nY1R6J8hnlV76I6i+VSwwffup5ohZM4Gqg8rdMcvRza6/NUhhynQTfXJVWcbzoyDfr
	FMWxQ9TqnEJebpsEw/EYGzgOWgyTMcGWegfxSKJpsBUf3AnzurcNODArmojnLGlZ0P5y
	RA3w==
Received: by 10.182.164.69 with SMTP id yo5mr9661836obb.17.1338257583143; Mon,
	28 May 2012 19:13:03 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.182.129.108 with HTTP; Mon, 28 May 2012 19:12:32 -0700 (PDT)
In-Reply-To: <jq05rk$nd7$1@dough.gmane.org>
References: <jq05rk$nd7$1@dough.gmane.org>
From: Clark WANG <dearvoid@gmail.com>
Date: Tue, 29 May 2012 10:12:32 +0800
Message-ID: <CADv8-ogH00a8Us2C91B5KY+ZPOYevgvtGOQf86skzyBTw7rMag@mail.gmail.com>
Subject: Re: Red-Hat Bug 825751 - bash-completion fails on environment
	variables
To: "John E. Malmberg" <wb8tyw@qsl.net>
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.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: Tue, 29 May 2012 02:13:09 -0000

On Mon, May 28, 2012 at 11:32 PM, John E. Malmberg <wb8tyw@qsl.net> wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=825751
>
> bash-4.2.24-1.fc16.i686
>
> Steps to Reproduce:
> 1. Activate a terminal running a bash shell
> 2. ls $HOME/<TAB>
> 3.
>
> Actual results:
> ls \$HOME/

Already discussed for quite a few times. :) For example:

http://lists.gnu.org/archive/html/bug-bash/2011-12/msg00079.html
(patched attached)
http://lists.gnu.org/archive/html/bug-bash/2011-12/msg00035.html


>
> I get the directory get expanded result on Bash 1.4.8 (VMS special build)
> and on Bash 3.2.25(1)-release.
>
> Regards,
> -John
>


From MAILER-DAEMON Mon May 28 23:24:59 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZD3L-0000Py-7f
	for mharc-bug-bash@gnu.org; Mon, 28 May 2012 23:24:59 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41956)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SZD3J-0000Ok-0g
	for bug-bash@gnu.org; Mon, 28 May 2012 23:24:58 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SZD3H-0003xI-B3
	for bug-bash@gnu.org; Mon, 28 May 2012 23:24:56 -0400
Received: from mail-wi0-f171.google.com ([209.85.212.171]:39240)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon.seymour@gmail.com>) id 1SZD3H-0003xB-2H
	for bug-bash@gnu.org; Mon, 28 May 2012 23:24:55 -0400
Received: by wibhm14 with SMTP id hm14so1676533wib.12
	for <bug-bash@gnu.org>; Mon, 28 May 2012 20:24: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:date:message-id:subject:from:to
	:cc:content-type;
	bh=j/I2wn8rswHVDLht+elfSFezZgL+o38uUaEWczArZ3w=;
	b=xn5NwsRDtMWLdEx5sjN1xn2xeG/6eMy7+SFTkD6gfET1kNlHEbBGeobieduHmtOYWb
	LacPdQdbRaLh3eOCXlJge43cks1KVuqtbunRM8nIJPccApAIZUFK8nQGfZg28+JtgjMG
	5B24E7Tw02ZscuTqg1MzW+s7Bc5s6Q5fZ4Smt1d5ss7u2jsk48WhQAlwjIWcymQpr14I
	yJqxrvgZAV99I6jptmBHU3Onui5gIz/h5Dmm2fD7Vz35ypYLpFgFFk2p3StwPBRRUDkN
	G6OAB6NZ3G21tXLcQ9DXJoGIU3orxv7EzLcoQZP3FTjCwGbcxFP0FZbXv2Qi8Tl19q8J
	SlIA==
MIME-Version: 1.0
Received: by 10.216.143.105 with SMTP id k83mr5813141wej.99.1338261892049;
	Mon, 28 May 2012 20:24:52 -0700 (PDT)
Received: by 10.180.146.166 with HTTP; Mon, 28 May 2012 20:24:52 -0700 (PDT)
In-Reply-To: <4FC394E0.4030007@redhat.com>
References: <CAH3AnrrXCFu2DOofWYfxj8HXZ-P1OPiv9Kt9fnwDED8A-Xm2tQ@mail.gmail.com>
	<CAO-BiTKNoesWfXmdyFtf14d7-OMx+2E0PGo9U+VXTx-P40CX-g@mail.gmail.com>
	<D365ADA4-7D32-463F-9410-44ED70468FAD@gmail.com>
	<m27gvxn9lo.fsf@igel.home>
	<CAH3AnrrX=yKsqdVABLADtUb9AzeLMJGkf8em0Vvhe4=7B1YGng@mail.gmail.com>
	<4FC394E0.4030007@redhat.com>
Date: Tue, 29 May 2012 13:24:52 +1000
Message-ID: <CAH3AnroOG95AaVhKwmG2zVdV=sTqLwi-hZ2ahWC3euhPJB55Gg@mail.gmail.com>
Subject: Re: handling of test == by BASH's POSIX mode
From: Jon Seymour <jon.seymour@gmail.com>
To: Eric Blake <eblake@redhat.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.212.171
Cc: Andreas Schwab <schwab@linux-m68k.org>,
	"bug-bash@gnu.org" <bug-bash@gnu.org>, Geir Hauge <geir.hauge@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: Tue, 29 May 2012 03:24:58 -0000

On Tue, May 29, 2012 at 1:08 AM, Eric Blake <eblake@redhat.com> wrote:
> On 05/27/2012 07:09 AM, Jon Seymour wrote:
>
>> I understand that the behaviour is unspecitied by POSIX - I didn't
>> know that before, but I know that now - thanks.
>>
>> That said, from the point of view of promoting interoperable scripts,
>> my view is that it (in an ideal world**) would be better if bash chose
>> to fail, while executing in POSIX mode, in this case.
>
> Sounds like you want debian's 'posh', which is even stricter than
> 'dash', and excellent for pointing out use of extensions by failing
> loudly at any encountered extension, including == under test.

Thanks, I'll check it out.

jon.


From MAILER-DAEMON Tue May 29 03:25:08 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZGnk-0007Fw-NJ
	for mharc-bug-bash@gnu.org; Tue, 29 May 2012 03:25:08 -0400
Path: usenet.stanford.edu!postnews.google.com!t2g2000pbl.googlegroups.com!not-for-mail
From: movingmen <themovingmen.au@gmail.com>
Newsgroups: gnu.bash.bug
Subject: Movers  Gold Coast
Date: Tue, 29 May 2012 00:19:54 -0700 (PDT)
Organization: http://groups.google.com
Lines: 6
Message-ID: <c12f10fa-ca21-4a0f-8c25-0bb52b053d36@t2g2000pbl.googlegroups.com>
NNTP-Posting-Host: 210.56.106.233
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: posting.google.com 1338276086 8691 127.0.0.1 (29 May 2012 07:21:26
	GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 29 May 2012 07:21:26 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: t2g2000pbl.googlegroups.com; posting-host=210.56.106.233;
	posting-account=jzRCxQoAAACtMKvvUbcMRe_E-5FfTUv_
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.1;
	rv:12.0) Gecko/20100101 Firefox/12.0,gzip(gfe)
Xref: usenet.stanford.edu gnu.bash.bug:24724
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, 29 May 2012 07:25:07 -0000

The Moving Men are able to supply you with just the man power to move
things internally around your home or office in Perth, Brisbane and
Gold Coast.


http://www.themovingmen.com.au/

From MAILER-DAEMON Tue May 29 08:12:51 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZLIB-0001l6-9T
	for mharc-bug-bash@gnu.org; Tue, 29 May 2012 08:12:51 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46603)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SZLI4-0001kR-0K
	for bug-bash@gnu.org; Tue, 29 May 2012 08:12:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SZLI2-0001J2-02
	for bug-bash@gnu.org; Tue, 29 May 2012 08:12:43 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:41584)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SZLI1-0001Ic-SR
	for bug-bash@gnu.org; Tue, 29 May 2012 08:12:41 -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 BZB41605 (AUTH cpr);
	Tue, 29 May 2012 08:12:40 -0400 (EDT)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id AXS03574 (AUTH cpr);
	Tue, 29 May 2012 08:12:38 -0400 (EDT)
Message-ID: <4FC4BD36.3030806@case.edu>
Date: Tue, 29 May 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:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: "John E. Malmberg" <wb8tyw@qsl.net>
Subject: Re: Red-Hat Bug 825751 - bash-completion fails on environment
	variables
References: <jq05rk$nd7$1@dough.gmane.org>
In-Reply-To: <jq05rk$nd7$1@dough.gmane.org>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 29 May 2012 12:12:49 -0000

On 5/28/12 11:32 AM, John E. Malmberg wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=825751
> 
> bash-4.2.24-1.fc16.i686

Please take a look at
http://git.savannah.gnu.org/cgit/bash.git/log/?h=direxpand
and see if that behaves the way you like.

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


From MAILER-DAEMON Tue May 29 08:35:01 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZLdd-0005ON-JD
	for mharc-bug-bash@gnu.org; Tue, 29 May 2012 08:35:01 -0400
Received: from eggs.gnu.org ([208.118.235.92]:59909)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wb8tyw@qsl.net>) id 1SZLdV-0005Kj-MY
	for bug-bash@gnu.org; Tue, 29 May 2012 08:34:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wb8tyw@qsl.net>) id 1SZLdQ-0003CO-Nn
	for bug-bash@gnu.org; Tue, 29 May 2012 08:34:53 -0400
Received: from eisner.encompasserve.org ([67.53.90.116]:1432
	helo=Encompasserve.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wb8tyw@qsl.net>) id 1SZLdQ-0003Bm-K4
	for bug-bash@gnu.org; Tue, 29 May 2012 08:34:48 -0400
Received: from CONVERSION-DAEMON.Encompasserve.org by Encompasserve.org
	(PMDF V6.5-x7 #36614) id <01OG1PH3IMXC004IGE@Encompasserve.org> for
	bug-bash@gnu.org; Tue, 29 May 2012 07:34:44 -0500 (CDT)
Received: from [192.168.0.101]
	(173-19-202-206.client.mchsi.com [173.19.202.206])
	by Encompasserve.org (PMDF V6.5-x7 #36614)
	with ESMTPSA id <01OG1PH2VDME017G0Y@Encompasserve.org>; Tue,
	29 May 2012 07:34:44 -0500 (CDT)
Date: Tue, 29 May 2012 07:34:06 -0500
From: "John E. Malmberg" <wb8tyw@qsl.net>
Subject: Re: Red-Hat Bug 825751 - bash-completion fails on environment
	variables
In-reply-to: <4FC4BD36.3030806@case.edu>
To: bug-bash@gnu.org
Message-id: <4FC4C23E.4050003@qsl.net>
MIME-version: 1.0
Content-type: text/plain; format=flowed; charset=ISO-8859-1
Content-transfer-encoding: 7BIT
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20120129
	Thunderbird/10.0
References: <jq05rk$nd7$1@dough.gmane.org> <4FC4BD36.3030806@case.edu>
X-detected-operating-system: by eggs.gnu.org: OpenVMS 7.2 (Multinet 4.3-4.4
	stack)
X-Received-From: 67.53.90.116
Cc: 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: Tue, 29 May 2012 12:34:59 -0000

On 5/29/2012 7:12 AM, Chet Ramey wrote:
> On 5/28/12 11:32 AM, John E. Malmberg wrote:
>> https://bugzilla.redhat.com/show_bug.cgi?id=825751
>>
>> bash-4.2.24-1.fc16.i686
>
> Please take a look at
> http://git.savannah.gnu.org/cgit/bash.git/log/?h=direxpand
> and see if that behaves the way you like.

Thanks,

In the discussion that you referenced earlier, it mentions that it was 
considered making this behavior controlled by a settable parameter.

Is that implemented with this patch?

Is this eventually going to be part of an official patch?

This issue was reported to me by the same person that submitted the 
Red-Hat Bug report, and not something that is directly impacting me.

I did search for the issue before posting, but apparently did not use 
the right keywords, and I did not see the issue addressed in any of the 
official patches.

In my current spare time project below, I am planning to try to just 
implement as much as the current Bash + official patch behavior as I 
can, and probably not implement the optional patches.  Once I get the 
base 4.2 release functional, then I will apply all the official patches 
to the source.

LION> bash --version
GNU bash, version 4.2.0(1)-release (ia64-dec-vms)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
GNV-2.1-3-JEM-2 May 12 2012 19:36:33

On this platform, file names with $ in them tend to show up as they have 
special meaning.

BASH-4.2$ echo *\$*
GNV$BASH.DSF GNV$BASH.EXE GNV$BASH.MAP GNV$SHELL.C_FIRST 
GNV$VERSION.C_FIRST gnv$bash_startup.com gnv$main_wrapper 
gnv$vms_main_link.exe

Regards,
-John


From MAILER-DAEMON Tue May 29 11:50:09 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZOgT-0002yb-F0
	for mharc-bug-bash@gnu.org; Tue, 29 May 2012 11:50:09 -0400
Path: usenet.stanford.edu!postnews.google.com!si8g2000pbc.googlegroups.com!not-for-mail
From: kevin <seo2@sentientit.net>
Newsgroups: gnu.bash.bug
Subject: Helpful app for your dream wedding planning
Date: Thu, 24 May 2012 02:47:23 -0700 (PDT)
Organization: http://groups.google.com
Lines: 19
Message-ID: <0f61e35c-eb70-4aec-8823-e457ce849280@si8g2000pbc.googlegroups.com>
NNTP-Posting-Host: 122.174.62.37
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: posting.google.com 1337852962 12307 127.0.0.1 (24 May 2012 09:49:22
	GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 24 May 2012 09:49:22 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: si8g2000pbc.googlegroups.com; posting-host=122.174.62.37;
	posting-account=VvRBYAkAAABEBQpJ0lf5xGCVJrCIgWoW
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/536.5 (KHTML, like
	Gecko) Chrome/19.0.1084.46 Safari/536.5,gzip(gfe)
Xref: usenet.stanford.edu gnu.bash.bug:24727
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, 29 May 2012 15:50:08 -0000

The wedding planning can be done easily using like wedding planner,
wedding app etc. It depends upon the wedding planning people to choose
the path, according to their convenient, Budget allocations and their
requirement. The best option to plan the wedding is doing by wedding
couple itself. They can plan their wedding with the help of
"iWedPlanner" wedding app. This wedding app will helpful in all stages
of wedding planning. It has the carious features like RSVP, Budget
calculation, Creating wedding personnel wedding website, Easy finding
of wedding resources, Reminder, Organizer and many more. To get this
wedding app(iPhone, iPad, iPod Touch and Android) will available in
appstore or get from the given link.

http://itunes.apple.com/us/app/iwedplanner-the-wedding-planner/id408373537?mt=8

https://play.google.com/store/apps/details?id=com.sentientit.newiwedplanner(Android)

Also Get the useful updates of wedding directly on your facebook

http://www.facebook.com/iWedPlanner

From MAILER-DAEMON Tue May 29 16:21:35 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZSv9-0004w5-QP
	for mharc-bug-bash@gnu.org; Tue, 29 May 2012 16:21:35 -0400
Received: from eggs.gnu.org ([208.118.235.92]:47936)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SZSv7-0004vy-NH
	for bug-bash@gnu.org; Tue, 29 May 2012 16:21:35 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SZSv0-0004Wm-8e
	for bug-bash@gnu.org; Tue, 29 May 2012 16:21:33 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:48984)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SZSv0-0004Vd-3h
	for bug-bash@gnu.org; Tue, 29 May 2012 16:21:26 -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 BLF08661;
	Tue, 29 May 2012 16:21:23 -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 AXV04423 (AUTH cpr);
	Tue, 29 May 2012 16:21:23 -0400 (EDT)
Message-ID: <4FC52FC3.7040007@case.edu>
Date: Tue, 29 May 2012 16:21:23 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: gregrwm <backuppc-users@whitleymott.net>
Subject: Re: quoted and concatenated positional parameters
References: <CAD+dB9B4JG+qUwZBQUwiQmVt0j6NDn=DDTxr9R+nkA8DL4KLJA@mail.gmail.com>
In-Reply-To: <CAD+dB9B4JG+qUwZBQUwiQmVt0j6NDn=DDTxr9R+nkA8DL4KLJA@mail.gmail.com>
X-Enigmail-Version: 1.4.1
Content-Type: multipart/mixed; boundary="------------040201060301040400050701"
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: Dan Douglas <ormaaj@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: Tue, 29 May 2012 20:21:35 -0000

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

On 5/23/12 10:47 PM, gregrwm wrote:

> Machine Type: x86_64-redhat-linux-gnu
> 
> Bash Version: 4.1
> Patch Level: 2
> Release Status: release
> 
> Description:
>         expansion anomaly with quoted and concatenated positional parameters

This wasn't actually that hard to fix.  The attached patch should apply
fairly cleanly to bash-4.2.28.

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/

--------------040201060301040400050701
Content-Type: application/x-patch;
 name="quoted-dollar-at.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="quoted-dollar-at.patch"

KioqIC4uL2Jhc2gtMjAxMjA1MTgvc3Vic3QuYwkyMDEyLTA1LTA3IDE2OjA2OjM1LjAwMDAw
MDAwMCAtMDQwMAotLS0gc3Vic3QuYwkyMDEyLTA1LTI3IDIxOjU2OjE5LjAwMDAwMDAwMCAt
MDQwMAoqKioqKioqKioqKioqKioKKioqIDc5MjksNzkzMyAqKioqCiAgICAvKiBTdGF0ZSBm
bGFncyAqLwogICAgaW50IGhhZF9xdW90ZWRfbnVsbDsKISAgIGludCBoYXNfZG9sbGFyX2F0
OwogICAgaW50IHRmbGFnOwogICAgaW50IHBmbGFnczsJCQkvKiBmbGFncyBwYXNzZWQgdG8g
cGFyYW1fZXhwYW5kICovCi0tLSA3OTQwLDc5NDQgLS0tLQogICAgLyogU3RhdGUgZmxhZ3Mg
Ki8KICAgIGludCBoYWRfcXVvdGVkX251bGw7CiEgICBpbnQgaGFzX2RvbGxhcl9hdCwgdGVt
cF9oYXNfZG9sbGFyX2F0OwogICAgaW50IHRmbGFnOwogICAgaW50IHBmbGFnczsJCQkvKiBm
bGFncyBwYXNzZWQgdG8gcGFyYW1fZXhwYW5kICovCioqKioqKioqKioqKioqKgoqKiogODEz
NCw4MTM4ICoqKioKICAJICAgICpleHBhbmRlZF9zb21ldGhpbmcgPSAxOwogIAohIAkgIGhh
c19kb2xsYXJfYXQgPSAwOwogIAkgIHBmbGFncyA9ICh3b3JkLT5mbGFncyAmIFdfTk9DT01T
VUIpID8gUEZfTk9DT01TVUIgOiAwOwogIAkgIGlmICh3b3JkLT5mbGFncyAmIFdfTk9TUExJ
VDIpCi0tLSA4MTQ1LDgxNDkgLS0tLQogIAkgICAgKmV4cGFuZGVkX3NvbWV0aGluZyA9IDE7
CiAgCiEgCSAgdGVtcF9oYXNfZG9sbGFyX2F0ID0gMDsKICAJICBwZmxhZ3MgPSAod29yZC0+
ZmxhZ3MgJiBXX05PQ09NU1VCKSA/IFBGX05PQ09NU1VCIDogMDsKICAJICBpZiAod29yZC0+
ZmxhZ3MgJiBXX05PU1BMSVQyKQoqKioqKioqKioqKioqKioKKioqIDgxNDEsODE0NiAqKioq
CiAgCSAgICBwZmxhZ3MgfD0gUEZfQVNTSUdOUkhTOwogIAkgIHR3b3JkID0gcGFyYW1fZXhw
YW5kIChzdHJpbmcsICZzaW5kZXgsIHF1b3RlZCwgZXhwYW5kZWRfc29tZXRoaW5nLAohIAkJ
CSAgICAgICAmaGFzX2RvbGxhcl9hdCwgJnF1b3RlZF9kb2xsYXJfYXQsCiAgCQkJICAgICAg
ICZoYWRfcXVvdGVkX251bGwsIHBmbGFncyk7CiAgCiAgCSAgaWYgKHR3b3JkID09ICZleHBh
bmRfd2Rlc2NfZXJyb3IgfHwgdHdvcmQgPT0gJmV4cGFuZF93ZGVzY19mYXRhbCkKLS0tIDgx
NTIsODE1OCAtLS0tCiAgCSAgICBwZmxhZ3MgfD0gUEZfQVNTSUdOUkhTOwogIAkgIHR3b3Jk
ID0gcGFyYW1fZXhwYW5kIChzdHJpbmcsICZzaW5kZXgsIHF1b3RlZCwgZXhwYW5kZWRfc29t
ZXRoaW5nLAohIAkJCSAgICAgICAmdGVtcF9oYXNfZG9sbGFyX2F0LCAmcXVvdGVkX2RvbGxh
cl9hdCwKICAJCQkgICAgICAgJmhhZF9xdW90ZWRfbnVsbCwgcGZsYWdzKTsKKyAJICBoYXNf
ZG9sbGFyX2F0ICs9IHRlbXBfaGFzX2RvbGxhcl9hdDsKICAKICAJICBpZiAodHdvcmQgPT0g
JmV4cGFuZF93ZGVzY19lcnJvciB8fCB0d29yZCA9PSAmZXhwYW5kX3dkZXNjX2ZhdGFsKQoq
KioqKioqKioqKioqKioKKioqIDgyODQsODI5MCAqKioqCiAgCSAgICAgIHRlbXAgPSAoY2hh
ciAqKU5VTEw7CiAgCiEgCSAgICAgIGhhc19kb2xsYXJfYXQgPSAwOwogIAkgICAgICAvKiBO
ZWVkIHRvIGdldCBXX0hBU1FVT1RFRE5VTEwgZmxhZyB0aHJvdWdoIHRoaXMgZnVuY3Rpb24u
ICovCiEgCSAgICAgIGxpc3QgPSBleHBhbmRfd29yZF9pbnRlcm5hbCAodHdvcmQsIFFfRE9V
QkxFX1FVT1RFUywgMCwgJmhhc19kb2xsYXJfYXQsIChpbnQgKilOVUxMKTsKICAKICAJICAg
ICAgaWYgKGxpc3QgPT0gJmV4cGFuZF93b3JkX2Vycm9yIHx8IGxpc3QgPT0gJmV4cGFuZF93
b3JkX2ZhdGFsKQotLS0gODI5Niw4MzAzIC0tLS0KICAJICAgICAgdGVtcCA9IChjaGFyICop
TlVMTDsKICAKISAJICAgICAgdGVtcF9oYXNfZG9sbGFyX2F0ID0gMDsJLyogWFhYICovCiAg
CSAgICAgIC8qIE5lZWQgdG8gZ2V0IFdfSEFTUVVPVEVETlVMTCBmbGFnIHRocm91Z2ggdGhp
cyBmdW5jdGlvbi4gKi8KISAJICAgICAgbGlzdCA9IGV4cGFuZF93b3JkX2ludGVybmFsICh0
d29yZCwgUV9ET1VCTEVfUVVPVEVTLCAwLCAmdGVtcF9oYXNfZG9sbGFyX2F0LCAoaW50ICop
TlVMTCk7CiEgCSAgICAgIGhhc19kb2xsYXJfYXQgKz0gdGVtcF9oYXNfZG9sbGFyX2F0Owog
IAogIAkgICAgICBpZiAobGlzdCA9PSAmZXhwYW5kX3dvcmRfZXJyb3IgfHwgbGlzdCA9PSAm
ZXhwYW5kX3dvcmRfZmF0YWwpCg==
--------------040201060301040400050701--



From MAILER-DAEMON Tue May 29 19:32:28 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZVtr-0004sR-Vf
	for mharc-bug-bash@gnu.org; Tue, 29 May 2012 19:32:27 -0400
Received: from eggs.gnu.org ([208.118.235.92]:34650)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <akasei@inoto.net>) id 1SZPVv-0004fA-MJ
	for bug-bash@gnu.org; Tue, 29 May 2012 12:43:20 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <akasei@inoto.net>) id 1SZPVt-0006Ll-5R
	for bug-bash@gnu.org; Tue, 29 May 2012 12:43:19 -0400
Received: from mail-bk0-f41.google.com ([209.85.214.41]:55957)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <akasei@inoto.net>) id 1SZPVs-0006Kz-Ue
	for bug-bash@gnu.org; Tue, 29 May 2012 12:43:17 -0400
Received: by bkcjm19 with SMTP id jm19so3984882bkc.0
	for <bug-bash@gnu.org>; Tue, 29 May 2012 09:43:14 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=google.com; s=20120113;
	h=mime-version:x-originating-ip:date:message-id:subject:from:to
	:content-type:x-gm-message-state;
	bh=0D9WHpfLQbqnE2sAye0weBCchrXjC/v9GFbIAHP1JQk=;
	b=atShZxLyQae321jSQyHOeKc9ioZR0dHmPpnRtfJ5nEwPE5zd0rkFIF1l05ULBDrqVM
	hiL9QhFkE270vNIqtLAd7BDBCl4nJxMioxHxPxa7kEvaiLBuBx/DtP8PjTYxBeW5Ekm/
	5tu0n6bfxymwrA0LIteStq+g0OsELDuumwW1r6edYh4UpkoPe+e34ZH2mp1vYiCPVOsb
	BKj4amcBKZgdYKW0BXqfnAyM4HSbahs3cGjzdoFAaFCAhJ/mROA6ss9L58AYtJfCLVaJ
	/2fdoddt6dGc9dNRC0DMONgnuYYJIlCWygwhaw27RCYDZAORg+Y6LhxN8226tYY0sLOH
	bZbA==
MIME-Version: 1.0
Received: by 10.204.156.150 with SMTP id x22mr6518825bkw.55.1338309793662;
	Tue, 29 May 2012 09:43:13 -0700 (PDT)
Received: by 10.204.182.70 with HTTP; Tue, 29 May 2012 09:43:13 -0700 (PDT)
X-Originating-IP: [195.211.2.7]
Date: Tue, 29 May 2012 18:43:13 +0200
Message-ID: <CALtf9+qvO2BDHriAvi28q=kKr2j3b6KJbKLoBhs3D615y+8dLA@mail.gmail.com>
Subject: Compare 2 arrays.
From: Akasei Yoshiko <akasei@inoto.net>
To: bug-bash@gnu.org
Content-Type: text/plain; charset=ISO-8859-1
X-Gm-Message-State: ALoCoQk1FKd21MgJlx/QkVsi/daH+wcHcTZngzixTxVIv3bRx6iaiamF4+ryYPhkXx/EJOOe5bs7
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.214.41
X-Mailman-Approved-At: Tue, 29 May 2012 19:32:26 -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: Tue, 29 May 2012 16:43:21 -0000

I have something like that:

> #!/bin/bash
> # [PL] Porownuje dwie tablice, zwraca prawde/falsz.
>
> A=( "$1" )
> B=( "$2" )
> EQUAL=0
>
> if [ ${#A[@]} -eq ${#B[@]} ]; then
> 	for id in `seq 0 2 $[ ${#A[@]} - 2 ]`; do
> 		if [ "${A[ $id ]}" == "${B[ $id ]}" ]; then
> 			EQUAL=1
> 		else
> 			EQUAL=0
> 			break
> 		fi
> 	done
> fi
>
> echo $EQUAL


When i type:
> user[~] $ ./compare "wget 0" "wget 0"
> 0

Returns zero.

How do this properly?


From MAILER-DAEMON Tue May 29 20:47:57 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZX4v-0006Dk-SO
	for mharc-bug-bash@gnu.org; Tue, 29 May 2012 20:47:57 -0400
Received: from eggs.gnu.org ([208.118.235.92]:51628)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SZX4s-0006DJ-R8
	for bug-bash@gnu.org; Tue, 29 May 2012 20:47:55 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SZX4r-0000Le-0K
	for bug-bash@gnu.org; Tue, 29 May 2012 20:47:54 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:8270)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SZX4q-0000LQ-Rt
	for bug-bash@gnu.org; Tue, 29 May 2012 20:47:52 -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 BLF30884;
	Tue, 29 May 2012 20:47:51 -0400
Received: from h191.11.172.72.dynamic.ip.windstream.net (EHLO z4.local)
	([72.172.11.191]) by mpv8.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id UGW84719 (AUTH cpr);
	Tue, 29 May 2012 20:47:50 -0400 (EDT)
Message-ID: <4FC56E34.6050206@case.edu>
Date: Tue, 29 May 2012 20:47:48 -0400
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: "John E. Malmberg" <wb8tyw@qsl.net>
Subject: Re: Red-Hat Bug 825751 - bash-completion fails on environment
	variables
References: <jq05rk$nd7$1@dough.gmane.org> <4FC4BD36.3030806@case.edu>
	<4FC4C23E.4050003@qsl.net>
In-Reply-To: <4FC4C23E.4050003@qsl.net>
X-Enigmail-Version: 1.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at 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, 30 May 2012 00:47:56 -0000

On 5/29/12 8:34 AM, John E. Malmberg wrote:

> In the discussion that you referenced earlier, it mentions that it was
> considered making this behavior controlled by a settable parameter.
> 
> Is that implemented with this patch?
> 
> Is this eventually going to be part of an official patch?

Yes and yes and sooner rather than later.

-- 
``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 May 29 22:30:25 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZYg5-0001n6-ON
	for mharc-bug-bash@gnu.org; Tue, 29 May 2012 22:30:25 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60452)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <qfissler@gmail.com>) id 1SZYg3-0001my-GT
	for bug-bash@gnu.org; Tue, 29 May 2012 22:30:24 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <qfissler@gmail.com>) id 1SZYg1-0000nV-BL
	for bug-bash@gnu.org; Tue, 29 May 2012 22:30:23 -0400
Received: from mail-ob0-f169.google.com ([209.85.214.169]:50550)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <qfissler@gmail.com>) id 1SZYg1-0000n3-3y
	for bug-bash@gnu.org; Tue, 29 May 2012 22:30:21 -0400
Received: by obbwd18 with SMTP id wd18so9625011obb.0
	for <bug-bash@gnu.org>; Tue, 29 May 2012 19:30:18 -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=qsu1m2LEwsqWwjlNSEwj3sTYF0f5bNNkh2vIt4azNQE=;
	b=xFwZuOyqlMNcjRzE3fflOMTJuZ8pkjJROxn0RDleH6ixYwZjyr2wIhadhZAXLR+pzC
	hDs29QR46KKNFENuthajUk2iuFv4+HaEQNbI8EYr/vr+6I3QO1BSwcY5uNrz25l+si/F
	LMipYaWVo9afHtwx/5g0/IdQA0/LEhj6oW/PYsUwrIfOKxAgqTHyLWB8TcMnQkgnEfHF
	mOAxThv49yxbnEWJpUVODQbUdgp6ffgtfmRAmNHIfXXQ2rvEDFcIoici3dbyYwTpVPGO
	KCr4GNIZDNUuXZn9OKz4ioUcwLnIm7sX9JHScnZbp3Gk+lGedgAu3iTQKaXHxHuyfHTp
	RacQ==
Received: by 10.182.76.169 with SMTP id l9mr13487632obw.44.1338345018291; Tue,
	29 May 2012 19:30:18 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.182.46.69 with HTTP; Tue, 29 May 2012 19:29:58 -0700 (PDT)
In-Reply-To: <CALtf9+qvO2BDHriAvi28q=kKr2j3b6KJbKLoBhs3D615y+8dLA@mail.gmail.com>
References: <CALtf9+qvO2BDHriAvi28q=kKr2j3b6KJbKLoBhs3D615y+8dLA@mail.gmail.com>
From: Quinn Fissler <qfissler@gmail.com>
Date: Wed, 30 May 2012 03:29:58 +0100
Message-ID: <CAD6paDsgBfUPPd6MyQF0GPjCDRHhK3SXh57WEKoLb+1F19m-rQ@mail.gmail.com>
Subject: Re: Compare 2 arrays.
To: Akasei Yoshiko <akasei@inoto.net>
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.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: Wed, 30 May 2012 02:30:24 -0000

See any problem here?

########
#!/bin/bash
# [PL] Porownuje dwie tablice, zwraca prawde/falsz.
set -x
A=3D( "$1" )
B=3D( "$2" )
EQUAL=3D0

if [ ${#A[@]} -eq ${#B[@]} ]; then
for id in `seq 0 2 $[ ${#A[@]} - 2 ]`; do
if [ "${A[ $id ]}" =3D=3D "${B[ $id ]}" ]; then
EQUAL=3D1
else
EQUAL=3D0
break
fi
done
fi
echo $EQUAL

########
dog@zen:/home/dog$ ./pl.bash "ls" "ls"
+ A=3D("$1")
+ B=3D("$2")
+ EQUAL=3D0
+ '[' 1 -eq 1 ']'
++ seq 0 2 -1
+ echo 0
0
dog@zen:/home/dog$

########

On 29 May 2012 17:43, Akasei Yoshiko <akasei@inoto.net> wrote:
> I have something like that:
>
>> #!/bin/bash
>> # [PL] Porownuje dwie tablice, zwraca prawde/falsz.
>>
>> A=3D( "$1" )
>> B=3D( "$2" )
>> EQUAL=3D0
>>
>> if [ ${#A[@]} -eq ${#B[@]} ]; then
>> =A0 =A0 =A0 for id in `seq 0 2 $[ ${#A[@]} - 2 ]`; do
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 if [ "${A[ $id ]}" =3D=3D "${B[ $id ]}" ]; t=
hen
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 EQUAL=3D1
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 else
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 EQUAL=3D0
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 fi
>> =A0 =A0 =A0 done
>> fi
>>
>> echo $EQUAL
>
>
> When i type:
>> user[~] $ ./compare "wget 0" "wget 0"
>> 0
>
> Returns zero.
>
> How do this properly?
>


From MAILER-DAEMON Tue May 29 23:33:07 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZZel-0007XM-9e
	for mharc-bug-bash@gnu.org; Tue, 29 May 2012 23:33:07 -0400
Received: from eggs.gnu.org ([208.118.235.92]:39635)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bill@ycc.com>) id 1SZZei-0007Wu-VD
	for bug-bash@gnu.org; Tue, 29 May 2012 23:33:06 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bill@ycc.com>) id 1SZZeh-000864-0S
	for bug-bash@gnu.org; Tue, 29 May 2012 23:33:04 -0400
Received: from mail-lpp01m010-f41.google.com ([209.85.215.41]:57185)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <bill@ycc.com>)
	id 1SZZeg-00085r-KB
	for bug-bash@gnu.org; Tue, 29 May 2012 23:33:02 -0400
Received: by lahi5 with SMTP id i5so3609188lah.0
	for <bug-bash@gnu.org>; Tue, 29 May 2012 20:32:59 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=google.com; s=20120113;
	h=mime-version:x-originating-ip:in-reply-to:references:date
	:message-id:subject:from:to:cc:content-type:x-gm-message-state;
	bh=Xi94mgAYMdarEJu0yEk6snnM3Vmgt21BmOLpukD+WbM=;
	b=crmcoS2KcN1aEZzGBZLdJKzU7E93fWfWgztUWequptckSl3dE/9WPzxQjbvtEa9MwA
	F4UT+9MPDe/uAhi45fDgUlLYfar59/t82v2LCgOVzSMAtfdnphMUPeaaFqjmEajhG1l3
	JhbtDVxFin3CJtjN5WGNFG0sZukUohcnKDET4z/gZEFUauMz3ehzKtOGoLmSUVciModR
	/crtr/jv4f3ST9aPFEG2SSBhJhjF3oM0vDskd1Tz9i7esmtfTuZhXETFVnxZL8JvB3Zh
	5/AP5t3sgGTzsh5Rr2niEMqh++p5o+nLY/fPXtnfRg9pNyhJaG74kv2IUWgR1PM1tjuZ
	i9Fw==
MIME-Version: 1.0
Received: by 10.112.82.42 with SMTP id f10mr5991452lby.95.1338348302592; Tue,
	29 May 2012 20:25:02 -0700 (PDT)
Received: by 10.112.22.1 with HTTP; Tue, 29 May 2012 20:25:02 -0700 (PDT)
X-Originating-IP: [186.2.144.204]
In-Reply-To: <CALtf9+qvO2BDHriAvi28q=kKr2j3b6KJbKLoBhs3D615y+8dLA@mail.gmail.com>
References: <CALtf9+qvO2BDHriAvi28q=kKr2j3b6KJbKLoBhs3D615y+8dLA@mail.gmail.com>
Date: Tue, 29 May 2012 21:25:02 -0600
Message-ID: <CAFyvKism-6PyxPO8FoaUFs=F5WZ83bY+7qn0tkr2ru8tfr6dXQ@mail.gmail.com>
Subject: Re: Compare 2 arrays.
From: Bill Gradwohl <bill@ycc.com>
To: Akasei Yoshiko <akasei@inoto.net>
X-Gm-Message-State: ALoCoQnjNa8TuMCVtpz7VNX+TK3uQb07Oc1D3EWilXmzkaGPyW4tysMkGur2QIlKzH+sUvtJBQcW
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.215.41
Content-Type: text/plain; charset=ISO-8859-1
X-Content-Filtered-By: Mailman/MimeDel 2.1.14
Cc: 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, 30 May 2012 03:33:06 -0000

I have no idea what the wget's are supposed to be doing, but here's a
function that will compare 2 foreign arrays and return true 0 or false 1.

compareForeignArrays(){
   ## $1 and $2 are the names of the arrays to compare.
   ## These are characters strings.

   local intermediary
   local sub

   intermediary="${1}[@]"
   local -a leftValue=("${!intermediary}")

   intermediary="${2}[@]"
   local -a rightValue=("${!intermediary}")

   local -a leftSub
   eval leftSub=(\"\${!${1}[@]}\")

   local -a rightSub
   eval rightSub=(\"\${!${2}[@]}\")

   [ ${#leftSub[@]} -ne ${#rightSub[@]} ] || \
   [ ${#leftValue[@]} -ne ${#rightValue[@]} ] && return 1

   for ((sub=0; sub<${#leftSub[@]}; ++sub)); do
      [ "${leftSub[sub]}" -ne "${rightSub[sub]}" ] && return 1
   done

   for ((sub=0; sub<${#leftValue[@]}; ++sub)); do
      [ "${leftValue[sub]}" -ne "${rightValue[sub]}" ] && return 1
   done

   return 0
}

declare -a this=(1 2 3 4 5)
declare -a that=(1 2 3 4 5)
compareForeignArrays this that && echo Equal || echo NOT Equal

declare -a yours=(10 20 30 40)
declare -a mine=(10 21 30 40)
compareForeignArrays yours mine && echo Equal || echo NOT Equal

declare -a red=(1 2 3 4 5)
declare -a blue=(1 2 3 4)
compareForeignArrays red blue && echo Equal || echo NOT Equal

declare -a night=(1 2 [7]=3 4 5)
declare -a day=(1 2 [6]=3 4 5)
compareForeignArrays night day && echo Equal || echo NOT Equal



-- 
Bill Gradwohl

From MAILER-DAEMON Wed May 30 08:34:31 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZi6h-0000OJ-F5
	for mharc-bug-bash@gnu.org; Wed, 30 May 2012 08:34:31 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48655)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SZi6b-0000Mn-3o
	for bug-bash@gnu.org; Wed, 30 May 2012 08:34:30 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SZi6S-0000qr-Fl
	for bug-bash@gnu.org; Wed, 30 May 2012 08:34:24 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:50309
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SZi6S-0000nH-9A
	for bug-bash@gnu.org; Wed, 30 May 2012 08:34:16 -0400
Received: (qmail 3549 invoked from network); 30 May 2012 12:33:50 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Wed, 30 May 2012 08:33:50 -0400
Received: (qmail 12157 invoked by uid 563); 30 May 2012 12:33:49 -0000
Date: Wed, 30 May 2012 08:33:49 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: bug-bash@gnu.org
Subject: Re: Compare 2 arrays.
Message-ID: <20120530123349.GI1506@eeg.ccf.org>
References: <CALtf9+qvO2BDHriAvi28q=kKr2j3b6KJbKLoBhs3D615y+8dLA@mail.gmail.com>
	<CAFyvKism-6PyxPO8FoaUFs=F5WZ83bY+7qn0tkr2ru8tfr6dXQ@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAFyvKism-6PyxPO8FoaUFs=F5WZ83bY+7qn0tkr2ru8tfr6dXQ@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: Wed, 30 May 2012 12:34:30 -0000

On Tue, May 29, 2012 at 09:25:02PM -0600, Bill Gradwohl wrote:
> I have no idea what the wget's are supposed to be doing, but here's a
> function that will compare 2 foreign arrays and return true 0 or false 1.
> 
> compareForeignArrays(){
>    ## $1 and $2 are the names of the arrays to compare.
>    ## These are characters strings.
> 
>    local intermediary
>    local sub
> 
>    intermediary="${1}[@]"
>    local -a leftValue=("${!intermediary}")

Hacks like this are precisely why I stress that such functions *should
not* be written in bash.  If you want to compare two arrays, use a loop,
without wrapping a function around it.  That way you have access to the
arrays directly, by their actual names, in the actual context where they
are defined.

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

I don't know whether the tmp="$1[@]"; x=("${!tmp}") trick is a bug or
a feature.  It's certainly undocumented.  I don't know whether it will
go away in some future version of bash, with or without a notification in
the changelog, since it looks like a bug that people are exploiting.


From MAILER-DAEMON Wed May 30 11:05:29 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZkSn-0005rR-As
	for mharc-bug-bash@gnu.org; Wed, 30 May 2012 11:05:29 -0400
Received: from eggs.gnu.org ([208.118.235.92]:40341)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1SZkSd-0005pK-Av
	for bug-bash@gnu.org; Wed, 30 May 2012 11:05:27 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1SZkSX-0007LF-2Y
	for bug-bash@gnu.org; Wed, 30 May 2012 11:05:18 -0400
Received: from mail-ob0-f169.google.com ([209.85.214.169]:48738)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1SZkSW-0007K7-RQ
	for bug-bash@gnu.org; Wed, 30 May 2012 11:05:12 -0400
Received: by obbwd18 with SMTP id wd18so10673455obb.0
	for <bug-bash@gnu.org>; Wed, 30 May 2012 08:05:09 -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=CDGOdJPYQ3WF7OiRuwvhCbjpchtysqhxx5Xgb9DweKA=;
	b=q3oTovdnHWYMGCZcCXWKVgWrw+Tye0QjzHNX0ts9anH2qP6gfUkq1e4kgCJnWgtTDU
	U4Sy7bWrBNTe6DDK8SBzvzBGhmWfmLb4a6nz5wLZUE2+ZIUQDf+PpuS8cMK1mmdYClqC
	DQaE6s1/gOPFnpZW+w5At4EXOJngr4kKViyn72Lh9qix4/t13Sn8Eu+RFsoeLwrR6gF7
	WIg1cImtwox0r+KKJ3X8ZcbLeV7lefwjtNm7MxfejYfYkbQWdt12WNqYzsW6IUUM9HeB
	1Wf3YPwLV7+aeRkivu3z13heGPXdYLTM0erfJS8wdZn6qJbjsa74BZosDJ9UCjZ/+NED
	RtGA==
MIME-Version: 1.0
Received: by 10.182.167.104 with SMTP id zn8mr7184739obb.62.1338390309676;
	Wed, 30 May 2012 08:05:09 -0700 (PDT)
Sender: pyroinajar@gmail.com
Received: by 10.60.133.47 with HTTP; Wed, 30 May 2012 08:05:09 -0700 (PDT)
In-Reply-To: <4FC4C23E.4050003@qsl.net>
References: <jq05rk$nd7$1@dough.gmane.org> <4FC4BD36.3030806@case.edu>
	<4FC4C23E.4050003@qsl.net>
Date: Wed, 30 May 2012 11:05:09 -0400
X-Google-Sender-Auth: Nrmdpv7z_iKJ7nO9bsesy4TnTSU
Message-ID: <CAPg6Z087LWmAYgWdc-AYcVfOwHF-iwmxM8L_11V+mqHwaCkF5w@mail.gmail.com>
Subject: Re: Red-Hat Bug 825751 - bash-completion fails on environment
	variables
From: DJ Mills <danielmills1@gmail.com>
To: "John E. Malmberg" <wb8tyw@qsl.net>
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@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: Wed, 30 May 2012 15:05:27 -0000

On Tue, May 29, 2012 at 8:34 AM, John E. Malmberg <wb8tyw@qsl.net> wrote:
>
> On this platform, file names with $ in them tend to show up as they have
> special meaning.
>
> BASH-4.2$ echo *\$*
> GNV$BASH.DSF GNV$BASH.EXE GNV$BASH.MAP GNV$SHELL.C_FIRST GNV$VERSION.C_FIRST
> gnv$bash_startup.com gnv$main_wrapper gnv$vms_main_link.exe
>
> Regards,
> -John
>

Pathname expansion doesn't perform any escaping... this is a
completely separate thing from the readline tab completion issue.

touch 'foo bar' 'baz blah'; echo *\ *
baz blah foo bar

echo takes its arguments and concatenates them with spaces... using
printf can show that they're properly escaped.
touch 'foo bar' 'baz blah'; printf '<%s> ' *\ *; echo
<baz blah> <foo bar>


From MAILER-DAEMON Wed May 30 12:14:50 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZlXu-00021n-RQ
	for mharc-bug-bash@gnu.org; Wed, 30 May 2012 12:14:50 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44206)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bill@ycc.com>) id 1SZlXr-00020j-Td
	for bug-bash@gnu.org; Wed, 30 May 2012 12:14:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bill@ycc.com>) id 1SZlXp-0003tg-Q8
	for bug-bash@gnu.org; Wed, 30 May 2012 12:14:47 -0400
Received: from mail-lpp01m010-f41.google.com ([209.85.215.41]:37181)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <bill@ycc.com>)
	id 1SZlXp-0003ta-Dy
	for bug-bash@gnu.org; Wed, 30 May 2012 12:14:45 -0400
Received: by lahi5 with SMTP id i5so4189012lah.0
	for <bug-bash@gnu.org>; Wed, 30 May 2012 09:14:42 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=google.com; s=20120113;
	h=mime-version:x-originating-ip:in-reply-to:references:date
	:message-id:subject:from:cc:content-type:x-gm-message-state;
	bh=POQCaol5ATMsVjKVfqkTIjVPnfeIN6odAA26uhumIEc=;
	b=c0INmFePNJYpwGRVxAkTKlN2NwCvjBQtDx6Q8itQzCKzPwky2JBZ8q7TsCI0xKbB1Q
	W5/oe93XxSbbAY+Wc5kzUq5dxqe1DeEBAvGc9m/wJc3jO9RDglRt+0t3NjHHjCWeG8am
	bRJdZAcVRDnrpiYhGGCEUAJxCWwmS2HF4pVQze7+9LT3Brpl7dmD0i+yEV4dCBj1exDK
	qVxZ7XLuLoca8hetgPWnJfLWCeKtEomQRW05EnIjBzIAqkxQc3RCF4vWFo/zpMz+NV4w
	m0ca8U6rlPlzT4A3YdLPrrji2QKOKlo5IWV8xJ34SKz+QT6ov+0Q6qmIewwfPnr5oy/p
	I5GQ==
MIME-Version: 1.0
Received: by 10.152.112.233 with SMTP id it9mr16050963lab.40.1338394482670;
	Wed, 30 May 2012 09:14:42 -0700 (PDT)
Received: by 10.112.22.1 with HTTP; Wed, 30 May 2012 09:14:42 -0700 (PDT)
X-Originating-IP: [186.2.144.237]
In-Reply-To: <20120530123349.GI1506@eeg.ccf.org>
References: <CALtf9+qvO2BDHriAvi28q=kKr2j3b6KJbKLoBhs3D615y+8dLA@mail.gmail.com>
	<CAFyvKism-6PyxPO8FoaUFs=F5WZ83bY+7qn0tkr2ru8tfr6dXQ@mail.gmail.com>
	<20120530123349.GI1506@eeg.ccf.org>
Date: Wed, 30 May 2012 10:14:42 -0600
Message-ID: <CAFyvKivTSDCNt_4jy1QOKCrq49ciJ+gW2UhT9bM5NxHeRNNUYw@mail.gmail.com>
Subject: Re: Compare 2 arrays.
From: Bill Gradwohl <bill@ycc.com>
Cc: bug-bash@gnu.org
X-Gm-Message-State: ALoCoQm2oKZS+h+MbKzuH0r7c/Hsfr25LXKXyqmCst5K48KeULMekhu0IMXRzzGdCC8AvFGSxou9
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.215.41
Content-Type: text/plain; charset=ISO-8859-1
X-Content-Filtered-By: Mailman/MimeDel 2.1.14
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, 30 May 2012 16:14:49 -0000

On Wed, May 30, 2012 at 6:33 AM, Greg Wooledge <wooledg@eeg.ccf.org> wrote:

>
> Hacks like this are precisely why I stress that such functions *should
> not* be written in bash.  If you want to compare two arrays, use a loop,
> without wrapping a function around it.  That way you have access to the
> arrays directly, by their actual names, in the actual context where they
> are defined.
>

The term hack is used when something is in dispute - is it a bug or a
feature? If a bug, has it been declared so and will it get fixed? So many
things in bash are undocumented so the complete feature list is
indeterminate.

So, If I have several arrays to test, I should duplicate the code once for
each array?
I shouldn't put it into a function but instead I should reinvent the wheel
every time I need this?

Admittedly, bash doesn't go out of its way to highlight this technique, but
it does work.

What say you Chet? Bug or feature? There is no middle ground.


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

I believe we're quibbling over the officialness of the solution I provided
to the poster. Obviously bash does support a way of manipulating a foreign
array. I'd like it to be more obvious with something like a nameref as you
suggest, but it's not there.

Every disto I know of uses bash as its default. That's why people use it -
because its suggested by the disto assemblers and because it's there. Bash
is part of the GNU family and many people mistakenly think of GNU as Linux.
By extension, bash has tremendous mind share, is prominently featured and
is what people expect. In the 12 years I've used Linux exclusively, I've
never used any shell but bash.

I wish bash had something akin to C pointers and address arithmetic.
I wish it had pass by reference.
I wish it had a C style prototype as a function definition.
I wish I could set a shopt that would fail a script for an undeclared
variable.
I wish it could return more than just an 8 bit return code.
I wish it had a more robust concept of name space so variables wouldn't
bump into each other.
I wish local really meant local and something further on down the call
chain couldn't access it.
I wish sub functions were hidden from the outside world and only accessible
from within the containing function.

I wish bash had lots of things it doesn't, and yet it does a fine job as a
command interpreter. I have to find alternatives for what I want or need,
but they are there.

...there are dark corners in the Bourne shell, and people use all of them.
-- Chet Ramey

I'm just using one of those dark corners.

-- 
Bill Gradwohl

From MAILER-DAEMON Wed May 30 12:58:03 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZmDj-0000aF-ER
	for mharc-bug-bash@gnu.org; Wed, 30 May 2012 12:58:03 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57735)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SZmDh-0000ZQ-F3
	for bug-bash@gnu.org; Wed, 30 May 2012 12:58:02 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SZmDb-0006sJ-D8
	for bug-bash@gnu.org; Wed, 30 May 2012 12:58:01 -0400
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:50375
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1SZmDb-0006s3-7p
	for bug-bash@gnu.org; Wed, 30 May 2012 12:57:55 -0400
Received: (qmail 6086 invoked from network); 30 May 2012 16:57:50 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Wed, 30 May 2012 12:57:50 -0400
Received: (qmail 12468 invoked by uid 563); 30 May 2012 16:57:50 -0000
Date: Wed, 30 May 2012 12:57:50 -0400
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: bug-bash@gnu.org
Subject: Re: Compare 2 arrays.
Message-ID: <20120530165750.GK1506@eeg.ccf.org>
References: <CALtf9+qvO2BDHriAvi28q=kKr2j3b6KJbKLoBhs3D615y+8dLA@mail.gmail.com>
	<CAFyvKism-6PyxPO8FoaUFs=F5WZ83bY+7qn0tkr2ru8tfr6dXQ@mail.gmail.com>
	<20120530123349.GI1506@eeg.ccf.org>
	<CAFyvKivTSDCNt_4jy1QOKCrq49ciJ+gW2UhT9bM5NxHeRNNUYw@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAFyvKivTSDCNt_4jy1QOKCrq49ciJ+gW2UhT9bM5NxHeRNNUYw@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: Wed, 30 May 2012 16:58:03 -0000

On Wed, May 30, 2012 at 10:14:42AM -0600, Bill Gradwohl wrote:
> What say you Chet? Bug or feature? There is no middle ground.

That's unrealistic.  There are plenty of things that occupy that middle
ground -- unexpected program behaviors.  The programmer can never
anticipate *every* input sequence that users will throw at the software,
so some of them may cause surprises.

The danger of using unexpected program behaviors in your applications
is that the behaviors may change without warning in a future version of
the program.  The programmer may not even be aware that this behavior
exists, let alone that people are using it.  A clean-up of the parser
(or similar change) may make the behavior go away, or change.

http://mywiki.wooledge.org/BashFAQ/006 has this to say on the matter
(right after demonstrating ksh93's nameref):

  We are not aware of any trick that can duplicate that functionality
  in POSIX or Bourne shells (short of using eval, which is extremely
  difficult to do securely). Bash can almost do it -- some indirect
  array tricks work, and others do not, and we do not know whether the
  syntax involved will remain stable in future releases. So, consider
  this a use at your own risk hack.

  # Bash -- trick #1.  Seems to work in bash 2 and up.
  realarray=(...) ref=realarray; index=2
  tmp="$ref[$index]"
  echo "${!tmp}"            # gives array element [2]

  # Bash -- trick #2.  Seems to work in bash 3 and up.
  # Does NOT work in bash 2.05b.
  tmp="$ref[@]"
  printf "<%s> " "${!tmp}"; echo    # Iterate whole array.

I added that on 2011-05-02 after Buglouse described it on IRC.  I'm fairly
certain that EVERYONE else in the channel at the time was as surprised
by it as I was.


From MAILER-DAEMON Wed May 30 14:28:52 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZndc-0000Zx-D2
	for mharc-bug-bash@gnu.org; Wed, 30 May 2012 14:28:52 -0400
Received: from eggs.gnu.org ([208.118.235.92]:55088)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bill@ycc.com>) id 1SZnda-0000Zr-6M
	for bug-bash@gnu.org; Wed, 30 May 2012 14:28:51 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bill@ycc.com>) id 1SZndX-0007kY-Pe
	for bug-bash@gnu.org; Wed, 30 May 2012 14:28:49 -0400
Received: from mail-lb0-f169.google.com ([209.85.217.169]:57541)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <bill@ycc.com>)
	id 1SZndX-0007js-Co
	for bug-bash@gnu.org; Wed, 30 May 2012 14:28:47 -0400
Received: by lbjn8 with SMTP id n8so273046lbj.0
	for <bug-bash@gnu.org>; Wed, 30 May 2012 11:28:44 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=google.com; s=20120113;
	h=mime-version:x-originating-ip:in-reply-to:references:date
	:message-id:subject:from:cc:content-type:x-gm-message-state;
	bh=3KAFYpFNG9wKLh8W+i/FbV1wMELtMyd8ylYhwoFYHaU=;
	b=LyuXDMNhqkiip2KuR+7Iw0Yj9vhzBcMfIgEhgKpJwm/X7rekfdahcpuEbUE4G7UeE+
	BVbBwoni4LW2NurUrni/PdGcPTWwentZZ4U1BvHKVyrKhkFQaAety7kABr9lS20SGK/V
	nYH2YmGcB7p7PHglGSLYvghIck5zMdOhseUGf8E5fx/hEKiw9wgZD1q38ismlswz8lzi
	RSavLlCQUvu+RvMpPqxMdCcNnpuiHxOgxnCzDZu8Hj8U4SXfmnXLblTXJrkcUoq65SDi
	J2Dmelweq1UIadwNU7Vc6Iva0tL6l/2SXeFxvjGkmeZZ4lzPTjiplCA1ZhD2PnbmGC4z
	tqdg==
MIME-Version: 1.0
Received: by 10.152.112.34 with SMTP id in2mr16620607lab.6.1338402524514; Wed,
	30 May 2012 11:28:44 -0700 (PDT)
Received: by 10.112.22.1 with HTTP; Wed, 30 May 2012 11:28:44 -0700 (PDT)
X-Originating-IP: [186.2.144.237]
In-Reply-To: <20120530165750.GK1506@eeg.ccf.org>
References: <CALtf9+qvO2BDHriAvi28q=kKr2j3b6KJbKLoBhs3D615y+8dLA@mail.gmail.com>
	<CAFyvKism-6PyxPO8FoaUFs=F5WZ83bY+7qn0tkr2ru8tfr6dXQ@mail.gmail.com>
	<20120530123349.GI1506@eeg.ccf.org>
	<CAFyvKivTSDCNt_4jy1QOKCrq49ciJ+gW2UhT9bM5NxHeRNNUYw@mail.gmail.com>
	<20120530165750.GK1506@eeg.ccf.org>
Date: Wed, 30 May 2012 12:28:44 -0600
Message-ID: <CAFyvKitwvd_XrEmA5vWTYrNf+79M-VPS58veqDMcbTr-7KRr_w@mail.gmail.com>
Subject: Re: Compare 2 arrays.
From: Bill Gradwohl <bill@ycc.com>
Cc: bug-bash@gnu.org
X-Gm-Message-State: ALoCoQla9OaPXMJO8SuDYwF5D4+dmM7qFSuuESH++Fo7Z+o/iKue2KJcz7WCoYyZZvrZkl/9NlDy
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.217.169
Content-Type: text/plain; charset=ISO-8859-1
X-Content-Filtered-By: Mailman/MimeDel 2.1.14
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 30 May 2012 18:28:51 -0000

On Wed, May 30, 2012 at 10:57 AM, Greg Wooledge <wooledg@eeg.ccf.org> wrote:

> There are plenty of things that occupy that middle
> ground -- unexpected program behaviors.  The programmer can never
> anticipate *every* input sequence that users will throw at the software,
> so some of them may cause surprises.
>
> True enough!

Where is it written that this is not legitimate? Where is it written that
it is? In the absence of formal documentation one way or the other, the
product itself arbitrates the matter. In this case bash says its legit
because it works.

Once something has been identified as belonging in that gray area, a
determination has to be made one way or the other as to what to do about
it. Leaving it unresolved adds uncertainty which is never a good thing.

Clearly this "feature" is a needed part of the language. Coding around its
non existence is either impossible in your case or as you say, a hack in
mine. So do we simply stop and hold our collective breath till X number of
releases go by to see what happened or do we get a determination? I would
prefer something cleaner and well documented, but I'll use what is
available till then.

To change bash to search out the existing capability and stop it would be
counter productive. The same effort could probably provide a documented new
feature similar to nameref in ksh. I'd use that feature in an instant if it
were available.

The danger of using unexpected program behaviors in your applications
> is that the behaviors may change without warning in a future version of
> the program.  The programmer may not even be aware that this behavior
> exists, let alone that people are using it.  A clean-up of the parser
> (or similar change) may make the behavior go away, or change.
>
>
You say it's unexpected behavior. I'll agree it's using what the product
provides in a way that isn't obvious, but why is that necessarily bad? If
it goes away in the future, I expect it will do so because something
documented replaced it. Progress demands that the next release should be at
least as capable as the current one and since the current one provides
access to a foreign array as I demonstrated, the next release should also.
Hopefully well documented.

Using the tool you have now and doing something is better than waiting and
doing nothing in the interim.

-- 
Bill Gradwohl

From MAILER-DAEMON Wed May 30 16:26:53 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZpTp-0004lg-9Y
	for mharc-bug-bash@gnu.org; Wed, 30 May 2012 16:26:53 -0400
Received: from eggs.gnu.org ([208.118.235.92]:54658)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SZpTm-0004ju-JN
	for bug-bash@gnu.org; Wed, 30 May 2012 16:26:51 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SZpTk-0002KT-Rs
	for bug-bash@gnu.org; Wed, 30 May 2012 16:26:50 -0400
Received: from mail-out.m-online.net ([212.18.0.10]:52561)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1SZpTk-0002Ju-Ll
	for bug-bash@gnu.org; Wed, 30 May 2012 16:26:48 -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 3W2jyJ5D4bz3hhXr
	for <bug-bash@gnu.org>; Wed, 30 May 2012 22:26:48 +0200 (CEST)
Received: from igel.home (ppp-93-104-155-151.dynamic.mnet-online.de
	[93.104.155.151])
	by mail.mnet-online.de (Postfix) with ESMTPA id 3W2jyH1pstz4KK3p
	for <bug-bash@gnu.org>; Wed, 30 May 2012 22:26:47 +0200 (CEST)
Received: by igel.home (Postfix, from userid 501)
	id CAA6FCA2A2; Wed, 30 May 2012 22:26:46 +0200 (CEST)
From: Andreas Schwab <schwab@linux-m68k.org>
To: bug-bash@gnu.org
Subject: bashref.texi typos
X-Yow: I appoint you ambassador to Fantasy Island!!!
Date: Wed, 30 May 2012 22:26:46 +0200
Message-ID: <m2lik99zzt.fsf@igel.home>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.97 (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
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, 30 May 2012 20:26:51 -0000

diff --git a/doc/bashref.texi b/doc/bashref.texi
index 19c56c1..9fa99dc 100644
--- a/doc/bashref.texi
+++ b/doc/bashref.texi
@@ -1795,7 +1795,7 @@ Bash uses the value of the variable formed from the rest of
 expanded and that value is used in the rest of the substitution, rather
 than the value of @var{parameter} itself.
 This is known as @code{indirect expansion}.
-The exceptions to this are the expansions of $@{!@var{prefix}@*@}
+The exceptions to this are the expansions of $@{!@var{prefix}*@}
 and $@{!@var{name}[@@]@}
 described below.
 The exclamation point must immediately follow the left brace in order to
@@ -8053,7 +8053,7 @@ which matches @var{pattern} and replaces it with @var{replacement} in
 the value of @code{var}, is available (@pxref{Shell Parameter Expansion}).
 
 @item
-The expansion @code{$@{!@var{prefix@}*}} expansion, which expands to
+The expansion @code{$@{!@var{prefix*@}}}, which expands to
 the names of all shell variables whose names begin with @var{prefix},
 is available (@pxref{Shell Parameter Expansion}).
 
-- 
1.7.10.3


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 May 30 22:00:42 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZugs-0003zG-OQ
	for mharc-bug-bash@gnu.org; Wed, 30 May 2012 22:00:42 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60805)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SZugo-0003yE-7p
	for bug-bash@gnu.org; Wed, 30 May 2012 22:00:40 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SZugk-0003XH-SE
	for bug-bash@gnu.org; Wed, 30 May 2012 22:00:37 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:64925)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SZugk-0003X4-MK
	for bug-bash@gnu.org; Wed, 30 May 2012 22:00:34 -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 BLH38301;
	Wed, 30 May 2012 22:00:32 -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 AXY79212; Wed, 30 May 2012 22:00:31 -0400 (EDT)
Date: Wed, 30 May 2012 21:59:54 -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 29
Message-ID: <120531015954.AA53541.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: Thu, 31 May 2012 02:00:40 -0000

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

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

Bug-Reported-by:	"Michael Kalisz" <michael@kalisz.homelinux.net>
Bug-Reference-ID:	<50241.78.69.11.112.1298585641.squirrel@kalisz.homelinux.net>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00274.html

Bug-Description:

Bash-4.2 tries to leave completed directory names as the user typed them,
without expanding them to a full pathname.  One effect of this is that
shell variables used in pathnames being completed (e.g., $HOME) are left
unchanged, but the `$' is quoted by readline because it is a special
character to the shell.

This patch introduces two things:

1.  A new shell option, `direxpand', which, if set, attempts to emulate the
    bash-4.1 behavior of expanding words to full pathnames during
    completion;
2.  A set of heuristics that reduce the number of times special characters
    such as `$' are quoted when the directory name is not expanded.

Patch (apply with `patch -p0'):

diff -NrC 2 ../bash-4.2-patched/bashline.c ./bashline.c
*** ../bash-4.2-patched/bashline.c	2011-01-16 15:32:47.000000000 -0500
--- ./bashline.c	2012-05-07 16:27:18.000000000 -0400
***************
*** 122,125 ****
--- 122,128 ----
  static int bash_push_line __P((void));
  
+ static rl_icppfunc_t *save_directory_hook __P((void));
+ static void reset_directory_hook __P((rl_icppfunc_t *));
+ 
  static void cleanup_expansion_error __P((void));
  static void maybe_make_readline_line __P((char *));
***************
*** 244,251 ****
--- 247,261 ----
  int dircomplete_spelling = 0;
  
+ /* Expand directory names during word/filename completion. */
+ int dircomplete_expand = 0;
+ int dircomplete_expand_relpath = 0;
+ 
  static char *bash_completer_word_break_characters = " \t\n\"'@><=;|&(:";
  static char *bash_nohostname_word_break_characters = " \t\n\"'><=;|&(:";
  /* )) */
  
+ static const char *default_filename_quote_characters = " \t\n\\\"'@<>=;|&()#$`?*[!:{~";	/*}*/
+ static char *custom_filename_quote_characters = 0;
+ 
  static rl_hook_func_t *old_rl_startup_hook = (rl_hook_func_t *)NULL;
  
***************
*** 502,506 ****
    /* Tell the completer that we might want to follow symbolic links or
       do other expansion on directory names. */
!   rl_directory_rewrite_hook = bash_directory_completion_hook;
  
    rl_filename_rewrite_hook = bash_filename_rewrite_hook;
--- 512,516 ----
    /* Tell the completer that we might want to follow symbolic links or
       do other expansion on directory names. */
!   set_directory_hook ();
  
    rl_filename_rewrite_hook = bash_filename_rewrite_hook;
***************
*** 530,534 ****
  
    /* characters that need to be quoted when appearing in filenames. */
!   rl_filename_quote_characters = " \t\n\\\"'@<>=;|&()#$`?*[!:{~";	/*}*/
  
    rl_filename_quoting_function = bash_quote_filename;
--- 540,544 ----
  
    /* characters that need to be quoted when appearing in filenames. */
!   rl_filename_quote_characters = default_filename_quote_characters;
  
    rl_filename_quoting_function = bash_quote_filename;
***************
*** 565,570 ****
    rl_attempted_completion_function = attempt_shell_completion;
    rl_completion_entry_function = NULL;
-   rl_directory_rewrite_hook = bash_directory_completion_hook;
    rl_ignore_some_completions_function = filename_completion_ignore;
  }
  
--- 575,582 ----
    rl_attempted_completion_function = attempt_shell_completion;
    rl_completion_entry_function = NULL;
    rl_ignore_some_completions_function = filename_completion_ignore;
+   rl_filename_quote_characters = default_filename_quote_characters;
+ 
+   set_directory_hook ();
  }
  
***************
*** 1280,1283 ****
--- 1292,1298 ----
    rl_ignore_some_completions_function = filename_completion_ignore;
  
+   rl_filename_quote_characters = default_filename_quote_characters;
+   set_directory_hook ();
+ 
    /* Determine if this could be a command word.  It is if it appears at
       the start of the line (ignoring preceding whitespace), or if it
***************
*** 1592,1595 ****
--- 1607,1616 ----
  	  else
  	    {
+ 	     if (dircomplete_expand && dot_or_dotdot (filename_hint))
+ 		{
+ 		  dircomplete_expand = 0;
+ 		  set_directory_hook ();
+ 		  dircomplete_expand = 1;
+ 		}
  	      mapping_over = 4;
  	      goto inner;
***************
*** 1792,1795 ****
--- 1813,1819 ----
   inner:
    val = rl_filename_completion_function (filename_hint, istate);
+   if (mapping_over == 4 && dircomplete_expand)
+     set_directory_hook ();
+ 
    istate = 1;
  
***************
*** 2694,2697 ****
--- 2718,2767 ----
  }
  
+ /* Functions to save and restore the appropriate directory hook */
+ /* This is not static so the shopt code can call it */
+ void
+ set_directory_hook ()
+ {
+   if (dircomplete_expand)
+     {
+       rl_directory_completion_hook = bash_directory_completion_hook;
+       rl_directory_rewrite_hook = (rl_icppfunc_t *)0;
+     }
+   else
+     {
+       rl_directory_rewrite_hook = bash_directory_completion_hook;
+       rl_directory_completion_hook = (rl_icppfunc_t *)0;
+     }
+ }
+ 
+ static rl_icppfunc_t *
+ save_directory_hook ()
+ {
+   rl_icppfunc_t *ret;
+ 
+   if (dircomplete_expand)
+     {
+       ret = rl_directory_completion_hook;
+       rl_directory_completion_hook = (rl_icppfunc_t *)NULL;
+     }
+   else
+     {
+       ret = rl_directory_rewrite_hook;
+       rl_directory_rewrite_hook = (rl_icppfunc_t *)NULL;
+     }
+ 
+   return ret;
+ }
+ 
+ static void
+ restore_directory_hook (hookf)
+      rl_icppfunc_t *hookf;
+ {
+   if (dircomplete_expand)
+     rl_directory_completion_hook = hookf;
+   else
+     rl_directory_rewrite_hook = hookf;
+ }
+ 
  /* Handle symbolic link references and other directory name
     expansions while hacking completion.  This should return 1 if it modifies
***************
*** 2703,2720 ****
  {
    char *local_dirname, *new_dirname, *t;
!   int return_value, should_expand_dirname;
    WORD_LIST *wl;
    struct stat sb;
  
!   return_value = should_expand_dirname = 0;
    local_dirname = *dirname;
  
!   if (mbschr (local_dirname, '$'))
!     should_expand_dirname = 1;
    else
      {
        t = mbschr (local_dirname, '`');
        if (t && unclosed_pair (local_dirname, strlen (local_dirname), "`") == 0)
! 	should_expand_dirname = 1;
      }
  
--- 2773,2801 ----
  {
    char *local_dirname, *new_dirname, *t;
!   int return_value, should_expand_dirname, nextch, closer;
    WORD_LIST *wl;
    struct stat sb;
  
!   return_value = should_expand_dirname = nextch = closer = 0;
    local_dirname = *dirname;
  
!   if (t = mbschr (local_dirname, '$'))
!     {
!       should_expand_dirname = '$';
!       nextch = t[1];
!       /* Deliberately does not handle the deprecated $[...] arithmetic
! 	 expansion syntax */
!       if (nextch == '(')
! 	closer = ')';
!       else if (nextch == '{')
! 	closer = '}';
!       else
! 	nextch = 0;
!     }
    else
      {
        t = mbschr (local_dirname, '`');
        if (t && unclosed_pair (local_dirname, strlen (local_dirname), "`") == 0)
! 	should_expand_dirname = '`';
      }
  
***************
*** 2740,2743 ****
--- 2821,2841 ----
  	  dispose_words (wl);
  	  local_dirname = *dirname;
+ 	  /* XXX - change rl_filename_quote_characters here based on
+ 	     should_expand_dirname/nextch/closer.  This is the only place
+ 	     custom_filename_quote_characters is modified. */
+ 	  if (rl_filename_quote_characters && *rl_filename_quote_characters)
+ 	    {
+ 	      int i, j, c;
+ 	      i = strlen (default_filename_quote_characters);
+ 	      custom_filename_quote_characters = xrealloc (custom_filename_quote_characters, i+1);
+ 	      for (i = j = 0; c = default_filename_quote_characters[i]; i++)
+ 		{
+ 		  if (c == should_expand_dirname || c == nextch || c == closer)
+ 		    continue;
+ 		  custom_filename_quote_characters[j++] = c;
+ 		}
+ 	      custom_filename_quote_characters[j] = '\0';
+ 	      rl_filename_quote_characters = custom_filename_quote_characters;
+ 	    }
  	}
        else
***************
*** 2759,2762 ****
--- 2857,2871 ----
      }
  
+   /* no_symbolic_links == 0 -> use (default) logical view of the file system.
+      local_dirname[0] == '.' && local_dirname[1] == '/' means files in the
+      current directory (./).
+      local_dirname[0] == '.' && local_dirname[1] == 0 means relative pathnames
+      in the current directory (e.g., lib/sh).
+      XXX - should we do spelling correction on these? */
+ 
+   /* This is test as it was in bash-4.2: skip relative pathnames in current
+      directory.  Change test to
+       (local_dirname[0] != '.' || (local_dirname[1] && local_dirname[1] != '/'))
+      if we want to skip paths beginning with ./ also. */
    if (no_symbolic_links == 0 && (local_dirname[0] != '.' || local_dirname[1]))
      {
***************
*** 2764,2767 ****
--- 2873,2885 ----
        int len1, len2;
  
+       /* If we have a relative path
+       		(local_dirname[0] != '/' && local_dirname[0] != '.')
+ 	 that is canonical after appending it to the current directory, then
+ 	 	temp1 = temp2+'/'
+ 	 That is,
+ 	 	strcmp (temp1, temp2) == 0
+ 	 after adding a slash to temp2 below.  It should be safe to not
+ 	 change those.
+       */
        t = get_working_directory ("symlink-hook");
        temp1 = make_absolute (local_dirname, t);
***************
*** 2798,2802 ****
  	    }
  	}
!       return_value |= STREQ (local_dirname, temp2) == 0;
        free (local_dirname);
        *dirname = temp2;
--- 2916,2928 ----
  	    }
  	}
! 
!       /* dircomplete_expand_relpath == 0 means we want to leave relative
! 	 pathnames that are unchanged by canonicalization alone.
! 	 *local_dirname != '/' && *local_dirname != '.' == relative pathname
! 	 (consistent with general.c:absolute_pathname())
! 	 temp1 == temp2 (after appending a slash to temp2) means the pathname
! 	 is not changed by canonicalization as described above. */
!       if (dircomplete_expand_relpath || ((local_dirname[0] != '/' && local_dirname[0] != '.') && STREQ (temp1, temp2) == 0))
! 	return_value |= STREQ (local_dirname, temp2) == 0;
        free (local_dirname);
        *dirname = temp2;
***************
*** 3003,3012 ****
    orig_func = rl_completion_entry_function;
    orig_attempt_func = rl_attempted_completion_function;
-   orig_dir_func = rl_directory_rewrite_hook;
    orig_ignore_func = rl_ignore_some_completions_function;
    orig_rl_completer_word_break_characters = rl_completer_word_break_characters;
    rl_completion_entry_function = rl_filename_completion_function;
    rl_attempted_completion_function = (rl_completion_func_t *)NULL;
-   rl_directory_rewrite_hook = (rl_icppfunc_t *)NULL;
    rl_ignore_some_completions_function = filename_completion_ignore;
    rl_completer_word_break_characters = " \t\n\"\'";
--- 3129,3139 ----
    orig_func = rl_completion_entry_function;
    orig_attempt_func = rl_attempted_completion_function;
    orig_ignore_func = rl_ignore_some_completions_function;
    orig_rl_completer_word_break_characters = rl_completer_word_break_characters;
+ 
+   orig_dir_func = save_directory_hook ();
+ 
    rl_completion_entry_function = rl_filename_completion_function;
    rl_attempted_completion_function = (rl_completion_func_t *)NULL;
    rl_ignore_some_completions_function = filename_completion_ignore;
    rl_completer_word_break_characters = " \t\n\"\'";
***************
*** 3016,3023 ****
    rl_completion_entry_function = orig_func;
    rl_attempted_completion_function = orig_attempt_func;
-   rl_directory_rewrite_hook = orig_dir_func;
    rl_ignore_some_completions_function = orig_ignore_func;
    rl_completer_word_break_characters = orig_rl_completer_word_break_characters;
  
    return r;
  }
--- 3143,3151 ----
    rl_completion_entry_function = orig_func;
    rl_attempted_completion_function = orig_attempt_func;
    rl_ignore_some_completions_function = orig_ignore_func;
    rl_completer_word_break_characters = orig_rl_completer_word_break_characters;
  
+   restore_directory_hook (orig_dir_func);
+ 
    return r;
  }
diff -NrC 2 ../bash-4.2-patched/bashline.h ./bashline.h
*** ../bash-4.2-patched/bashline.h	2009-01-04 14:32:22.000000000 -0500
--- ./bashline.h	2012-05-07 16:27:18.000000000 -0400
***************
*** 34,41 ****
--- 34,46 ----
  extern int bash_re_edit __P((char *));
  
+ extern void bashline_set_event_hook __P((void));
+ extern void bashline_reset_event_hook __P((void));
+ 
  extern int bind_keyseq_to_unix_command __P((char *));
  
  extern char **bash_default_completion __P((const char *, int, int, int, int));
  
+ void set_directory_hook __P((void));
+ 
  /* Used by programmable completion code. */
  extern char *command_word_completion_function __P((const char *, int));
diff -NrC 2 ../bash-4.2-patched/builtins/shopt.def ./builtins/shopt.def
*** ../bash-4.2-patched/builtins/shopt.def	2010-07-02 22:42:44.000000000 -0400
--- ./builtins/shopt.def	2012-05-07 16:27:18.000000000 -0400
***************
*** 62,65 ****
--- 62,69 ----
  #include "bashgetopt.h"
  
+ #if defined (READLINE)
+ #  include "../bashline.h"
+ #endif
+ 
  #if defined (HISTORY)
  #  include "../bashhist.h"
***************
*** 95,99 ****
  extern int no_empty_command_completion;
  extern int force_fignore;
! extern int dircomplete_spelling;
  
  extern int enable_hostname_completion __P((int));
--- 99,103 ----
  extern int no_empty_command_completion;
  extern int force_fignore;
! extern int dircomplete_spelling, dircomplete_expand;
  
  extern int enable_hostname_completion __P((int));
***************
*** 122,125 ****
--- 126,133 ----
  #endif
  
+ #if defined (READLINE)
+ static int shopt_set_complete_direxpand __P((char *, int));
+ #endif
+ 
  static int shopt_login_shell;
  static int shopt_compat31;
***************
*** 151,154 ****
--- 159,163 ----
    { "compat41", &shopt_compat41, set_compatibility_level },
  #if defined (READLINE)
+   { "direxpand", &dircomplete_expand, shopt_set_complete_direxpand },
    { "dirspell", &dircomplete_spelling, (shopt_set_func_t *)NULL },
  #endif
***************
*** 536,539 ****
--- 545,559 ----
  }
  
+ #if defined (READLINE)
+ static int
+ shopt_set_complete_direxpand (option_name, mode)
+      char *option_name;
+      int mode;
+ {
+   set_directory_hook ();
+   return 0;
+ }
+ #endif
+ 
  #if defined (RESTRICTED_SHELL)
  /* Don't allow the value of restricted_shell to be modified. */
Binary files ../bash-4.2-patched/doc/._bashref.pdf and ./doc/._bashref.pdf differ
diff -NrC 2 ../bash-4.2-patched/doc/bash.1 ./doc/bash.1
*** ../bash-4.2-patched/doc/bash.1	2011-01-16 15:31:39.000000000 -0500
--- ./doc/bash.1	2012-05-07 16:27:18.000000000 -0400
***************
*** 8949,8952 ****
--- 8949,8962 ----
  The default bash behavior remains as in previous versions.
  .TP 8
+ .B direxpand
+ If set,
+ .B bash
+ replaces directory names with the results of word expansion when performing
+ filename completion.  This changes the contents of the readline editing
+ buffer.
+ If not set,
+ .B bash
+ attempts to preserve what the user typed.
+ .TP 8
  .B dirspell
  If set,
diff -NrC 2 ../bash-4.2-patched/doc/bashref.texi ./doc/bashref.texi
*** ../bash-4.2-patched/doc/bashref.texi	2011-01-16 15:31:57.000000000 -0500
--- ./doc/bashref.texi	2012-05-07 16:27:18.000000000 -0400
***************
*** 4536,4539 ****
--- 4536,4546 ----
  The default Bash behavior remains as in previous versions.
  
+ @item direxpand
+ If set, Bash
+ replaces directory names with the results of word expansion when performing
+ filename completion.  This changes the contents of the readline editing
+ buffer.
+ If not set, Bash attempts to preserve what the user typed.
+ 
  @item dirspell
  If set, Bash
diff -NrC 2 ../bash-4.2-patched/tests/shopt.right ./tests/shopt.right
*** ../bash-4.2-patched/tests/shopt.right	2010-07-02 23:36:30.000000000 -0400
--- ./tests/shopt.right	2012-05-07 16:27:18.000000000 -0400
***************
*** 13,16 ****
--- 13,17 ----
  shopt -u compat40
  shopt -u compat41
+ shopt -u direxpand
  shopt -u dirspell
  shopt -u dotglob
***************
*** 69,72 ****
--- 70,74 ----
  shopt -u compat40
  shopt -u compat41
+ shopt -u direxpand
  shopt -u dirspell
  shopt -u dotglob
***************
*** 102,105 ****
--- 104,108 ----
  compat40       	off
  compat41       	off
+ direxpand      	off
  dirspell       	off
  dotglob        	off
*** ../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 28
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 29
  
  #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 Wed May 30 22:17:30 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZux8-0004v3-UN
	for mharc-bug-bash@gnu.org; Wed, 30 May 2012 22:17:30 -0400
Received: from eggs.gnu.org ([208.118.235.92]:55893)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SZux5-0004sC-Kg
	for bug-bash@gnu.org; Wed, 30 May 2012 22:17:28 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SZux3-00077L-Kx
	for bug-bash@gnu.org; Wed, 30 May 2012 22:17:27 -0400
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:3261)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SZux3-00077D-Gg
	for bug-bash@gnu.org; Wed, 30 May 2012 22:17:25 -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 BLH39440;
	Wed, 30 May 2012 22:17:24 -0400
Received: from h191.11.172.72.dynamic.ip.windstream.net (EHLO z4.local)
	([72.172.11.191]) by mpv8.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id UHF79781 (AUTH cpr);
	Wed, 30 May 2012 22:17:24 -0400 (EDT)
Message-ID: <4FC6D4B1.70001@case.edu>
Date: Wed, 30 May 2012 22:17:21 -0400
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Dan Douglas <ormaaj@gmail.com>
Subject: Re: Segfault on compound assignment to a variable whose name is set
	in the environment of a declaration builtin.
References: <1430566.bsMcg8UFsV@smorgbox>
In-Reply-To: <1430566.bsMcg8UFsV@smorgbox>
X-Enigmail-Version: 1.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv2.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.37
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 31 May 2012 02:17:29 -0000

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

On 5/18/12 2:08 PM, Dan Douglas wrote:
> Hi Chet, segfault occurs during array assignment if an attempt is made to modify a
> variable of the same name from the environment. It appears to only occur in the global scope.
> I imagine the expected result should be either an error, or to evaluate in a mannar similar to
> `x=1 let "x[x++]=x"', for example.

Thanks for the report.  It only happens in an arithmetic expression
context.

> Thanks again. (not overly anxious for a fix.)

OK, it will be fixed in the next 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/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk/G1KkACgkQu1hp8GTqdKvsdQCeM8MTYW5WM+XbWs6JQ4xIL8le
WjEAnjwBOzLpjUF8XbpzZNRNuwU+Fth4
=1m7x
-----END PGP SIGNATURE-----


From MAILER-DAEMON Wed May 30 23:28:54 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SZw4E-0003Pn-6v
	for mharc-bug-bash@gnu.org; Wed, 30 May 2012 23:28:54 -0400
Received: from eggs.gnu.org ([208.118.235.92]:54094)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SZw4B-0003O9-CX
	for bug-bash@gnu.org; Wed, 30 May 2012 23:28:52 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SZw47-0004Lq-RZ
	for bug-bash@gnu.org; Wed, 30 May 2012 23:28:50 -0400
Received: from mail-pz0-f41.google.com ([209.85.210.41]:44820)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1SZw47-0004LF-Hs
	for bug-bash@gnu.org; Wed, 30 May 2012 23:28:47 -0400
Received: by dakp5 with SMTP id p5so680475dak.0
	for <bug-bash@gnu.org>; Wed, 30 May 2012 20:28:44 -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=SzarsQbNUk5fThZXNOoIyzVbKwOtcPPTl/Qc7GhZn7w=;
	b=EKsJUtYorbSv2dFVZUsZtGj63LdRdl3CsavNbz2+h5iyhmtHVh/ajTOGz4smHxzLUP
	9InuV4a+01eg/6RJRfgTA3rHLLGgSPsnBis6a79Mb8YaZfxB9xqocE9npO/SZAQkkcWy
	blEHzXLf+KfQ9BIxtPMUMuH5F9j59d6yFuODx95UJtpByqLEiV2goWB5wa/9PUC38u6c
	GddJy246WJuYHQMso4EyX/KMY8RZwlnNawb+cYT3NhEMoLX21EciXYFyCmi4ke7h8mcM
	QN2UsA0S5oD1q7z3D/LREAhXqAfkB1XMKOhjFnBObY3VW4Attm9y5954eNvlO8jZzpby
	uYGQ==
MIME-Version: 1.0
Received: by 10.68.134.1 with SMTP id pg1mr2254483pbb.1.1338434924426; Wed, 30
	May 2012 20:28:44 -0700 (PDT)
Received: by 10.68.196.201 with HTTP; Wed, 30 May 2012 20:28:44 -0700 (PDT)
In-Reply-To: <20120530165750.GK1506@eeg.ccf.org>
References: <CALtf9+qvO2BDHriAvi28q=kKr2j3b6KJbKLoBhs3D615y+8dLA@mail.gmail.com>
	<CAFyvKism-6PyxPO8FoaUFs=F5WZ83bY+7qn0tkr2ru8tfr6dXQ@mail.gmail.com>
	<20120530123349.GI1506@eeg.ccf.org>
	<CAFyvKivTSDCNt_4jy1QOKCrq49ciJ+gW2UhT9bM5NxHeRNNUYw@mail.gmail.com>
	<20120530165750.GK1506@eeg.ccf.org>
Date: Thu, 31 May 2012 03:28:44 +0000
Message-ID: <CADVxHgPgyH=_xhSp0CX3GYFP2YYfb92Y8_fSS5FUM6wRj+Eh3A@mail.gmail.com>
Subject: Re: Compare 2 arrays.
From: Dan Douglas <ormaaj@gmail.com>
To: Greg Wooledge <wooledg@eeg.ccf.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.210.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, 31 May 2012 03:28:52 -0000

On Wed, May 30, 2012 at 4:57 PM, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
>
> On Wed, May 30, 2012 at 10:14:42AM -0600, Bill Gradwohl wrote:
> > What say you Chet? Bug or feature? There is no middle ground.
>
> That's unrealistic. =C2=A0There are plenty of things that occupy that mid=
dle
> ground -- unexpected program behaviors. =C2=A0The programmer can never
> anticipate *every* input sequence that users will throw at the software,
> so some of them may cause surprises.

Since variable names treated as strings can cause execution of
arbitrary code in Bash, mixing them with user input isn't usually
possible anyway. However, that's irrelevant to whether this kind of
expansion is a bug.

> The danger of using unexpected program behaviors in your applications
> is that the behaviors may change without warning in a future version of
> the program. =C2=A0The programmer may not even be aware that this behavio=
r
> exists, let alone that people are using it. =C2=A0A clean-up of the parse=
r
> (or similar change) may make the behavior go away, or change.

That is true, but I don't think this particular thing is unexpected.
Hopefully it doesn't change unless it's replaced by something better,
because it's extremely useful.

> ...
> I added that on 2011-05-02 after Buglouse described it on IRC. =C2=A0I'm =
fairly
> certain that EVERYONE else in the channel at the time was as surprised
> by it as I was.
>

I think they shouldn't have been surprised. Here it is described on
stackoverflow prior to that date:
http://stackoverflow.com/a/4017175/495451

I don't understand why you continue to consider this a possible bug.
The manual only has a couple sentences to say about indirect
expansion:

"If the first character of parameter is an exclamation point (!), a
level of variable indirection is introduced.	Bash uses the value of
the variable formed from the rest of parameter as the name of the
variable; this variable is then expanded and that value is used in the
rest of the substitution, rather than the value of parameter itself.
This is known as indirect expansion."

And Bash does exactly that. If indirect array expansion is a bug, then
it's a documentation bug, because it's implied by the manual amongst
other things. The question is whether or not values of the form
"arr[n]" are considered valid "parameters" or "variable names". IMO,
they are. "The value of the variable formed from the rest of the
parameter" must itself be a "variable name" in order for these
sentences to make sense. This is consistent with their usage in
several Bash builtins that accept "variable names" as arguments such
as "read", "unset", and "printf". I consider some of those which don't
as bugs, such as "[[ -v". IMO, this should be made consistent. But at
least I've tested "${!x}" extensively in complex situations and it
works as expected every time. It's also not that difficult to
understand.

Still, it's an advanced feature and probably just as well that it's obfusca=
ted.


From MAILER-DAEMON Thu May 31 15:56:28 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SaBTw-0001WI-S6
	for mharc-bug-bash@gnu.org; Thu, 31 May 2012 15:56:28 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49011)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SaBTt-0001Vs-Ph
	for bug-bash@gnu.org; Thu, 31 May 2012 15:56:27 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SaBTs-0001f9-6z
	for bug-bash@gnu.org; Thu, 31 May 2012 15:56:25 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:32891
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1SaBTr-0001bY-St
	for bug-bash@gnu.org; Thu, 31 May 2012 15:56:24 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q4VJuIpX027529
	for <bug-bash@gnu.org>; Thu, 31 May 2012 12:56:20 -0700
Message-ID: <4FC7CCE2.60500@tlinx.org>
Date: Thu, 31 May 2012 12:56:18 -0700
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
	rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24
	Mnenhy/0.7.6.666
MIME-Version: 1.0
To: bug-bash <bug-bash@gnu.org>
Subject: req for fix: Completion: inconsistent case correction and '/'
	appending(for dirs)
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 31 May 2012 19:56:27 -0000

if I type in a path:

(1st example)
 > ls -d /share/doc/new<tab>, bash displays:

ls /share/doc/New\ Folder

Pressing 'Enter' gets:

ls: cannot access /share/doc/New Folder: No such file or directory

vs.

(2nd example)
 > ls /share/do<tab>
ls /share/Doc/n<tab>
ls /share/Doc/New\ Folder/  (<enter>)
/share/Doc/New Folder//


-----
The first case did a path lookup in case-insensitive manner, and only
corrected case for the last path element -- but it needed to correct
the case for the 2nd element in order for the 3rd element to be 'valid'...

So it needs to case-correct all needed path elements that it used to
generate the completion it displays (otherwise it appears to give a
completion in an invalid pathname).

and 2nd item -- I suspect it is related to the first item --
it doesn't append "/" in the 1st example because it tries to look
up "New Folder" under the displayed path and fails -- BUT,
I think it very well might be correct behavior IF:

a) it is supposed to display the longest common string,
   and then
b) present a menu for options. 

Since the "ls" command can terminate after the "New Folder" (i.e. the
"/" would be part of a different command (looking up "New Folder/"
which makes a difference in some 'copy' commands).

In any event, correct or not, the 2nd example appends the "/"
and ends up yielding a "//" in ls (or a different target in some
copy commands).  So which ever is "correct"**, it should do the same
completion in both cases.

**-- controlled by inputrc, I believe -- I have (relevant settings):
set mark-directories on
set meta-flag on
set output-meta on
set menu-complete-display-prefix on
set print-completions-horizontally off
set show-all-if-unmodified on
set show-all-if-ambiguous off





From MAILER-DAEMON Thu May 31 16:25:50 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SaBwM-0005pc-0t
	for mharc-bug-bash@gnu.org; Thu, 31 May 2012 16:25:50 -0400
Received: from eggs.gnu.org ([208.118.235.92]:47960)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SaBwJ-0005pU-3O
	for bug-bash@gnu.org; Thu, 31 May 2012 16:25:48 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SaBwH-0000UM-2X
	for bug-bash@gnu.org; Thu, 31 May 2012 16:25:46 -0400
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:9317)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1SaBwG-0000U2-OP
	for bug-bash@gnu.org; Thu, 31 May 2012 16:25:44 -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 BZF42855 (AUTH cpr);
	Thu, 31 May 2012 16:25:42 -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 AYA38424 (AUTH cpr);
	Thu, 31 May 2012 16:25:42 -0400 (EDT)
Message-ID: <4FC7D3C5.40601@case.edu>
Date: Thu, 31 May 2012 16:25:41 -0400
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: Bill Gradwohl <bill@ycc.com>
Subject: Re: Compare 2 arrays.
References: <CALtf9+qvO2BDHriAvi28q=kKr2j3b6KJbKLoBhs3D615y+8dLA@mail.gmail.com>
	<CAFyvKism-6PyxPO8FoaUFs=F5WZ83bY+7qn0tkr2ru8tfr6dXQ@mail.gmail.com>
	<20120530123349.GI1506@eeg.ccf.org>
	<CAFyvKivTSDCNt_4jy1QOKCrq49ciJ+gW2UhT9bM5NxHeRNNUYw@mail.gmail.com>
In-Reply-To: <CAFyvKivTSDCNt_4jy1QOKCrq49ciJ+gW2UhT9bM5NxHeRNNUYw@mail.gmail.com>
X-Enigmail-Version: 1.4.1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 31 May 2012 20:25:48 -0000

On 5/30/12 12:14 PM, Bill Gradwohl wrote:

> Admittedly, bash doesn't go out of its way to highlight this technique, but
> it does work.
> 
> What say you Chet? Bug or feature? There is no middle ground.

Sure, there is.  It's not explicitly documented, so the behavior is
undefined.  You can read the documentation of indirect expansion as
allowing it.

> I believe we're quibbling over the officialness of the solution I provided
> to the poster. Obviously bash does support a way of manipulating a foreign
> array. I'd like it to be more obvious with something like a nameref as you
> suggest, but it's not there.

I'm not going to go out of my way to make it stop working, and I can't
see it not working unless I do something really dramatic to the code in
parameter_brace_expand_indir().  I plan to do something more
straightforward along the lines of namerefs in the future, but this syntax
is, as you say, useful.

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/


