From MAILER-DAEMON Sun Jan 01 22:15:50 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RhYNK-0003Gm-AQ
	for mharc-bug-bash@gnu.org; Sun, 01 Jan 2012 22:15:50 -0500
Received: from eggs.gnu.org ([140.186.70.92]:39222)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RhYNH-0003Gg-3U
	for bug-bash@gnu.org; Sun, 01 Jan 2012 22:15:48 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RhYNF-0005BY-Ra
	for bug-bash@gnu.org; Sun, 01 Jan 2012 22:15:47 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:25704)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RhYNF-0005BU-M3
	for bug-bash@gnu.org; Sun, 01 Jan 2012 22:15:45 -0500
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 BUE13623; Sun, 01 Jan 2012 22:15:44 -0500 (EST)
Received: from h156.184.190.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.190.184.156]) by mpv7.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SFO57061 (AUTH cpr);
	Sun, 01 Jan 2012 22:15:44 -0500 (EST)
Message-ID: <4F01215F.30107@case.edu>
Date: Sun, 01 Jan 2012 22:15:43 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Stas Sergeev <stsp@list.ru>
Subject: Re: bug in force_interactive handling
References: <4EF88EF4.8000202@list.ru> <4EFA3595.4020809@case.edu>
	<4EFAE497.5080602@list.ru> <4EFC9B2E.8050108@case.edu>
	<4EFD941D.6000601@list.ru>
In-Reply-To: <4EFD941D.6000601@list.ru>
X-Enigmail-Version: 1.3.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Jan 2012 03:15:48 -0000

On 12/30/11 5:36 AM, Stas Sergeev wrote:
> Hello Chet, thanks for your patch file.
> It is slightly broken, attached is the fixed version
> of your patch.
> BUT: it solves only half of the bug.

Thanks, I inadvertently left that part of the patch out of what I sent.

> Please check it yourself, here's the script:
> ---
> #!./bash -i
> set -m; cat
> echo Finished!
> while :; do jobs; sleep 2; done
> ---
> 
> Run this script, then do
> killall -STOP cat
> You'll start seeing the output of "jobs" every 2 seconds,
> and the cat is marked "Stopped".
> Then do
> killall -CONT cat
> Nothing changes, the cat is still listed as stopped.
> Then bash will run terminate_stopped_jobs() on it. :(
> Do you know how to fix also this?

I don't get this behavior; after the patch I get the `cat' listed as
running until it gets rescheduled, which depends on the kernel and
the scheduler.  (I have to wait much longer for it to be rescheduled
and run on Mac OS X than Linux, for instance.)  Let's talk through the
behavior you'd like to see happen.

If you send the `cat' a SIGCONT it will end up running in the background:
its process group id will never be the same as the terminal's.  Sending
SIGCONT from another process will not set the terminal's process group to
cat's pgid.  That's why things like `fg' and `bg' are shell builtins --
so the shell can multiplex the terminal's process group among its children.

Because cat is running as a background job, it will get SIGTTIN from the
kernel as soon as it runs and attempts to read from the terminal (and, in
fact, when you look at it with `ps', the status is `T').

Since the cat is stopped, and will be sent SIGTSTP every time it reads
from the terminal no matter how many times it gets SIGCONT, chances are
pretty good that bash will find it stopped, report it as such, and
terminate it before exiting.

What about this would you like to change?

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 Jan 02 04:28:24 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RheBs-0002TS-G6
	for mharc-bug-bash@gnu.org; Mon, 02 Jan 2012 04:28:24 -0500
Received: from eggs.gnu.org ([140.186.70.92]:33385)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <stsp@list.ru>) id 1RheBo-0002Nc-R8
	for bug-bash@gnu.org; Mon, 02 Jan 2012 04:28:21 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <stsp@list.ru>) id 1RheBn-0008AY-P5
	for bug-bash@gnu.org; Mon, 02 Jan 2012 04:28:20 -0500
Received: from smtp24.mail.ru ([94.100.176.177]:46386)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <stsp@list.ru>)
	id 1RheBn-0008AL-7W
	for bug-bash@gnu.org; Mon, 02 Jan 2012 04:28:19 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru;
	s=mail; 
	h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID;
	bh=sEBtBagz3huDnriwVpxVz7IcAZ4AnPeDqAl4RQvS0Kw=; 
	b=TRTZcyI09wucpznImKW3zCHZ1fAXNzfmkqNDSdn3qkUhp9+RvzMsrv4p4Vih764LaI7ZnR0Jwa4Vq/EOyHa3nND29jF2d7UomMwx0SpcqrKxNdeekmuAVP8dQmR+Xm2v;
Received: from [89.23.196.133] (port=57724)
	by smtp24.mail.ru with esmtpa (envelope-from <stsp@list.ru>)
	id 1RheBk-0008TL-51; Mon, 02 Jan 2012 13:28:16 +0400
Message-ID: <4F017865.1050907@list.ru>
Date: Mon, 02 Jan 2012 13:27:01 +0400
From: Stas Sergeev <stsp@list.ru>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:8.0) Gecko/20111115 Thunderbird/8.0
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: bug in force_interactive handling
References: <4EF88EF4.8000202@list.ru> <4EFA3595.4020809@case.edu>
	<4EFAE497.5080602@list.ru> <4EFC9B2E.8050108@case.edu>
	<4EFD941D.6000601@list.ru> <4F01215F.30107@case.edu>
In-Reply-To: <4F01215F.30107@case.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Mru-NR: 2
X-Mru-UID: 185631573
X-Mru-IsAutoreg: 0
X-Mru-AutoregInfo: 4740282, []
X-Spam: Not detected
X-Mras: Ok
X-Mru-Karma: 0
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 94.100.176.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: Mon, 02 Jan 2012 09:28:21 -0000

02.01.2012 07:15, Chet Ramey wrote:
> On 12/30/11 5:36 AM, Stas Sergeev wrote:
>> Hello Chet, thanks for your patch file.
>> It is slightly broken, attached is the fixed version
>> of your patch.
>> BUT: it solves only half of the bug.
> Thanks, I inadvertently left that part of the patch out of what I sent.
Will you apply this patch for the next bash release?

>> Do you know how to fix also this?
> If you send the `cat' a SIGCONT it will end up running in the background:
> its process group id will never be the same as the terminal's.  Sending
> SIGCONT from another process will not set the terminal's process group to
> cat's pgid.  That's why things like `fg' and `bg' are shell builtins --
> so the shell can multiplex the terminal's process group among its children.
Thanks for the explanation.
In this case it would be nice for bash to have
a signal that will move the background process
to the foreground. Without this I still can't do
what I intended: I wanted the script to finish,
leaving the background process running. This
works only if my script sleeps till I send SIGCONT
to the process.
If it doesn't sleep, the SIGCONT may arrive later
than the script finishes, and the job gets killed.
I wonder if its possible in bash to implement the
signal handler to move the process to the background,
but that's probably about asking too much. :)
Thanks for your help!


From MAILER-DAEMON Mon Jan 02 13:27:08 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RhmbE-0008BP-HF
	for mharc-bug-bash@gnu.org; Mon, 02 Jan 2012 13:27:08 -0500
Received: from eggs.gnu.org ([140.186.70.92]:55919)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RhmbC-00088d-2r
	for bug-bash@gnu.org; Mon, 02 Jan 2012 13:27:07 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RhmbA-0004Gu-W0
	for bug-bash@gnu.org; Mon, 02 Jan 2012 13:27:06 -0500
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:56332)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RhmbA-0004Gq-SL
	for bug-bash@gnu.org; Mon, 02 Jan 2012 13:27:04 -0500
Received: from mpv7.case.edu (mpv7.tis.CWRU.Edu [129.22.104.170])
	by mpv2.tis.cwru.edu (MOS 4.3.3-GA) with ESMTP id BGU06075;
	Mon, 2 Jan 2012 13:27:04 -0500
Received: from h156.184.190.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.190.184.156]) by mpv7.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SFR03402 (AUTH cpr);
	Mon, 02 Jan 2012 13:27:04 -0500 (EST)
Message-ID: <4F01F6F8.3020500@case.edu>
Date: Mon, 02 Jan 2012 13:27:04 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Stas Sergeev <stsp@list.ru>
Subject: Re: bug in force_interactive handling
References: <4EF88EF4.8000202@list.ru> <4EFA3595.4020809@case.edu>
	<4EFAE497.5080602@list.ru> <4EFC9B2E.8050108@case.edu>
	<4EFD941D.6000601@list.ru> <4F01215F.30107@case.edu>
	<4F017865.1050907@list.ru>
In-Reply-To: <4F017865.1050907@list.ru>
X-Enigmail-Version: 1.3.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: Mon, 02 Jan 2012 18:27:07 -0000

On 1/2/12 4:27 AM, Stas Sergeev wrote:
> 02.01.2012 07:15, Chet Ramey wrote:

>> Thanks, I inadvertently left that part of the patch out of what I sent.
> Will you apply this patch for the next bash release?

Yes, it's already applied.

> In this case it would be nice for bash to have
> a signal that will move the background process
> to the foreground.

But there is already a command to do that: fg.  You can hook SIGCHLD
with a trap handler, process the `jobs' output, and fg the appropriate
process.  I still think that's way more work than you need to do.

> Without this I still can't do
> what I intended: I wanted the script to finish,
> leaving the background process running. This
> works only if my script sleeps till I send SIGCONT
> to the process.

Since you're not really using job control at all, but controlling the
process's status by sending it signals from another process, you
could add a process in between, making the job you're interested in
a grandchild of the shell.  That way it doesn't matter what the shell
does when it exits.

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 Jan 02 13:40:19 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rhmnz-0003wr-Gl
	for mharc-bug-bash@gnu.org; Mon, 02 Jan 2012 13:40:19 -0500
Received: from eggs.gnu.org ([140.186.70.92]:45466)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <stsp@list.ru>) id 1Rhmnx-0003wL-PJ
	for bug-bash@gnu.org; Mon, 02 Jan 2012 13:40:18 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <stsp@list.ru>) id 1Rhmnw-0005i3-I1
	for bug-bash@gnu.org; Mon, 02 Jan 2012 13:40:17 -0500
Received: from smtp23.mail.ru ([94.100.176.176]:49973)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <stsp@list.ru>)
	id 1Rhmnv-0005hs-Tc
	for bug-bash@gnu.org; Mon, 02 Jan 2012 13:40:16 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru;
	s=mail; 
	h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID;
	bh=A/8HTBzcDiNf3qyIePuUmYGQew75WwAmbUFblH0sbS4=; 
	b=sgssE6CVIQ449gbt5l3sefIQJkD2HanE3uqrsRYA3pM67qQFSQu4Fy7f6v1PdQvWx2IfYTbicV0LK1ybtwjla6+nJSSUHR5yUKj3pnu+gswMP0mENvQrpf2RiMHq8Y/r;
Received: from [89.23.196.133] (port=35842)
	by smtp23.mail.ru with esmtpa (envelope-from <stsp@list.ru>)
	id 1Rhmns-0000jW-6U; Mon, 02 Jan 2012 22:40:14 +0400
Message-ID: <4F01F9C0.2090605@list.ru>
Date: Mon, 02 Jan 2012 22:38:56 +0400
From: Stas Sergeev <stsp@list.ru>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:8.0) Gecko/20111115 Thunderbird/8.0
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: bug in force_interactive handling
References: <4EF88EF4.8000202@list.ru> <4EFA3595.4020809@case.edu>
	<4EFAE497.5080602@list.ru> <4EFC9B2E.8050108@case.edu>
	<4EFD941D.6000601@list.ru> <4F01215F.30107@case.edu>
	<4F017865.1050907@list.ru> <4F01F6F8.3020500@case.edu>
In-Reply-To: <4F01F6F8.3020500@case.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Mru-NR: 2
X-Mru-UID: 185631573
X-Mru-IsAutoreg: 0
X-Mru-AutoregInfo: 4740282, []
X-Spam: Not detected
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 94.100.176.176
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, 02 Jan 2012 18:40:18 -0000

02.01.2012 22:27, Chet Ramey wrote:
>> In this case it would be nice for bash to have
>> a signal that will move the background process
>> to the foreground.
> But there is already a command to do that: fg.
Sorry, mistyped, I meant the other way around: move
the foreground process to the background, then finish
the script, leaving the process alive.
Will your suggestion about the trap handler work
also for ^Z+bg rather than just fg?

>  could add a process in between, making the job you're interested in

The extra process in-between is a good workaround,
yes, but I wonder if this can be avoided.


From MAILER-DAEMON Mon Jan 02 13:53:47 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rhn11-0000vf-5A
	for mharc-bug-bash@gnu.org; Mon, 02 Jan 2012 13:53:47 -0500
Received: from eggs.gnu.org ([140.186.70.92]:35341)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rhn0z-0000vG-De
	for bug-bash@gnu.org; Mon, 02 Jan 2012 13:53:46 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rhn0w-0007L8-T3
	for bug-bash@gnu.org; Mon, 02 Jan 2012 13:53:45 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:18337)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rhn0w-0007L1-O2
	for bug-bash@gnu.org; Mon, 02 Jan 2012 13:53:42 -0500
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 BUE56737 (AUTH cpr);
	Mon, 02 Jan 2012 13:53:41 -0500 (EST)
Received: from h156.184.190.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.190.184.156]) by mpv7.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SFR09996 (AUTH cpr);
	Mon, 02 Jan 2012 13:53:41 -0500 (EST)
Message-ID: <4F01FD36.6080001@case.edu>
Date: Mon, 02 Jan 2012 13:53:42 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Stas Sergeev <stsp@list.ru>
Subject: Re: bug in force_interactive handling
References: <4EF88EF4.8000202@list.ru> <4EFA3595.4020809@case.edu>
	<4EFAE497.5080602@list.ru> <4EFC9B2E.8050108@case.edu>
	<4EFD941D.6000601@list.ru> <4F01215F.30107@case.edu>
	<4F017865.1050907@list.ru> <4F01F6F8.3020500@case.edu>
	<4F01F9C0.2090605@list.ru>
In-Reply-To: <4F01F9C0.2090605@list.ru>
X-Enigmail-Version: 1.3.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Jan 2012 18:53:46 -0000

On 1/2/12 1:38 PM, Stas Sergeev wrote:
> 02.01.2012 22:27, Chet Ramey wrote:
>>> In this case it would be nice for bash to have
>>> a signal that will move the background process
>>> to the foreground.
>> But there is already a command to do that: fg.
> Sorry, mistyped, I meant the other way around: move
> the foreground process to the background, then finish
> the script, leaving the process alive.

The SIGSTOP/SIGCONT works to put the process into the background: the
jobs pgrp is not the same as the terminal's pgrp.  If you don't want
the shell to terminate the job at exit because it's stopped, use
`disown' after the job stops to have the shell forget it while you
continue it from another process.

> Will your suggestion about the trap handler work
> also for ^Z+bg rather than just fg?

It should.

I know that `cat' was just an example, but you have to make sure the
job you want to stop/continue is not attempting to read from the terminal.
If it is, the kernel will SIGTSTP it every time.

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 Jan 02 14:11:50 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RhnIU-0003uU-Tq
	for mharc-bug-bash@gnu.org; Mon, 02 Jan 2012 14:11:50 -0500
Received: from eggs.gnu.org ([140.186.70.92]:60448)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <stsp@list.ru>) id 1RhnIS-0003uE-LV
	for bug-bash@gnu.org; Mon, 02 Jan 2012 14:11:49 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <stsp@list.ru>) id 1RhnIR-0001PO-Fs
	for bug-bash@gnu.org; Mon, 02 Jan 2012 14:11:48 -0500
Received: from smtp15.mail.ru ([94.100.176.133]:53461)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <stsp@list.ru>)
	id 1RhnIQ-0001PH-QN
	for bug-bash@gnu.org; Mon, 02 Jan 2012 14:11:47 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru;
	s=mail; 
	h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID;
	bh=cbcd4imPg2qxyag82qRvgx9H7ScizuCqJtC5cB+oZIw=; 
	b=qgwG+DUomiIRvDUe1LSjSs8IjLWq36174sdmuK4pFSL2NeT+KASVtVGP887VXFSxbhxmTxkYhpdRaaCDMcrPHmzNDF63UCVw3IRRUSH30ku31reGIqCShozntcTuF5Jb;
Received: from [89.23.196.133] (port=48965)
	by smtp15.mail.ru with esmtpa (envelope-from <stsp@list.ru>)
	id 1RhnIP-0006nk-5K; Mon, 02 Jan 2012 23:11:45 +0400
Message-ID: <4F020125.1020508@list.ru>
Date: Mon, 02 Jan 2012 23:10:29 +0400
From: Stas Sergeev <stsp@list.ru>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:8.0) Gecko/20111115 Thunderbird/8.0
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: bug in force_interactive handling
References: <4EF88EF4.8000202@list.ru> <4EFA3595.4020809@case.edu>
	<4EFAE497.5080602@list.ru> <4EFC9B2E.8050108@case.edu>
	<4EFD941D.6000601@list.ru> <4F01215F.30107@case.edu>
	<4F017865.1050907@list.ru> <4F01F6F8.3020500@case.edu>
	<4F01F9C0.2090605@list.ru> <4F01FD36.6080001@case.edu>
In-Reply-To: <4F01FD36.6080001@case.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Mru-NR: 2
X-Mru-UID: 185631573
X-Mru-IsAutoreg: 0
X-Mru-AutoregInfo: 4740282, []
X-Spam: Not detected
X-Mras: Ok
X-Mru-Karma: 0
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 94.100.176.133
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, 02 Jan 2012 19:11:49 -0000

02.01.2012 22:53, Chet Ramey wrote:
>> the script, leaving the process alive.
> The SIGSTOP/SIGCONT works to put the process into the background: the
> jobs pgrp is not the same as the terminal's pgrp.  If you don't want
> the shell to terminate the job at exit because it's stopped, use
> `disown' after the job stops to have the shell forget it while you
> continue it from another process.
Thanks! The disown might do the trick.

>> Will your suggestion about the trap handler work
>> also for ^Z+bg rather than just fg?
> It should.
I tried:
---
trap bg USR1
---
Now if I first send SIGSTOP to the job and then SIGUSR1 to
bash, that works.
Is it possible to avoid sending SIGSTOP to the job, and make
the trap handler to do both things at once? Not that it is strictly
required since you already described a few other ways, but I wonder. :)


From MAILER-DAEMON Mon Jan 02 15:07:32 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RhoAO-0000yF-Oh
	for mharc-bug-bash@gnu.org; Mon, 02 Jan 2012 15:07:32 -0500
Received: from eggs.gnu.org ([140.186.70.92]:44348)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RhoAM-0000wy-09
	for bug-bash@gnu.org; Mon, 02 Jan 2012 15:07:31 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RhoAK-0007JN-Lc
	for bug-bash@gnu.org; Mon, 02 Jan 2012 15:07:29 -0500
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:32380)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RhoAK-0007JC-HC
	for bug-bash@gnu.org; Mon, 02 Jan 2012 15:07:28 -0500
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 BGU09414;
	Mon, 2 Jan 2012 15:07:27 -0500
Received: from h156.184.190.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.190.184.156]) by mpv8.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SMD27231 (AUTH cpr);
	Mon, 02 Jan 2012 15:07:27 -0500 (EST)
Message-ID: <4F020E7E.6060806@case.edu>
Date: Mon, 02 Jan 2012 15:07:26 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Stas Sergeev <stsp@list.ru>
Subject: Re: bug in force_interactive handling
References: <4EF88EF4.8000202@list.ru> <4EFA3595.4020809@case.edu>
	<4EFAE497.5080602@list.ru> <4EFC9B2E.8050108@case.edu>
	<4EFD941D.6000601@list.ru> <4F01215F.30107@case.edu>
	<4F017865.1050907@list.ru> <4F01F6F8.3020500@case.edu>
	<4F01F9C0.2090605@list.ru> <4F01FD36.6080001@case.edu>
	<4F020125.1020508@list.ru>
In-Reply-To: <4F020125.1020508@list.ru>
X-Enigmail-Version: 1.3.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: Mon, 02 Jan 2012 20:07:31 -0000

On 1/2/12 2:10 PM, Stas Sergeev wrote:

>>> Will your suggestion about the trap handler work
>>> also for ^Z+bg rather than just fg?
>> It should.
> I tried:
> ---
> trap bg USR1
> ---
> Now if I first send SIGSTOP to the job and then SIGUSR1 to
> bash, that works.
> Is it possible to avoid sending SIGSTOP to the job, and make
> the trap handler to do both things at once? Not that it is strictly
> required since you already described a few other ways, but I wonder. :)

Well, this is getting pretty esoteric.  On one hand, you can avoid the
entire SIGSTOP/SIGCONT issue by initially starting the job in the
background with `&'.  On the other, if you want to move a foreground
job to the background, you have to get it to give up control somehow, and
sending it a signal is the way to do that.

You can install a trap handler for another signal, say SIGALRM, and have
some process send SIGALRM to the shell after some period (e.g.,
`( sleep 20 ; kill -ALRM $$)' ), but you'll have to get the shell to react
to the signal once it's received rather than waiting for the foreground
process to change state.  Once you get the shell running, it can issue
the SIGSTOP/bg.

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 Jan 02 16:56:53 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RhpsD-0008Po-V3
	for mharc-bug-bash@gnu.org; Mon, 02 Jan 2012 16:56:53 -0500
Received: from eggs.gnu.org ([140.186.70.92]:47335)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <stsp@list.ru>) id 1RhpsB-0008Ph-RU
	for bug-bash@gnu.org; Mon, 02 Jan 2012 16:56:52 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <stsp@list.ru>) id 1RhpsA-0003lY-Ch
	for bug-bash@gnu.org; Mon, 02 Jan 2012 16:56:51 -0500
Received: from smtp20.mail.ru ([94.100.176.173]:37418)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <stsp@list.ru>)
	id 1Rhps9-0003lH-SH
	for bug-bash@gnu.org; Mon, 02 Jan 2012 16:56:50 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru;
	s=mail; 
	h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID;
	bh=NS1pWJQi18fPZEH9smjUycDP12XjASSzev5JMoV5Q/M=; 
	b=Z4GrRH8XpuKnbQlooyq8QwieVxyCMeZMLolDjV0L6ip3ZWLs0+qT8yNYGJyh+3515Lmc5P9tZuou7bFw4uWtVhRLTM4UhW6Wuh3OegTxNpi6Hzz3lhuNedgrl0JbYltK;
Received: from [89.23.196.133] (port=17807)
	by smtp20.mail.ru with esmtpa (envelope-from <stsp@list.ru>)
	id 1Rhps7-0004LA-Rr; Tue, 03 Jan 2012 01:56:47 +0400
Message-ID: <4F0227D4.9070604@list.ru>
Date: Tue, 03 Jan 2012 01:55:32 +0400
From: Stas Sergeev <stsp@list.ru>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:8.0) Gecko/20111115 Thunderbird/8.0
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: bug in force_interactive handling
References: <4EF88EF4.8000202@list.ru> <4EFA3595.4020809@case.edu>
	<4EFAE497.5080602@list.ru> <4EFC9B2E.8050108@case.edu>
	<4EFD941D.6000601@list.ru> <4F01215F.30107@case.edu>
	<4F017865.1050907@list.ru> <4F01F6F8.3020500@case.edu>
	<4F01F9C0.2090605@list.ru> <4F01FD36.6080001@case.edu>
	<4F020125.1020508@list.ru> <4F020E7E.6060806@case.edu>
In-Reply-To: <4F020E7E.6060806@case.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Mru-NR: 2
X-Mru-UID: 185631573
X-Mru-IsAutoreg: 0
X-Mru-AutoregInfo: 4740282, []
X-Spam: Not detected
X-Mras: Ok
X-Mru-Karma: 0
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 94.100.176.173
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, 02 Jan 2012 21:56:52 -0000

03.01.2012 00:07, Chet Ramey wrote:
> background with `&'.  On the other, if you want to move a foreground
> job to the background, you have to get it to give up control somehow, and
> sending it a signal is the way to do that.
Unless I am mistaken, nothing special is required
for that, and SIGSTOP only makes waitpid() to return,
but any other signal can be used to interrupt waitpid()
with EINTR. But, in case of EINTR, bash simply restarts
waitpid() it seems.
So my wild guess is that the functionality of moving
the process to the background can be implemented
with some special type of trap that will not restart
waitpid() after that signal is received.
But anyway, I already have the workable solutions to
this. :)


From MAILER-DAEMON Tue Jan 03 12:21:41 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Ri83R-0000uG-T4
	for mharc-bug-bash@gnu.org; Tue, 03 Jan 2012 12:21:41 -0500
Received: from eggs.gnu.org ([140.186.70.92]:59576)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <nick.c.humphrey@gmail.com>) id 1Ri4jA-0001Qt-Qr
	for bug-bash@gnu.org; Tue, 03 Jan 2012 08:48:33 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <nick.c.humphrey@gmail.com>) id 1Ri4j6-0006OF-OT
	for bug-bash@gnu.org; Tue, 03 Jan 2012 08:48:32 -0500
Received: from mail-gx0-f169.google.com ([209.85.161.169]:52459)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <nick.c.humphrey@gmail.com>) id 1Ri4j6-0006OB-LV
	for bug-bash@gnu.org; Tue, 03 Jan 2012 08:48:28 -0500
Received: by ggni2 with SMTP id i2so11609131ggn.0
	for <bug-bash@gnu.org>; Tue, 03 Jan 2012 05:48:27 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:date:message-id:subject:from:to:content-type;
	bh=KLWhfxZpQCtso01SbnQmeLUsPwKAsRE2cQfLsUu8b9E=;
	b=RcidOSibsM6k08lPoJ3SlnaFqNo3KqbqQyQWt6ih5qdtPZpVpX0Ir19a3LVyA9VeUs
	bGyGGAYx/BT/odpqOhxGMlIpt4NzHvi0uGzFuLJwVIMFchW2p1f3zIJyMtfF8BHr8yL6
	ObQzGaiP0+RvauuHxBOWPmBp2qN1ljPPy/7Cg=
MIME-Version: 1.0
Received: by 10.50.36.230 with SMTP id t6mr62161724igj.5.1325598507619; Tue,
	03 Jan 2012 05:48:27 -0800 (PST)
Received: by 10.42.244.129 with HTTP; Tue, 3 Jan 2012 05:48:27 -0800 (PST)
Date: Tue, 3 Jan 2012 14:48:27 +0100
Message-ID: <CAKDOLahz0LCyKm6GtiygJvFiqPsUqJ3=BuL6VoBRBd9WLZO3dw@mail.gmail.com>
Subject: bash, echo or openssl bug?
From: nick humphrey <nick.c.humphrey@gmail.com>
To: bug-bash@gnu.org, bash@packages.debian.org
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 209.85.161.169
X-Mailman-Approved-At: Tue, 03 Jan 2012 12:21:40 -0500
Content-Type: text/plain; charset=UTF-8
X-Content-Filtered-By: Mailman/MimeDel 2.1.14
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Jan 2012 13:48:33 -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' -DC$
uname output: Linux buildserver 2.6.27-11-server #1 SMP Wed Apr 1 21:34:13
UTC 2009 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

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

Description:
        i dont know if the bug is a bash bug or openssl or echo, but when i
echo a string and pipe it to openssl, the
output comes on the same line as the prompt instead of a new line. it makes
the output hard to read because it is prepended
to the prompt text, e.g. mySecretPasswordtcadmin@buildserver: ~$

Repeat-By:
        1. run the following code in bash terminal:
echo OHBjcWNLNGlQaVF5 | openssl base64 -d

        2. the output in the bash terminal looks like this:
mySecretPasswordtcadmin@buildserver: ~$

        3. the output SHOULD look like this:
mySecretPassword
tcadmin@buildserver: ~$

From MAILER-DAEMON Tue Jan 03 12:21:42 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Ri83R-0000uY-V4
	for mharc-bug-bash@gnu.org; Tue, 03 Jan 2012 12:21:41 -0500
Received: from eggs.gnu.org ([140.186.70.92]:51352)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <tcadmin@buildserver.local>) id 1Ri4s3-0004mU-0d
	for bug-bash@gnu.org; Tue, 03 Jan 2012 08:57:43 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <tcadmin@buildserver.local>) id 1Ri4s2-0007l0-1C
	for bug-bash@gnu.org; Tue, 03 Jan 2012 08:57:42 -0500
Received: from [77.40.152.154] (port=33861 helo=buildserver.local)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <tcadmin@buildserver.local>) id 1Ri4s1-0007kv-Hi
	for bug-bash@gnu.org; Tue, 03 Jan 2012 08:57:41 -0500
Received: from buildserver.local (localhost [127.0.0.1])
	by buildserver.local (8.14.3/8.14.3/Debian-4) with ESMTP id
	q03DXR8n018059; Tue, 3 Jan 2012 14:33:28 +0100
Received: (from tcadmin@localhost)
	by buildserver.local (8.14.3/8.14.3/Submit) id q03DXR0F018058;
	Tue, 3 Jan 2012 14:33:27 +0100
Date: Tue, 3 Jan 2012 14:33:27 +0100
Message-Id: <201201031333.q03DXR0F018058@buildserver.local>
From: tcadmin@buildserver.local
To: bug-bash@gnu.org, bash@packages.debian.org
Subject: bash, echo or openssl bug?
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 77.40.152.154
X-Mailman-Approved-At: Tue, 03 Jan 2012 12:21:40 -0500
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?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, 03 Jan 2012 13:57:43 -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   -g -O2 -Wall
uname output: Linux buildserver 2.6.27-11-server #1 SMP Wed Apr 1 21:34:13 UTC 2009 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

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

Description:
	i dont know if the bug is a bash bug or openssl or echo, but when i echo a string and pipe it to openssl, the 
output comes on the same line as the prompt instead of a new line. it makes the output hard to read because it is prepended 
to the prompt text, e.g. mySecretPasswordtcadmin@buildserver: ~$

Repeat-By:
	1. run the following code in bash terminal:
echo OHBjcWNLNGlQaVF5 | openssl base64 -d

	2. the output in the bash terminal looks like this:
mySecretPasswordtcadmin@buildserver: ~$

	3. the output SHOULD look like this:
mySecretPassword
tcadmin@buildserver: ~$


From MAILER-DAEMON Tue Jan 03 12:29:36 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Ri8B6-000365-0H
	for mharc-bug-bash@gnu.org; Tue, 03 Jan 2012 12:29:36 -0500
Received: from eggs.gnu.org ([140.186.70.92]:56390)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1Ri8B0-0002x0-Ju
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:29:34 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1Ri8Av-0001kY-Oh
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:29:30 -0500
Received: from caiajhbdcaib.dreamhost.com ([208.97.132.81]:52895
	helo=homiemail-a38.g.dreamhost.com)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1Ri8Av-0001jv-DQ
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:29:25 -0500
Received: from homiemail-a38.g.dreamhost.com (localhost [127.0.0.1])
	by homiemail-a38.g.dreamhost.com (Postfix) with ESMTP id 6F9C010AFB1
	for <bug-bash@gnu.org>; Tue,  3 Jan 2012 09:29:23 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; c=nofws; d=jidanni.org; h=from:to:subject
	:date:message-id:mime-version:content-type; q=dns; s=jidanni.org
	; b=Y+6YvXVjDHD3ieFYlYuTMdUL5/SUvk7Pyu3m97yaChaeHQ56+de8dFyT2mwc
	NUoiNR3M8Vf3HMuJtLWY5fw56Bq395YMHD/YRhHdUBqaC2+ReDfxTnP85tM3xmXG
	CvC0fBgJ287T2BWx+sJVUHtWx34bm40XtC/CPBf/PcJHt9Q=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=jidanni.org; h=from:to
	:subject:date:message-id:mime-version:content-type; s=
	jidanni.org; bh=1n8lEmLHw8xVjsZ6WJkNeTtxuB8=; b=D5IcfVEAV2/6hf5L
	OMwR0aGITxpiC8ODvUvZzuuFVnMTxrt8vp6t0gNOn8TR6VrZdM0eiL5UrITYy74d
	4rmhxHxr7+AvX7klUHgvSW2zhwFXeFBfuWPwHfJFABBmnEq8gu9unpdCZPTG1RJR
	tGKLbIjMOlqvUMiSXrouR4lofPg=
Received: from jidanni.org (218-163-22-10.dynamic.hinet.net [218.163.22.10])
	(using TLSv1 with cipher AES256-SHA (256/256 bits))
	(No client certificate requested)
	(Authenticated sender: jidanni@jidanni.org)
	by homiemail-a38.g.dreamhost.com (Postfix) with ESMTPSA id 0BC0E10AFAD
	for <bug-bash@gnu.org>; Tue,  3 Jan 2012 09:29:23 -0800 (PST)
From: jidanni@jidanni.org
To: bug-bash@gnu.org
Subject: let's set the positional parameters with a simple 'read'
Date: Wed, 04 Jan 2012 01:16:27 +0800
Message-ID: <87vcosr9jo.fsf@jidanni.org>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 208.97.132.81
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?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, 03 Jan 2012 17:29:34 -0000

One can do
$ read p
to set $p
but no just as easy method to set $@, $1, etc.
One must do
$ set -- `cat` #which involves ^D, "too much trouble"
Or set -- `read x; echo "$x"` etc.

No, nothing as easy as
$ read 1
sds
bash: read: `1': not a valid identifier
$ read @
sdss
bash: read: `@': not a valid identifier

Regretful.

How about just
$ set -- sds
you say. Well that won't work as good as
$ read x
http://www.youtube.com/watch?v=PLTOc2TVAs8&list=PL54881C422E6B58FC
$

When one is pasting URLs with the mouse, and they contain special
characters.

Yes one could do
$ set '<PASTE>'
but that is a little more fuss.

So I propose we 'wreck the language' to allow me to do
$ read @
to set $@, same with 1, 2,.. * (almost the same as @).



From MAILER-DAEMON Tue Jan 03 12:30:13 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Ri8Bh-0003Ib-Ea
	for mharc-bug-bash@gnu.org; Tue, 03 Jan 2012 12:30:13 -0500
Received: from eggs.gnu.org ([140.186.70.92]:56711)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1Ri8Ba-0003FZ-PQ
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:30:11 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1Ri8BZ-0001wU-Mk
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:30:06 -0500
Received: from mx1.redhat.com ([209.132.183.28]:51803)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1Ri8BZ-0001vR-Cu
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:30:05 -0500
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 q03HU36s017423
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Tue, 3 Jan 2012 12:30:03 -0500
Received: from [10.3.113.16] ([10.3.113.16])
	by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
	id q03HU3Wi028775; Tue, 3 Jan 2012 12:30:03 -0500
Message-ID: <4F033B1A.300@redhat.com>
Date: Tue, 03 Jan 2012 10:30:02 -0700
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:9.0) Gecko/20111222 Thunderbird/9.0
MIME-Version: 1.0
To: nick humphrey <nick.c.humphrey@gmail.com>
Subject: Re: bash, echo or openssl bug?
References: <CAKDOLahz0LCyKm6GtiygJvFiqPsUqJ3=BuL6VoBRBd9WLZO3dw@mail.gmail.com>
In-Reply-To: <CAKDOLahz0LCyKm6GtiygJvFiqPsUqJ3=BuL6VoBRBd9WLZO3dw@mail.gmail.com>
X-Enigmail-Version: 1.3.4
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="------------enigAB0404D9B9C7D1ED148F9B12"
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 209.132.183.28
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: Tue, 03 Jan 2012 17:30:11 -0000

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

On 01/03/2012 06:48 AM, nick humphrey wrote:
> Description:
>         i dont know if the bug is a bash bug or openssl or echo, but wh=
en i
> echo a string and pipe it to openssl, the
> output comes on the same line as the prompt instead of a new line.

None of the above.  It's not a bug.  Your encoded string does not have a
trailing newline, and your $PS1 settings don't inject a starting
newline, so the behavior is expected.  If you want to guarantee a
trailing newline, then add one manually:

>         1. run the following code in bash terminal:
> echo OHBjcWNLNGlQaVF5 | openssl base64 -d

echo OHBjcWNLNGlQaVF5 | openssl base64 -d && echo

or modify your PS1 to start with a newline request.

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


--------------enigAB0404D9B9C7D1ED148F9B12
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.11 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJPAzsaAAoJEKeha0olJ0NqjhAIAIvohQYRl1i7XjpbAGHoyqZ1
kjEjbU6Rs1KptS9AOAK+ToZ80NYDhjzGq9lNbnjtcny/q5piHjUBmuf5jNG2B49W
Mm0L2t365q1B/+FgvkzoEiut2RjRK9Zd/3JvJA0FT9Wkd0SxCVnijlBh1ZHyfoXv
wT2AW8HbgKlttC++zCSyb6GfeCojlgQs9LUgeV303cV68B/juL4fphJvuAkbDzzw
zn96vawyNXJqOlNNUsCNkl5HtCP+7Z6Vect4csgPucNdEVOgGY2DoMctP6zR4le7
FwNp7/qKhOqj4tOno8Ej/QTKOvp+gfpyARJhYk0ImPOXuGlGVJg9omcAkJlXbuI=
=pryS
-----END PGP SIGNATURE-----

--------------enigAB0404D9B9C7D1ED148F9B12--


From MAILER-DAEMON Tue Jan 03 12:36:36 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Ri8Hr-0004DV-WD
	for mharc-bug-bash@gnu.org; Tue, 03 Jan 2012 12:36:35 -0500
Received: from eggs.gnu.org ([140.186.70.92]:52581)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Ri8Hp-00049T-Lt
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:36:34 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Ri8Ho-0002qC-ON
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:36:33 -0500
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:38257
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Ri8Ho-0002q6-Jd
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:36:32 -0500
Received: (qmail 4049 invoked from network); 3 Jan 2012 17:36:31 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Tue, 03 Jan 2012 12:36:31 -0500
Received: (qmail 812 invoked by uid 563); 3 Jan 2012 17:36:30 -0000
Date: Tue, 3 Jan 2012 12:36:30 -0500
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: jidanni@jidanni.org
Subject: Re: let's set the positional parameters with a simple 'read'
Message-ID: <20120103173630.GF8556@eeg.ccf.org>
References: <87vcosr9jo.fsf@jidanni.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <87vcosr9jo.fsf@jidanni.org>
User-Agent: Mutt/1.4.2.3i
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older,
	2)
X-Received-From: 139.137.100.1
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Jan 2012 17:36:34 -0000

On Wed, Jan 04, 2012 at 01:16:27AM +0800, jidanni@jidanni.org wrote:
> So I propose we 'wreck the language' to allow me to do
> $ read @
> to set $@, same with 1, 2,.. * (almost the same as @).

Why not just use a named array?

$ read -a myarray


From MAILER-DAEMON Tue Jan 03 12:36:37 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Ri8Ht-0004Hu-RA
	for mharc-bug-bash@gnu.org; Tue, 03 Jan 2012 12:36:37 -0500
Received: from eggs.gnu.org ([140.186.70.92]:52565)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1Ri8Hm-00049N-MZ
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:36:36 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1Ri8Hl-0002pf-D6
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:36:30 -0500
Received: from mx1.redhat.com ([209.132.183.28]:3735)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1Ri8Hl-0002pT-5D
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:36:29 -0500
Received: from int-mx12.intmail.prod.int.phx2.redhat.com
	(int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q03HaRYC026837
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Tue, 3 Jan 2012 12:36:28 -0500
Received: from [10.3.113.16] ([10.3.113.16])
	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id q03HaRGb016473; Tue, 3 Jan 2012 12:36:27 -0500
Message-ID: <4F033C9B.2050701@redhat.com>
Date: Tue, 03 Jan 2012 10:36:27 -0700
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:9.0) Gecko/20111222 Thunderbird/9.0
MIME-Version: 1.0
To: jidanni@jidanni.org
Subject: Re: let's set the positional parameters with a simple 'read'
References: <87vcosr9jo.fsf@jidanni.org>
In-Reply-To: <87vcosr9jo.fsf@jidanni.org>
X-Enigmail-Version: 1.3.4
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="------------enig2796D003446F92AB34976BE3"
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
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: Tue, 03 Jan 2012 17:36:36 -0000

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

On 01/03/2012 10:16 AM, jidanni@jidanni.org wrote:
> One can do
> $ read p
> to set $p
> but no just as easy method to set $@, $1, etc.
> One must do
> $ set -- `cat` #which involves ^D, "too much trouble"
> Or set -- `read x; echo "$x"` etc.

No need for a subshell to do what you want.  Just do:

read p
set -- "$p"

to set $1, or

read p
set -- $p

to set all of $@ according to the IFS splitting of $p.

>=20
> So I propose we 'wreck the language' to allow me to do
> $ read @
> to set $@, same with 1, 2,.. * (almost the same as @).

Sorry, I don't think this is worth doing.

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


--------------enig2796D003446F92AB34976BE3
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.11 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJPAzybAAoJEKeha0olJ0NqZlkH/jlTnICqRSBKv0zTXUcSvwt/
awPnPiJ+W7/gxAQeSmVkmi4K4ymYeNEdc72t0jTKA0bO0/BIDlJbMbbf1IHKKrGO
Ao7gZ7Z8j7szZdCeU0IiOnM729//CPb/9fEh3cJytseFVqU63BncKqPAF83hKn2f
6Ydh2qkJUDVwbl5IunSVbitJFiQWhatYmzgYTSU6o65S/tVUiuFYYu9n2+K0neSt
7DNYO3NGDspmH/bHLb+o8uqw4zeQKgdlLAH2G6UOU4tFt04c6GcFbdvhw3QLYm0p
pMhGyRVyCKucaWa8PuaM8XMUAOtMFLa1JVgfpsH/vB/9BXKaH/n2d8xEVu38eXQ=
=Cbxs
-----END PGP SIGNATURE-----

--------------enig2796D003446F92AB34976BE3--


From MAILER-DAEMON Tue Jan 03 12:36:45 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Ri8I1-0004T6-UO
	for mharc-bug-bash@gnu.org; Tue, 03 Jan 2012 12:36:45 -0500
Received: from eggs.gnu.org ([140.186.70.92]:52638)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Ri8Hx-0004Qh-A5
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:36:45 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Ri8Hw-0002rw-Cc
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:36:41 -0500
Received: from mail-tul01m020-f169.google.com ([209.85.214.169]:33319)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Ri8Hw-0002rh-9Q
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:36:40 -0500
Received: by obcwo8 with SMTP id wo8so15612338obc.0
	for <bug-bash@gnu.org>; Tue, 03 Jan 2012 09:36:39 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type;
	bh=pRVh1E7SUqJg+5ihlQep2M8lh9J/8zQkAJBQvC+VIRU=;
	b=fjNcAnm0CAvUxxXkVgTMIdQaPVKKYEdkWSsLMsdMhba+SGq1SyVH5NvLhkhcav/F8Y
	Lxlt6EDx0msjP4PGXCDw9u76n+iyXUlaaQK3pbZNFJAdJpqmrfTF4PZ5JSafjAOeQerL
	T4wvNWM5JM3uPk5L/YvlMi52GUxTXeageqBZ8=
Received: by 10.50.195.227 with SMTP id ih3mr63586206igc.19.1325612199072;
	Tue, 03 Jan 2012 09:36:39 -0800 (PST)
MIME-Version: 1.0
Received: by 10.42.230.71 with HTTP; Tue, 3 Jan 2012 09:36:16 -0800 (PST)
In-Reply-To: <87vcosr9jo.fsf@jidanni.org>
References: <87vcosr9jo.fsf@jidanni.org>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Tue, 3 Jan 2012 19:36:16 +0200
Message-ID: <CAPSX3sRgAoN9PykdiSg5sxy9jPYmG0kUcU6ArXYKwwj25G1mzw@mail.gmail.com>
Subject: Re: let's set the positional parameters with a simple 'read'
To: jidanni@jidanni.org
Content-Type: text/plain; charset=ISO-8859-1
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
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, 03 Jan 2012 17:36:45 -0000

On Tue, Jan 3, 2012 at 7:16 PM,  <jidanni@jidanni.org> wrote:
...
> So I propose we 'wreck the language' to allow me to do
> $ read @
> to set $@, same with 1, 2,.. * (almost the same as @).
>

Since you can use "read -a arr" to set arr[1] arr[2] ...etc it's not
that interesting
Setting the positional parameters is really only useful as tricks in
shells that don't have
function local variables or arrays.


From MAILER-DAEMON Tue Jan 03 12:37:16 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Ri8IW-0005QR-Io
	for mharc-bug-bash@gnu.org; Tue, 03 Jan 2012 12:37:16 -0500
Received: from eggs.gnu.org ([140.186.70.92]:52695)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1Ri8IU-0005PB-Jo
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:37:15 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1Ri8IO-0002tU-9z
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:37:14 -0500
Received: from smtp.gentoo.org ([140.211.166.183]:43191)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vapier@gentoo.org>) id 1Ri8IO-0002tO-4r
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:37:08 -0500
Received: from vapier.localnet (localhost [127.0.0.1])
	by smtp.gentoo.org (Postfix) with ESMTP id CFAFC1B4010;
	Tue,  3 Jan 2012 17:37:03 +0000 (UTC)
From: Mike Frysinger <vapier@gentoo.org>
Organization: wh0rd.org
To: bug-bash@gnu.org
Subject: Re: bash, echo or openssl bug?
Date: Tue, 3 Jan 2012 12:37:15 -0500
User-Agent: KMail/1.13.7 (Linux/3.1.0-atsc; KDE/4.6.5; x86_64; ; )
References: <CAKDOLahz0LCyKm6GtiygJvFiqPsUqJ3=BuL6VoBRBd9WLZO3dw@mail.gmail.com>
In-Reply-To: <CAKDOLahz0LCyKm6GtiygJvFiqPsUqJ3=BuL6VoBRBd9WLZO3dw@mail.gmail.com>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart1566000.xs58Rd8s2a";
	protocol="application/pgp-signature"; micalg=pgp-sha1
Content-Transfer-Encoding: 7bit
Message-Id: <201201031237.16324.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: nick humphrey <nick.c.humphrey@gmail.com>, 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: Tue, 03 Jan 2012 17:37:15 -0000

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

On Tuesday 03 January 2012 08:48:27 nick humphrey wrote:
> Description:
>         i dont know if the bug is a bash bug or openssl or echo, but when=
 i
> echo a string and pipe it to openssl, the
> output comes on the same line as the prompt instead of a new line. it mak=
es
> the output hard to read because it is prepended
> to the prompt text, e.g. mySecretPasswordtcadmin@buildserver: ~$
>=20
> Repeat-By:
>         1. run the following code in bash terminal:
> echo OHBjcWNLNGlQaVF5 | openssl base64 -d
>=20
>         2. the output in the bash terminal looks like this:
> mySecretPasswordtcadmin@buildserver: ~$

there is no bug in any of these packages.  openssl doesn't include a traili=
ng=20
new line.

>         3. the output SHOULD look like this:
> mySecretPassword
> tcadmin@buildserver: ~$

then add it yourself:
	$ echo OHBjcWNLNGlQaVF5 | openssl base64 -d; echo
	$ out=3D$(echo OHBjcWNLNGlQaVF5 | openssl base64 -d); echo "${out}"
	... many other ways ...
=2Dmike

--nextPart1566000.xs58Rd8s2a
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)

iQIcBAABAgAGBQJPAzzMAAoJEEFjO5/oN/WBx1sQAJzusFlhDKAgGuKyFHeBaSF/
kSO5CZTlkFAQ0GF1ArdUde5OTmcNSbLFGl5+FgPcEqNhmRkfU0zeu6GTrXo81xX6
HJeTNo9XxxMC9y9IC/sfE7pasdaf0etzFQ5t/ejbwqGsopR+5bSb3KrmpWhkN5Zq
JICutsDRWT/SuirzrCtik/B7wJ+jc83qSRxRFX6SPomRpvDIeiVYuD+Oc/n8vGrN
tWOrOvbakDXqMjjBAUBOvlCEJLIzMe10cZT3JmsvqZxaXXrahSgxHAF1ZsIASFXV
B0Ddd0+5AwsKoZtEJJb85xv5eYeF74NYi0C874ClaPQ/GpbgGKMbnbTeruVMZY6v
43/02e+SVoYPd+ir3vTcpS8hWnBwQCP3TZZob9Yvl42n0f7FgEVczvipX9eQktAP
MTB2eiMWYDYGeaeyZ/SMj+BGBWN7AE7cbdnFRKmQuOePYA7g9tCJBS497s9vToyZ
EG5B2NHa6WJDfweV+yckI31+y5U/JdlcPtjTZA+SJqyaB310QOivgeGGuyqrSTah
te2jgN30fgIWCbp0CyZVx1zCN90PL3mDox3E4G2yaTic3d9gbxz7V0PDohIQeFJE
/fB8NcIRc+bWcYUxhKclwFk4ZS2q01tB0FFbD7jC6kVhn2+Xfqz9VF5uTramaXJx
1LT5JarABlgLi0EqxVE8
=PAHu
-----END PGP SIGNATURE-----

--nextPart1566000.xs58Rd8s2a--


From MAILER-DAEMON Tue Jan 03 12:47:15 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Ri8SB-0002wt-V9
	for mharc-bug-bash@gnu.org; Tue, 03 Jan 2012 12:47:15 -0500
Received: from eggs.gnu.org ([140.186.70.92]:44866)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1Ri8S7-0002t3-0Z
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:47:14 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1Ri8S0-0004PP-2A
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:47:10 -0500
Received: from caiajhbdccah.dreamhost.com ([208.97.132.207]:34643
	helo=homiemail-a4.g.dreamhost.com)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1Ri8Rz-0004PA-QC
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:47:04 -0500
Received: from homiemail-a4.g.dreamhost.com (localhost [127.0.0.1])
	by homiemail-a4.g.dreamhost.com (Postfix) with ESMTP id 4339251C073;
	Tue,  3 Jan 2012 09:47:02 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; c=nofws; d=jidanni.org; h=from:to:cc:subject
	:references:date:message-id:mime-version:content-type;
	q=dns; s=
	jidanni.org; b=KFMYcv+ouKaMDhTtoWqN43RB/DQWtETcfWOsVqpZ3u/wtmc9r
	1nmSme3b66lL2FtOkF1iAeWYzQXnjJ/LmE9g1Wy/+IWnq8BpahrKaG7lj2KCnaIc
	FeJ6aK8u1BjwCMKog4nki4om89Kv9UZ3cxnKA7fFY5cpn9nP5d3gwQTiJI=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=jidanni.org; h=from:to:cc
	:subject:references:date:message-id:mime-version:content-type;
	s=jidanni.org; bh=rfUyauy0P1XYFS1mlCsKXpx7Mgo=; b=ju4CNMunmqbS3
	Z2opJrkeuS82uSOiPz9/rON3VgdlFZgp4qTow01PjrSzSyKPlyTidCT9b/yaytKw
	zRMger/KvX+QjYnU5tUeqVCLfAuRlcVo14K1BaMAOjnn4ZPg+3FSRTxT+6QgHZx2
	9LezSltZbamEBu4YCjTfgYkVQzoSqk=
Received: from jidanni.org (218-163-22-10.dynamic.hinet.net [218.163.22.10])
	(using TLSv1 with cipher AES256-SHA (256/256 bits))
	(No client certificate requested)
	(Authenticated sender: jidanni@jidanni.org)
	by homiemail-a4.g.dreamhost.com (Postfix) with ESMTPSA id EBF4751C070; 
	Tue,  3 Jan 2012 09:47:01 -0800 (PST)
From: jidanni@jidanni.org
To: wooledg@eeg.ccf.org
Subject: Re: let's set the positional parameters with a simple 'read'
References: <20120103173630.GF8556@eeg.ccf.org>
Date: Wed, 04 Jan 2012 01:46:59 +0800
Message-ID: <87d3b0r84s.fsf@jidanni.org>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 208.97.132.207
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, 03 Jan 2012 17:47:14 -0000

>>>>> "GW" == Greg Wooledge <wooledg@eeg.ccf.org> writes:
GW> Why not just use a named array?
GW> $ read -a myarray
But does that let me get a my favorite array, the positional parameters?


From MAILER-DAEMON Tue Jan 03 12:53:26 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Ri8YA-0004Ak-N9
	for mharc-bug-bash@gnu.org; Tue, 03 Jan 2012 12:53:26 -0500
Received: from eggs.gnu.org ([140.186.70.92]:42177)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1Ri8Y7-00041s-SW
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:53:24 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1Ri8Y5-0005Dp-PU
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:53:23 -0500
Received: from mx1.redhat.com ([209.132.183.28]:33795)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1Ri8Y5-0005DV-BY
	for bug-bash@gnu.org; Tue, 03 Jan 2012 12:53:21 -0500
Received: from int-mx12.intmail.prod.int.phx2.redhat.com
	(int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q03HqtFq005018
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Tue, 3 Jan 2012 12:52:55 -0500
Received: from [10.3.113.16] ([10.3.113.16])
	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id q03HqsXN022620; Tue, 3 Jan 2012 12:52:54 -0500
Message-ID: <4F034076.6080807@redhat.com>
Date: Tue, 03 Jan 2012 10:52:54 -0700
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:9.0) Gecko/20111222 Thunderbird/9.0
MIME-Version: 1.0
To: jidanni@jidanni.org
Subject: Re: let's set the positional parameters with a simple 'read'
References: <20120103173630.GF8556@eeg.ccf.org> <87d3b0r84s.fsf@jidanni.org>
In-Reply-To: <87d3b0r84s.fsf@jidanni.org>
X-Enigmail-Version: 1.3.4
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="------------enigB0DBE523CE2B2213AF5F22A8"
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 209.132.183.28
Cc: wooledg@eeg.ccf.org, bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Jan 2012 17:53:24 -0000

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

On 01/03/2012 10:46 AM, jidanni@jidanni.org wrote:
>>>>>> "GW" =3D=3D Greg Wooledge <wooledg@eeg.ccf.org> writes:
> GW> Why not just use a named array?
> GW> $ read -a myarray
> But does that let me get a my favorite array, the positional parameters=
?

Any time you want to assign the positional parameters, use set.  It's as
simple as that.  What's wrong with:

read -a myarray
set -- "${myarray[@]}"

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


--------------enigB0DBE523CE2B2213AF5F22A8
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.11 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJPA0B2AAoJEKeha0olJ0NqvGIH/1g6skj5b/cOYKzihNFJU2eZ
sNLrYXFvxGbWnNo8Q1oHU8qnWSJXi694KnwUUv+xphQ8DI7q/zZnSe48E5Ain/7t
lyDTFORK+74YEelb690CZU1Y2n4FYjerKS7+IIG9WicTAL1ZGbVWj3ATZzR63kya
odhMA0JFK4JxusypT32QIz2zuaNB9bWtXVnwPpcWOTre87JCF+VJWgYelNGWsa54
+sUldFnFyGcePKEMKJsJouysqX8apjtTiso1v8WG738rlCULxvNcJIX1h0F1OZPc
p9O/Qsj1BHauqHnn0cCL7F13jq47k7ZncfG2mokxyP0OGcGBgUIDqFaRvVULpJA=
=ZmEd
-----END PGP SIGNATURE-----

--------------enigB0DBE523CE2B2213AF5F22A8--


From MAILER-DAEMON Tue Jan 03 16:04:52 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RiBXQ-0001Ps-Js
	for mharc-bug-bash@gnu.org; Tue, 03 Jan 2012 16:04:52 -0500
Received: from eggs.gnu.org ([140.186.70.92]:59371)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1RiBXO-0001Mk-88
	for bug-bash@gnu.org; Tue, 03 Jan 2012 16:04:51 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1RiBXN-0004Eq-6o
	for bug-bash@gnu.org; Tue, 03 Jan 2012 16:04:50 -0500
Received: from lo.gmane.org ([80.91.229.12]:35845)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1RiBXN-0004Em-1h
	for bug-bash@gnu.org; Tue, 03 Jan 2012 16:04:49 -0500
Received: from list by lo.gmane.org with local (Exim 4.69)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1RiBXL-0000iR-9C
	for bug-bash@gnu.org; Tue, 03 Jan 2012 22:04:47 +0100
Received: from 188-223-3-27.zone14.bethere.co.uk ([188.223.3.27])
	by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
	id 1AlnuQ-0007hv-00
	for <bug-bash@gnu.org>; Tue, 03 Jan 2012 22:04:47 +0100
Received: from stephane_chazelas by 188-223-3-27.zone14.bethere.co.uk with
	local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00
	for <bug-bash@gnu.org>; Tue, 03 Jan 2012 22:04:47 +0100
X-Injected-Via-Gmane: http://gmane.org/
Mail-Followup-To: bug-bash@gnu.org
To: bug-bash@gnu.org
From: Stephane CHAZELAS <stephane_chazelas@yahoo.fr>
Subject: Re: let's set the positional parameters with a simple 'read'
Date: Tue, 3 Jan 2012 21:04:30 +0000 (UTC)
Lines: 28
Message-ID: <slrnjg6rat.tpb.stephane_chazelas@spam.is.invalid>
References: <20120103173630.GF8556@eeg.ccf.org> <87d3b0r84s.fsf@jidanni.org>
X-Complaints-To: usenet@dough.gmane.org
X-Gmane-NNTP-Posting-Host: 188-223-3-27.zone14.bethere.co.uk
Mail-Copies-To: nobody
User-Agent: slrn/pre1.0.0-18 (Linux)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 80.91.229.12
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?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, 03 Jan 2012 21:04:51 -0000

2012-01-04, 01:46(+08), jidanni@jidanni.org:
>>>>>> "GW" == Greg Wooledge <wooledg@eeg.ccf.org> writes:
>GW> Why not just use a named array?
>GW> $ read -a myarray
> But does that let me get a my favorite array, the positional parameters?

FWIW, in zsh:

~$ read -A argv
a b c
~$ echo $1
a
~$ read 1
x
~$ echo $1
x

See also

vared argv
and
vared 1

to edit them with the zsh line editor (zle, the bash equivalent
would be readline as invoked by read -e)

-- 
Stephane



From MAILER-DAEMON Tue Jan 03 18:31:26 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RiDpG-00058c-Ld
	for mharc-bug-bash@gnu.org; Tue, 03 Jan 2012 18:31:26 -0500
Received: from eggs.gnu.org ([140.186.70.92]:43903)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <nick.c.humphrey@gmail.com>) id 1RiDpC-00052L-5q
	for bug-bash@gnu.org; Tue, 03 Jan 2012 18:31:23 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <nick.c.humphrey@gmail.com>) id 1RiDpA-0001nZ-Mt
	for bug-bash@gnu.org; Tue, 03 Jan 2012 18:31:22 -0500
Received: from mail-iy0-f169.google.com ([209.85.210.169]:50715)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <nick.c.humphrey@gmail.com>) id 1RiDpA-0001nV-9U
	for bug-bash@gnu.org; Tue, 03 Jan 2012 18:31:20 -0500
Received: by iacb35 with SMTP id b35so34769099iac.0
	for <bug-bash@gnu.org>; Tue, 03 Jan 2012 15:31:19 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type;
	bh=Whj6DQMxsP86K3vZY0Rx4xpBm99LD8owt8Pdthcrctw=;
	b=FyBfmc40w+F5mOhvaAej1+gDlA9LPt1kRpR3Fq5EAJ4wIuWORW9uZcvWwT9iA0nTEl
	HhiCFAsEgZoTNbsYg2z4FV6skBCYIPOX3VDegkPFhf/vniZZyCHP4bWxoWg04dJ8wNkx
	sOB3kmdqacn5aLJQsC9fPXEMcNz0tEV4k0eiQ=
MIME-Version: 1.0
Received: by 10.42.117.193 with SMTP id u1mr56480261icq.24.1325633479422; Tue,
	03 Jan 2012 15:31:19 -0800 (PST)
Received: by 10.42.244.129 with HTTP; Tue, 3 Jan 2012 15:31:19 -0800 (PST)
In-Reply-To: <4F033B1A.300@redhat.com>
References: <CAKDOLahz0LCyKm6GtiygJvFiqPsUqJ3=BuL6VoBRBd9WLZO3dw@mail.gmail.com>
	<4F033B1A.300@redhat.com>
Date: Wed, 4 Jan 2012 00:31:19 +0100
Message-ID: <CAKDOLajyhGgwBGrJ+9tOuk4Dt7s-Bn7ce3a2UrNvF7vSdzBcuA@mail.gmail.com>
Subject: Re: bash, echo or openssl bug?
From: nick humphrey <nick.c.humphrey@gmail.com>
To: Eric Blake <eblake@redhat.com>, vapier@gentoo.org
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 209.85.210.169
Content-Type: text/plain; charset=UTF-8
X-Content-Filtered-By: Mailman/MimeDel 2.1.14
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: Tue, 03 Jan 2012 23:31:23 -0000

thanks eric and mike for your quick reply and suggestions =)

2012/1/3 Eric Blake <eblake@redhat.com>

> On 01/03/2012 06:48 AM, nick humphrey wrote:
> > Description:
> >         i dont know if the bug is a bash bug or openssl or echo, but
> when i
> > echo a string and pipe it to openssl, the
> > output comes on the same line as the prompt instead of a new line.
>
> None of the above.  It's not a bug.  Your encoded string does not have a
> trailing newline, and your $PS1 settings don't inject a starting
> newline, so the behavior is expected.  If you want to guarantee a
> trailing newline, then add one manually:
>
> >         1. run the following code in bash terminal:
> > echo OHBjcWNLNGlQaVF5 | openssl base64 -d
>
> echo OHBjcWNLNGlQaVF5 | openssl base64 -d && echo
>
> or modify your PS1 to start with a newline request.
>
> --
> Eric Blake   eblake@redhat.com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>

From MAILER-DAEMON Wed Jan 04 01:38:34 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RiKUc-0001vx-TD
	for mharc-bug-bash@gnu.org; Wed, 04 Jan 2012 01:38:34 -0500
Received: from eggs.gnu.org ([140.186.70.92]:45232)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1RiKUa-0001t5-44
	for bug-bash@gnu.org; Wed, 04 Jan 2012 01:38:32 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1RiKUZ-0006Tm-0j
	for bug-bash@gnu.org; Wed, 04 Jan 2012 01:38:32 -0500
Received: from caiajhbdcaid.dreamhost.com ([208.97.132.83]:35863
	helo=homiemail-a62.g.dreamhost.com)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1RiKUY-0006Tf-FP
	for bug-bash@gnu.org; Wed, 04 Jan 2012 01:38:30 -0500
Received: from homiemail-a62.g.dreamhost.com (localhost [127.0.0.1])
	by homiemail-a62.g.dreamhost.com (Postfix) with ESMTP id 31D2D634075;
	Tue,  3 Jan 2012 22:38:28 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; c=nofws; d=jidanni.org; h=from:to:cc:subject
	:references:date:message-id:mime-version:content-type;
	q=dns; s=
	jidanni.org; b=L7bg9bh90e1QRQWeylPC4SwHPWdzxpvelluOkZaQ26+sdGP1I
	x6LDNFcxJHwUCbMMzSyHbldo/8Vs8ZRxVDz4hd1UqAhZc6F8w8sx4iNYskZqIGeB
	GIdDm1Ak1yj+2WKw57C/RU4GkeqTz6na0jUqKOeJHjKv0vkGUn7r9Ht9Xg=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=jidanni.org; h=from:to:cc
	:subject:references:date:message-id:mime-version:content-type;
	s=jidanni.org; bh=hp6aW4MI1emrkPdWlVfvas5ixlQ=; b=Ll8JfmR0wEX71
	hFx/qCJMZ7TcRNBK2RkYEP/LsrXfBk9n2StMNvIA1Tl4WbXrIP3GrCVUjUWV+L1b
	irjjQ2Pgr8x8dOTYXam6LjdajwXpKyYO9ek3vjzu8hSN46vNHvoZZX6r/uXmH6Ld
	QRmuOlzh7h6JvK43pJ73n9amS3mwss=
Received: from jidanni.org (218-163-16-52.dynamic.hinet.net [218.163.16.52])
	(using TLSv1 with cipher AES256-SHA (256/256 bits))
	(No client certificate requested)
	(Authenticated sender: jidanni@jidanni.org)
	by homiemail-a62.g.dreamhost.com (Postfix) with ESMTPSA id D1B3963406E; 
	Tue,  3 Jan 2012 22:38:27 -0800 (PST)
From: jidanni@jidanni.org
To: eblake@redhat.com
Subject: Re: let's set the positional parameters with a simple 'read'
References: <4F033C9B.2050701@redhat.com>
Date: Wed, 04 Jan 2012 14:38:22 +0800
Message-ID: <87zke4c6qp.fsf@jidanni.org>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 208.97.132.83
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, 04 Jan 2012 06:38:32 -0000

Hmmm, as S. CHAZELAS said seems zsh also gives one a chance to reset an
arbitrary positional parameter, e.g., the 42nd, whereas in bash one must
set them all at once:
$ set `seq 55`
$ echo $42
42
$ echo $66
66
:-)
Anyway isn't it rather old fashioned not to be able to somehow reset
${42} without needing to tamper with the rest?


From MAILER-DAEMON Wed Jan 04 07:21:41 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RiPqf-0008Nt-E1
	for mharc-bug-bash@gnu.org; Wed, 04 Jan 2012 07:21:41 -0500
Received: from eggs.gnu.org ([140.186.70.92]:55390)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <stsp@list.ru>) id 1RiPqd-0008Nn-A7
	for bug-bash@gnu.org; Wed, 04 Jan 2012 07:21:40 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <stsp@list.ru>) id 1RiPqc-0000Qf-1Y
	for bug-bash@gnu.org; Wed, 04 Jan 2012 07:21:39 -0500
Received: from smtp18.mail.ru ([94.100.176.155]:58190)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <stsp@list.ru>)
	id 1RiPqb-0000QL-DP
	for bug-bash@gnu.org; Wed, 04 Jan 2012 07:21:38 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru;
	s=mail; 
	h=Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID;
	bh=nIDGDO7C/RCdEDYtxeK5rRlv41AAcTuVlIQDoIP1RBE=; 
	b=bid7svxflKQnEjhHZLVYggApS6O8hQreFmPAKod3CjmdRHLIEtoFA673BPnTMLsIHCgWZZbIp/n57h4i62vISPpkW7IkIUJfAjNh2Q1pG5RBn+1u1NJCa7iHfS1NO0Od;
Received: from [89.23.194.253] (port=44938)
	by smtp18.mail.ru with esmtpa (envelope-from <stsp@list.ru>)
	id 1RiPqY-00046C-KV; Wed, 04 Jan 2012 16:21:35 +0400
Message-ID: <4F044402.9070804@list.ru>
Date: Wed, 04 Jan 2012 16:20:18 +0400
From: Stas Sergeev <stsp@list.ru>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:8.0) Gecko/20111115 Thunderbird/8.0
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: bug in force_interactive handling
References: <4EF88EF4.8000202@list.ru> <4EFA3595.4020809@case.edu>
	<4EFAE497.5080602@list.ru> <4EFC9B2E.8050108@case.edu>
	<4EFD941D.6000601@list.ru> <4F01215F.30107@case.edu>
	<4F017865.1050907@list.ru> <4F01F6F8.3020500@case.edu>
	<4F01F9C0.2090605@list.ru> <4F01FD36.6080001@case.edu>
	<4F020125.1020508@list.ru> <4F020E7E.6060806@case.edu>
In-Reply-To: <4F020E7E.6060806@case.edu>
Content-Type: multipart/mixed; boundary="------------040802080008020800000107"
X-Mru-NR: 2
X-Mru-UID: 185631573
X-Mru-IsAutoreg: 0
X-Mru-AutoregInfo: 4740282, []
X-Spam: Not detected
X-Mras: Ok
X-Mru-Karma: 0
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 94.100.176.155
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, 04 Jan 2012 12:21:40 -0000

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

03.01.2012 00:07, Chet Ramey wrote:
>> I tried:
>> ---
>> trap bg USR1
>> ---
>> Now if I first send SIGSTOP to the job and then SIGUSR1 to
>> bash, that works.
>> Is it possible to avoid sending SIGSTOP to the job, and make
>> the trap handler to do both things at once? Not that it is strictly
>> required since you already described a few other ways, but I wonder. :)
> Well, this is getting pretty esoteric.  On one hand, you can avoid the
> entire SIGSTOP/SIGCONT issue by initially starting the job in the
> background with `&'.  On the other, if you want to move a foreground
> job to the background, you have to get it to give up control somehow, and
> sending it a signal is the way to do that.
Hello Chet, I double-checked that, and with the attached
quick hack I was able to do:
trap bg USR1
and move the job to the background with just that SIGUSR1.
Do you think such a feature is worth being implemented?
If yes, feel free to give me the suggestions and I'll try to
implement it properly. The attached patch is just a POC of
course, it is entirely incorrect.

--------------040802080008020800000107
Content-Type: text/plain;
 name="jobs.c.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="jobs.c.diff"

--- jobs.c.old	2011-01-07 18:59:29.000000000 +0300
+++ jobs.c	2012-01-04 16:07:49.001668244 +0400
@@ -1391,6 +1391,26 @@
   return (NO_JOB);
 }
 
+static int
+find_foreground_job (procp)
+     PROCESS **procp;
+{
+  register int i;
+
+  /* XXX could use js.j_firstj here, and should check js.j_lastj */
+  for (i = 0; i < js.j_jobslots; i++)
+    {
+      if (jobs[i] && IS_FOREGROUND (i))
+        {
+          if (procp)
+            *procp = jobs[i]->pipe;
+          return (i);
+        }
+    }
+
+  return (NO_JOB);
+}
+
 /* Find a job given a PID.  If BLOCK is non-zero, block SIGCHLD as
    required by find_job. */
 int
@@ -3067,6 +3087,7 @@
   PROCESS *child;
   pid_t pid;
   int call_set_current, last_stopped_job, job, children_exited, waitpid_flags;
+  int wifcontinued;
   static int wcontinued = WCONTINUED;	/* run-time fix for glibc problem */
 
   call_set_current = children_exited = 0;
@@ -3117,12 +3138,24 @@
       /* If waitpid returns 0, there are running children.  If it returns -1,
 	 the only other error POSIX says it can return is EINTR. */
       CHECK_TERMSIG;
+      wifcontinued = WIFCONTINUED(status);
+      if (pid <= 0 && errno == EINTR)
+	{
+	  PROCESS *p;
+	  int i = find_foreground_job(&p);
+	  if (i != NO_JOB)
+	    {
+	      pid = p->pid;
+	      wifcontinued = 0;
+	      status = 0x7f;
+	    }
+	}
       if (pid <= 0)
 	continue;	/* jumps right to the test */
 
       /* children_exited is used to run traps on SIGCHLD.  We don't want to
          run the trap if a process is just being continued. */
-      if (WIFCONTINUED(status) == 0)
+      if (wifcontinued == 0)
 	{
 	  children_exited++;
 	  js.c_living--;
@@ -3148,7 +3181,7 @@
 
       /* Remember status, and whether or not the process is running. */
       child->status = status;
-      child->running = WIFCONTINUED(status) ? PS_RUNNING : PS_DONE;
+      child->running = wifcontinued ? PS_RUNNING : PS_DONE;
 
       if (PEXITED (child))
 	{

--------------040802080008020800000107--


From MAILER-DAEMON Wed Jan 04 08:28:35 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RiQtP-0005TF-E1
	for mharc-bug-bash@gnu.org; Wed, 04 Jan 2012 08:28:35 -0500
Received: from eggs.gnu.org ([140.186.70.92]:46252)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RiQtH-0005Qy-6Q
	for bug-bash@gnu.org; Wed, 04 Jan 2012 08:28:32 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RiQtC-0002JF-28
	for bug-bash@gnu.org; Wed, 04 Jan 2012 08:28:27 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:6251)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RiQtB-0002J2-VX
	for bug-bash@gnu.org; Wed, 04 Jan 2012 08:28:22 -0500
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 BUF93693; Wed, 04 Jan 2012 08:28:20 -0500 (EST)
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 APX61351 (AUTH cpr);
	Wed, 04 Jan 2012 08:28:20 -0500 (EST)
Message-ID: <4F0453F3.9010002@case.edu>
Date: Wed, 04 Jan 2012 08:28:19 -0500
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Stas Sergeev <stsp@list.ru>
Subject: Re: bug in force_interactive handling
References: <4EF88EF4.8000202@list.ru> <4EFA3595.4020809@case.edu>
	<4EFAE497.5080602@list.ru> <4EFC9B2E.8050108@case.edu>
	<4EFD941D.6000601@list.ru> <4F01215F.30107@case.edu>
	<4F017865.1050907@list.ru> <4F01F6F8.3020500@case.edu>
	<4F01F9C0.2090605@list.ru> <4F01FD36.6080001@case.edu>
	<4F020125.1020508@list.ru> <4F020E7E.6060806@case.edu>
	<4F044402.9070804@list.ru>
In-Reply-To: <4F044402.9070804@list.ru>
X-Enigmail-Version: 1.3.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Jan 2012 13:28:32 -0000

On 1/4/12 7:20 AM, Stas Sergeev wrote:

> Hello Chet, I double-checked that, and with the attached
> quick hack I was able to do:
> trap bg USR1
> and move the job to the background with just that SIGUSR1.
> Do you think such a feature is worth being implemented?

I don't think there's enough need to change bg from operating on stopped
jobs to operating on running jobs.  I would not add this to bash.

Chet

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


From MAILER-DAEMON Wed Jan 04 08:43:40 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RiR80-0000x2-EZ
	for mharc-bug-bash@gnu.org; Wed, 04 Jan 2012 08:43:40 -0500
Received: from eggs.gnu.org ([140.186.70.92]:57448)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <stsp@list.ru>) id 1RiR7u-0000tt-7j
	for bug-bash@gnu.org; Wed, 04 Jan 2012 08:43:38 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <stsp@list.ru>) id 1RiR7o-0004vL-Dr
	for bug-bash@gnu.org; Wed, 04 Jan 2012 08:43:34 -0500
Received: from smtp20.mail.ru ([94.100.176.173]:42507)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <stsp@list.ru>)
	id 1RiR7n-0004v6-Tv
	for bug-bash@gnu.org; Wed, 04 Jan 2012 08:43:28 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru;
	s=mail; 
	h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID;
	bh=F9LbgAwzD6u+ZNhN3Cboh+Yw//h3JVqXr7mNaRF6k0s=; 
	b=TveHt3KhZF3AAxya4UPFBH6iRj5P+XwKVLgJd+IHBIqpMJcNCl7efKnmYPdcYd3sWApZj7WzHYAR0U4Yxxk/FuqHeRd5/QBecFy/sbusjWhmPgJ+nlE7DLh6lyUb4bEd;
Received: from [89.23.194.253] (port=56329)
	by smtp20.mail.ru with esmtpa (envelope-from <stsp@list.ru>)
	id 1RiR7l-0007FX-L5; Wed, 04 Jan 2012 17:43:25 +0400
Message-ID: <4F045731.2060700@list.ru>
Date: Wed, 04 Jan 2012 17:42:09 +0400
From: Stas Sergeev <stsp@list.ru>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:8.0) Gecko/20111115 Thunderbird/8.0
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: bug in force_interactive handling
References: <4EF88EF4.8000202@list.ru> <4EFA3595.4020809@case.edu>
	<4EFAE497.5080602@list.ru> <4EFC9B2E.8050108@case.edu>
	<4EFD941D.6000601@list.ru> <4F01215F.30107@case.edu>
	<4F017865.1050907@list.ru> <4F01F6F8.3020500@case.edu>
	<4F01F9C0.2090605@list.ru> <4F01FD36.6080001@case.edu>
	<4F020125.1020508@list.ru> <4F020E7E.6060806@case.edu>
	<4F044402.9070804@list.ru> <4F0453F3.9010002@case.edu>
In-Reply-To: <4F0453F3.9010002@case.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Mru-NR: 2
X-Mru-UID: 185631573
X-Mru-IsAutoreg: 0
X-Mru-AutoregInfo: 4740282, []
X-Spam: Not detected
X-Mras: Ok
X-Mru-Karma: 0
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 94.100.176.173
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, 04 Jan 2012 13:43:38 -0000

04.01.2012 17:28, Chet Ramey wrote:
>> Hello Chet, I double-checked that, and with the attached
>> quick hack I was able to do:
>> trap bg USR1
>> and move the job to the background with just that SIGUSR1.
>> Do you think such a feature is worth being implemented?
> I don't think there's enough need to change bg from operating on stopped
> jobs to operating on running jobs.  I would not add this to bash.
I didn't mean that at all, and "bg" have almost
nothing to do with the idea.
I just meant for the way to make the trap handler
executed when the foreground job is running.
In my hack it temporary becames the background
job, then the trap is executed. Since the trap executes
"bg", it stays in the background. The command (bg) is
not even needed, maybe it just should be the special
kind of a trap that moves the job to the background
without executing any command? There can be any
kind of an implementation if you think the feature
itself is useful (I think it is, I'll use it :))


From MAILER-DAEMON Wed Jan 04 08:54:50 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RiRIo-0004Jb-5g
	for mharc-bug-bash@gnu.org; Wed, 04 Jan 2012 08:54:50 -0500
Received: from eggs.gnu.org ([140.186.70.92]:55550)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1RiRId-0004JS-6K
	for bug-bash@gnu.org; Wed, 04 Jan 2012 08:54:48 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1RiRIU-0006Y1-VQ
	for bug-bash@gnu.org; Wed, 04 Jan 2012 08:54:39 -0500
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:38748
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1RiRIU-0006XD-Qi
	for bug-bash@gnu.org; Wed, 04 Jan 2012 08:54:30 -0500
Received: (qmail 11300 invoked from network); 4 Jan 2012 13:54:07 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Wed, 04 Jan 2012 08:54:07 -0500
Received: (qmail 1998 invoked by uid 563); 4 Jan 2012 13:54:06 -0000
Date: Wed, 4 Jan 2012 08:54:06 -0500
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: jidanni@jidanni.org
Subject: Re: let's set the positional parameters with a simple 'read'
Message-ID: <20120104135406.GC916@eeg.ccf.org>
References: <4F033C9B.2050701@redhat.com> <87zke4c6qp.fsf@jidanni.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <87zke4c6qp.fsf@jidanni.org>
User-Agent: Mutt/1.4.2.3i
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older,
	2)
X-Received-From: 139.137.100.1
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Jan 2012 13:54:48 -0000

On Wed, Jan 04, 2012 at 02:38:22PM +0800, jidanni@jidanni.org wrote:
> Hmmm, as S. CHAZELAS said seems zsh also gives one a chance to reset an
> arbitrary positional parameter, e.g., the 42nd, whereas in bash one must
> set them all at once:

That is why named arrays are COMPLETELY superior and should be used in
almost every circumstance.

The only reason one would ever use the positional paramters instead of
a named array is because one is writing for sh instead of for bash.

> $ set `seq 55`
> $ echo $42
> 42
> $ echo $66
> 66

That is not doing what you think it is doing.

$ set A B C D E F
$ echo $66
F6

If you want to refer to the 66th positional parameter, you must use ${66}.


From MAILER-DAEMON Wed Jan 04 20:54:42 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RicXS-0001Sg-K3
	for mharc-bug-bash@gnu.org; Wed, 04 Jan 2012 20:54:42 -0500
Received: from eggs.gnu.org ([140.186.70.92]:48311)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pengyu.ut@gmail.com>) id 1RicXQ-0001Sa-TF
	for bug-bash@gnu.org; Wed, 04 Jan 2012 20:54:41 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pengyu.ut@gmail.com>) id 1RicXQ-000068-1b
	for bug-bash@gnu.org; Wed, 04 Jan 2012 20:54:40 -0500
Received: from mail-iy0-f169.google.com ([209.85.210.169]:39691)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pengyu.ut@gmail.com>) id 1RicXP-000061-Us
	for bug-bash@gnu.org; Wed, 04 Jan 2012 20:54:40 -0500
Received: by iacb35 with SMTP id b35so125977iac.0
	for <bug-bash@gnu.org>; Wed, 04 Jan 2012 17:54:38 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:date:message-id:subject:from:to:content-type;
	bh=S0BX5bAOTeho7VZRaY6d1iBQDoTEN8kmIKYKjQ/HQ90=;
	b=aNdeyzw1c6WGcODQKxxZvvETEU+Wj7WIWiRqp8fFwxmvB07QKC6KLmB+P8LINCi2UZ
	p4wZxEFAf2WTlCeIl3cTO8OdT30DFYfvyYIwXhwCusMUF8BVgsVYw6s4VVHiInpiieWs
	Joo6Jbns1f7amsLoQzGhcwlXzVzamRawI6KDM=
MIME-Version: 1.0
Received: by 10.50.34.233 with SMTP id c9mr45050igj.19.1325728478817; Wed, 04
	Jan 2012 17:54:38 -0800 (PST)
Received: by 10.50.87.170 with HTTP; Wed, 4 Jan 2012 17:54:38 -0800 (PST)
Date: Wed, 4 Jan 2012 19:54:38 -0600
Message-ID: <CABrM6wmtFDksPYKbAmTKJBWbTik1A86Cba+JpHa0N3em++cqeQ@mail.gmail.com>
Subject: Specify completion without name
From: Peng Yu <pengyu.ut@gmail.com>
To: bug-bash <bug-bash@gnu.org>
Content-Type: text/plain; charset=ISO-8859-1
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 209.85.210.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, 05 Jan 2012 01:54:41 -0000

Hi,

I want to customize the command completion for completing executables,
I want to search in a file (which includes all the executables in
PATH) rather than the default PATH variable. But I don't see how to do
so, as the following help indicates that it can only configure how to
complete the arguments of a command. Does anybody know how to
configure command completion for the name itself rather than its
arguments? Thanks!

~/Downloads$ help complete
complete: complete [-abcdefgjksuv] [-pr] [-o option] [-A action] [-G
globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F
function] [-C command] [name ...]
    For each NAME, specify how arguments are to be completed.
    If the -p option is supplied, or if no options are supplied, existing
    completion specifications are printed in a way that allows them to be
    reused as input.  The -r option removes a completion specification for
    each NAME, or, if no NAMEs are supplied, all completion specifications.

-- 
Regards,
Peng


From MAILER-DAEMON Wed Jan 04 21:40:02 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RidFK-0004rL-1e
	for mharc-bug-bash@gnu.org; Wed, 04 Jan 2012 21:40:02 -0500
Received: from eggs.gnu.org ([140.186.70.92]:56356)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RidFH-0004po-5s
	for bug-bash@gnu.org; Wed, 04 Jan 2012 21:40:00 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RidFG-0006TB-3a
	for bug-bash@gnu.org; Wed, 04 Jan 2012 21:39:59 -0500
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:60547)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RidFF-0006T6-UV
	for bug-bash@gnu.org; Wed, 04 Jan 2012 21:39:58 -0500
Received: from mpv7.case.edu (mpv7.tis.CWRU.Edu [129.22.104.170])
	by mpv2.tis.cwru.edu (MOS 4.3.3-GA) with ESMTP id BGV97037;
	Wed, 4 Jan 2012 21:39:57 -0500
Received: from h156.184.190.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.190.184.156]) by mpv7.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SGD74785 (AUTH cpr);
	Wed, 04 Jan 2012 21:39:56 -0500 (EST)
Message-ID: <4F050D7C.7020503@case.edu>
Date: Wed, 04 Jan 2012 21:39:56 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Peng Yu <pengyu.ut@gmail.com>
Subject: Re: Specify completion without name
References: <CABrM6wmtFDksPYKbAmTKJBWbTik1A86Cba+JpHa0N3em++cqeQ@mail.gmail.com>
In-Reply-To: <CABrM6wmtFDksPYKbAmTKJBWbTik1A86Cba+JpHa0N3em++cqeQ@mail.gmail.com>
X-Enigmail-Version: 1.3.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 <bug-bash@gnu.org>, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Jan 2012 02:40:00 -0000

On 1/4/12 8:54 PM, Peng Yu wrote:
> Hi,
> 
> I want to customize the command completion for completing executables,
> I want to search in a file (which includes all the executables in
> PATH) rather than the default PATH variable. But I don't see how to do
> so, as the following help indicates that it can only configure how to
> complete the arguments of a command. 

If you upgrade, bash-4.1 added the `-E' option to complete to complete on
empty lines.  There is no programmable completion mechanism to complete
on non-empty command names.

-- 
``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 Jan 04 21:50:51 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RidPn-0005mh-2Y
	for mharc-bug-bash@gnu.org; Wed, 04 Jan 2012 21:50:51 -0500
Received: from eggs.gnu.org ([140.186.70.92]:41406)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RidPk-0005ma-Vj
	for bug-bash@gnu.org; Wed, 04 Jan 2012 21:50:49 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RidPj-0007xC-Op
	for bug-bash@gnu.org; Wed, 04 Jan 2012 21:50:48 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:22669)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RidPj-0007x8-KR
	for bug-bash@gnu.org; Wed, 04 Jan 2012 21:50:47 -0500
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 BUG71901 (AUTH cpr);
	Wed, 04 Jan 2012 21:50:46 -0500 (EST)
Received: from h156.184.190.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.190.184.156]) by mpv7.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SGF00574 (AUTH cpr);
	Wed, 04 Jan 2012 21:50:46 -0500 (EST)
Message-ID: <4F051005.8020901@case.edu>
Date: Wed, 04 Jan 2012 21:50:45 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Stas Sergeev <stsp@list.ru>
Subject: Re: bug in force_interactive handling
References: <4EF88EF4.8000202@list.ru> <4EFA3595.4020809@case.edu>
	<4EFAE497.5080602@list.ru> <4EFC9B2E.8050108@case.edu>
	<4EFD941D.6000601@list.ru> <4F01215F.30107@case.edu>
	<4F017865.1050907@list.ru> <4F01F6F8.3020500@case.edu>
	<4F01F9C0.2090605@list.ru> <4F01FD36.6080001@case.edu>
	<4F020125.1020508@list.ru> <4F020E7E.6060806@case.edu>
	<4F044402.9070804@list.ru> <4F0453F3.9010002@case.edu>
	<4F045731.2060700@list.ru>
In-Reply-To: <4F045731.2060700@list.ru>
X-Enigmail-Version: 1.3.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Jan 2012 02:50:50 -0000

On 1/4/12 8:42 AM, Stas Sergeev wrote:

> I just meant for the way to make the trap handler
> executed when the foreground job is running.

So you'd like the shell to act on a signal without `consulting' the
foreground job?  Take a look at http://www.cons.org/cracauer/sigint.html ,
keeping in mind that it applies to signals other than those generated
from the keyboard, and that it applies whether or not job control is
enabled, and see if you feel the same way.

I don't think it's a good idea.

Chet

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


From MAILER-DAEMON Wed Jan 04 22:13:30 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Ridli-000052-95
	for mharc-bug-bash@gnu.org; Wed, 04 Jan 2012 22:13:30 -0500
Received: from eggs.gnu.org ([140.186.70.92]:50211)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Ridlg-0008VO-E3
	for bug-bash@gnu.org; Wed, 04 Jan 2012 22:13:29 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Ridlf-00024d-9I
	for bug-bash@gnu.org; Wed, 04 Jan 2012 22:13:28 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:8042)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Ridlf-00024Z-0G
	for bug-bash@gnu.org; Wed, 04 Jan 2012 22:13:27 -0500
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 BUG72564 (AUTH cpr);
	Wed, 04 Jan 2012 22:13:25 -0500 (EST)
Received: from h156.184.190.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.190.184.156]) by mpv7.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SGF05508 (AUTH cpr);
	Wed, 04 Jan 2012 22:13:24 -0500 (EST)
Message-ID: <4F051553.9070705@case.edu>
Date: Wed, 04 Jan 2012 22:13:23 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: bug in force_interactive handling
References: <4EF88EF4.8000202@list.ru> <4EFA3595.4020809@case.edu>
	<4EFAE497.5080602@list.ru> <4EFC9B2E.8050108@case.edu>
	<4EFD941D.6000601@list.ru> <4F01215F.30107@case.edu>
	<4F017865.1050907@list.ru> <4F01F6F8.3020500@case.edu>
	<4F01F9C0.2090605@list.ru> <4F01FD36.6080001@case.edu>
	<4F020125.1020508@list.ru> <4F020E7E.6060806@case.edu>
	<4F044402.9070804@list.ru> <4F0453F3.9010002@case.edu>
	<4F045731.2060700@list.ru> <4F051005.8020901@case.edu>
In-Reply-To: <4F051005.8020901@case.edu>
X-Enigmail-Version: 1.3.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: chet.ramey@case.edu, Stas Sergeev <stsp@list.ru>, 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: Thu, 05 Jan 2012 03:13:29 -0000

On 1/4/12 9:50 PM, Chet Ramey wrote:
> On 1/4/12 8:42 AM, Stas Sergeev wrote:
> 
>> I just meant for the way to make the trap handler
>> executed when the foreground job is running.
> 
> So you'd like the shell to act on a signal without `consulting' the
> foreground job?  Take a look at http://www.cons.org/cracauer/sigint.html ,
> keeping in mind that it applies to signals other than those generated
> from the keyboard, and that it applies whether or not job control is
> enabled, and see if you feel the same way.
> 
> I don't think it's a good idea.

The reference isn't really applicable -- though it's still a good read --
since it assumes the signal is sent to both the shell and the foreground
process.  I still don't think this is a good idea, though.

Chet


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


From MAILER-DAEMON Wed Jan 04 22:37:48 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rie9E-0002QU-Mb
	for mharc-bug-bash@gnu.org; Wed, 04 Jan 2012 22:37:48 -0500
Received: from eggs.gnu.org ([140.186.70.92]:37576)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pengyu.ut@gmail.com>) id 1Rie9C-0002QO-Kj
	for bug-bash@gnu.org; Wed, 04 Jan 2012 22:37:47 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pengyu.ut@gmail.com>) id 1Rie9B-00056F-3k
	for bug-bash@gnu.org; Wed, 04 Jan 2012 22:37:46 -0500
Received: from mail-iy0-f169.google.com ([209.85.210.169]:55506)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pengyu.ut@gmail.com>) id 1Rie9A-000563-QZ
	for bug-bash@gnu.org; Wed, 04 Jan 2012 22:37:44 -0500
Received: by iacb35 with SMTP id b35so261312iac.0
	for <bug-bash@gnu.org>; Wed, 04 Jan 2012 19:37:43 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type;
	bh=q7ZNEij5XnQlKOJgWf3Bxgi0GOkeyBwfvK+FB0BCcPQ=;
	b=JRsTwINtaUyp/ydkVR+im3KZx76mGQ6nV/w/RuHD8pvV/nsJ0jq/6iBflJCFQgQCF9
	j83qTPp4xd1CwMA10FE2j3SsFMZVVLHmiAT4hYDJjMOCTWF+7K6ibOLdSVGneMkp1OY5
	marNeOHXhiR+14YeLe9e6t3CRpLH/orwSy7VE=
MIME-Version: 1.0
Received: by 10.50.51.199 with SMTP id m7mr796565igo.23.1325734663685; Wed, 04
	Jan 2012 19:37:43 -0800 (PST)
Received: by 10.50.87.170 with HTTP; Wed, 4 Jan 2012 19:37:43 -0800 (PST)
In-Reply-To: <4F050D7C.7020503@case.edu>
References: <CABrM6wmtFDksPYKbAmTKJBWbTik1A86Cba+JpHa0N3em++cqeQ@mail.gmail.com>
	<4F050D7C.7020503@case.edu>
Date: Wed, 4 Jan 2012 21:37:43 -0600
Message-ID: <CABrM6wnuCAkO8RugMcoKQDtJBn2sky1mUhYNGEUo5HQbqYA4GA@mail.gmail.com>
Subject: Re: Specify completion without name
From: Peng Yu <pengyu.ut@gmail.com>
To: chet.ramey@case.edu
Content-Type: text/plain; charset=ISO-8859-1
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 209.85.210.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: Thu, 05 Jan 2012 03:37:47 -0000

> empty lines.  There is no programmable completion mechanism to complete
> on non-empty command names.

I'm wondering if it is worthwhile to add such a feature. I have run
into the problem that it is very slow to command complete an
incomplete command especially when other programs are accessing the
disk (note that I frequently open new terminals, so the caching done
within a bash process does not help me much).

If I can configure how to complete on non-empty command names, I could
just check a file with all the commands in PATH are stored. By
checking just a single file, presumable the search can be much faster
than searching many directories.

-- 
Regards,
Peng


-- 
Regards,
Peng


From MAILER-DAEMON Thu Jan 05 04:43:59 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rijrb-0003qu-Kz
	for mharc-bug-bash@gnu.org; Thu, 05 Jan 2012 04:43:59 -0500
Received: from eggs.gnu.org ([140.186.70.92]:49133)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <stsp@list.ru>) id 1RijrU-0003kY-Pm
	for bug-bash@gnu.org; Thu, 05 Jan 2012 04:43:56 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <stsp@list.ru>) id 1RijrP-00029E-LO
	for bug-bash@gnu.org; Thu, 05 Jan 2012 04:43:52 -0500
Received: from smtp24.mail.ru ([94.100.176.177]:55352)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <stsp@list.ru>)
	id 1RijrP-00028k-1F
	for bug-bash@gnu.org; Thu, 05 Jan 2012 04:43:47 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru;
	s=mail; 
	h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID;
	bh=qTis4+PZpinHTgAwqlpCwoMRM+5cC4+5wg8jhxRIIiE=; 
	b=UmKxYEfzgE6+uYI7INtozLflyWB5bNShemeYUpaJ1JjKchmDCn39uSOuDciQ4zl6hrwcbNmivta1631Woo+5eatFYJa4JbkS33oDv/Io2Pbv87tGbGiMTRx2FSKFDGaR;
Received: from [89.23.198.54] (port=62676)
	by smtp24.mail.ru with esmtpa (envelope-from <stsp@list.ru>)
	id 1RijrM-0005Do-4A; Thu, 05 Jan 2012 13:43:44 +0400
Message-ID: <4F057084.9070101@list.ru>
Date: Thu, 05 Jan 2012 13:42:28 +0400
From: Stas Sergeev <stsp@list.ru>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:8.0) Gecko/20111115 Thunderbird/8.0
MIME-Version: 1.0
To: chet.ramey@case.edu
Subject: Re: bug in force_interactive handling
References: <4EF88EF4.8000202@list.ru> <4EFA3595.4020809@case.edu>
	<4EFAE497.5080602@list.ru> <4EFC9B2E.8050108@case.edu>
	<4EFD941D.6000601@list.ru> <4F01215F.30107@case.edu>
	<4F017865.1050907@list.ru> <4F01F6F8.3020500@case.edu>
	<4F01F9C0.2090605@list.ru> <4F01FD36.6080001@case.edu>
	<4F020125.1020508@list.ru> <4F020E7E.6060806@case.edu>
	<4F044402.9070804@list.ru> <4F0453F3.9010002@case.edu>
	<4F045731.2060700@list.ru> <4F051005.8020901@case.edu>
In-Reply-To: <4F051005.8020901@case.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Mru-NR: 2
X-Mru-UID: 185631573
X-Mru-IsAutoreg: 0
X-Mru-AutoregInfo: 4740282, []
X-Spam: Not detected
X-Mras: Ok
X-Mru-Karma: 0
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 94.100.176.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, 05 Jan 2012 09:43:56 -0000

05.01.2012 06:50, Chet Ramey wrote:
> So you'd like the shell to act on a signal without `consulting' the
> foreground job?
For only the dedicated traps. For example:
trap -b /bin/true USR1

-b here would mean that the foreground job, if
any, is to be moved to the background before
executing the command. Since the command is
not really needed (I only need to move the job
to the background), I specified /bin/true as an
example, and in my previous example I used
"bg" which was not needed too.


From MAILER-DAEMON Thu Jan 05 08:38:08 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RinWC-0005mc-EH
	for mharc-bug-bash@gnu.org; Thu, 05 Jan 2012 08:38:08 -0500
Received: from eggs.gnu.org ([140.186.70.92]:51538)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RinWA-0005lv-Ff
	for bug-bash@gnu.org; Thu, 05 Jan 2012 08:38:07 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RinVz-0002GQ-M2
	for bug-bash@gnu.org; Thu, 05 Jan 2012 08:38:06 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:47838)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RinVz-0002GB-J3
	for bug-bash@gnu.org; Thu, 05 Jan 2012 08:37:55 -0500
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 BUG95509; Thu, 05 Jan 2012 08:37:54 -0500 (EST)
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 APZ13249 (AUTH cpr);
	Thu, 05 Jan 2012 08:37:54 -0500 (EST)
Message-ID: <4F05A7B1.4060406@case.edu>
Date: Thu, 05 Jan 2012 08:37:53 -0500
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Peng Yu <pengyu.ut@gmail.com>
Subject: Re: Specify completion without name
References: <CABrM6wmtFDksPYKbAmTKJBWbTik1A86Cba+JpHa0N3em++cqeQ@mail.gmail.com>
	<4F050D7C.7020503@case.edu>
	<CABrM6wnuCAkO8RugMcoKQDtJBn2sky1mUhYNGEUo5HQbqYA4GA@mail.gmail.com>
In-Reply-To: <CABrM6wnuCAkO8RugMcoKQDtJBn2sky1mUhYNGEUo5HQbqYA4GA@mail.gmail.com>
X-Enigmail-Version: 1.3.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash <bug-bash@gnu.org>, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Jan 2012 13:38:07 -0000

On 1/4/12 10:37 PM, Peng Yu wrote:
>> empty lines.  There is no programmable completion mechanism to complete
>> on non-empty command names.
> 
> I'm wondering if it is worthwhile to add such a feature. I have run
> into the problem that it is very slow to command complete an
> incomplete command especially when other programs are accessing the
> disk (note that I frequently open new terminals, so the caching done
> within a bash process does not help me much).

That's a pretty good idea.  I'll take a look and see what I can do.
I have a feeling the most difficult part of the whole exercise will
be choosing an appropriately mnemonic option letter.

> If I can configure how to complete on non-empty command names, I could
> just check a file with all the commands in PATH are stored. By
> checking just a single file, presumable the search can be much faster
> than searching many directories.

Presumably you would also include aliases, shell builtins, and functions
in this file.

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 Jan 05 10:22:12 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rip8u-0003Gs-Lj
	for mharc-bug-bash@gnu.org; Thu, 05 Jan 2012 10:22:12 -0500
Received: from eggs.gnu.org ([140.186.70.92]:50117)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pengyu.ut@gmail.com>) id 1Rip8o-0002ww-G1
	for bug-bash@gnu.org; Thu, 05 Jan 2012 10:22:10 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pengyu.ut@gmail.com>) id 1Rip8i-0006Qv-Rw
	for bug-bash@gnu.org; Thu, 05 Jan 2012 10:22:06 -0500
Received: from mail-gx0-f169.google.com ([209.85.161.169]:37324)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pengyu.ut@gmail.com>) id 1Rip8i-0006Qp-OM
	for bug-bash@gnu.org; Thu, 05 Jan 2012 10:22:00 -0500
Received: by ggni2 with SMTP id i2so265933ggn.0
	for <bug-bash@gnu.org>; Thu, 05 Jan 2012 07:22:00 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type;
	bh=Wn/0qyasYjyuii3rGJFKiUxd8zWWi5l+1KE4nE5jPk0=;
	b=iiXOOO9DBQx2CdELeqwvb4OhYov1GRqLx/uJeGuQvxyITnWbpiIaELSz0YhzMQXm7C
	WUnJzG5OqteDtfQubBZ7h49LzloZDw0CLD5jQ99CDal0dsc1v+gP0jDgUTZZEjWXg8Ab
	cMBbCJ1beGGFS8lXV3ImZOUsDp9dQn0Fq1m9k=
MIME-Version: 1.0
Received: by 10.50.214.38 with SMTP id nx6mr3460319igc.19.1325776919931; Thu,
	05 Jan 2012 07:21:59 -0800 (PST)
Received: by 10.50.87.170 with HTTP; Thu, 5 Jan 2012 07:21:59 -0800 (PST)
In-Reply-To: <4F05A7B1.4060406@case.edu>
References: <CABrM6wmtFDksPYKbAmTKJBWbTik1A86Cba+JpHa0N3em++cqeQ@mail.gmail.com>
	<4F050D7C.7020503@case.edu>
	<CABrM6wnuCAkO8RugMcoKQDtJBn2sky1mUhYNGEUo5HQbqYA4GA@mail.gmail.com>
	<4F05A7B1.4060406@case.edu>
Date: Thu, 5 Jan 2012 09:21:59 -0600
Message-ID: <CABrM6wkneVcg1U8hYorV79pS5DV7jK6+FbSb4E6rxce+i_sgkg@mail.gmail.com>
Subject: Re: Specify completion without name
From: Peng Yu <pengyu.ut@gmail.com>
To: chet.ramey@case.edu
Content-Type: text/plain; charset=ISO-8859-1
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 209.85.161.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: Thu, 05 Jan 2012 15:22:10 -0000

> Presumably you would also include aliases, shell builtins, and functions
> in this file.

Yes. I just want to replace executables in PATH by the result from my
custom function. I think that aliases, builtins, and functions are all
in the memory of bash already, so it doesn't take extra time to search
them from bash. Therefore, the ideal behaviors is that bash still
search for aliases, builtins and functions, and in addition check the
results returned by my custom function. Hence, my custom function
should not return anything about them (this should be expect at least
by default).

-- 
Regards,
Peng


From MAILER-DAEMON Thu Jan 05 10:45:51 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RipVn-0004jQ-FB
	for mharc-bug-bash@gnu.org; Thu, 05 Jan 2012 10:45:51 -0500
Received: from eggs.gnu.org ([140.186.70.92]:54185)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RipVg-0004i6-Pv
	for bug-bash@gnu.org; Thu, 05 Jan 2012 10:45:49 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RipVf-000348-Ac
	for bug-bash@gnu.org; Thu, 05 Jan 2012 10:45:44 -0500
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:1402)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RipVf-00033z-6L
	for bug-bash@gnu.org; Thu, 05 Jan 2012 10:45:43 -0500
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 BGW29431;
	Thu, 5 Jan 2012 10:45:42 -0500
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 APZ35076 (AUTH cpr);
	Thu, 05 Jan 2012 10:45:42 -0500 (EST)
Message-ID: <4F05C5A6.8010704@case.edu>
Date: Thu, 05 Jan 2012 10:45:42 -0500
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Peng Yu <pengyu.ut@gmail.com>
Subject: Re: Specify completion without name
References: <CABrM6wmtFDksPYKbAmTKJBWbTik1A86Cba+JpHa0N3em++cqeQ@mail.gmail.com>
	<4F050D7C.7020503@case.edu>
	<CABrM6wnuCAkO8RugMcoKQDtJBn2sky1mUhYNGEUo5HQbqYA4GA@mail.gmail.com>
	<4F05A7B1.4060406@case.edu>
	<CABrM6wkneVcg1U8hYorV79pS5DV7jK6+FbSb4E6rxce+i_sgkg@mail.gmail.com>
In-Reply-To: <CABrM6wkneVcg1U8hYorV79pS5DV7jK6+FbSb4E6rxce+i_sgkg@mail.gmail.com>
X-Enigmail-Version: 1.3.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 <bug-bash@gnu.org>, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Jan 2012 15:45:49 -0000

On 1/5/12 10:21 AM, Peng Yu wrote:
>> Presumably you would also include aliases, shell builtins, and functions
>> in this file.
> 
> Yes. I just want to replace executables in PATH by the result from my
> custom function. I think that aliases, builtins, and functions are all
> in the memory of bash already, so it doesn't take extra time to search
> them from bash. Therefore, the ideal behaviors is that bash still
> search for aliases, builtins and functions, and in addition check the
> results returned by my custom function. Hence, my custom function
> should not return anything about them (this should be expect at least
> by default).

That's inelegent, and it's inconsistent with how programmable completion
works.  A shell function run for programmable completion has complete
control over the possible completions, as modified by options like
-o bashdefault, not replacing only portions of the default completions
to solve some perceived performance problem.

I would envision that such a completion function would assemble its list
of possible completions by using your read-from-a-file mechanism and
augment the list using compgen -a/compgen -b/compgen -A function.  It
would probably also want to handle glob patterns and expand them to
potentially multiple completions, but that gets tricky.

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 Jan 05 10:50:48 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Ripaa-00074e-FO
	for mharc-bug-bash@gnu.org; Thu, 05 Jan 2012 10:50:48 -0500
Received: from eggs.gnu.org ([140.186.70.92]:37341)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <drglynn@gmail.com>) id 1RipaQ-00071s-Fg
	for bug-bash@gnu.org; Thu, 05 Jan 2012 10:50:46 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <drglynn@gmail.com>) id 1RipaP-000439-7O
	for bug-bash@gnu.org; Thu, 05 Jan 2012 10:50:38 -0500
Received: from mail-iy0-f169.google.com ([209.85.210.169]:44958)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <drglynn@gmail.com>) id 1RipaO-000432-Tf
	for bug-bash@gnu.org; Thu, 05 Jan 2012 10:50:37 -0500
Received: by iacb35 with SMTP id b35so1345149iac.0
	for <bug-bash@gnu.org>; Thu, 05 Jan 2012 07:50:36 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:sender:date:x-google-sender-auth:message-id:subject
	:from:to:content-type;
	bh=MOGxhURehHBLh70+Ya4Cmes6CnJIpsKXa+nonrpDxuM=;
	b=hBmrezSZqqGAhDxUO9r6fjH9pYQ2Ss7m+P5N7Wb5m7yo4TZ3bkFitk/qqaPuhzx0DY
	965gJ4HfkMAcHvZW+GrhCD8SYt0I1kt9z9WSnzI8G31riYfI0fpg5EkbWRx54vRTWMgA
	hBoLG2zRMYgj9HHvL6dTYqUASziB1+4y5dt3s=
MIME-Version: 1.0
Received: by 10.50.47.136 with SMTP id d8mr3165262ign.21.1325778635993; Thu,
	05 Jan 2012 07:50:35 -0800 (PST)
Sender: drglynn@gmail.com
Received: by 10.231.186.79 with HTTP; Thu, 5 Jan 2012 07:50:35 -0800 (PST)
Date: Thu, 5 Jan 2012 15:50:35 +0000
X-Google-Sender-Auth: Hmn1CZfMQcmB5jFIVF_hdyI5x9U
Message-ID: <CAJ+HK6fnHQeOkavZh5UBqA-wocwRvUJCrwbWPo-F9T7xMiRjYw@mail.gmail.com>
Subject: Issue with errtrace
From: Dave <dave@gess.ie>
To: bug-bash@gnu.org
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 209.85.210.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, 05 Jan 2012 15:50:46 -0000

Hi all,

Recently upgraded to 3.2 and noticed some differences in a lot of my
scripts, consider the following example:

#!/bin/bash

trap error_reporter ERR
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
logf_error=/dev/null

function _exit
{
  local -ri retval="${1:-$?}"
  exit ${retval}
}

function error_reporter {
  local -ri retval=$?
  #echo "Error in script setup. Exiting with error value ${retval}."
  local -i i=0
  #echo "Function call stack:" >&2
  while caller $i >&2; do  (( i++ ));  done
  _exit ${retval}

}

function echo_aaaa {  #this is called as a $(command)

#a subcommand might return with 1 in the script, but in most cases it is
not a problem.
#At least in our scripts there are a lot of cases like this where the error
is handled afterwards
echo "aaaa" | grep b
echo "Execution continues"
}

echo "Turning off errtrace"
set +o errtrace
var=$(echo_aaaa)    #calling as a $(command)
echo $var
echo "Turning on errtrace"
set -o errtrace

echo "Next command will fail in bash3.2"
var=$(echo_aaaa)    #calling as a $(command)
echo $var



Doesnt work right on 3.2


Output from 3.0

root@atrcus365:/# /tmp/test
/tmp/test
Turning off errtrace
Execution continues
Turning on errtrace
Next command will fail in bash3.2
Execution continues
root@atrcus365:/# echo $BASH_VERSION
echo $BASH_VERSION
3.00.16(1)-release
root@atrcus365:/#


Output from 3.2

root@atmwsnfd:/# /tmp/test
Turning off errtrace
Execution continues
Turning on errtrace
Next command will fail in bash3.2
26 echo_aaaa /tmp/test
42 main /tmp/test
42 main /tmp/test
root@atmwsnfd:/# echo $BASH_VERSION
3.2.51(1)-release
root@atmwsnfd:/#



Could anyone point me in correct direction on this one ?

Regards
Dave

From MAILER-DAEMON Thu Jan 05 11:33:19 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RiqFj-0003AB-EB
	for mharc-bug-bash@gnu.org; Thu, 05 Jan 2012 11:33:19 -0500
Received: from eggs.gnu.org ([140.186.70.92]:44756)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pengyu.ut@gmail.com>) id 1RiqFf-00039r-Se
	for bug-bash@gnu.org; Thu, 05 Jan 2012 11:33:17 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pengyu.ut@gmail.com>) id 1RiqFe-00042S-J1
	for bug-bash@gnu.org; Thu, 05 Jan 2012 11:33:15 -0500
Received: from mail-iy0-f169.google.com ([209.85.210.169]:50784)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pengyu.ut@gmail.com>) id 1RiqFe-00042N-DK
	for bug-bash@gnu.org; Thu, 05 Jan 2012 11:33:14 -0500
Received: by iacb35 with SMTP id b35so1403609iac.0
	for <bug-bash@gnu.org>; Thu, 05 Jan 2012 08:33:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type:content-transfer-encoding;
	bh=/aBw7Ab0niEwTpZMOa5h5/vM89aGC49DnIMpljSTQN8=;
	b=PsWyZ1RUlTeJPkD550XbcSAwehQ98GGK83Baz3BgYpP+STWZmOfuHvZIPvaA334m0N
	S4HPiRRzoW4Cn+dSqIKZgcU5FW6hYf4ahfFodJ8LjMteNXva0NJ3CXj4E6kGMh7CvBUP
	ZSisZ38E3eW0kkEgj8b6Hn8gBfp9dDzlXyxJ4=
MIME-Version: 1.0
Received: by 10.50.51.199 with SMTP id m7mr3828791igo.23.1325781193847; Thu,
	05 Jan 2012 08:33:13 -0800 (PST)
Received: by 10.50.87.170 with HTTP; Thu, 5 Jan 2012 08:33:13 -0800 (PST)
In-Reply-To: <4F05C5A6.8010704@case.edu>
References: <CABrM6wmtFDksPYKbAmTKJBWbTik1A86Cba+JpHa0N3em++cqeQ@mail.gmail.com>
	<4F050D7C.7020503@case.edu>
	<CABrM6wnuCAkO8RugMcoKQDtJBn2sky1mUhYNGEUo5HQbqYA4GA@mail.gmail.com>
	<4F05A7B1.4060406@case.edu>
	<CABrM6wkneVcg1U8hYorV79pS5DV7jK6+FbSb4E6rxce+i_sgkg@mail.gmail.com>
	<4F05C5A6.8010704@case.edu>
Date: Thu, 5 Jan 2012 10:33:13 -0600
Message-ID: <CABrM6w=DzeaV5iVQ05VNz0oh0ZXxgxBkX1sR0b2tOfJJsn+ygw@mail.gmail.com>
Subject: Re: Specify completion without name
From: Peng Yu <pengyu.ut@gmail.com>
To: chet.ramey@case.edu
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 209.85.210.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: Thu, 05 Jan 2012 16:33:17 -0000

> I would envision that such a completion function would assemble its list
> of possible completions by using your read-from-a-file mechanism and
> augment the list using compgen -a/compgen -b/compgen -A function. =A0It
> would probably also want to handle glob patterns and expand them to
> potentially multiple completions, but that gets tricky.

I did not know that it is so simple to get the alias (compgen -a),
buildins (compgen -b) and functions (compgen -A function) as you
mentioned. Once I know these, I agree with you that bash need not
handle these internally, rather user can call these three functions
directly. But beware to clearly document these by giving working
EXAMPLE code which include these three commands (not just text
explanation without working code, by "working code" I mean code
snippet is discouraged, a complete completion function should be
provided).

BTW, as I mentioned several times the bash man favors document
maintainer rather readers. For example, the following help doesn't
help me much when I want to learn how to use compgen.

~$ help compgen
compgen: compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat]
[-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C
command] [word]
    Display the possible completions depending on the options.  Intended
    to be used from within a shell function generating possible completions=
.
    If the optional WORD argument is supplied, matches against WORD are
    generated.

The manpage also use a reference rather than list all the options
directly. Readers have to jump to complete to understand how to use
compgen. This is also inconvenient to users.

              Generate possible completion matches for word according  to  =
the
              options,  which  may  be  any  option  accepted  by the compl=
ete
              builtin


If you consider it repetitive to discuss the same option twice in both
compgen and complete, at least, you can expand "help compgen" to
describe all the options (merge the current description of compgen and
complete in man). Other help messages are so concise that they are not
very helpful for learning how to use them. I'd suggest change all of
them as well.

--=20
Regards,
Peng


From MAILER-DAEMON Thu Jan 05 16:09:01 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RiuYX-0006KZ-Bd
	for mharc-bug-bash@gnu.org; Thu, 05 Jan 2012 16:09:01 -0500
Received: from eggs.gnu.org ([140.186.70.92]:43673)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <drglynn@gmail.com>) id 1RikJN-0004V2-TD
	for bug-bash@gnu.org; Thu, 05 Jan 2012 05:12:47 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <drglynn@gmail.com>) id 1RikJI-0007Ci-6A
	for bug-bash@gnu.org; Thu, 05 Jan 2012 05:12:41 -0500
Received: from mail-iy0-f169.google.com ([209.85.210.169]:57508)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <drglynn@gmail.com>) id 1RikJH-0007CM-VQ
	for bug-bash@gnu.org; Thu, 05 Jan 2012 05:12:36 -0500
Received: by iacb35 with SMTP id b35so854799iac.0
	for <bug-bash@gnu.org>; Thu, 05 Jan 2012 02:12:35 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:date:message-id:subject:from:to:content-type;
	bh=spW2VfM4FWY2SphrqnkWM6Ta6WxcDQHvPiC+T7g+WfY=;
	b=u+J87b0YVVbXG5WNmdj84X2cPV6I/UDwIN9M2VzWuFSZpynKRaJxKyavkIh669L256
	rCL+AHTqcrw9v5UQM1saaFbZkXsp24y+vG+wWP138kQwZq3qMtp+nn+2F+3qKR92rP1T
	shX84jnOYHEZOGutOOwZQPs+J0lBWN7rNnvEE=
MIME-Version: 1.0
Received: by 10.42.148.198 with SMTP id s6mr1329055icv.20.1325758355087; Thu,
	05 Jan 2012 02:12:35 -0800 (PST)
Received: by 10.231.186.79 with HTTP; Thu, 5 Jan 2012 02:12:34 -0800 (PST)
Date: Thu, 5 Jan 2012 10:12:34 +0000
Message-ID: <CAJ+HK6eYrNC4RJQM8o3siKyadirS=XiYOHkoC-ySEqQMWsBcUQ@mail.gmail.com>
Subject: bash 3.2 vs 3.0
From: Dave <drglynn@gmail.com>
To: bug-bash@gnu.org
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 209.85.210.169
X-Mailman-Approved-At: Thu, 05 Jan 2012 16:09:00 -0500
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, 05 Jan 2012 10:12:47 -0000

Hi all,

Recently upgraded to 3.2 and noticed some differences in a lot of my
scripts, consider the following example:

#!/bin/bash

trap error_reporter ERR
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
logf_error=/dev/null

function _exit
{
  local -ri retval="${1:-$?}"
  exit ${retval}
}

function error_reporter {
  local -ri retval=$?
  #echo "Error in script setup. Exiting with error value ${retval}."
  local -i i=0
  #echo "Function call stack:" >&2
  while caller $i >&2; do  (( i++ ));  done
  _exit ${retval}

}

function echo_aaaa {  #this is called as a $(command)

#a subcommand might return with 1 in the script, but in most cases it is
not a problem.
#At least in our scripts there are a lot of cases like this where the error
is handled afterwards
echo "aaaa" | grep b
echo "Execution continues"
}

echo "Turning off errtrace"
set +o errtrace
var=$(echo_aaaa)    #calling as a $(command)
echo $var
echo "Turning on errtrace"
set -o errtrace

echo "Next command will fail in bash3.2"
var=$(echo_aaaa)    #calling as a $(command)
echo $var



Doesnt work right on 3.2


Output from 3.0

root@atrcus365:/# /tmp/test
/tmp/test
Turning off errtrace
Execution continues
Turning on errtrace
Next command will fail in bash3.2
Execution continues
root@atrcus365:/# echo $BASH_VERSION
echo $BASH_VERSION
3.00.16(1)-release
root@atrcus365:/#


Output from 3.2

root@atmwsnfd:/# /tmp/test
Turning off errtrace
Execution continues
Turning on errtrace
Next command will fail in bash3.2
26 echo_aaaa /tmp/test
42 main /tmp/test
42 main /tmp/test
root@atmwsnfd:/# echo $BASH_VERSION
3.2.51(1)-release
root@atmwsnfd:/#



Could anyone point me in correct direction on this one ?

Regards
Dave

From MAILER-DAEMON Thu Jan 05 17:46:33 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Riw4v-0000qG-HG
	for mharc-bug-bash@gnu.org; Thu, 05 Jan 2012 17:46:33 -0500
Received: from eggs.gnu.org ([140.186.70.92]:60224)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chris@cfajohnson.com>) id 1Riw4t-0000qA-4B
	for bug-bash@gnu.org; Thu, 05 Jan 2012 17:46:31 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chris@cfajohnson.com>) id 1Riw4r-000477-MQ
	for bug-bash@gnu.org; Thu, 05 Jan 2012 17:46:31 -0500
Received: from ironport2-out.teksavvy.com ([206.248.154.181]:11801)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chris@cfajohnson.com>) id 1Riw4r-00046m-JV
	for bug-bash@gnu.org; Thu, 05 Jan 2012 17:46:29 -0500
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Ah0FAOMnBk9MCrdZ/2dsb2JhbABCggWqe4EGgXIBAQQBOAIcIwULCzQSOR4GLodftjSMEQSIOZpOhFI
X-IronPort-AV: E=Sophos;i="4.71,464,1320642000"; d="scan'208";a="155429746"
Received: from 76-10-183-89.dsl.teksavvy.com (HELO linux.local)
	([76.10.183.89])
	by ironport2-out.teksavvy.com with ESMTP; 05 Jan 2012 17:46:27 -0500
Date: Thu, 5 Jan 2012 17:45:10 -0500 (EST)
From: "Chris F.A. Johnson" <chris@cfajohnson.com>
To: Dave <drglynn@gmail.com>
Subject: Re: bash 3.2 vs 3.0
In-Reply-To: <CAJ+HK6eYrNC4RJQM8o3siKyadirS=XiYOHkoC-ySEqQMWsBcUQ@mail.gmail.com>
Message-ID: <alpine.LMD.2.00.1201051741550.5853@localhost.localdomain>
References: <CAJ+HK6eYrNC4RJQM8o3siKyadirS=XiYOHkoC-ySEqQMWsBcUQ@mail.gmail.com>
User-Agent: Alpine 2.00 (LMD 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 206.248.154.181
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Jan 2012 22:46:32 -0000

On Thu, 5 Jan 2012, Dave wrote:

> Hi all,
>
> Recently upgraded to 3.2 and noticed some differences in a lot of my
> scripts, consider the following example:
...
> Could anyone point me in correct direction on this one ?

     Upgrade to 4.2; you are years behind the times!

-- 
    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 Jan 05 20:58:56 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Riz56-0007fE-CG
	for mharc-bug-bash@gnu.org; Thu, 05 Jan 2012 20:58:56 -0500
Received: from eggs.gnu.org ([140.186.70.92]:37804)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Riz53-0007eR-5h
	for bug-bash@gnu.org; Thu, 05 Jan 2012 20:58:54 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Riz51-0002xu-Pq
	for bug-bash@gnu.org; Thu, 05 Jan 2012 20:58:53 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:48582)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Riz51-0002vc-KH
	for bug-bash@gnu.org; Thu, 05 Jan 2012 20:58:51 -0500
Received: from mpv8.tis.CWRU.Edu (EHLO mpv8.case.edu) ([129.22.105.116])
	by mpv1.tis.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id BUI14648; Thu, 05 Jan 2012 20:58:50 -0500 (EST)
Received: from h156.184.190.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.190.184.156]) by mpv8.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SNB79562 (AUTH cpr);
	Thu, 05 Jan 2012 20:58:50 -0500 (EST)
Message-ID: <4F065559.5050104@case.edu>
Date: Thu, 05 Jan 2012 20:58:49 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Dave <drglynn@gmail.com>
Subject: Re: bash 3.2 vs 3.0
References: <CAJ+HK6eYrNC4RJQM8o3siKyadirS=XiYOHkoC-ySEqQMWsBcUQ@mail.gmail.com>
In-Reply-To: <CAJ+HK6eYrNC4RJQM8o3siKyadirS=XiYOHkoC-ySEqQMWsBcUQ@mail.gmail.com>
X-Enigmail-Version: 1.3.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Jan 2012 01:58:54 -0000

On 1/5/12 5:12 AM, Dave wrote:
> Hi all,
> 
> Recently upgraded to 3.2 and noticed some differences in a lot of my
> scripts, consider the following example:

You might have a tough time getting help on this.  Bash-3.2 was released
over five years ago; bash-3.0 two years before that.  I point people to
bash-4.2, the current version, which was released over a year ago.

The CHANGES file from bash-3.2 might be helpful.  I found in the changes
between bash-3.1 and bash-3.2:

z.  The inheritence of the DEBUG, RETURN, and ERR traps is now dependent only
    on the settings of the `functrace' and `errtrace' shell options, rather
    than whether or not the shell is in debugging mode.

It looks like the failing pipeline triggered the ERR trap, which bash-3.2
inherits (correctly) and bash-3.[01] did not.

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


From MAILER-DAEMON Thu Jan 05 22:09:52 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rj0Bk-0001hC-LO
	for mharc-bug-bash@gnu.org; Thu, 05 Jan 2012 22:09:52 -0500
Received: from eggs.gnu.org ([140.186.70.92]:46862)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dearvoid@gmail.com>) id 1Rj0Bi-0001fo-93
	for bug-bash@gnu.org; Thu, 05 Jan 2012 22:09:51 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dearvoid@gmail.com>) id 1Rj0Bd-0007eK-Rx
	for bug-bash@gnu.org; Thu, 05 Jan 2012 22:09:50 -0500
Received: from mail-yw0-f41.google.com ([209.85.213.41]:65435)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dearvoid@gmail.com>) id 1Rj0Bd-0007cz-Ap
	for bug-bash@gnu.org; Thu, 05 Jan 2012 22:09:45 -0500
Received: by yhgm50 with SMTP id m50so526886yhg.0
	for <bug-bash@gnu.org>; Thu, 05 Jan 2012 19:09:44 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type;
	bh=o/8qK7XHE8v0xq+uxCqFxtK+5GPbxtgpbZ7hqJzBjYc=;
	b=RtOjEozkFtZR/BIHAnQi0snLY6oQ+TuoPBHJz6CjbFMIH9+Z4Qg8O0h4l9+AypeSH1
	1VtsizvbCYP2HXNzYeSNvHbkRW/kzB3YfFNzP9rSyFg1th8RxAtLC1eSNye4+vh1ALG0
	Hd/vrzdbcIg6NwxErTU30jiJjzpRZNABzlg78=
Received: by 10.236.191.134 with SMTP id g6mr4945106yhn.95.1325819384277; Thu,
	05 Jan 2012 19:09:44 -0800 (PST)
MIME-Version: 1.0
Received: by 10.100.124.5 with HTTP; Thu, 5 Jan 2012 19:09:23 -0800 (PST)
In-Reply-To: <CABrM6w=DzeaV5iVQ05VNz0oh0ZXxgxBkX1sR0b2tOfJJsn+ygw@mail.gmail.com>
References: <CABrM6wmtFDksPYKbAmTKJBWbTik1A86Cba+JpHa0N3em++cqeQ@mail.gmail.com>
	<4F050D7C.7020503@case.edu>
	<CABrM6wnuCAkO8RugMcoKQDtJBn2sky1mUhYNGEUo5HQbqYA4GA@mail.gmail.com>
	<4F05A7B1.4060406@case.edu>
	<CABrM6wkneVcg1U8hYorV79pS5DV7jK6+FbSb4E6rxce+i_sgkg@mail.gmail.com>
	<4F05C5A6.8010704@case.edu>
	<CABrM6w=DzeaV5iVQ05VNz0oh0ZXxgxBkX1sR0b2tOfJJsn+ygw@mail.gmail.com>
From: "Clark J. Wang" <dearvoid@gmail.com>
Date: Fri, 6 Jan 2012 11:09:23 +0800
Message-ID: <CADv8-ohzzjqaSqbPAWYQU9DgUnFsfc2cBWXga6pukRjc-pWgaw@mail.gmail.com>
Subject: Re: Specify completion without name
To: Peng Yu <pengyu.ut@gmail.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 209.85.213.41
Content-Type: text/plain; charset=UTF-8
X-Content-Filtered-By: Mailman/MimeDel 2.1.14
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
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?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, 06 Jan 2012 03:09:51 -0000

On Fri, Jan 6, 2012 at 00:33, Peng Yu <pengyu.ut@gmail.com> wrote:

> > I would envision that such a completion function would assemble its list
> > of possible completions by using your read-from-a-file mechanism and
> > augment the list using compgen -a/compgen -b/compgen -A function.  It
> > would probably also want to handle glob patterns and expand them to
> > potentially multiple completions, but that gets tricky.
>
> I did not know that it is so simple to get the alias (compgen -a),
> buildins (compgen -b) and functions (compgen -A function) as you
> mentioned. Once I know these, I agree with you that bash need not
> handle these internally, rather user can call these three functions
> directly. But beware to clearly document these by giving working
> EXAMPLE code which include these three commands (not just text
> explanation without working code, by "working code" I mean code
> snippet is discouraged, a complete completion function should be
> provided).
>

The bash man page already has ~70 pages manual. I don't like it to grow to
~700 pages (like the ABS Guide) with all the working examples you expected.
:)

>
> BTW, as I mentioned several times the bash man favors document
> maintainer rather readers. For example, the following help doesn't
> help me much when I want to learn how to use compgen.
>
> ~$ help compgen
> compgen: compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat]
> [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C
> command] [word]
>    Display the possible completions depending on the options.  Intended
>    to be used from within a shell function generating possible completions.
>    If the optional WORD argument is supplied, matches against WORD are
>    generated.
>
> The manpage also use a reference rather than list all the options
> directly. Readers have to jump to complete to understand how to use
> compgen. This is also inconvenient to users.
>
>              Generate possible completion matches for word according  to
>  the
>              options,  which  may  be  any  option  accepted  by the
> complete
>              builtin
>
>
> If you consider it repetitive to discuss the same option twice in both
> compgen and complete, at least, you can expand "help compgen" to
> describe all the options (merge the current description of compgen and
> complete in man). Other help messages are so concise that they are not
> very helpful for learning how to use them. I'd suggest change all of
> them as well.
>
> --
> Regards,
> Peng
>
>

From MAILER-DAEMON Thu Jan 05 22:19:49 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rj0LN-0003AD-HD
	for mharc-bug-bash@gnu.org; Thu, 05 Jan 2012 22:19:49 -0500
Received: from eggs.gnu.org ([140.186.70.92]:46070)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pengyu.ut@gmail.com>) id 1Rj0LJ-00033r-Fc
	for bug-bash@gnu.org; Thu, 05 Jan 2012 22:19:46 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pengyu.ut@gmail.com>) id 1Rj0LI-0004S5-Dd
	for bug-bash@gnu.org; Thu, 05 Jan 2012 22:19:45 -0500
Received: from mail-iy0-f169.google.com ([209.85.210.169]:33488)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pengyu.ut@gmail.com>) id 1Rj0LI-0004Ru-Aa
	for bug-bash@gnu.org; Thu, 05 Jan 2012 22:19:44 -0500
Received: by iacb35 with SMTP id b35so2251953iac.0
	for <bug-bash@gnu.org>; Thu, 05 Jan 2012 19:19:43 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type;
	bh=0TZ8oOJAOfvXeCVLyNtU+kkUVz8+eZI1u4mpVwiM4A4=;
	b=ChY8kv/FxAXTpKFiI+h1eSmuhR8mwWB5DDGFhpX3Vq3Mshd+6+toDhFaGrA+6xxahi
	CYQWwixaodjFIWvUhr376P3ov9jDtcs+86fWbdcskFqg2arz5IbHhHmJSiMr35CNhvFy
	2nLun0wwHeKQKJn1xdMiZvieq26V8ihH7FC1c=
MIME-Version: 1.0
Received: by 10.50.214.38 with SMTP id nx6mr5951817igc.19.1325819983344; Thu,
	05 Jan 2012 19:19:43 -0800 (PST)
Received: by 10.50.87.170 with HTTP; Thu, 5 Jan 2012 19:19:43 -0800 (PST)
In-Reply-To: <CADv8-ohzzjqaSqbPAWYQU9DgUnFsfc2cBWXga6pukRjc-pWgaw@mail.gmail.com>
References: <CABrM6wmtFDksPYKbAmTKJBWbTik1A86Cba+JpHa0N3em++cqeQ@mail.gmail.com>
	<4F050D7C.7020503@case.edu>
	<CABrM6wnuCAkO8RugMcoKQDtJBn2sky1mUhYNGEUo5HQbqYA4GA@mail.gmail.com>
	<4F05A7B1.4060406@case.edu>
	<CABrM6wkneVcg1U8hYorV79pS5DV7jK6+FbSb4E6rxce+i_sgkg@mail.gmail.com>
	<4F05C5A6.8010704@case.edu>
	<CABrM6w=DzeaV5iVQ05VNz0oh0ZXxgxBkX1sR0b2tOfJJsn+ygw@mail.gmail.com>
	<CADv8-ohzzjqaSqbPAWYQU9DgUnFsfc2cBWXga6pukRjc-pWgaw@mail.gmail.com>
Date: Thu, 5 Jan 2012 21:19:43 -0600
Message-ID: <CABrM6wnw61t8UNwTuVTC55oFnKKDJh+tCYYJM9ROUp8BgEPBWQ@mail.gmail.com>
Subject: Re: Specify completion without name
From: Peng Yu <pengyu.ut@gmail.com>
To: "Clark J. Wang" <dearvoid@gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 209.85.210.169
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
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?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, 06 Jan 2012 03:19:46 -0000

> The bash man page already has ~70 pages manual. I don't like it to grow to
> ~700 pages (like the ABS Guide) with all the working examples you expected.
> :)

Do you use search at all? :) If you use search, it doesn't really
matter if is a 700 page manual.

-- 
Regards,
Peng


From MAILER-DAEMON Sat Jan 07 13:28:25 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rjb0D-0001or-G4
	for mharc-bug-bash@gnu.org; Sat, 07 Jan 2012 13:28:25 -0500
Received: from eggs.gnu.org ([140.186.70.92]:46656)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mod-submit@uni-berlin.de>) id 1RjJkb-000694-8h
	for bug-bash@gnu.org; Fri, 06 Jan 2012 19:03:10 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <mod-submit@uni-berlin.de>) id 1RjJka-0003tB-C2
	for bug-bash@gnu.org; Fri, 06 Jan 2012 19:03:09 -0500
Received: from moderators.individual.net ([130.133.4.7]:36017)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mod-submit@uni-berlin.de>) id 1RjJka-0003t0-5v
	for bug-bash@gnu.org; Fri, 06 Jan 2012 19:03:08 -0500
Received: from outpost1.zedat.fu-berlin.de ([130.133.4.66])
	by moderators.individual.net (Exim 4.69)
	for gnu-bash-bug@moderators.individual.net with esmtp
	(envelope-from <mod-submit@uni-berlin.de>)
	id <1RjJkZ-0003Gr-Iz>; Sat, 07 Jan 2012 01:03:07 +0100
Received: from relay1.zedat.fu-berlin.de ([130.133.4.67])
	by outpost1.zedat.fu-berlin.de (Exim 4.69)
	for gnu-bash-bug@moderators.individual.net with esmtp
	(envelope-from <mod-submit@uni-berlin.de>)
	id <1RjJkW-0000JW-Uq>; Sat, 07 Jan 2012 01:03:05 +0100
Received: from reader2.zedat.fu-berlin.de ([130.133.4.6])
	by relay1.zedat.fu-berlin.de (Exim 4.69)
	for gnu-bash-bug@moderators.individual.net with esmtp
	(envelope-from <mod-submit@uni-berlin.de>)
	id <1RjJkW-0008EW-Sd>; Sat, 07 Jan 2012 01:03:04 +0100
Received: by reader2.zedat.fu-berlin.de (Exim 4.72)
	for gnu-bash-bug@moderators.individual.net with local-bsmtp
	(envelope-from <mod-submit@uni-berlin.de>)
	id <1RjJkW-0006xY-RW>; Sat, 07 Jan 2012 01:03:04 +0100
To: gnu-bash-bug@moderators.individual.net
Path: individual.net!not-for-mail
From: Allodoxaphobia <knock_yourself_out@example.net>
Newsgroups: gnu.bash.bug
Subject: Re: bash 3.2 vs 3.0
Date: 7 Jan 2012 00:03:04 GMT
Lines: 6
Message-ID: <slrnjgf2sp.2o2o.knock_yourself_out@shell.config.com>
References: <mailman.1243.1325797741.15002.bug-bash@gnu.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Orig-X-Trace: individual.net
	cA9AtEOBPMmiOgj2lUbS8w2/uZ9+0agTEbHYrqTzPuYRd6bdZp
Cancel-Lock: sha1:lFFtuv1GgWLN86nC2p3KFf4uEgo=
User-Agent: slrn/0.9.9p1 (FreeBSD)
X-Originating-IP: 130.133.4.6
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 130.133.4.7
X-Mailman-Approved-At: Sat, 07 Jan 2012 13:28:23 -0500
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Jan 2012 00:03:10 -0000

On Thu, 5 Jan 2012 10:12:34 +0000, Dave wrote:
>
> Recently upgraded to 3.2 ........

That's *not* an upgrade.  That's merely a 'change' in obsolescence.



From MAILER-DAEMON Mon Jan 09 09:04:49 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RkFqD-0004kR-Pl
	for mharc-bug-bash@gnu.org; Mon, 09 Jan 2012 09:04:49 -0500
Received: from eggs.gnu.org ([140.186.70.92]:36622)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RkFq7-0004k5-2K
	for bug-bash@gnu.org; Mon, 09 Jan 2012 09:04:48 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RkFq0-0006Mw-M5
	for bug-bash@gnu.org; Mon, 09 Jan 2012 09:04:43 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:28743)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RkFq0-0006MU-IL
	for bug-bash@gnu.org; Mon, 09 Jan 2012 09:04:36 -0500
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 BUK26215 (AUTH cpr);
	Mon, 09 Jan 2012 09:04:35 -0500 (EST)
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 APQ62402 (AUTH cpr);
	Mon, 09 Jan 2012 09:04:35 -0500 (EST)
Message-ID: <4F0AF3F2.5080102@case.edu>
Date: Mon, 09 Jan 2012 09:04:34 -0500
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: "'bug-bash@gnu.org'" <bug-bash@gnu.org>
Subject: Re: Bash git repository on savannah
References: <4ECDC6CF.8040802@case.edu> <4EDFB607.9080106@case.edu>
In-Reply-To: <4EDFB607.9080106@case.edu>
X-Enigmail-Version: 1.3.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: 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, 09 Jan 2012 14:04:48 -0000

On 12/7/11 1:52 PM, Chet Ramey wrote:

> There is now a `devel' branch on the git tree, starting with bash-2.05b
> and bash-3.0-alpha.  There are regular (mostly weekly) snapshot updates,
> each a separate commit to that branch.

The git `devel' branch on savannah now has weekly snapshots up to the
end of 2011.  This is pretty close to an up-to-date look at the current
state of the bash development tree.

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 Jan 10 02:55:51 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RkWYh-000274-2a
	for mharc-bug-bash@gnu.org; Tue, 10 Jan 2012 02:55:51 -0500
Received: from eggs.gnu.org ([140.186.70.92]:58818)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dearvoid@gmail.com>) id 1RkWYZ-000261-P4
	for bug-bash@gnu.org; Tue, 10 Jan 2012 02:55:49 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dearvoid@gmail.com>) id 1RkWYY-00080h-ES
	for bug-bash@gnu.org; Tue, 10 Jan 2012 02:55:43 -0500
Received: from mail-we0-f169.google.com ([74.125.82.169]:34638)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dearvoid@gmail.com>) id 1RkWYX-00080d-V2
	for bug-bash@gnu.org; Tue, 10 Jan 2012 02:55:42 -0500
Received: by werf1 with SMTP id f1so4255916wer.0
	for <bug-bash@gnu.org>; Mon, 09 Jan 2012 23:55:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type;
	bh=L2RJNCiecLCu3CBgakOdtP88JC3f+SQC1G7eCr5G+mo=;
	b=to89FoGtfTHIKIm8NsNg1RdqRFyIm4PUSsqD5rEaV07Wf+2R5pFrgAJ0MpanjJFSbQ
	DTBd4gStzfdoetVXf9KIxpqR7aD6Mn7C2LWs6MePUG+5+ueF0fJTeXXfwbF6IB5djEuQ
	NA72X53mf0AU0JAk0WeP6cR34CoNPUFfvTbes=
Received: by 10.180.105.129 with SMTP id gm1mr1702662wib.1.1326182140463; Mon,
	09 Jan 2012 23:55:40 -0800 (PST)
MIME-Version: 1.0
Received: by 10.223.120.7 with HTTP; Mon, 9 Jan 2012 23:55:19 -0800 (PST)
In-Reply-To: <slrnj44oev.791.stephane.chazelas@spam.is.invalid>
References: <CAH3AnromByAAoRkL07gK7Xw5mssO-74pPRvDKRGgsqb_tbFAPA@mail.gmail.com>
	<4E40FDDC.5000003@sudrala.de> <4E413B39.9060104@syslang.net>
	<mailman.1094.1312970436.939.bug-bash@gnu.org>
	<slrnj44oev.791.stephane.chazelas@spam.is.invalid>
From: "Clark J. Wang" <dearvoid@gmail.com>
Date: Tue, 10 Jan 2012 15:55:19 +0800
Message-ID: <CADv8-oj9gwXswuwU2AsVvOQ0758bu9SYrmqWGN_43s5AX4MaUw@mail.gmail.com>
Subject: Re: equivalent of Linux readlink -f in pure bash?
To: Stephane CHAZELAS <stephane_chazelas@yahoo.fr>,
	Chet Ramey <chet.ramey@case.edu>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 74.125.82.169
Content-Type: text/plain; charset=UTF-8
X-Content-Filtered-By: Mailman/MimeDel 2.1.14
Cc: Bash Bug - ML <bug-bash@gnu.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 10 Jan 2012 07:55:49 -0000

On Wed, Aug 10, 2011 at 18:47, Stephane CHAZELAS <stephane_chazelas@yahoo.fr
> wrote:

> 2011-08-10, 12:00(+02), Bernd Eggink:
> [...]
> > function f
> > {
> >      local OPTIND=1
> >
> >      echo "\$1=$1"
> > }
> >
> > while getopts "abcdefg" opt
> > do
> >      echo "opt=$opt"
> >      f $opt
> > done
> > --------------------------------
> >
> > Calling the sript like this works fine:
> >       script -a -b -c
> >
> > But calling it like this leads to an endless loop:
> >       script -abc
> [...]
> > However, this also loops endlessly. The reason is most likely that bash
> > maintains an additional internal variable holding the index of the
> > current character, relative to the current word. While this variable is
> > not directly accessible by the user, it is set to 0 whenever OPTIND is
> > assigned a value.
> [...]
>
> That would be a bug in bash in my opinion. If OPTIND is marked
> local to the function, it shouldn't affect the behavior of
> parent contexts.
>
> Note that that bug is also in ksh93, pdksh, mksh and posh
> (though slightly different in that one), but not in ash nor zsh.
>

Seems like ksh93 (tested with version 93u 2011-02-08) implicitly declares
OPTIND and OPTARG in functions defined in the `function NAME {}' syntax and
everything works fine. But if OPTIND or OPTARG are explicitly declared as
local it may not work as expected.

Wish Chet would consider fixing this problem in future bash releases. :)


> Note that if you set OPTIND local, you probably want to do the
> same for OPTARG (and maybe OPTERR).
>
> --
> Stephane
>
>

From MAILER-DAEMON Tue Jan 10 08:03:09 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RkbM5-0002s9-KW
	for mharc-bug-bash@gnu.org; Tue, 10 Jan 2012 08:03:09 -0500
Received: from eggs.gnu.org ([140.186.70.92]:54022)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RkbM2-0002qB-HJ
	for bug-bash@gnu.org; Tue, 10 Jan 2012 08:03:07 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RkbLx-0006Pb-Vt
	for bug-bash@gnu.org; Tue, 10 Jan 2012 08:03:06 -0500
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:44836)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RkbLx-0006PL-So
	for bug-bash@gnu.org; Tue, 10 Jan 2012 08:03:01 -0500
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 BGZ48952;
	Tue, 10 Jan 2012 08:02:56 -0500
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 AQG18840; Tue, 10 Jan 2012 08:02:56 -0500 (EST)
Date: Tue, 10 Jan 2012 07:55:51 -0500
From: Chet Ramey <chet.ramey@case.edu>
Sender: Chet Ramey <chet@caleb.ins.cwru.edu>
To: dearvoid@gmail.com
Subject: Re: equivalent of Linux readlink -f in pure bash?
References: <CAH3AnromByAAoRkL07gK7Xw5mssO-74pPRvDKRGgsqb_tbFAPA@mail.gmail.com>
	<4E40FDDC.5000003@sudrala.de> <4E413B39.9060104@syslang.net>
	<mailman.1094.1312970436.939.bug-bash@gnu.org>
	<slrnj44oev.791.stephane.chazelas@spam.is.invalid>
	<CADv8-oj9gwXswuwU2AsVvOQ0758bu9SYrmqWGN_43s5AX4MaUw@mail.gmail.com>
In-Reply-To: Message from dearvoid@gmail.com of Tue,
	10 Jan 2012 15:55:19 +0800 (id
	<CADv8-oj9gwXswuwU2AsVvOQ0758bu9SYrmqWGN_43s5AX4MaUw@mail.gmail.com>)
Message-ID: <120110125551.AA77677.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: stephane_chazelas@yahoo.fr, bug-bash@gnu.org, chet@po.cwru.edu,
	chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 10 Jan 2012 13:03:07 -0000

> > > However, this also loops endlessly. The reason is most likely that bash
> > > maintains an additional internal variable holding the index of the
> > > current character, relative to the current word. While this variable is
> > > not directly accessible by the user, it is set to 0 whenever OPTIND is
> > > assigned a value.
> > [...]
> >
> > That would be a bug in bash in my opinion. If OPTIND is marked
> > local to the function, it shouldn't affect the behavior of
> > parent contexts.
> >
> > Note that that bug is also in ksh93, pdksh, mksh and posh
> > (though slightly different in that one), but not in ash nor zsh.
> >
> 
> Seems like ksh93 (tested with version 93u 2011-02-08) implicitly declares
> OPTIND and OPTARG in functions defined in the `function NAME {}' syntax and
> everything works fine. But if OPTIND or OPTARG are explicitly declared as
> local it may not work as expected.
> 
> Wish Chet would consider fixing this problem in future bash releases. :)

Bash doesn't have the `posix' and `non-posix' distinction between function
syntax that ksh93 makes.  All variables are global unless explicitly
declared as local.  The other thing that Posix requires is that setting
OPTIND to 1 resets getopts' internal state.  I'll take another look and
see if I can work around the issue: resetting getopts when returning from
the shell function restores the value `1' (since we're still processing
the first argument), which causes getopts' internal state to reset.

Chet

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


From MAILER-DAEMON Wed Jan 11 03:34:05 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RktdE-0006EX-Un
	for mharc-bug-bash@gnu.org; Wed, 11 Jan 2012 03:34:04 -0500
Received: from eggs.gnu.org ([140.186.70.92]:52654)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <sungpae@gmail.com>) id 1RktdC-0006Be-2y
	for bug-bash@gnu.org; Wed, 11 Jan 2012 03:34:03 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <sungpae@gmail.com>) id 1Rktd6-0003rx-Ek
	for bug-bash@gnu.org; Wed, 11 Jan 2012 03:34:02 -0500
Received: from mail-iy0-f169.google.com ([209.85.210.169]:49063)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <sungpae@gmail.com>) id 1Rktd6-0003rZ-9c
	for bug-bash@gnu.org; Wed, 11 Jan 2012 03:33:56 -0500
Received: by iafj26 with SMTP id j26so913627iaf.0
	for <bug-bash@gnu.org>; Wed, 11 Jan 2012 00:33:55 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=content-type:mime-version:subject:from:in-reply-to:date
	:content-transfer-encoding:message-id:references:to:x-mailer;
	bh=d166W01IXnI+7VCOZFcS+jdIKxT522sOSJYJdGOcbLA=;
	b=ZHahmqZcO44iXHw9sQq7/5T+q2TF6vMdkB0P10kE7G3DmMfHLP1uMGEedf/CuhdnmH
	5rIIGd6uarlM7meeIdcWyM/bWH3p5UD9gpHkkrdQucxAg3B+0CQF+SjUg0tXlJPvio4T
	YFOBa//dufnxguhkxNQhuTNQ5TxABqr3JYoq0=
Received: by 10.43.50.67 with SMTP id vd3mr24397884icb.10.1326270835066;
	Wed, 11 Jan 2012 00:33:55 -0800 (PST)
Received: from [192.168.1.99] (c-98-228-72-208.hsd1.il.comcast.net.
	[98.228.72.208])
	by mx.google.com with ESMTPS id aq5sm7550954igc.5.2012.01.11.00.33.53
	(version=TLSv1/SSLv3 cipher=OTHER);
	Wed, 11 Jan 2012 00:33:54 -0800 (PST)
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0 (Apple Message framework v1251.1)
Subject: Default completion bug
From: Sung Pae <sungpae@gmail.com>
In-Reply-To: <120110125551.AA77677.SM@caleb.ins.cwru.edu>
Date: Wed, 11 Jan 2012 02:31:42 -0600
Content-Transfer-Encoding: 7bit
Message-Id: <C95BE4FB-DC6A-4368-8B1D-D5EBB4D54C61@gmail.com>
References: <CAH3AnromByAAoRkL07gK7Xw5mssO-74pPRvDKRGgsqb_tbFAPA@mail.gmail.com>
	<4E40FDDC.5000003@sudrala.de> <4E413B39.9060104@syslang.net>
	<mailman.1094.1312970436.939.bug-bash@gnu.org>
	<slrnj44oev.791.stephane.chazelas@spam.is.invalid>
	<CADv8-oj9gwXswuwU2AsVvOQ0758bu9SYrmqWGN_43s5AX4MaUw@mail.gmail.com>
	<120110125551.AA77677.SM@caleb.ins.cwru.edu>
To: bug-bash@gnu.org
X-Mailer: Apple Mail (2.1251.1)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 209.85.210.169
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 11 Jan 2012 08:34:03 -0000

Hello,

There is a small bug in the default completion system due to a
disagreement between a few functions in what is considered a command
delimiter. I have tested this on the current devel HEAD in the git repo
(d00a2d6).

Define a default completion:

    _completion_loader() {
        complete -W "COMPLETE ME" "$1" && return 124
    }

    complete -F _completion_loader -D

Try to trigger completion for ">" (^I is literal tab):

    $ > ^I^I
    $ complete -p
    complete -F _completion_loader -D
    complete -W 'COMPLETE ME' >

Check to make sure things are working:

    $ ls ^I^I
    COMPLETE  ME
    $ complete -p
    complete -F _completion_loader -D
    complete -W 'COMPLETE ME' >
    complete -W 'COMPLETE ME' ls

Works just fine for "ls". Now, set a COMPSPEC for the empty string, "":

    $ complete -W "EMPTY STRING" ""

And try to complete ">" again:

    $ > ^I^I
    EMPTY   STRING
    $ complete -p
    complete -W 'EMPTY STRING'
    complete -F _completion_loader -D
    complete -W 'COMPLETE ME' >
    complete -W 'COMPLETE ME' ls

It works this time, but only because it is loading the COMPSPEC for the
empty string, instead of for ">".

The reason for this is that gen_progcomp_completions() first searches
the prog_completes table with the results from find_cmd_name() [1],
which given a command line "> ", returns "" (the empty string).

Failing this, it will call the default completion function
_completion_loader(), and pass it a word list composed from the results
of command_line_to_word_list(), which when given the _same_ command line
"> ", returns the list [">", ""].

Our default completion function then faithfully inserts a COMPSPEC into
prog_completes for the key ">" and returns 124 to restart the completion
loop. However, since the prog_completes table is never looked up with
the key ">", it is never actually found.

Of course, once a COMPSPEC for the empty string is inserted into the
table (which can also be done by trying to complete an empty command
line), completing ">" works as if one was completing the empty string,
which will most likely be assigned the same dynamic completion, thus
having the unfortunate appearance of suddenly working as intended.

I have not attached a patch to this bug report, because I know
the subtle differences of rl_basic_word_break_characters,
COMMAND_SEPARATORS, and the value embedded in find_cmd_name(), are
important, and that any changes, for better or worse, are scrupulously
recorded for ALL TIME. I have implemented a couple of solutions, but who
am _I_ to say what is a command delimiter?

So while a proper fix is complicated, there is a simple workaround
that can be implemented in userland: simply define the completion for
the empty string ("") for the keys that slip between the cracks of the
different command delimiter lists (i.e. "<", ">", ">>"):

    complete -o default ""

Cheers,
Sung Pae


[1]: Not directly, but by provenance. These are the stack traces for the
     functions progcomp_search() and progcomp_insert():

(HASH SEARCH)                       (HASH INSERTION)
0  progcomp_search + 39             0  progcomp_insert + 101
1  gen_progcomp_completions + 40    1  complete_builtin + 943
2  programmable_completions + 115   2  execute_builtin + 500
3  attempt_shell_completion + 1201  3  execute_command_internal + 8420
4  gen_completion_matches + 58      4  execute_command + 138
5  rl_complete_internal + 294       5  execute_command_internal + 16943
6  _rl_dispatch_subseq + 623        6  execute_command_internal + 14939
7  readline_internal_char + 267     7  execute_function + 1339
8  readline + 101                   8  execute_shell_function + 135
9  yy_readline_get + 185            9  gen_compspec_completions + 1107
10 shell_getc + 490                 10 gen_progcomp_completions + 149
11 read_token + 525                 11 programmable_completions + 261
12 yyparse + 1189                   12 attempt_shell_completion + 1201
13 parse_command + 184              13 gen_completion_matches + 58
14 read_command + 200               14 rl_complete_internal + 294
15 reader_loop + 355                15 _rl_dispatch_subseq + 623
16 main + 6292                      16 readline_internal_char + 267
17 start + 52                       17 readline + 101
18 0x0 + 2                          18 yy_readline_get + 185
                                    19 shell_getc + 490
                                    20 read_token + 525
                                    21 yyparse + 1189
                                    22 parse_command + 184
                                    23 read_command + 200
                                    24 reader_loop + 355
                                    25 main + 6292
                                    26 start + 52
                                    27 0x0 + 2



From MAILER-DAEMON Wed Jan 11 06:07:58 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rkw2A-0007Y2-AQ
	for mharc-bug-bash@gnu.org; Wed, 11 Jan 2012 06:07:58 -0500
Received: from eggs.gnu.org ([140.186.70.92]:40139)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jrnieder@gmail.com>) id 1Rkw22-00079G-Ly
	for bug-bash@gnu.org; Wed, 11 Jan 2012 06:07:56 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jrnieder@gmail.com>) id 1Rkw1w-0004Bm-Us
	for bug-bash@gnu.org; Wed, 11 Jan 2012 06:07:50 -0500
Received: from mail-iy0-f169.google.com ([209.85.210.169]:59974)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jrnieder@gmail.com>) id 1Rkw1w-0004BZ-Qb
	for bug-bash@gnu.org; Wed, 11 Jan 2012 06:07:44 -0500
Received: by iafj26 with SMTP id j26so1145632iaf.0
	for <bug-bash@gnu.org>; Wed, 11 Jan 2012 03:07:43 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=date:from:to:cc:subject:message-id:references:mime-version
	:content-type:content-disposition:in-reply-to:user-agent;
	bh=WBhR8GYzcZ+lrLFcx3dSFcAKT6rmXRNfDDfLq7tJFoc=;
	b=T30Y28dgn3y26R191ITIYj0o9i2dcjFA2YjDCOljDkudTiLSzMMkaJpGX+Wv2CV7mE
	g2/zydPtW2sPQLeOnQQZHl8Xg3AY4V9VsHMfhweczlxOIjZh5BarqlBx5CMGDdQYmgZi
	IC1LPohboRwFXVHfT/OJJw5RSwuDIW95iU3dQ=
Received: by 10.50.183.199 with SMTP id eo7mr6745464igc.5.1326280063837;
	Wed, 11 Jan 2012 03:07:43 -0800 (PST)
Received: from burratino (c-24-1-56-9.hsd1.il.comcast.net. [24.1.56.9])
	by mx.google.com with ESMTPS id 36sm4171432ibc.6.2012.01.11.03.07.43
	(version=SSLv3 cipher=OTHER); Wed, 11 Jan 2012 03:07:43 -0800 (PST)
Date: Wed, 11 Jan 2012 05:12:41 -0600
From: Jonathan Nieder <jrnieder@gmail.com>
To: "Sarnath K - ERS, HCLTech" <k_sarnath@hcl.com>
Subject: Re: Restricted Bash - Not so restrictive (in 4.2 as well)
Message-ID: <20120111111241.GB32173@burratino>
References: <FBC403853F920B468D2D47C8CC27E30609812A7D9C@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <FBC403853F920B468D2D47C8CC27E30609812A7D9C@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
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: 209.85.210.169
Cc: "bug-bash@gnu.org" <bug-bash@gnu.org>,
	"bash@packages.debian.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: Wed, 11 Jan 2012 11:07:56 -0000

Hi,

Sarnath K - ERS, HCLTech wrote:

> I see this problem in the latest Bash 4.2 as well. Say, I invoke
> "rbash" or "bash -r". This leaves me in a restrictive shell.
> However, this restrictive shell allows me to run "bash" or any other
> shell (without execing - just simply run) which leaves me in a
> normal shell.

Typically rbash is used with a nonstandard PATH setting to give users
access to a restricted set of commands.

However, I notice that the bash(1) manpage does not mention anything
about that.  If you can come up with a way to hint at it without
making the manpage much longer (maybe by tweaking the sentence that
starts "A restricted shell is used to set up an environment"), I
imagine that would be helpful.

Thanks and hope that helps,
Jonathan


From MAILER-DAEMON Wed Jan 11 06:38:37 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RkwVp-0003YT-MS
	for mharc-bug-bash@gnu.org; Wed, 11 Jan 2012 06:38:37 -0500
Received: from eggs.gnu.org ([140.186.70.92]:60674)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jrnieder@gmail.com>) id 1RkwVi-0003YN-EW
	for bug-bash@gnu.org; Wed, 11 Jan 2012 06:38:35 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jrnieder@gmail.com>) id 1RkwVh-0001D0-FW
	for bug-bash@gnu.org; Wed, 11 Jan 2012 06:38:30 -0500
Received: from mail-iy0-f169.google.com ([209.85.210.169]:51672)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jrnieder@gmail.com>) id 1RkwVh-0001Cw-7s
	for bug-bash@gnu.org; Wed, 11 Jan 2012 06:38:29 -0500
Received: by iafj26 with SMTP id j26so1190211iaf.0
	for <bug-bash@gnu.org>; Wed, 11 Jan 2012 03:38:28 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=date:from:to:cc:subject:message-id:references:mime-version
	:content-type:content-disposition:in-reply-to:user-agent;
	bh=m+aD8EEpzACLh0SQuLBbHi/U83d952fkS3Dssu79qok=;
	b=UHF0nffoIY5WP5mbdnWsBZ32HnKAOo/2vXLQX4fV/kZ5Ci8S9Yjw6Rlc5T0x16WaLY
	fRp4Pod8ARkw6VB4Q5gfoIsZ/6tcqxffVCcU92prRZC6m3Y7yRHBnUrQZnlwJXx2I9yl
	INfTNfOipPTZsb72F9cYUy6we9d12B7pXizmw=
Received: by 10.42.246.71 with SMTP id lx7mr5327313icb.54.1326281908498;
	Wed, 11 Jan 2012 03:38:28 -0800 (PST)
Received: from burratino (c-24-1-56-9.hsd1.il.comcast.net. [24.1.56.9])
	by mx.google.com with ESMTPS id r18sm4475374ibh.4.2012.01.11.03.38.27
	(version=SSLv3 cipher=OTHER); Wed, 11 Jan 2012 03:38:28 -0800 (PST)
Date: Wed, 11 Jan 2012 05:43:25 -0600
From: Jonathan Nieder <jrnieder@gmail.com>
To: "Sarnath K - ERS, HCLTech" <k_sarnath@hcl.com>
Subject: Re: Restricted Bash - Not so restrictive (in 4.2 as well)
Message-ID: <20120111114324.GC32173@burratino>
References: <FBC403853F920B468D2D47C8CC27E30609812A7D9C@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
	<20120111111241.GB32173@burratino>
	<FBC403853F920B468D2D47C8CC27E30609817B2720@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <FBC403853F920B468D2D47C8CC27E30609817B2720@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
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: 209.85.210.169
Cc: "bug-bash@gnu.org" <bug-bash@gnu.org>,
	"bash@packages.debian.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: Wed, 11 Jan 2012 11:38:35 -0000

Sarnath K - ERS, HCLTech wrote:

> Apart from this, BASH Documentation says "When a command that is
> found to be a shell script is executed (see COMMAND EXECUTION
> above), rbash turns off  any  restrictions in the shell spawned to
> execute the script.".
>
> Does this mean that a guy with restricted shell can just write a
> shell script to do a privileged operation and get away with it?

"./my-custom-script" contains a "/".


From MAILER-DAEMON Wed Jan 11 08:59:22 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rkyi2-0007lp-F3
	for mharc-bug-bash@gnu.org; Wed, 11 Jan 2012 08:59:22 -0500
Received: from eggs.gnu.org ([140.186.70.92]:47439)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rkyhv-0007hv-8h
	for bug-bash@gnu.org; Wed, 11 Jan 2012 08:59:20 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rkyhp-0002cg-J9
	for bug-bash@gnu.org; Wed, 11 Jan 2012 08:59:15 -0500
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:30671)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rkyhp-0002cZ-G2
	for bug-bash@gnu.org; Wed, 11 Jan 2012 08:59:09 -0500
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 BHA34753;
	Wed, 11 Jan 2012 08:58:57 -0500
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 APT59572 (AUTH cpr);
	Wed, 11 Jan 2012 08:58:57 -0500 (EST)
Message-ID: <4F0D95A0.1020504@case.edu>
Date: Wed, 11 Jan 2012 08:58:56 -0500
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: "Sarnath K - ERS, HCLTech" <k_sarnath@hcl.com>
Subject: Re: Restricted Bash - Not so restrictive (in 4.2 as well)
References: <FBC403853F920B468D2D47C8CC27E30609812A7D9C@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
	<20120111111241.GB32173@burratino>
In-Reply-To: <20120111111241.GB32173@burratino>
X-Enigmail-Version: 1.3.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: Jonathan Nieder <jrnieder@gmail.com>, "bug-bash@gnu.org" <bug-bash@gnu.org>,
	"bash@packages.debian.org" <bash@packages.debian.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, 11 Jan 2012 13:59:20 -0000

On 1/11/12 6:12 AM, Jonathan Nieder wrote:
> Hi,
> 
> Sarnath K - ERS, HCLTech wrote:
> 
>> I see this problem in the latest Bash 4.2 as well. Say, I invoke
>> "rbash" or "bash -r". This leaves me in a restrictive shell.
>> However, this restrictive shell allows me to run "bash" or any other
>> shell (without execing - just simply run) which leaves me in a
>> normal shell.
> 
> Typically rbash is used with a nonstandard PATH setting to give users
> access to a restricted set of commands.

The restricted shell is only one of several components of a restricted
environment.  Two others are a (readonly) value of $PATH that includes
only the directory Jonathan mentioned (typically /usr/rbin) and not
giving users write access to their home directory.  A readonly .profile
in a readonly home directory sets up the desired $PATH and leaves the
user in some other scratch directory to which he has write access.  When
I set this kind of thing up about 25 years ago, we used ~/work.

It's appropriate for the bash man page to describe the bash behavior
when run in restricted mode.  That's not the place for a tutorial on
how to set up a restricted environment.

Chet

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


From MAILER-DAEMON Wed Jan 11 10:06:26 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rkzkw-0003nR-9X
	for mharc-bug-bash@gnu.org; Wed, 11 Jan 2012 10:06:26 -0500
Received: from eggs.gnu.org ([140.186.70.92]:33162)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <k_sarnath@hcl.com>) id 1RkveJ-0002xs-1X
	for bug-bash@gnu.org; Wed, 11 Jan 2012 05:43:26 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <k_sarnath@hcl.com>) id 1RkveB-0007nZ-Jq
	for bug-bash@gnu.org; Wed, 11 Jan 2012 05:43:19 -0500
Received: from gws07.hcl.com ([203.105.186.23]:52413)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <k_sarnath@hcl.com>) id 1RkveA-0007kL-L5
	for bug-bash@gnu.org; Wed, 11 Jan 2012 05:43:11 -0500
Received: from CHN-HCLIN-HT04.CORP.HCL.IN (10.249.64.34) by
	CHN-HCLIN-EDGE3.HCL.COM (10.249.64.140) with Microsoft SMTP Server id
	8.2.254.0; Wed, 11 Jan 2012 15:49:14 +0530
Received: from CHN-HCLT-HT03.HCLT.CORP.HCL.IN (10.108.45.35) by
	CHN-HCLIN-HT04.CORP.HCL.IN (10.249.64.34) with Microsoft SMTP Server
	(TLS) id 8.2.176.0; Wed, 11 Jan 2012 15:52:43 +0530
Received: from CHN-HCLT-EVS08.HCLT.CORP.HCL.IN ([fe80::69bc:f9a4:16ee:d3c6])
	by CHN-HCLT-HT03.HCLT.CORP.HCL.IN ([::1]) with mapi; Wed, 11 Jan 2012
	15:52:41 +0530
From: "Sarnath K - ERS, HCLTech" <k_sarnath@hcl.com>
To: "bug-bash@gnu.org" <bug-bash@gnu.org>, "bash@packages.debian.org"
	<bash@packages.debian.org>
Date: Wed, 11 Jan 2012 15:52:35 +0530
Subject: Restricted Bash - Not so restrictive (in 4.2 as well)
Thread-Topic: Restricted Bash - Not so restrictive (in 4.2 as well)
Thread-Index: AczQSu/2hRg7cyNMQ6GNOUltduzOIA==
Message-ID: <FBC403853F920B468D2D47C8CC27E30609812A7D9C@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-cr-puzzleid: {80132253-1BE1-477A-BA9E-89B74F1C2533}
x-cr-hashedpuzzle: NKY= lOs= CkJV C5Lv Do8N DqI1 GOAu GObC I91/ LHLa MJOw
	MYqw Motp M0ye Otck U/H7; 2;
	YgBhAHMAaABAAHAAYQBjAGsAYQBnAGUAcwAuAGQAZQBiAGkAYQBuAC4AbwByAGcAOwBiAHUAZwAtAGIAYQBzAGgAQABnAG4AdQAuAG8AcgBnAA==;
	Sosha1_v1; 7; {80132253-1BE1-477A-BA9E-89B74F1C2533};
	awBfAHMAYQByAG4AYQB0AGgAQABoAGMAbAAuAGMAbwBtAA==; Wed,
	11 Jan 2012 10:22:35 GMT;
	UgBlAHMAdAByAGkAYwB0AGUAZAAgAEIAYQBzAGgAIAAtACAATgBvAHQAIABzAG8AIAByAGUAcwB0AHIAaQBjAHQAaQB2AGUAIAAoAGkAbgAgADQALgAyACAAYQBzACAAdwBlAGwAbAApAA==
acceptlanguage: en-US
MIME-Version: 1.0
X-detected-operating-system: by eggs.gnu.org: Windows 2000 SP2+,
	XP SP1+ (seldom 98)
X-Received-From: 203.105.186.23
X-Mailman-Approved-At: Wed, 11 Jan 2012 10:06:22 -0500
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
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, 11 Jan 2012 10:43:26 -0000

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM=3D'bash' -DCONF_HOSTTYPE=3D'x86_64' -DCONF_O=
STYPE=3D'linux-gnu' -DCONF_MACHTYPE=3D'x86_64-pc-linux-gnu' -DCONF$
uname output: Linux ubuntu 2.6.32-24-generic #39-Ubuntu SMP Wed Jul 28 05:1=
4:15 UTC 2010 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

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

Description:
       I see this problem in the latest Bash 4.2 as well. Say, I invoke "rb=
ash" or "bash -r". This leaves me in a restrictive shell. However, this res=
trictive shell allows me to run "bash" or any other shell (without execing =
- just simply run) which leaves me in a normal shell. This shell does not h=
ave any restricted capabilities. So, the entire purpose of having a restric=
ted shell goes for a toss. I was trying to restrict a user by making "rbash=
" as his default shell. Now, with this bug, I don't think I can be fool-pro=
of.

Repeat-By:

sarnath@ubuntu:~$ bash -r
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

sarnath@ubuntu:~$ cd /
bash: cd: restricted
sarnath@ubuntu:~$
sarnath@ubuntu:~$ bash
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

sarnath@ubuntu:~$
sarnath@ubuntu:~$ cd /
sarnath@ubuntu:/$ cd
sarnath@ubuntu:~$

Fix:
Just my 2 cents. Please apply your discretion:
Just make sure that while in restricted mode, the user can spawn only "rbas=
h" and no other shell.
Any invocation of "bash" must be replaced with "bash -r".
A list of shells/applications could be black-listed in a configuration file=
 which is processed while processing .bashrc
This will make bash foolproof.

________________________________
::DISCLAIMER::
---------------------------------------------------------------------------=
--------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and inte=
nded for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliate=
s. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect t=
he opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification,=
 distribution and / or publication of
this message without the prior written consent of the author of this e-mail=
 is strictly prohibited. If you have
received this email in error please delete it and notify the sender immedia=
tely. Before opening any mail and
attachments please check them for viruses and defect.

---------------------------------------------------------------------------=
--------------------------------------------

From MAILER-DAEMON Wed Jan 11 10:06:26 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rkzkw-0003ns-Cm
	for mharc-bug-bash@gnu.org; Wed, 11 Jan 2012 10:06:26 -0500
Received: from eggs.gnu.org ([140.186.70.92]:39636)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <k_sarnath@hcl.com>) id 1RkwIg-0001ra-9r
	for bug-bash@gnu.org; Wed, 11 Jan 2012 06:25:12 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <k_sarnath@hcl.com>) id 1RkwIZ-0007A5-Uh
	for bug-bash@gnu.org; Wed, 11 Jan 2012 06:25:02 -0500
Received: from gws08.hcl.com ([203.105.186.26]:25444)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <k_sarnath@hcl.com>) id 1RkwIY-00079V-84
	for bug-bash@gnu.org; Wed, 11 Jan 2012 06:24:55 -0500
Received: from CHN-HCLIN-HT04.CORP.HCL.IN (10.249.64.34) by
	CHN-HCLIN-EDGE4.HCL.COM (10.249.64.141) with Microsoft SMTP Server id
	8.2.254.0; Wed, 11 Jan 2012 16:54:30 +0530
Received: from CHN-HCLT-HT04.HCLT.CORP.HCL.IN (10.108.45.37) by
	CHN-HCLIN-HT04.CORP.HCL.IN (10.249.64.34) with Microsoft SMTP Server
	(TLS) id 8.2.176.0; Wed, 11 Jan 2012 16:54:47 +0530
Received: from CHN-HCLT-EVS08.HCLT.CORP.HCL.IN ([fe80::69bc:f9a4:16ee:d3c6])
	by CHN-HCLT-HT04.HCLT.CORP.HCL.IN ([::1]) with mapi; Wed, 11 Jan 2012
	16:54:44 +0530
From: "Sarnath K - ERS, HCLTech" <k_sarnath@hcl.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Date: Wed, 11 Jan 2012 16:54:42 +0530
Subject: RE: Restricted Bash - Not so restrictive (in 4.2 as well)
Thread-Topic: Restricted Bash - Not so restrictive (in 4.2 as well)
Thread-Index: AczQUUC7CmVL7R+USq+MHPsoTMYBaAAALUUw
Message-ID: <FBC403853F920B468D2D47C8CC27E30609817B2720@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
References: <FBC403853F920B468D2D47C8CC27E30609812A7D9C@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
	<20120111111241.GB32173@burratino>
In-Reply-To: <20120111111241.GB32173@burratino>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
acceptlanguage: en-US
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-detected-operating-system: by eggs.gnu.org: Windows 2000 SP2+,
	XP SP1+ (seldom 98)
X-Received-From: 203.105.186.26
X-Mailman-Approved-At: Wed, 11 Jan 2012 10:06:23 -0500
Cc: "bug-bash@gnu.org" <bug-bash@gnu.org>,
	"bash@packages.debian.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: Wed, 11 Jan 2012 11:25:12 -0000

Hello Jonathan,

Thanks for the quick hint.

What I understand is that you are suggesting me to collate all required com=
mands in a special directory and then use it in the PATH and remove everyth=
ing else from the PATH in ".bashrc".

I think that would really serve my purpose. Thanks!

As far as changes to BASH documentation goes, I think the existing document=
ation is just fine. It clearly says that "A restricted shell is used to set=
up an environment more controlled than the shell". I think it is up to the =
administrator to use it innovatively.

Apart from this, BASH Documentation says "When a command that is found to b=
e a shell script is executed (see COMMAND EXECUTION above), rbash turns off=
  any  restrictions in the shell spawned to execute the script.".
Does this mean that a guy with restricted shell can just write a shell scri=
pt to do a privileged operation and get away with it?

Thanks for your time and such a quick response,

Best Regards,
Sarnath

-----Original Message-----
From: Jonathan Nieder [mailto:jrnieder@gmail.com]
Sent: Wednesday, January 11, 2012 4:43 PM
To: Sarnath K - ERS, HCLTech
Cc: bug-bash@gnu.org; bash@packages.debian.org
Subject: Re: Restricted Bash - Not so restrictive (in 4.2 as well)

Hi,

Sarnath K - ERS, HCLTech wrote:

> I see this problem in the latest Bash 4.2 as well. Say, I invoke
> "rbash" or "bash -r". This leaves me in a restrictive shell.
> However, this restrictive shell allows me to run "bash" or any other
> shell (without execing - just simply run) which leaves me in a
> normal shell.

Typically rbash is used with a nonstandard PATH setting to give users
access to a restricted set of commands.

However, I notice that the bash(1) manpage does not mention anything
about that.  If you can come up with a way to hint at it without
making the manpage much longer (maybe by tweaking the sentence that
starts "A restricted shell is used to set up an environment"), I
imagine that would be helpful.

Thanks and hope that helps,
Jonathan

::DISCLAIMER::
---------------------------------------------------------------------------=
--------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and inte=
nded for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliate=
s. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect t=
he opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification,=
 distribution and / or publication of
this message without the prior written consent of the author of this e-mail=
 is strictly prohibited. If you have
received this email in error please delete it and notify the sender immedia=
tely. Before opening any mail and
attachments please check them for viruses and defect.

---------------------------------------------------------------------------=
--------------------------------------------


From MAILER-DAEMON Wed Jan 11 15:03:56 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rl4Op-0003yi-W5
	for mharc-bug-bash@gnu.org; Wed, 11 Jan 2012 15:03:55 -0500
Received: from eggs.gnu.org ([140.186.70.92]:55003)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Rl4Ol-0003xE-UC
	for bug-bash@gnu.org; Wed, 11 Jan 2012 15:03:53 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Rl4Ok-0001uS-KD
	for bug-bash@gnu.org; Wed, 11 Jan 2012 15:03:51 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:54005
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Rl4Oj-0001uG-U4
	for bug-bash@gnu.org; Wed, 11 Jan 2012 15:03:50 -0500
Received: from [192.168.3.140] (Athenae [192.168.3.140])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q0BK3hbT005235; Wed, 11 Jan 2012 12:03:45 -0800
Message-ID: <4F0DEB14.9050004@tlinx.org>
Date: Wed, 11 Jan 2012 12:03:32 -0800
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: Specify completion without name
References: <CABrM6wmtFDksPYKbAmTKJBWbTik1A86Cba+JpHa0N3em++cqeQ@mail.gmail.com>	<4F050D7C.7020503@case.edu>	<CABrM6wnuCAkO8RugMcoKQDtJBn2sky1mUhYNGEUo5HQbqYA4GA@mail.gmail.com>	<4F05A7B1.4060406@case.edu>	<CABrM6wkneVcg1U8hYorV79pS5DV7jK6+FbSb4E6rxce+i_sgkg@mail.gmail.com>	<4F05C5A6.8010704@case.edu>	<CABrM6w=DzeaV5iVQ05VNz0oh0ZXxgxBkX1sR0b2tOfJJsn+ygw@mail.gmail.com>
	<CADv8-ohzzjqaSqbPAWYQU9DgUnFsfc2cBWXga6pukRjc-pWgaw@mail.gmail.com>
In-Reply-To: <CADv8-ohzzjqaSqbPAWYQU9DgUnFsfc2cBWXga6pukRjc-pWgaw@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: "Clark J. Wang" <dearvoid@gmail.com>, Peng Yu <pengyu.ut@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: Wed, 11 Jan 2012 20:03:54 -0000



Clark J. Wang wrote:
> On Fri, Jan 6, 2012 at 00:33, Peng Yu <pengyu.ut@gmail.com> wrote:
> 
> But beware to clearly document these by giving working
>> EXAMPLE code which include these three commands (not just text
>> explanation without working code, by "working code" I mean code
>> snippet is discouraged, a complete completion function should be
>> provided).
>>
> 
> The bash man page already has ~70 pages manual. I don't like it to grow to
> ~700 pages (like the ABS Guide) with all the working examples you expected.
> :)
----
  Vs. having things undocumented, as is the case in the current bash man page.

  I think the bash doc maintainers would benefit greatly by looking at the
perl manpages, which generally do a good job of documenting a complex
product.

  Like... compat40 mentions it changes behavior, about interrupting a command
list, yet try to find out what that behavior is, or what compat40 would
change it 'to'?

Or how about, does compat 31 imply compat32 and compat40?  If not, does that
really mean compat31 is really 'compat31', or just "use <feature> 3.1" to
specify that a specific feature be used in it's 3.1 version vs. a newer version.

I agree insomuch as if every new incompatibility had to be thoroughly documented,
the impact of such incompatibilities might be more thoroughly thought out,
not to mention the benefit for users trying to read the man page to program
by...






From MAILER-DAEMON Wed Jan 11 17:36:01 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rl6m1-0006tr-G9
	for mharc-bug-bash@gnu.org; Wed, 11 Jan 2012 17:36:01 -0500
Received: from eggs.gnu.org ([140.186.70.92]:57424)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rl6lt-0006sM-PP
	for bug-bash@gnu.org; Wed, 11 Jan 2012 17:35:59 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rl6lm-0005DS-Lf
	for bug-bash@gnu.org; Wed, 11 Jan 2012 17:35:53 -0500
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:23685)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rl6lm-0005DI-IY
	for bug-bash@gnu.org; Wed, 11 Jan 2012 17:35:46 -0500
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 BHA80742;
	Wed, 11 Jan 2012 17:35:45 -0500
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 APU41557 (AUTH cpr);
	Wed, 11 Jan 2012 17:35:44 -0500 (EST)
Message-ID: <4F0E0EC0.6080707@case.edu>
Date: Wed, 11 Jan 2012 17:35:44 -0500
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Linda Walsh <bash@tlinx.org>
Subject: Re: Specify completion without name
References: <CABrM6wmtFDksPYKbAmTKJBWbTik1A86Cba+JpHa0N3em++cqeQ@mail.gmail.com>	<4F050D7C.7020503@case.edu>	<CABrM6wnuCAkO8RugMcoKQDtJBn2sky1mUhYNGEUo5HQbqYA4GA@mail.gmail.com>	<4F05A7B1.4060406@case.edu>	<CABrM6wkneVcg1U8hYorV79pS5DV7jK6+FbSb4E6rxce+i_sgkg@mail.gmail.com>	<4F05C5A6.8010704@case.edu>	<CABrM6w=DzeaV5iVQ05VNz0oh0ZXxgxBkX1sR0b2tOfJJsn+ygw@mail.gmail.com>
	<CADv8-ohzzjqaSqbPAWYQU9DgUnFsfc2cBWXga6pukRjc-pWgaw@mail.gmail.com>
	<4F0DEB14.9050004@tlinx.org>
In-Reply-To: <4F0DEB14.9050004@tlinx.org>
X-Enigmail-Version: 1.3.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: chet.ramey@case.edu, "Clark J. Wang" <dearvoid@gmail.com>,
	bug-bash <bug-bash@gnu.org>, Peng Yu <pengyu.ut@gmail.com>
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, 11 Jan 2012 22:35:59 -0000

On 1/11/12 3:03 PM, Linda Walsh wrote:

>  Like... compat40 mentions it changes behavior, about interrupting a command
> list, yet try to find out what that behavior is, or what compat40 would
> change it 'to'?

Thanks, I added that to the description.  It means that bash versions
later than 4.0 interrupt a list when one of the commands in the list
terminates due to SIGINT and job control is in effect; previous versions
just continued on.

> 
> Or how about, does compat 31 imply compat32 and compat40?  If not, does that
> really mean compat31 is really 'compat31', or just "use <feature> 3.1" to
> specify that a specific feature be used in it's 3.1 version vs. a newer
> version.

There is only a single shell compatibility level; the last variable
set wins.  The compatibility level variables are mutually exclusive.

The descriptions of each option are self-contained.  That's why the
descriptions for compat32 and compat40 include the same text concerning
using strcoll for < and > comparisons (and why the description for
compat31 should include it as well).

The COMPAT file in the bash distribution has a much more extensive
description of incompatibilities between versions.

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 Jan 12 05:26:46 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RlHrq-0006Yw-AH
	for mharc-bug-bash@gnu.org; Thu, 12 Jan 2012 05:26:46 -0500
Received: from eggs.gnu.org ([140.186.70.92]:56715)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <k_sarnath@hcl.com>) id 1RlHri-0006Y2-DS
	for bug-bash@gnu.org; Thu, 12 Jan 2012 05:26:43 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <k_sarnath@hcl.com>) id 1RlHrc-00033N-MD
	for bug-bash@gnu.org; Thu, 12 Jan 2012 05:26:38 -0500
Received: from gws07.hcl.com ([203.105.186.23]:27379)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <k_sarnath@hcl.com>) id 1RlHrc-00032Z-1X
	for bug-bash@gnu.org; Thu, 12 Jan 2012 05:26:32 -0500
Received: from CHN-HCLIN-HT04.CORP.HCL.IN (10.249.64.34) by
	CHN-HCLIN-EDGE3.HCL.COM (10.249.64.140) with Microsoft SMTP Server id
	8.2.254.0; Thu, 12 Jan 2012 15:52:47 +0530
Received: from CHN-HCLT-HT04.HCLT.CORP.HCL.IN (10.108.45.37) by
	CHN-HCLIN-HT04.CORP.HCL.IN (10.249.64.34) with Microsoft SMTP Server
	(TLS) id 8.2.176.0; Thu, 12 Jan 2012 15:56:21 +0530
Received: from CHN-HCLT-EVS08.HCLT.CORP.HCL.IN ([fe80::69bc:f9a4:16ee:d3c6])
	by CHN-HCLT-HT04.HCLT.CORP.HCL.IN ([::1]) with mapi; Thu, 12 Jan 2012
	15:56:21 +0530
From: "Sarnath K - ERS, HCLTech" <k_sarnath@hcl.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Date: Thu, 12 Jan 2012 15:56:19 +0530
Subject: RE: Restricted Bash - Not so restrictive (in 4.2 as well)
Thread-Topic: Restricted Bash - Not so restrictive (in 4.2 as well)
Thread-Index: AczQVYwPijtuXt/8RvS6eqisYw/3XwAveJjQ
Message-ID: <FBC403853F920B468D2D47C8CC27E30609817B2C87@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
References: <FBC403853F920B468D2D47C8CC27E30609812A7D9C@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
	<20120111111241.GB32173@burratino>
	<FBC403853F920B468D2D47C8CC27E30609817B2720@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
	<20120111114324.GC32173@burratino>
In-Reply-To: <20120111114324.GC32173@burratino>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
acceptlanguage: en-US
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-detected-operating-system: by eggs.gnu.org: Windows 2000 SP2+,
	XP SP1+ (seldom 98)
X-Received-From: 203.105.186.23
Cc: "bug-bash@gnu.org" <bug-bash@gnu.org>,
	"bash@packages.debian.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: Thu, 12 Jan 2012 10:26:44 -0000

Hello Jonathan,

Thanks for your inputs. I was able to created a super-restricted login.
Here are a few things that I learnt during this process:

1. "vim" has a restricted mode called "rvim (or) vim -Z". This way, I can r=
estrict the user from running shell commands from vim and peep into the Fil=
esystem
    a) CAVEAT: "vim" allows the user to "read" and "write" files in the fil=
e-system provided the user _knows_ the path (or guesses some file path)
    b) So, to make it foolproof, I had to go with "nano" editor
        - which supports a restricted mode that does not allow the user to =
edit any other file than the one specified in the command line
    c) As per your advice, I created pre-processing shell scripts which scr=
eens the user-commands and disallows anything that contains a "/" in the ar=
guments.
         (actually, they do not allow more than 1 argument)
    d) Similarly, I got pre-processing scripts for compiling and running th=
e test application.

I still have to block "FTP/SFTP" access. Otherwise, it will still not be fo=
olproof - I think.
I will look around,

Thanks for all your help!

Best Regards,
Sarnath

-----Original Message-----
From: Jonathan Nieder [mailto:jrnieder@gmail.com]
Sent: Wednesday, January 11, 2012 5:13 PM
To: Sarnath K - ERS, HCLTech
Cc: bug-bash@gnu.org; bash@packages.debian.org
Subject: Re: Restricted Bash - Not so restrictive (in 4.2 as well)

Sarnath K - ERS, HCLTech wrote:

> Apart from this, BASH Documentation says "When a command that is
> found to be a shell script is executed (see COMMAND EXECUTION
> above), rbash turns off  any  restrictions in the shell spawned to
> execute the script.".
>
> Does this mean that a guy with restricted shell can just write a
> shell script to do a privileged operation and get away with it?

"./my-custom-script" contains a "/".

::DISCLAIMER::
---------------------------------------------------------------------------=
--------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and inte=
nded for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliate=
s. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect t=
he opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification,=
 distribution and / or publication of
this message without the prior written consent of the author of this e-mail=
 is strictly prohibited. If you have
received this email in error please delete it and notify the sender immedia=
tely. Before opening any mail and
attachments please check them for viruses and defect.

---------------------------------------------------------------------------=
--------------------------------------------


From MAILER-DAEMON Thu Jan 12 05:35:22 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RlI0A-0007cM-3j
	for mharc-bug-bash@gnu.org; Thu, 12 Jan 2012 05:35:22 -0500
Received: from eggs.gnu.org ([140.186.70.92]:51053)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1RlI05-0007be-Vc
	for bug-bash@gnu.org; Thu, 12 Jan 2012 05:35:20 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1RlI00-0004Kp-EM
	for bug-bash@gnu.org; Thu, 12 Jan 2012 05:35:17 -0500
Received: from mail-iy0-f169.google.com ([209.85.210.169]:53981)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1RlI00-0004Kh-AA
	for bug-bash@gnu.org; Thu, 12 Jan 2012 05:35:12 -0500
Received: by iafj26 with SMTP id j26so3065359iaf.0
	for <bug-bash@gnu.org>; Thu, 12 Jan 2012 02:35:11 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=YK+PrhaehmWsOHKj2nEeQR42LRg9rDmqsfh3232IjqI=;
	b=ed0fxlhnOBTcCeU9QO8T2KCm6J6J1BVKQ2NgmY7ZNqqTZgTiRizRVzM9H5NMpbSKgI
	bfq9ozYeJKNSXjr0mT7LxPptXnX4nu7zo8K7gshxE+pxOlqdVMVhsaVDEwdlEszJklsq
	YiRyrzyL6w4ej5OSA2RuNP4qWVdp72b3ls9LQ=
Received: by 10.42.135.138 with SMTP id p10mr2910076ict.25.1326364511362; Thu,
	12 Jan 2012 02:35:11 -0800 (PST)
MIME-Version: 1.0
Received: by 10.42.230.71 with HTTP; Thu, 12 Jan 2012 02:34:49 -0800 (PST)
In-Reply-To: <FBC403853F920B468D2D47C8CC27E30609817B2C87@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
References: <FBC403853F920B468D2D47C8CC27E30609812A7D9C@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
	<20120111111241.GB32173@burratino>
	<FBC403853F920B468D2D47C8CC27E30609817B2720@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
	<20120111114324.GC32173@burratino>
	<FBC403853F920B468D2D47C8CC27E30609817B2C87@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Thu, 12 Jan 2012 12:34:49 +0200
Message-ID: <CAPSX3sQC=JzL7i6+OomwtPDSj89e7JFFAqx0ynUP8gZnqmdD8A@mail.gmail.com>
Subject: Re: Restricted Bash - Not so restrictive (in 4.2 as well)
To: "Sarnath K - ERS, HCLTech" <k_sarnath@hcl.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 209.85.210.169
Cc: "bug-bash@gnu.org" <bug-bash@gnu.org>,
	"bash@packages.debian.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: Thu, 12 Jan 2012 10:35:20 -0000

On Thu, Jan 12, 2012 at 12:26 PM, Sarnath K - ERS, HCLTech
<k_sarnath@hcl.com> wrote:
> Hello Jonathan,
>
> Thanks for your inputs. I was able to created a super-restricted login.
> Here are a few things that I learnt during this process:
>
> 1. "vim" has a restricted mode called "rvim (or) vim -Z". This way, I can=
 restrict the user from running shell commands from vim and peep into the F=
ilesystem
> =A0 =A0a) CAVEAT: "vim" allows the user to "read" and "write" files in th=
e file-system provided the user _knows_ the path (or guesses some file path=
)

> =A0 =A0b) So, to make it foolproof, I had to go with "nano" editor
> =A0 =A0 =A0 =A0- which supports a restricted mode that does not allow the=
 user to edit any other file than the one specified in the command line

Can't you read a file with: echo "$(< pathtofile)"?
I never really tried, but I'd probably look into things like chroot
(or even a vm) to provide something really restricted.


From MAILER-DAEMON Thu Jan 12 05:51:38 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RlIFu-0004D3-OK
	for mharc-bug-bash@gnu.org; Thu, 12 Jan 2012 05:51:38 -0500
Received: from eggs.gnu.org ([140.186.70.92]:34491)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <k_sarnath@hcl.com>) id 1RlIFo-000493-1x
	for bug-bash@gnu.org; Thu, 12 Jan 2012 05:51:36 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <k_sarnath@hcl.com>) id 1RlIFm-0007AT-TU
	for bug-bash@gnu.org; Thu, 12 Jan 2012 05:51:32 -0500
Received: from gws08.hcl.com ([203.105.186.26]:29048)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <k_sarnath@hcl.com>) id 1RlIFm-00079N-6l
	for bug-bash@gnu.org; Thu, 12 Jan 2012 05:51:30 -0500
Received: from chn-hclin-ht01.CORP.HCL.IN (10.249.64.35) by
	CHN-HCLIN-EDGE4.HCL.COM (10.249.64.141) with Microsoft SMTP Server id
	8.2.254.0; Thu, 12 Jan 2012 16:20:56 +0530
Received: from CHN-HCLT-CASHT1.HCLT.CORP.HCL.IN (10.108.45.33) by
	chn-hclin-ht01.CORP.HCL.IN (10.249.64.35) with Microsoft SMTP Server
	(TLS) id 8.2.254.0; Thu, 12 Jan 2012 16:21:15 +0530
Received: from CHN-HCLT-EVS08.HCLT.CORP.HCL.IN ([fe80::69bc:f9a4:16ee:d3c6])
	by CHN-HCLT-CASHT1.HCLT.CORP.HCL.IN ([::1]) with mapi; Thu, 12 Jan 2012
	16:21:14 +0530
From: "Sarnath K - ERS, HCLTech" <k_sarnath@hcl.com>
To: Pierre Gaston <pierre.gaston@gmail.com>
Date: Thu, 12 Jan 2012 16:21:13 +0530
Subject: RE: Restricted Bash - Not so restrictive (in 4.2 as well)
Thread-Topic: Restricted Bash - Not so restrictive (in 4.2 as well)
Thread-Index: AczRFd29taZTB9fvSLe/fFJbCxHMQAAAHVag
Message-ID: <FBC403853F920B468D2D47C8CC27E30609817B2CBC@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
References: <FBC403853F920B468D2D47C8CC27E30609812A7D9C@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
	<20120111111241.GB32173@burratino>
	<FBC403853F920B468D2D47C8CC27E30609817B2720@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
	<20120111114324.GC32173@burratino>
	<FBC403853F920B468D2D47C8CC27E30609817B2C87@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
	<CAPSX3sQC=JzL7i6+OomwtPDSj89e7JFFAqx0ynUP8gZnqmdD8A@mail.gmail.com>
In-Reply-To: <CAPSX3sQC=JzL7i6+OomwtPDSj89e7JFFAqx0ynUP8gZnqmdD8A@mail.gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
acceptlanguage: en-US
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: Windows 2000 SP2+,
	XP SP1+ (seldom 98)
X-Received-From: 203.105.186.26
Cc: "bug-bash@gnu.org" <bug-bash@gnu.org>,
	"bash@packages.debian.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: Thu, 12 Jan 2012 10:51:36 -0000

Oops.. It actually works! That's a great catch!

I thought "redirection" is not supported in restricted mode though..!
I just checked... It is mostly related to "output" re-direction.

Hmm......I think I am going to tinker "bash" source code to disable the "ec=
ho" builtin. :-)

Any ideas?

-----Original Message-----
From: Pierre Gaston [mailto:pierre.gaston@gmail.com]
Sent: Thursday, January 12, 2012 4:05 PM
To: Sarnath K - ERS, HCLTech
Cc: bug-bash@gnu.org; bash@packages.debian.org
Subject: Re: Restricted Bash - Not so restrictive (in 4.2 as well)

On Thu, Jan 12, 2012 at 12:26 PM, Sarnath K - ERS, HCLTech
<k_sarnath@hcl.com> wrote:
> Hello Jonathan,
>
> Thanks for your inputs. I was able to created a super-restricted login.
> Here are a few things that I learnt during this process:
>
> 1. "vim" has a restricted mode called "rvim (or) vim -Z". This way, I can=
 restrict the user from running shell commands from vim and peep into the F=
ilesystem
>    a) CAVEAT: "vim" allows the user to "read" and "write" files in the fi=
le-system provided the user _knows_ the path (or guesses some file path)

>    b) So, to make it foolproof, I had to go with "nano" editor
>        - which supports a restricted mode that does not allow the user to=
 edit any other file than the one specified in the command line

Can't you read a file with: echo "$(< pathtofile)"?
I never really tried, but I'd probably look into things like chroot
(or even a vm) to provide something really restricted.

::DISCLAIMER::
---------------------------------------------------------------------------=
--------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and inte=
nded for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliate=
s. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect t=
he opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification,=
 distribution and / or publication of
this message without the prior written consent of the author of this e-mail=
 is strictly prohibited. If you have
received this email in error please delete it and notify the sender immedia=
tely. Before opening any mail and
attachments please check them for viruses and defect.

---------------------------------------------------------------------------=
--------------------------------------------


From MAILER-DAEMON Thu Jan 12 06:00:32 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RlIOW-0006jx-V5
	for mharc-bug-bash@gnu.org; Thu, 12 Jan 2012 06:00:32 -0500
Received: from eggs.gnu.org ([140.186.70.92]:57911)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1RlIOM-0006gC-IN
	for bug-bash@gnu.org; Thu, 12 Jan 2012 06:00:31 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1RlIOH-0000T4-3r
	for bug-bash@gnu.org; Thu, 12 Jan 2012 06:00:22 -0500
Received: from mail-tul01m020-f169.google.com ([209.85.214.169]:45741)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1RlIOG-0000Sx-Ub
	for bug-bash@gnu.org; Thu, 12 Jan 2012 06:00:17 -0500
Received: by obbuo9 with SMTP id uo9so702253obb.0
	for <bug-bash@gnu.org>; Thu, 12 Jan 2012 03:00:16 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type;
	bh=d7biJbXMIZhBSaujslxZ0kIxv/ha4DjhNFn+42p8e/Y=;
	b=Bm0aF5z6mHmE6aUBIBh6YJvd2DEUJZjF/kzs+AQDHgDDe1hKvLMY0dkc2NIUirc8Wf
	4SH2XCxXfcErdGOO8W9QE8WYz5oUeHa1NXrr135DUQHLFT0OUmYhM5Yo6qSmspUz3smb
	cnso0hRBTIcUW5tPkFuMg8PneROXFNgp1cLsM=
Received: by 10.50.6.233 with SMTP id e9mr3491801iga.17.1326366015559; Thu, 12
	Jan 2012 03:00:15 -0800 (PST)
MIME-Version: 1.0
Received: by 10.42.230.71 with HTTP; Thu, 12 Jan 2012 02:59:54 -0800 (PST)
In-Reply-To: <FBC403853F920B468D2D47C8CC27E30609817B2CBC@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
References: <FBC403853F920B468D2D47C8CC27E30609812A7D9C@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
	<20120111111241.GB32173@burratino>
	<FBC403853F920B468D2D47C8CC27E30609817B2720@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
	<20120111114324.GC32173@burratino>
	<FBC403853F920B468D2D47C8CC27E30609817B2C87@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
	<CAPSX3sQC=JzL7i6+OomwtPDSj89e7JFFAqx0ynUP8gZnqmdD8A@mail.gmail.com>
	<FBC403853F920B468D2D47C8CC27E30609817B2CBC@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Thu, 12 Jan 2012 12:59:54 +0200
Message-ID: <CAPSX3sRYqsrbte+yd_UHFyTSWfBeC99XrC5JS+5uikPHJ0COHQ@mail.gmail.com>
Subject: Re: Restricted Bash - Not so restrictive (in 4.2 as well)
To: "Sarnath K - ERS, HCLTech" <k_sarnath@hcl.com>
Content-Type: text/plain; charset=ISO-8859-1
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 209.85.214.169
Cc: "bug-bash@gnu.org" <bug-bash@gnu.org>,
	"bash@packages.debian.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: Thu, 12 Jan 2012 11:00:31 -0000

On Thu, Jan 12, 2012 at 12:51 PM, Sarnath K - ERS, HCLTech
<k_sarnath@hcl.com> wrote:
> Oops.. It actually works! That's a great catch!
>
> I thought "redirection" is not supported in restricted mode though..!
> I just checked... It is mostly related to "output" re-direction.
>
> Hmm......I think I am going to tinker "bash" source code to disable the "echo" builtin. :-)
>
> Any ideas?
>
I don 't think it's a good idea, there are many many many tricks like
this ( printf, read, mapfile....), or for instance just run:
"$(<file)"
and you will get the file as an error message.

As hinted at the beginning securing a shell like you want should
probably be discussed elsewhere, maybe on a debian list.


From MAILER-DAEMON Thu Jan 12 06:32:57 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RlItt-0002qQ-Ce
	for mharc-bug-bash@gnu.org; Thu, 12 Jan 2012 06:32:57 -0500
Received: from eggs.gnu.org ([140.186.70.92]:59401)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <k_sarnath@hcl.com>) id 1RlItl-0002pZ-Tb
	for bug-bash@gnu.org; Thu, 12 Jan 2012 06:32:55 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <k_sarnath@hcl.com>) id 1RlItc-0005b4-Tx
	for bug-bash@gnu.org; Thu, 12 Jan 2012 06:32:49 -0500
Received: from gws08.hcl.com ([203.105.186.26]:17482)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <k_sarnath@hcl.com>) id 1RlItc-0005aT-7M
	for bug-bash@gnu.org; Thu, 12 Jan 2012 06:32:40 -0500
Received: from chn-hclin-ht02.CORP.HCL.IN (10.249.64.36) by
	CHN-HCLIN-EDGE4.HCL.COM (10.249.64.141) with Microsoft SMTP Server id
	8.2.254.0; Thu, 12 Jan 2012 17:02:09 +0530
Received: from CHN-HCLT-HT03.HCLT.CORP.HCL.IN (10.108.45.35) by
	chn-hclin-ht02.CORP.HCL.IN (10.249.64.36) with Microsoft SMTP Server
	(TLS) id 8.2.254.0; Thu, 12 Jan 2012 17:02:29 +0530
Received: from CHN-HCLT-EVS08.HCLT.CORP.HCL.IN ([fe80::69bc:f9a4:16ee:d3c6])
	by CHN-HCLT-HT03.HCLT.CORP.HCL.IN ([::1]) with mapi; Thu, 12 Jan 2012
	17:02:28 +0530
From: "Sarnath K - ERS, HCLTech" <k_sarnath@hcl.com>
To: Pierre Gaston <pierre.gaston@gmail.com>
Date: Thu, 12 Jan 2012 17:02:26 +0530
Subject: RE: Restricted Bash - Not so restrictive (in 4.2 as well)
Thread-Topic: Restricted Bash - Not so restrictive (in 4.2 as well)
Thread-Index: AczRGV9S0zCxrv/GQuKfcIOLMVcBSAAAUQ9A
Message-ID: <FBC403853F920B468D2D47C8CC27E30609817B2D04@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
References: <FBC403853F920B468D2D47C8CC27E30609812A7D9C@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
	<20120111111241.GB32173@burratino>
	<FBC403853F920B468D2D47C8CC27E30609817B2720@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
	<20120111114324.GC32173@burratino>
	<FBC403853F920B468D2D47C8CC27E30609817B2C87@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
	<CAPSX3sQC=JzL7i6+OomwtPDSj89e7JFFAqx0ynUP8gZnqmdD8A@mail.gmail.com>
	<FBC403853F920B468D2D47C8CC27E30609817B2CBC@CHN-HCLT-EVS08.HCLT.CORP.HCL.IN>
	<CAPSX3sRYqsrbte+yd_UHFyTSWfBeC99XrC5JS+5uikPHJ0COHQ@mail.gmail.com>
In-Reply-To: <CAPSX3sRYqsrbte+yd_UHFyTSWfBeC99XrC5JS+5uikPHJ0COHQ@mail.gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
acceptlanguage: en-US
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-detected-operating-system: by eggs.gnu.org: Windows 2000 SP2+,
	XP SP1+ (seldom 98)
X-Received-From: 203.105.186.26
Cc: "bug-bash@gnu.org" <bug-bash@gnu.org>,
	"bash@packages.debian.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: Thu, 12 Jan 2012 11:32:55 -0000

Thanks for the education!

I am planning a workaround. If I hit success, I will write again - hoping y=
ou guys won't mind...

-----Original Message-----
From: Pierre Gaston [mailto:pierre.gaston@gmail.com]
Sent: Thursday, January 12, 2012 4:30 PM
To: Sarnath K - ERS, HCLTech
Cc: bug-bash@gnu.org; bash@packages.debian.org
Subject: Re: Restricted Bash - Not so restrictive (in 4.2 as well)

On Thu, Jan 12, 2012 at 12:51 PM, Sarnath K - ERS, HCLTech
<k_sarnath@hcl.com> wrote:
> Oops.. It actually works! That's a great catch!
>
> I thought "redirection" is not supported in restricted mode though..!
> I just checked... It is mostly related to "output" re-direction.
>
> Hmm......I think I am going to tinker "bash" source code to disable the "=
echo" builtin. :-)
>
> Any ideas?
>
I don 't think it's a good idea, there are many many many tricks like
this ( printf, read, mapfile....), or for instance just run:
"$(<file)"
and you will get the file as an error message.

As hinted at the beginning securing a shell like you want should
probably be discussed elsewhere, maybe on a debian list.

::DISCLAIMER::
---------------------------------------------------------------------------=
--------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and inte=
nded for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliate=
s. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect t=
he opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification,=
 distribution and / or publication of
this message without the prior written consent of the author of this e-mail=
 is strictly prohibited. If you have
received this email in error please delete it and notify the sender immedia=
tely. Before opening any mail and
attachments please check them for viruses and defect.

---------------------------------------------------------------------------=
--------------------------------------------


From MAILER-DAEMON Sat Jan 14 00:50:24 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RlwVU-0001S7-O5
	for mharc-bug-bash@gnu.org; Sat, 14 Jan 2012 00:50:24 -0500
Received: from eggs.gnu.org ([140.186.70.92]:50284)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1RlwVR-0001Pv-GE
	for bug-bash@gnu.org; Sat, 14 Jan 2012 00:50:22 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1RlwVQ-0003lS-85
	for bug-bash@gnu.org; Sat, 14 Jan 2012 00:50:21 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:54147
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1RlwVO-0003lF-4v
	for bug-bash@gnu.org; Sat, 14 Jan 2012 00:50:20 -0500
Received: from [192.168.3.140] (Athenae [192.168.3.140])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q0E5oArj008167
	for <bug-bash@gnu.org>; Fri, 13 Jan 2012 21:50:13 -0800
Message-ID: <4F111784.2050507@tlinx.org>
Date: Fri, 13 Jan 2012 21:49:56 -0800
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@gnu.org
Subject: read -ei "y" -p "> " bug(s)
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 14 Jan 2012 05:50:22 -0000

/* vim: ts=1 sw=1 et sc fo=cqwa1 tw=78 syntax=css */
There's actually 1 parts 2 this, I ran into the 2nd while  testing the 
first...

I wanted to be able to check the keyboard if the user had 'typed' ahead,
and mean to answer an upcoming question on purpose or if it was left 
over from a previous
y/n single input response.

I wanted to do a
   read -t 0.01 pre_ans

just before my read to see if there was input already available and 
scarf it up..
initially just to 'flush the buffer', but later with the intent of 
asking if that
was what they meant, and to just accept the type ahead...  (didn't want 
to take
a key press accidently doubled as input to a next command, but wanted to 
allow it
to enable it if that was desired).

I wanted a way to be able to take any key I pre-read in, and put it back 
into the input
stream if the user wanted it done... I thought to use
the preload feature of readline, and load their key into the buffer if it
was a normal key (I wanted to be able to examine keys outside of the 
input stream,
basically)...


Well -- it didn't return until the user pressed a key -- so even with a 
key already
loaded, and a limit of 1, telling it to return upon 1 key in the buff, 
it still
didn't return until it got the 2nd key.

The thing is, if the user presses a key and doesn't erase the key 
presented, their
key is ignored.

So either 1) it should come back immediately because it already has the 
one key, or 2,
if the use presses a different key, then it should take that key.


II -- while testing the above, .. found a more annoying bug --

if you use read -N 1,

on future lines that I would 'edit' (in vimode), CR would be entered as 
input , but would
not recognized as 'enter line'... only ^j worked actually execute the 
line...

The terminal wasn't in 'raw' mode... output was unchanged, just that CR 
was no longer
taken for entry.   erase and such still worked normally...


I did an output of stty -a of a working window and a non working one, 
the settings
are the same!

It is repeatable
BASH_VERSION = 4.1.10(1)-release




From MAILER-DAEMON Mon Jan 16 08:39:44 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rmmmm-0006bu-7y
	for mharc-bug-bash@gnu.org; Mon, 16 Jan 2012 08:39:44 -0500
Received: from eggs.gnu.org ([140.186.70.92]:40095)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Rmmme-0006Jh-Kr
	for bug-bash@gnu.org; Mon, 16 Jan 2012 08:39:42 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1RmmmZ-0005eL-Sf
	for bug-bash@gnu.org; Mon, 16 Jan 2012 08:39:36 -0500
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:44526
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1RmmmZ-0005Xl-P7
	for bug-bash@gnu.org; Mon, 16 Jan 2012 08:39:31 -0500
Received: (qmail 15441 invoked from network); 16 Jan 2012 13:39:07 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Mon, 16 Jan 2012 08:39:07 -0500
Received: (qmail 17425 invoked by uid 563); 16 Jan 2012 13:39:06 -0000
Date: Mon, 16 Jan 2012 08:39:06 -0500
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Linda Walsh <bash@tlinx.org>
Subject: Re: read -ei "y" -p "> " bug(s)
Message-ID: <20120116133906.GF916@eeg.ccf.org>
References: <4F111784.2050507@tlinx.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4F111784.2050507@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: Mon, 16 Jan 2012 13:39:42 -0000

On Fri, Jan 13, 2012 at 09:49:56PM -0800, Linda Walsh wrote:

> BASH_VERSION = 4.1.10(1)-release

> I wanted to be able to check the keyboard if the user had 'typed' ahead,

read -t 0

> I wanted to do a
>   read -t 0.01 pre_ans
> 
> just before my read to see if there was input already available and 
> scarf it up..

No, read -t 0 was created for this purpose, and is available in bash 4.0
and higher, which you have.

> if you use read -N 1,
> 
> on future lines that I would 'edit' (in vimode), CR would be entered as 
> input , but would
> not recognized as 'enter line'... only ^j worked actually execute the 
> line...

I cannot reproduce this behavior as you state it.  (I assume you are
saying that you type "read -N 1", then press a key, then at a new prompt
you type something, then press ESC, then press v, then move the cursor
around, then press Enter.  When I do that, Enter works as expected.)

> The terminal wasn't in 'raw' mode... output was unchanged, just that CR 
> was no longer
> taken for entry.   erase and such still worked normally...

Well, it certainly *sounds* as though you had somehow managed to perform
the equivalent of "stty -icrnl".  (Although, on my system, even that
won't break the Enter key in bash.  Just in ssh.  See below.)

> I did an output of stty -a of a working window and a non working one, 
> the settings
> are the same!

That's odd.

The only way I can come close to the behavior you describe is to run
"stty -icrnl".  In bash, in my terminal, this produces no immediately
noticeable difference -- the Enter key still works to submit commands
to bash.  However, if I run something like "ssh localhost", and get a
password prompt from ssh, then the Enter key no longer works and I have
to press Ctrl-J.  Which is precisely what I'd expect, from having typed
"stty -icrnl".

But "read -N 1" does not do this for me -- no change in stty settings,
no change in bash behavior, no change in ssh behavior.  I tried in both
bash 4.2 and bash 4.1.

Can you tell us precisely, step by step, mouse click by mouse click and
keystroke by keystroke, how to reproduce your issue?  Include what OS you
are on, and what terminal you are in.


From MAILER-DAEMON Mon Jan 16 12:29:42 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RmqNK-0000L8-VU
	for mharc-bug-bash@gnu.org; Mon, 16 Jan 2012 12:29:42 -0500
Received: from eggs.gnu.org ([140.186.70.92]:50924)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RmqNE-0000JC-VL
	for bug-bash@gnu.org; Mon, 16 Jan 2012 12:29:41 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RmqNA-0002Va-AG
	for bug-bash@gnu.org; Mon, 16 Jan 2012 12:29:36 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:52227)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RmqNA-0002VU-6G
	for bug-bash@gnu.org; Mon, 16 Jan 2012 12:29:32 -0500
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 BUP41243; Mon, 16 Jan 2012 12:29:30 -0500 (EST)
Received: from h186.190.190.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.190.190.186]) by mpv7.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SIS36646 (AUTH cpr);
	Mon, 16 Jan 2012 12:29:30 -0500 (EST)
Message-ID: <4F145E81.7080505@case.edu>
Date: Mon, 16 Jan 2012 12:29:37 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Sung Pae <sungpae@gmail.com>
Subject: Re: Default completion bug
References: <CAH3AnromByAAoRkL07gK7Xw5mssO-74pPRvDKRGgsqb_tbFAPA@mail.gmail.com>
	<4E40FDDC.5000003@sudrala.de> <4E413B39.9060104@syslang.net>
	<mailman.1094.1312970436.939.bug-bash@gnu.org>
	<slrnj44oev.791.stephane.chazelas@spam.is.invalid>
	<CADv8-oj9gwXswuwU2AsVvOQ0758bu9SYrmqWGN_43s5AX4MaUw@mail.gmail.com>
	<120110125551.AA77677.SM@caleb.ins.cwru.edu>
	<C95BE4FB-DC6A-4368-8B1D-D5EBB4D54C61@gmail.com>
In-Reply-To: <C95BE4FB-DC6A-4368-8B1D-D5EBB4D54C61@gmail.com>
X-Enigmail-Version: 1.3.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 16 Jan 2012 17:29:41 -0000

On 1/11/12 3:31 AM, Sung Pae wrote:
> Hello,
> 
> There is a small bug in the default completion system due to a
> disagreement between a few functions in what is considered a command
> delimiter. I have tested this on the current devel HEAD in the git repo
> (d00a2d6).

I think you've uncovered a potential problem, but not the one you think.
The important thing is that `>' is not a command separator and cannot be
a command name.  As such, it kind of slips between the cracks of the
completion system.

> 
> Define a default completion:
> 
>     _completion_loader() {
>         complete -W "COMPLETE ME" "$1" && return 124
>     }
> 
>     complete -F _completion_loader -D
> 
> Try to trigger completion for ">" (^I is literal tab):
> 
>     $ > ^I^I
>     $ complete -p
>     complete -F _completion_loader -D
>     complete -W 'COMPLETE ME' >
> 
> Check to make sure things are working:
> 
>     $ ls ^I^I
>     COMPLETE  ME
>     $ complete -p
>     complete -F _completion_loader -D
>     complete -W 'COMPLETE ME' >
>     complete -W 'COMPLETE ME' ls
> 
> Works just fine for "ls". Now, set a COMPSPEC for the empty string, "":
> 
>     $ complete -W "EMPTY STRING" ""
> 
> And try to complete ">" again:
> 
>     $ > ^I^I
>     EMPTY   STRING
>     $ complete -p
>     complete -W 'EMPTY STRING'
>     complete -F _completion_loader -D
>     complete -W 'COMPLETE ME' >
>     complete -W 'COMPLETE ME' ls
> 
> It works this time, but only because it is loading the COMPSPEC for the
> empty string, instead of for ">".
> 
> The reason for this is that gen_progcomp_completions() first searches
> the prog_completes table with the results from find_cmd_name() [1],
> which given a command line "> ", returns "" (the empty string).

That's because `>' is not part of a command name.  It *ends* a command
name.  It's a shell metacharacter, and unquoted metacharacters separate
words.

> 
> Failing this, it will call the default completion function
> _completion_loader(), and pass it a word list composed from the results
> of command_line_to_word_list(), which when given the _same_ command line
> "> ", returns the list [">", ""].

Yes, those are separate words.

> Our default completion function then faithfully inserts a COMPSPEC into
> prog_completes for the key ">" and returns 124 to restart the completion
> loop. However, since the prog_completes table is never looked up with
> the key ">", it is never actually found.

True, the completion system will allow you to define a compspec for
something that will never be used as a command name.

> Of course, once a COMPSPEC for the empty string is inserted into the
> table (which can also be done by trying to complete an empty command
> line), completing ">" works as if one was completing the empty string,
> which will most likely be assigned the same dynamic completion, thus
> having the unfortunate appearance of suddenly working as intended.

Completing `>' *is* the same as completing the empty string, because `>'
is not a command name, or part of a command name.  If you think about
how the shell parser operates, a sequence of characters like "foo>bar"
is three words: the command name `foo', the operator `>' and the word
`bar'.  Removing `foo' doesn't change the meaning of `>' and `bar'.

> 
> I have not attached a patch to this bug report, because I know
> the subtle differences of rl_basic_word_break_characters,
> COMMAND_SEPARATORS, and the value embedded in find_cmd_name(), are
> important, and that any changes, for better or worse, are scrupulously
> recorded for ALL TIME. I have implemented a couple of solutions, but who
> am _I_ to say what is a command delimiter?

Well, Posix says what is and what is not a command delimiter.  Let's see
if I can explain what these do a little better.

Readline has its own idea about completion: it breaks the command line
into units on which the user might find it convenient to perform
completion.  That's why characters like `:' and `@' are in readline's word
break characters when they are not shell metacharacters.

find_cmd_start and find_cmd_end are intended to find the boundaries of the
command containing the word to be completed.  That means find_cmd_start
uses characters after which it might be reasonable to find a command name.
That's why `{' appears in the value of COMMAND_SEPARATORS even though it's
not a shell operator.

find_cmd_end is where we might have a potential problem.  Like _start, it
should include characters that can reasonably end a command, so it should
include `)' instead of `('.  It all works out ok in the end, since `(' is
a character that starts the next command instead of one that ends the
current one, but there's potential improvement there.

find_cmd_name is different.  It uses word boundaries, not command
boundaries.  That's why it uses the shell break characters as delimiters
(look at syntax.h for the value of shell_break_characters), which are
those characters that delimit tokens when the shell is parsing input.

> So while a proper fix is complicated, there is a simple workaround
> that can be implemented in userland: simply define the completion for
> the empty string ("") for the keys that slip between the cracks of the
> different command delimiter lists (i.e. "<", ">", ">>"):

While we can talk about whether or not it's reasonable to extend the
completion system to incorporate redirections and other shell operators,
there's no bug in the way things currently work.

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 Jan 16 13:10:12 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rmr0W-000427-O9
	for mharc-bug-bash@gnu.org; Mon, 16 Jan 2012 13:10:12 -0500
Received: from eggs.gnu.org ([140.186.70.92]:41626)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rmr0P-0003xs-Sl
	for bug-bash@gnu.org; Mon, 16 Jan 2012 13:10:11 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rmr0L-0000tZ-Gu
	for bug-bash@gnu.org; Mon, 16 Jan 2012 13:10:05 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:26879)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rmr0L-0000sy-9x
	for bug-bash@gnu.org; Mon, 16 Jan 2012 13:10:01 -0500
Received: from mpv8.tis.CWRU.Edu (EHLO mpv8.case.edu) ([129.22.105.116])
	by mpv1.tis.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id BUP43443; Mon, 16 Jan 2012 13:10:00 -0500 (EST)
Received: from h186.190.190.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.190.190.186]) by mpv8.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SPH65424 (AUTH cpr);
	Mon, 16 Jan 2012 13:10:00 -0500 (EST)
Message-ID: <4F1467FE.2060000@case.edu>
Date: Mon, 16 Jan 2012 13:10:06 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Linda Walsh <bash@tlinx.org>
Subject: Re: read -ei "y" -p "> " bug(s)
References: <4F111784.2050507@tlinx.org>
In-Reply-To: <4F111784.2050507@tlinx.org>
X-Enigmail-Version: 1.3.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 16 Jan 2012 18:10:11 -0000

On 1/14/12 12:49 AM, Linda Walsh wrote:
> /* vim: ts=1 sw=1 et sc fo=cqwa1 tw=78 syntax=css */
> There's actually 1 parts 2 this, I ran into the 2nd while  testing the
> first...

Like Greg Wooledge, I wasn't able to reproduce the second issue with
`read -N 1' (which I assume is actually something like `read -e -N 1'
from your description.

> I wanted to be able to check the keyboard if the user had 'typed' ahead,
> and mean to answer an upcoming question on purpose or if it was left over
> from a previous
> y/n single input response.
> 
> I wanted to do a
>   read -t 0.01 pre_ans

As Greg said, use `read -t 0'.

> 
> Well -- it didn't return until the user pressed a key -- so even with a key
> already
> loaded, and a limit of 1, telling it to return upon 1 key in the buff, it
> still
> didn't return until it got the 2nd key.

That's where you have a bad assumption: read -N 1 means to read exactly one
character from the input.  It doesn't exactly mean to return when there's
one character loaded into the readline buffer, it means to read at least
one character and return when you have at least one character in the
buffer.  If it didn't mean that, how could we allow the user to erase any
default intput?  If you wanted readline to return immediately if you had
one or more characters preloaded, why would you call read that way in the
first place?  It doesn't add or change anything.

By default, when using readline to obtain the line, we take characters from
the beginning of the returned line buffer.  If we want one character, we
take the first one.

If you want to experiment with skipping any pre-inserted text, try changing
the value initializing `rlind'.  You could use something like

	rlind = deftext && *deftext ? strlen (deftext) : 0;

before the call to edit_line.

Doing that leads to other questions, though.  Say a user hits return when
a character has been preloaded into the buffer.  Should the code retrieve
the key the user pressed, or the key in the line buffer?

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 Jan 16 14:14:41 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rms0v-0001J0-NV
	for mharc-bug-bash@gnu.org; Mon, 16 Jan 2012 14:14:41 -0500
Received: from eggs.gnu.org ([140.186.70.92]:50341)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Rms0t-0001HJ-Ky
	for bug-bash@gnu.org; Mon, 16 Jan 2012 14:14:40 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Rms0s-00040i-QX
	for bug-bash@gnu.org; Mon, 16 Jan 2012 14:14:39 -0500
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:44588
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1Rms0s-00040a-KW
	for bug-bash@gnu.org; Mon, 16 Jan 2012 14:14:38 -0500
Received: (qmail 17924 invoked from network); 16 Jan 2012 19:14:35 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Mon, 16 Jan 2012 14:14:35 -0500
Received: (qmail 17754 invoked by uid 563); 16 Jan 2012 19:14:34 -0000
Date: Mon, 16 Jan 2012 14:14:34 -0500
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: bug-bash@gnu.org
Subject: inappropriate brace expansion in command substitution
Message-ID: <20120116191434.GG916@eeg.ccf.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
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: Mon, 16 Jan 2012 19:14:40 -0000

Someone in IRC was doing an overly complex command invovling grep "^.{1,8}"
inside a command substitution, and we believe he stumbled upon a bash bug.
I've simplified it down to this:

$ echo "$(echo "a{1,8}")"
a1 a8

The curly braces here should not be treated as a brace expansion, since
they're obviously inside a quoted argument.

This is occurring in every version of bash tested (which includes 2.05b,
3.2.51, 4.0.33, 4.1.9, and 4.2.20).

This slightly different command works as expected:

x="$(echo "a{1,8}")"; echo "$x"
a{1,8}


From MAILER-DAEMON Mon Jan 16 15:11:49 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RmsuD-00089W-UT
	for mharc-bug-bash@gnu.org; Mon, 16 Jan 2012 15:11:49 -0500
Received: from eggs.gnu.org ([140.186.70.92]:40864)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RmsuB-00088v-FN
	for bug-bash@gnu.org; Mon, 16 Jan 2012 15:11:48 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rmsu6-0005Q0-PP
	for bug-bash@gnu.org; Mon, 16 Jan 2012 15:11:47 -0500
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:8957)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rmsu6-0005Pq-MN
	for bug-bash@gnu.org; Mon, 16 Jan 2012 15:11:42 -0500
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 BHD86392;
	Mon, 16 Jan 2012 15:11:41 -0500
Received: from h186.190.190.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.190.190.186]) by mpv8.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SPI17978 (AUTH cpr);
	Mon, 16 Jan 2012 15:11:41 -0500 (EST)
Message-ID: <4F14847C.7060801@case.edu>
Date: Mon, 16 Jan 2012 15:11:40 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Greg Wooledge <wooledg@eeg.ccf.org>
Subject: Re: inappropriate brace expansion in command substitution
References: <20120116191434.GG916@eeg.ccf.org>
In-Reply-To: <20120116191434.GG916@eeg.ccf.org>
X-Enigmail-Version: 1.3.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: Mon, 16 Jan 2012 20:11:48 -0000

On 1/16/12 2:14 PM, Greg Wooledge wrote:
> Someone in IRC was doing an overly complex command invovling grep "^.{1,8}"
> inside a command substitution, and we believe he stumbled upon a bash bug.
> I've simplified it down to this:
> 
> $ echo "$(echo "a{1,8}")"
> a1 a8
> 
> The curly braces here should not be treated as a brace expansion, since
> they're obviously inside a quoted argument.

The curly braces shouldn't be handled by the "outer" shell anyway, since
they're part of a command substitution.  (The quotes inside the command
substitution should not be misinterpreted as terminating the outer quoted
string.)  This was already reported and fixed for the next bash releaes.

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 Jan 16 15:57:45 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rmtcf-0007Ut-65
	for mharc-bug-bash@gnu.org; Mon, 16 Jan 2012 15:57:45 -0500
Received: from eggs.gnu.org ([140.186.70.92]:56203)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <sungpae@gmail.com>) id 1Rmtcd-0007Ug-1G
	for bug-bash@gnu.org; Mon, 16 Jan 2012 15:57:43 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <sungpae@gmail.com>) id 1Rmtcb-0006fo-Sl
	for bug-bash@gnu.org; Mon, 16 Jan 2012 15:57:42 -0500
Received: from mail-gx0-f169.google.com ([209.85.161.169]:34401)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <sungpae@gmail.com>) id 1Rmtcb-0006fj-Pd
	for bug-bash@gnu.org; Mon, 16 Jan 2012 15:57:41 -0500
Received: by ggnp4 with SMTP id p4so3291417ggn.0
	for <bug-bash@gnu.org>; Mon, 16 Jan 2012 12:57:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=subject:mime-version:content-type:from:in-reply-to:date:cc
	:content-transfer-encoding:message-id:references:to:x-mailer;
	bh=adnjy08sRvykw2zAH6jXSNObN/iFwkoxf8UiO/cvOKM=;
	b=bvJ11T+XDiVCnhvKPpHhwJ5Jgwudy95dVl4X/Sm4gJ0QYtt5N4sCqDFKxbrQY2YwrJ
	mv9EBhhJwRf2w6Xj9uC+G92vk02zr1M1AeI89v7pF6VCSWtk3BgdP2w2UQJLJ7xBrqA3
	dXP0QvmVXLoKykRt5PnTQhVr5CmOqQit4670k=
Received: by 10.101.22.15 with SMTP id z15mr1532471ani.67.1326747460550;
	Mon, 16 Jan 2012 12:57:40 -0800 (PST)
Received: from [192.168.1.99] (c-98-228-72-208.hsd1.il.comcast.net.
	[98.228.72.208])
	by mx.google.com with ESMTPS id a7sm53223798ana.5.2012.01.16.12.57.38
	(version=TLSv1/SSLv3 cipher=OTHER);
	Mon, 16 Jan 2012 12:57:38 -0800 (PST)
Subject: Re: Default completion bug
Mime-Version: 1.0 (Apple Message framework v1251.1)
Content-Type: text/plain; charset=iso-8859-1
From: Sung Pae <sungpae@gmail.com>
In-Reply-To: <4F145E81.7080505@case.edu>
Date: Mon, 16 Jan 2012 14:54:56 -0600
Content-Transfer-Encoding: 7bit
Message-Id: <DEAB1A5A-B63A-47E1-9C45-F9A33E589F78@gmail.com>
References: <CAH3AnromByAAoRkL07gK7Xw5mssO-74pPRvDKRGgsqb_tbFAPA@mail.gmail.com>
	<4E40FDDC.5000003@sudrala.de> <4E413B39.9060104@syslang.net>
	<mailman.1094.1312970436.939.bug-bash@gnu.org>
	<slrnj44oev.791.stephane.chazelas@spam.is.invalid>
	<CADv8-oj9gwXswuwU2AsVvOQ0758bu9SYrmqWGN_43s5AX4MaUw@mail.gmail.com>
	<120110125551.AA77677.SM@caleb.ins.cwru.edu>
	<C95BE4FB-DC6A-4368-8B1D-D5EBB4D54C61@gmail.com>
	<4F145E81.7080505@case.edu>
To: chet.ramey@case.edu
X-Mailer: Apple Mail (2.1251.1)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 209.85.161.169
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 16 Jan 2012 20:57:44 -0000

On 16 Jan 2012, at 11:29 AM, Chet Ramey wrote:

> I think you've uncovered a potential problem, but not the one you
> think. The important thing is that `>' is not a command separator and
> cannot be a command name. As such, it kind of slips between the cracks
> of the completion system.

> > Of course, once a COMPSPEC for the empty string is inserted into
> > the table (which can also be done by trying to complete an empty
> > command line), completing ">" works as if one was completing the
> > empty string,

> Completing `>' *is* the same as completing the empty string, because
> `>' is not a command name, or part of a command name. If you think
> about how the shell parser operates, a sequence of characters like
> "foo>bar" is three words: the command name `foo', the operator `>' and
> the word `bar'. Removing `foo' doesn't change the meaning of `>' and
> `bar'.

I see. Trying to complete the command line:

    $ >^I

is the same as completing:

    $ "">^I

I have mistaken `>` for the command.

> > I have not attached a patch to this bug report, because I know
> > the subtle differences of rl_basic_word_break_characters,
> > COMMAND_SEPARATORS, and the value embedded in find_cmd_name(), are
> > important,

> Well, Posix says what is and what is not a command delimiter. Let's
> see if I can explain what these do a little better.

Thank you for the explanation; it's clear now. I had a suspicion the
reasoning for this was deeper than I imagined.

> While we can talk about whether or not it's reasonable to extend
> the completion system to incorporate redirections and other shell
> operators, there's no bug in the way things currently work.

The only issue then is that completing a bare `<`, `>` and `>>` results
in the default completion command receiving the redirection operator as
its first argument. The manual, however, states (my emphasis):

    For instance, assuming that there is a library of compspecs,
    each kept in a file corresponding to the *name of the command*,
    the following default completion function would load completions
    dynamically:

    _completion_loader()
    {
        . "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124
    }
    complete -D -F _completion_loader

Is it not reasonable then that _completion_loader should receive the
empty string instead of the redirection operator in this corner case?

Cheers,
Sung Pae



From MAILER-DAEMON Tue Jan 17 15:25:36 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RnFb6-0006Sr-Nb
	for mharc-bug-bash@gnu.org; Tue, 17 Jan 2012 15:25:36 -0500
Received: from eggs.gnu.org ([140.186.70.92]:35413)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RnFb3-0006Sl-NW
	for bug-bash@gnu.org; Tue, 17 Jan 2012 15:25:34 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RnFb2-0002XM-5x
	for bug-bash@gnu.org; Tue, 17 Jan 2012 15:25:33 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:23358)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RnFb2-0002XG-2r
	for bug-bash@gnu.org; Tue, 17 Jan 2012 15:25:32 -0500
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 BUQ43525; Tue, 17 Jan 2012 15:25:30 -0500 (EST)
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 AQB58723 (AUTH cpr);
	Tue, 17 Jan 2012 15:25:30 -0500 (EST)
Message-ID: <4F15D93A.4060906@case.edu>
Date: Tue, 17 Jan 2012 15:25:30 -0500
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Sung Pae <sungpae@gmail.com>
Subject: Re: Default completion bug
References: <CAH3AnromByAAoRkL07gK7Xw5mssO-74pPRvDKRGgsqb_tbFAPA@mail.gmail.com>
	<4E40FDDC.5000003@sudrala.de> <4E413B39.9060104@syslang.net>
	<mailman.1094.1312970436.939.bug-bash@gnu.org>
	<slrnj44oev.791.stephane.chazelas@spam.is.invalid>
	<CADv8-oj9gwXswuwU2AsVvOQ0758bu9SYrmqWGN_43s5AX4MaUw@mail.gmail.com>
	<120110125551.AA77677.SM@caleb.ins.cwru.edu>
	<C95BE4FB-DC6A-4368-8B1D-D5EBB4D54C61@gmail.com>
	<4F145E81.7080505@case.edu>
	<DEAB1A5A-B63A-47E1-9C45-F9A33E589F78@gmail.com>
In-Reply-To: <DEAB1A5A-B63A-47E1-9C45-F9A33E589F78@gmail.com>
X-Enigmail-Version: 1.3.4
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: 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, 17 Jan 2012 20:25:34 -0000

On 1/16/12 3:54 PM, Sung Pae wrote:

> The only issue then is that completing a bare `<`, `>` and `>>` results
> in the default completion command receiving the redirection operator as
> its first argument. The manual, however, states (my emphasis):
> 
>     For instance, assuming that there is a library of compspecs,
>     each kept in a file corresponding to the *name of the command*,
>     the following default completion function would load completions
>     dynamically:
> 
>     _completion_loader()
>     {
>         . "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124
>     }
>     complete -D -F _completion_loader
> 
> Is it not reasonable then that _completion_loader should receive the
> empty string instead of the redirection operator in this corner case?

That's an excellent point.  It's a case of these corner cases violating
one of the assumptions the programmable completion code makes.  I know
how to fix it -- the correct information exists, and is used to search
for the right compspec.  That null command just needs to be passed to
the right function.  This fix will be in the next version of bash.

Chet


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


From MAILER-DAEMON Tue Jan 17 19:04:31 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RnJ0x-0003Fw-7N
	for mharc-bug-bash@gnu.org; Tue, 17 Jan 2012 19:04:31 -0500
Received: from eggs.gnu.org ([140.186.70.92]:59529)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <zmiller@cobalt.cs.wisc.edu>) id 1RnJ0u-0003EI-Q5
	for bug-bash@gnu.org; Tue, 17 Jan 2012 19:04:29 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <zmiller@cobalt.cs.wisc.edu>) id 1RnJ0t-0004qf-Ti
	for bug-bash@gnu.org; Tue, 17 Jan 2012 19:04:28 -0500
Received: from cobalt.cs.wisc.edu ([128.105.121.30]:57877)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <zmiller@cobalt.cs.wisc.edu>) id 1RnJ0t-0004pS-O1
	for bug-bash@gnu.org; Tue, 17 Jan 2012 19:04:27 -0500
Received: from cobalt.cs.wisc.edu (localhost [127.0.0.1])
	by cobalt.cs.wisc.edu (8.14.1/8.14.1) with ESMTP id q0I04JMf021840
	for <bug-bash@gnu.org>; Tue, 17 Jan 2012 18:04:19 -0600
Received: (from zmiller@localhost)
	by cobalt.cs.wisc.edu (8.14.1/8.14.1/Submit) id q0I04J8a021839
	for bug-bash@gnu.org; Tue, 17 Jan 2012 18:04:19 -0600
Date: Tue, 17 Jan 2012 18:04:19 -0600
From: Zachary Miller <zmiller@cs.wisc.edu>
To: bug-bash@gnu.org
Subject: minor bug in bash
Message-ID: <20120118000419.GA21592@cs.wisc.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.4.2.2i
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 128.105.121.30
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 18 Jan 2012 00:04:29 -0000


hello,

i would like to report a what i believe to be a minor bug in bash 4.2 that has
to do with file redirection:

in redir.c:356 (function write_here_document()), this block of code:
      if (write (fd, document, document_len) < document_len)
        {
          if (errno == 0)
            errno = ENOSPC;
          return (errno);
        }
      else
        return 0;

checks for a short write() but doesn't retry writing the remainder of the bytes
(and in fact returns ENOSPC instead, even though no error has yet occurred).

according to the man page for write(2), fewer bytes may be written and this is
not by itself an error.

thanks!


cheers,
-zach



From MAILER-DAEMON Tue Jan 17 21:49:05 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RnLaC-0001lT-V9
	for mharc-bug-bash@gnu.org; Tue, 17 Jan 2012 21:49:04 -0500
Received: from eggs.gnu.org ([140.186.70.92]:59450)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RnLa9-0001gY-LI
	for bug-bash@gnu.org; Tue, 17 Jan 2012 21:49:02 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RnLa8-0006Fg-DA
	for bug-bash@gnu.org; Tue, 17 Jan 2012 21:49:01 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:55300)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RnLa8-0006F5-7a
	for bug-bash@gnu.org; Tue, 17 Jan 2012 21:49:00 -0500
Received: from mpv8.tis.CWRU.Edu (EHLO mpv8.case.edu) ([129.22.105.116])
	by mpv1.tis.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id BUQ68342; Tue, 17 Jan 2012 21:48:54 -0500 (EST)
Received: from h232.201.189.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.189.201.232]) by mpv8.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SPP46059 (AUTH cpr);
	Tue, 17 Jan 2012 21:48:53 -0500 (EST)
Message-ID: <4F163315.8010503@case.edu>
Date: Tue, 17 Jan 2012 21:48:53 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Zachary Miller <zmiller@cs.wisc.edu>
Subject: Re: minor bug in bash
References: <20120118000419.GA21592@cs.wisc.edu>
In-Reply-To: <20120118000419.GA21592@cs.wisc.edu>
X-Enigmail-Version: 1.3.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 18 Jan 2012 02:49:02 -0000

On 1/17/12 7:04 PM, Zachary Miller wrote:
> 
> hello,
> 
> i would like to report a what i believe to be a minor bug in bash 4.2 that has
> to do with file redirection:
> 
> in redir.c:356 (function write_here_document()), this block of code:
>       if (write (fd, document, document_len) < document_len)
>         {
>           if (errno == 0)
>             errno = ENOSPC;
>           return (errno);
>         }
>       else
>         return 0;
> 
> checks for a short write() but doesn't retry writing the remainder of the bytes
> (and in fact returns ENOSPC instead, even though no error has yet occurred).
> 
> according to the man page for write(2), fewer bytes may be written and this is
> not by itself an error.

Thanks for the report.  As a practical matter, this doesn't present a
problem.  When writing to a regular file, with no special flags supplied
to open(), the only cases Posix says it can return fewer bytes than
specified are errors.

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 Jan 17 22:05:27 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RnLq3-0002r6-Fa
	for mharc-bug-bash@gnu.org; Tue, 17 Jan 2012 22:05:27 -0500
Received: from eggs.gnu.org ([140.186.70.92]:60716)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <zmiller@cobalt.cs.wisc.edu>) id 1RnLq1-0002r0-HZ
	for bug-bash@gnu.org; Tue, 17 Jan 2012 22:05:26 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <zmiller@cobalt.cs.wisc.edu>) id 1RnLq0-0000IY-QA
	for bug-bash@gnu.org; Tue, 17 Jan 2012 22:05:25 -0500
Received: from cobalt.cs.wisc.edu ([128.105.121.30]:57973)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <zmiller@cobalt.cs.wisc.edu>) id 1RnLq0-0000IL-Ju
	for bug-bash@gnu.org; Tue, 17 Jan 2012 22:05:24 -0500
Received: from cobalt.cs.wisc.edu (localhost [127.0.0.1])
	by cobalt.cs.wisc.edu (8.14.1/8.14.1) with ESMTP id q0I35DnE024248;
	Tue, 17 Jan 2012 21:05:13 -0600
Received: (from zmiller@localhost)
	by cobalt.cs.wisc.edu (8.14.1/8.14.1/Submit) id q0I35CNO024247;
	Tue, 17 Jan 2012 21:05:12 -0600
Date: Tue, 17 Jan 2012 21:05:12 -0600
From: Zachary Miller <zmiller@cs.wisc.edu>
To: Chet Ramey <chet.ramey@case.edu>
Subject: Re: minor bug in bash
Message-ID: <20120118030512.GA24099@cs.wisc.edu>
References: <20120118000419.GA21592@cs.wisc.edu> <4F163315.8010503@case.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4F163315.8010503@case.edu>
User-Agent: Mutt/1.4.2.2i
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 128.105.121.30
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, 18 Jan 2012 03:05:26 -0000

> Thanks for the report.  As a practical matter, this doesn't present a
> problem.  When writing to a regular file, with no special flags supplied
> to open(), the only cases Posix says it can return fewer bytes than
> specified are errors.

thank chet.  i figured that may be the case.  if you wouldn't mind, could you
point me to where exactly that behavior is documented?


cheers,
-zach



From MAILER-DAEMON Tue Jan 17 22:18:14 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RnM2Q-0004Y1-Fx
	for mharc-bug-bash@gnu.org; Tue, 17 Jan 2012 22:18:14 -0500
Received: from eggs.gnu.org ([140.186.70.92]:59391)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RnM2O-0004Xv-7Q
	for bug-bash@gnu.org; Tue, 17 Jan 2012 22:18:13 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RnM2K-0005ir-8m
	for bug-bash@gnu.org; Tue, 17 Jan 2012 22:18:12 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:34966)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RnM2K-0005i8-5d
	for bug-bash@gnu.org; Tue, 17 Jan 2012 22:18:08 -0500
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 BUQ69694; Tue, 17 Jan 2012 22:18:07 -0500 (EST)
Received: from h232.201.189.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.189.201.232]) by mpv7.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SJA48667 (AUTH cpr);
	Tue, 17 Jan 2012 22:18:05 -0500 (EST)
Message-ID: <4F1639E8.9050607@case.edu>
Date: Tue, 17 Jan 2012 22:18:00 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Zachary Miller <zmiller@cs.wisc.edu>
Subject: Re: minor bug in bash
References: <20120118000419.GA21592@cs.wisc.edu> <4F163315.8010503@case.edu>
	<20120118030512.GA24099@cs.wisc.edu>
In-Reply-To: <20120118030512.GA24099@cs.wisc.edu>
X-Enigmail-Version: 1.3.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 18 Jan 2012 03:18:13 -0000

On 1/17/12 10:05 PM, Zachary Miller wrote:
>> Thanks for the report.  As a practical matter, this doesn't present a
>> problem.  When writing to a regular file, with no special flags supplied
>> to open(), the only cases Posix says it can return fewer bytes than
>> specified are errors.
> 
> thank chet.  i figured that may be the case.  if you wouldn't mind, could you
> point me to where exactly that behavior is documented?

Sure.  That's how I read

http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html#tag_16_879


-- 
``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 Jan 17 22:39:43 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RnMND-0005Tz-L0
	for mharc-bug-bash@gnu.org; Tue, 17 Jan 2012 22:39:43 -0500
Received: from eggs.gnu.org ([140.186.70.92]:36075)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <zmiller@cobalt.cs.wisc.edu>) id 1RnMNA-0005OO-5l
	for bug-bash@gnu.org; Tue, 17 Jan 2012 22:39:41 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <zmiller@cobalt.cs.wisc.edu>) id 1RnMN9-0003C6-6q
	for bug-bash@gnu.org; Tue, 17 Jan 2012 22:39:40 -0500
Received: from cobalt.cs.wisc.edu ([128.105.121.30]:57991)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <zmiller@cobalt.cs.wisc.edu>) id 1RnMN9-0003C0-29
	for bug-bash@gnu.org; Tue, 17 Jan 2012 22:39:39 -0500
Received: from cobalt.cs.wisc.edu (localhost [127.0.0.1])
	by cobalt.cs.wisc.edu (8.14.1/8.14.1) with ESMTP id q0I3dbmU024751;
	Tue, 17 Jan 2012 21:39:37 -0600
Received: (from zmiller@localhost)
	by cobalt.cs.wisc.edu (8.14.1/8.14.1/Submit) id q0I3damP024750;
	Tue, 17 Jan 2012 21:39:36 -0600
Date: Tue, 17 Jan 2012 21:39:36 -0600
From: Zachary Miller <zmiller@cs.wisc.edu>
To: Chet Ramey <chet.ramey@case.edu>
Subject: Re: minor bug in bash
Message-ID: <20120118033936.GA24591@cs.wisc.edu>
References: <20120118000419.GA21592@cs.wisc.edu> <4F163315.8010503@case.edu>
	<20120118030512.GA24099@cs.wisc.edu> <4F1639E8.9050607@case.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4F1639E8.9050607@case.edu>
User-Agent: Mutt/1.4.2.2i
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 128.105.121.30
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, 18 Jan 2012 03:39:41 -0000

On Tue, Jan 17, 2012 at 10:18:00PM -0500, Chet Ramey wrote:
> On 1/17/12 10:05 PM, Zachary Miller wrote:
> >> Thanks for the report.  As a practical matter, this doesn't present a
> >> problem.  When writing to a regular file, with no special flags supplied
> >> to open(), the only cases Posix says it can return fewer bytes than
> >> specified are errors.
> > 
> > thank chet.  i figured that may be the case.  if you wouldn't mind, could you
> > point me to where exactly that behavior is documented?
> 
> Sure.  That's how I read
> 
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html#tag_16_879

thank you.  for me, this is the line at issue:

  If write() is interrupted by a signal after it successfully writes some data, it shall return the number of bytes written.

consider SIGSTOP, which is non-maskable.  when the process continues, wouldn't
this be a situation where the write was interrupted and thus could legitimately
return fewer bytes?

(btw, i agree that as a practical matter, this probably isn't anything to worry
 about, but i'm curious how others view this theoretical situation)


cheers,
-zach



From MAILER-DAEMON Tue Jan 17 23:19:38 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RnMzq-0008Ma-AS
	for mharc-bug-bash@gnu.org; Tue, 17 Jan 2012 23:19:38 -0500
Received: from eggs.gnu.org ([140.186.70.92]:35278)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <teika@lavabit.com>) id 1RnMzn-0008MR-Qt
	for bug-bash@gnu.org; Tue, 17 Jan 2012 23:19:37 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <teika@lavabit.com>) id 1RnMzm-0000DT-F7
	for bug-bash@gnu.org; Tue, 17 Jan 2012 23:19:35 -0500
Received: from karen.lavabit.com ([72.249.41.33]:47467)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <teika@lavabit.com>) id 1RnMzm-0000D9-CB
	for bug-bash@gnu.org; Tue, 17 Jan 2012 23:19:34 -0500
Received: from e.earth.lavabit.com (e.earth.lavabit.com [192.168.111.14])
	by karen.lavabit.com (Postfix) with ESMTP id 5181B11BAEC;
	Tue, 17 Jan 2012 22:19:33 -0600 (CST)
Received: from localhost (p1052-ipad406hodogaya.kanagawa.ocn.ne.jp
	[123.222.40.52]) by lavabit.com with ESMTP id 4TAPK5K1U4O2;
	Tue, 17 Jan 2012 22:19:33 -0600
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lavabit; d=lavabit.com;
	b=bNHHojLIIgMamSL1uCSU9ddrc0E/6euq8hvYGLdryOU63ZIL58nUNY3qFqMNIEdCBOOF1eIjxMT5YQg8+sxL8Ul/PCg56IRTmWgYs+Rm4ZhyHRHm3F1q5IacI2AR6wSo+w6yuDtrnerzHo5VJbTmYRHwCe5IawG7BVrbnhpOVv0=;
	h=Date:Message-Id:To:Subject:From:Mime-Version:Content-Type:Content-Transfer-Encoding;
Date: Wed, 18 Jan 2012 13:19:20 +0900 (JST)
Message-Id: <20120118.131920.820014786091794292.teika@lavabit.com>
To: bug-bash@gnu.org
Subject: Edit vs delete a running script. Why difference?
From: Teika Kazura <teika@lavabit.com>
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older,
	4)
X-Received-From: 72.249.41.33
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 18 Jan 2012 04:19:37 -0000

Hi. When you edit a running bash script, it's affected, so you
shouldn't do that [1][2]. However, I heard[3] that if you delete the
script itself from the filesystem, the original is remembered by bash,
and it continues to run as-is (as-was?). It seems correct as far as I
tried several times.

What's the, or are there any rationale for this difference? If the
entire script is read at invocation, then why should / does
modification affect? Is it a bug?

Thanks (indeed, very much) in advance.
Teika (Teika kazura)

[1]: http://stackoverflow.com/a/6303416
[2]: http://lists.gnu.org/archive/html/bug-bash/2008-02/msg00025.html
[3]: http://stackoverflow.com/a/8350089



From MAILER-DAEMON Wed Jan 18 01:42:17 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RnPDt-0002Ai-5h
	for mharc-bug-bash@gnu.org; Wed, 18 Jan 2012 01:42:17 -0500
Received: from eggs.gnu.org ([140.186.70.92]:46980)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1RnPDq-0002AH-5Z
	for bug-bash@gnu.org; Wed, 18 Jan 2012 01:42:15 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1RnPDp-0005ls-8v
	for bug-bash@gnu.org; Wed, 18 Jan 2012 01:42:14 -0500
Received: from joseki.proulx.com ([216.17.153.58]:39474)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1RnPDp-0005lh-3X
	for bug-bash@gnu.org; Wed, 18 Jan 2012 01:42:13 -0500
Received: from discord.proulx.com (discord.proulx.com [172.27.61.2])
	(Authenticated sender: discord)
	by joseki.proulx.com (Postfix) with ESMTPA id 74D7E211D8;
	Tue, 17 Jan 2012 23:42:10 -0700 (MST)
Received: by discord.proulx.com (Postfix, from userid 1000)
	id B8DCC90C06B; Tue, 17 Jan 2012 23:42:09 -0700 (MST)
Date: Tue, 17 Jan 2012 23:42:09 -0700
From: Bob Proulx <bob@proulx.com>
To: Zachary Miller <zmiller@cs.wisc.edu>, bug-bash@gnu.org
Subject: Re: minor bug in bash
Message-ID: <20120118064209.GD24449@discord.proulx.com>
Mail-Followup-To: Zachary Miller <zmiller@cs.wisc.edu>, bug-bash@gnu.org
References: <20120118000419.GA21592@cs.wisc.edu> <4F163315.8010503@case.edu>
	<20120118030512.GA24099@cs.wisc.edu> <4F1639E8.9050607@case.edu>
	<20120118033936.GA24591@cs.wisc.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20120118033936.GA24591@cs.wisc.edu>
User-Agent: Mutt/1.5.18 (2008-05-17)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 216.17.153.58
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 18 Jan 2012 06:42:15 -0000

Zachary Miller wrote:
>   If write() is interrupted by a signal after it successfully writes
>   some data, it shall return the number of bytes written.
> 
> consider SIGSTOP, which is non-maskable.  when the process continues, wouldn't
> this be a situation where the write was interrupted and thus could legitimately
> return fewer bytes?

I am going to get myself in trouble by responding from memory instead
of researching and quoting W. Richard Stevens but...

When reading and writing there is a concept of high speed devices and
slow speed devices.  As I recall high speed devices include
filesystems (slow speed would be tty devices) and high speed devices
as I recall cannot be interrupted.  Therefore as a practical matter
this could never appear when reading or writing a file on a
filesystem.  This could only appear when reading or writing a "slow"
device such as a serial port or tty or other.  Assuming I recall this
correctly of course.

Bob


From MAILER-DAEMON Wed Jan 18 02:19:34 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RnPny-0006gO-5e
	for mharc-bug-bash@gnu.org; Wed, 18 Jan 2012 02:19:34 -0500
Received: from eggs.gnu.org ([140.186.70.92]:59580)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1RnPnw-0006eT-4D
	for bug-bash@gnu.org; Wed, 18 Jan 2012 02:19:32 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1RnPnq-0006BU-DY
	for bug-bash@gnu.org; Wed, 18 Jan 2012 02:19:32 -0500
Received: from mail-iy0-f169.google.com ([209.85.210.169]:58725)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1RnPnq-0006BO-A7
	for bug-bash@gnu.org; Wed, 18 Jan 2012 02:19:26 -0500
Received: by iadj38 with SMTP id j38so4849231iad.0
	for <bug-bash@gnu.org>; Tue, 17 Jan 2012 23:19:25 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=8I0DRCYEnJcXgpyOLs8CfbSAmPdYgb2yGIf7XHN6aGo=;
	b=ikh76eSp4oh1ZsU3vRo38BdDng/wJCdVZ+ymDYgUp83spZCblekYlEbxxwfgmrJbcj
	wODx6iefRJUaM37DQKel3q6ax/HHLTuSF8cnNRQhF5iLk/0WY9hwXH7fLwfP1tvBNhq9
	aJsSJrt7uDyh//1D8keyEKrZcTn1OFtGXzlic=
Received: by 10.50.47.170 with SMTP id e10mr21188172ign.14.1326871165234; Tue,
	17 Jan 2012 23:19:25 -0800 (PST)
MIME-Version: 1.0
Received: by 10.42.29.136 with HTTP; Tue, 17 Jan 2012 23:19:04 -0800 (PST)
In-Reply-To: <20120118.131920.820014786091794292.teika@lavabit.com>
References: <20120118.131920.820014786091794292.teika@lavabit.com>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Wed, 18 Jan 2012 09:19:04 +0200
Message-ID: <CAPSX3sS1rnVcpPuboCZfGzg0gmcwQ51aSCas61ORtWA-dsT8oQ@mail.gmail.com>
Subject: Re: Edit vs delete a running script. Why difference?
To: Teika Kazura <teika@lavabit.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.210.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, 18 Jan 2012 07:19:33 -0000

On Wed, Jan 18, 2012 at 6:19 AM, Teika Kazura <teika@lavabit.com> wrote:
>
> Hi. When you edit a running bash script, it's affected, so you
> shouldn't do that [1][2]. However, I heard[3] that if you delete the
> script itself from the filesystem, the original is remembered by bash,
> and it continues to run as-is (as-was?). It seems correct as far as I
> tried several times.
>
> What's the, or are there any rationale for this difference? If the
> entire script is read at invocation, then why should / does
> modification affect? Is it a bug?
>

It's due to the way unix works, if you look at the documentation of
unlink, for instance in the=A0posix man page:

"When the file's link count becomes 0 and no process has the file
open, the space occupied by the file shall be freed and the file shall
no longer be accessible. If one or more processes have the file open
when the last link is removed, the link shall be removed before
unlink() returns, but the removal of the file contents shall be
postponed until all references to the file are closed."

You'll notice that your are not really deleting a file, you are
decrementing a counter by one. So what you do when you delete the file
is that you remove one link, since bash has it open to execute the
script there is still a reference to the old script and bash continues
normally.

If you edit the file bash is reading, then everything can happen, you
might edit a portion of the file that bash has read but not yet
executed for instance (since io is buffered).


From MAILER-DAEMON Wed Jan 18 08:22:41 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RnVTN-0005bd-Sh
	for mharc-bug-bash@gnu.org; Wed, 18 Jan 2012 08:22:41 -0500
Received: from eggs.gnu.org ([140.186.70.92]:35829)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1RnVTI-0005bV-Am
	for bug-bash@gnu.org; Wed, 18 Jan 2012 08:22:40 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1RnVT9-0001J0-8j
	for bug-bash@gnu.org; Wed, 18 Jan 2012 08:22:36 -0500
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:45582
	helo=gateway.eeg.ccf.org) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1RnVT9-0001Fu-3q
	for bug-bash@gnu.org; Wed, 18 Jan 2012 08:22:27 -0500
Received: (qmail 32647 invoked from network); 18 Jan 2012 13:22:02 -0000
Received: from unknown (HELO imadev.eeg.ccf.org) (10.76.173.78)
	by ccfadm.eeg.ccf.org with SMTP; Wed, 18 Jan 2012 08:22:02 -0500
Received: (qmail 20215 invoked by uid 563); 18 Jan 2012 13:22:01 -0000
Date: Wed, 18 Jan 2012 08:22:01 -0500
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Teika Kazura <teika@lavabit.com>
Subject: Re: Edit vs delete a running script. Why difference?
Message-ID: <20120118132201.GK916@eeg.ccf.org>
References: <20120118.131920.820014786091794292.teika@lavabit.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20120118.131920.820014786091794292.teika@lavabit.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: Wed, 18 Jan 2012 13:22:40 -0000

On Wed, Jan 18, 2012 at 01:19:20PM +0900, Teika Kazura wrote:
> If the
> entire script is read at invocation, then why should / does
> modification affect? Is it a bug?

The entire script *isn't* read at invocation.  Bash just reads a little
bit at a time, as needed.


From MAILER-DAEMON Thu Jan 19 01:58:31 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rnlx9-00042J-2N
	for mharc-bug-bash@gnu.org; Thu, 19 Jan 2012 01:58:31 -0500
Received: from eggs.gnu.org ([140.186.70.92]:37543)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1Rnlx6-000428-7v
	for bug-bash@gnu.org; Thu, 19 Jan 2012 01:58:29 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1Rnlx4-0007mh-Si
	for bug-bash@gnu.org; Thu, 19 Jan 2012 01:58:28 -0500
Received: from cordova.acsalaska.net ([209.112.173.243]:53184)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1Rnlx4-0007ma-Gr
	for bug-bash@gnu.org; Thu, 19 Jan 2012 01:58:26 -0500
Received: from localhost2.local
	(66-230-86-34-rb1.fai.dsl.dynamic.acsalaska.net [66.230.86.34])
	by cordova.acsalaska.net (8.14.4/8.14.4) with ESMTP id q0J6wM7W070871
	for <bug-bash@gnu.org>; Wed, 18 Jan 2012 21:58:22 -0900 (AKST)
	(envelope-from rogerx.oss@gmail.com)
Date: Wed, 18 Jan 2012 21:58:18 -0900
From: Roger <rogerx.oss@gmail.com>
To: bug-bash@gnu.org
Subject: Bash readline remap ESC insert/command mode key
Message-ID: <20120119065818.GA2709@localhost2.local>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3
	(cordova.acsalaska.net [209.112.168.121]);
	Wed, 18 Jan 2012 21:58:23 -0900 (AKST)
X-ACS-Spam-Status: no
X-ACS-Spam-Score: 1.999 (x)
X-ACS-Spam-Tests: KHOP_DYNAMIC,ACS_BOGUS_LOCALHOST
X-ACS-Scanned-By: MD 2.67; SA 3.3.0; spamdefang 1.122
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.112.173.243
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?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, 19 Jan 2012 06:58:29 -0000

I use vi mode for Bash's realine and want to remap the ESC key to double 'ii' 
and ';;' instead of having to remove my hands from the keyboard to tap the ESC 
key.

>From what I see, I would be using something similar to:

$ bind -m vi-command '"ii": <toggle insert/command mode command>'


Second issue, I'm not sure of the command to use for toggling insert/command 
mode. (ie. bind -l)  I think the two commands are vi-insertion-mode and 
vi-movement-mode.


I do know double key taps works such as the 'dd' key press sequence to delete a 
line, but only while in vi-movement mode or AKA command mode.


Any ideas?  I'm all Googled-out over this one.

-- 
Roger
http://rogerx.freeshell.org/


From MAILER-DAEMON Thu Jan 19 02:13:05 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RnmBF-0005I3-M9
	for mharc-bug-bash@gnu.org; Thu, 19 Jan 2012 02:13:05 -0500
Received: from eggs.gnu.org ([140.186.70.92]:35953)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RnmBC-0005Hs-9H
	for bug-bash@gnu.org; Thu, 19 Jan 2012 02:13:03 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RnmBB-0001bb-2M
	for bug-bash@gnu.org; Thu, 19 Jan 2012 02:13:02 -0500
Received: from denali.acsalaska.net ([209.112.173.242]:44591)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RnmBA-0001bK-Nv
	for bug-bash@gnu.org; Thu, 19 Jan 2012 02:13:01 -0500
Received: from localhost2.local
	(66-230-86-34-rb1.fai.dsl.dynamic.acsalaska.net [66.230.86.34])
	by denali.acsalaska.net (8.14.4/8.14.4) with ESMTP id q0J7Cwbb014505
	for <bug-bash@gnu.org>; Wed, 18 Jan 2012 22:12:58 -0900 (AKST)
	(envelope-from rogerx.oss@gmail.com)
Date: Wed, 18 Jan 2012 22:12:54 -0900
From: Roger <rogerx.oss@gmail.com>
To: bug-bash@gnu.org
Subject: Re: Bash readline remap ESC insert/command mode key
Message-ID: <20120119071254.GB2709@localhost2.local>
References: <20120119065818.GA2709@localhost2.local>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20120119065818.GA2709@localhost2.local>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3
	(denali.acsalaska.net [209.112.168.121]);
	Wed, 18 Jan 2012 22:12:59 -0900 (AKST)
X-ACS-Spam-Status: no
X-ACS-Spam-Score: 1.999 (x)
X-ACS-Spam-Tests: KHOP_DYNAMIC,ACS_BOGUS_LOCALHOST
X-ACS-Scanned-By: MD 2.67; SA 3.3.0; spamdefang 1.122
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.112.173.242
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?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, 19 Jan 2012 07:13:03 -0000

> On Wed, Jan 18, 2012 at 09:58:18PM -0900, Roger wrote:
>I use vi mode for Bash's realine and want to remap the ESC key to double 'ii' 
>and ';;' instead of having to remove my hands from the keyboard to tap the ESC 
>key.
>
>From what I see, I would be using something similar to:
>
>$ bind -m vi-command '"ii": <toggle insert/command mode command>'
>
>
>Second issue, I'm not sure of the command to use for toggling insert/command 
>mode. (ie. bind -l)  I think the two commands are vi-insertion-mode and 
>vi-movement-mode.
>
>
>I do know double key taps works such as the 'dd' key press sequence to delete a 
>line, but only while in vi-movement mode or AKA command mode.
>
>
>Any ideas?  I'm all Googled-out over this one.


Ah. A new Google search got me a solution.

bind -m vi-command '"ii": vi-insertion-mode'
bind -m vi-insert '"ii": vi-movement-mode'


Or the following should work (untested here) using $HOME/.inputrc:

$if mode=vi

    set keymap vi-command
    "ii": vi-insertion-mode

    set keymap vi-insert
    "ii": vi-movement-mode

$endif


-- 
Roger
http://rogerx.freeshell.org/


From MAILER-DAEMON Thu Jan 19 02:25:51 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RnmNb-0007g4-Up
	for mharc-bug-bash@gnu.org; Thu, 19 Jan 2012 02:25:51 -0500
Received: from eggs.gnu.org ([140.186.70.92]:39818)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RnmNa-0007fy-1K
	for bug-bash@gnu.org; Thu, 19 Jan 2012 02:25:50 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RnmNZ-0003uq-2M
	for bug-bash@gnu.org; Thu, 19 Jan 2012 02:25:50 -0500
Received: from denali.acsalaska.net ([209.112.173.242]:45651)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RnmNY-0003ul-LN
	for bug-bash@gnu.org; Thu, 19 Jan 2012 02:25:49 -0500
Received: from localhost2.local
	(66-230-86-34-rb1.fai.dsl.dynamic.acsalaska.net [66.230.86.34])
	by denali.acsalaska.net (8.14.4/8.14.4) with ESMTP id q0J7PkqI015236
	for <bug-bash@gnu.org>; Wed, 18 Jan 2012 22:25:46 -0900 (AKST)
	(envelope-from rogerx.oss@gmail.com)
Date: Wed, 18 Jan 2012 22:25:42 -0900
From: Roger <rogerx.oss@gmail.com>
To: bug-bash@gnu.org
Subject: Re: Bash readline remap ESC insert/command mode key
Message-ID: <20120119072542.GC2709@localhost2.local>
References: <20120119065818.GA2709@localhost2.local>
	<20120119071254.GB2709@localhost2.local>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20120119071254.GB2709@localhost2.local>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3
	(denali.acsalaska.net [209.112.168.121]);
	Wed, 18 Jan 2012 22:25:47 -0900 (AKST)
X-ACS-Spam-Status: no
X-ACS-Spam-Score: 1.999 (x)
X-ACS-Spam-Tests: KHOP_DYNAMIC,ACS_BOGUS_LOCALHOST
X-ACS-Scanned-By: MD 2.67; SA 3.3.0; spamdefang 1.122
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.112.173.242
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?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, 19 Jan 2012 07:25:51 -0000

>bind -m vi-command '"ii": vi-insertion-mode'
>bind -m vi-insert '"ii": vi-movement-mode'
>
>
>Or the following should work (untested here) using $HOME/.inputrc:
>
>$if mode=vi
>
>    set keymap vi-command
>    "ii": vi-insertion-mode
>
>    set keymap vi-insert
>    "ii": vi-movement-mode
>
>$endif


I've just tested the above inputrc by executing a new bash shell instance and 
the above inputrc statement works, but there is an undesirable effect when 
using it.

While in insert mode, pressing the 'i' key only once causes readline to 
intercept it and not print the 'i' char to screen if only pressed once.  In 
order to get the 'i' char printed, I need to immediately press any other key 
following the 'i' char/key so it is not intercepted by readline as it is not a 
double 'i' key (ie 'ii').

For example, I'm typing the imaginary command "sit" and accidently typed "st".  
I go to history and then movement mode and try to insert just an 'i' and will 
fail as readline is intercepting the single char and awaiting a secondary char 
to determine if it's a double 'i' key press.  I would need to type 'i' and then 
right cursor to successfully fix the typing error.

(Or, to be lazy and humorous, I could just fix it to 'silt' preventing less 
finger movement.)

-- 
Roger
http://rogerx.freeshell.org/


From MAILER-DAEMON Thu Jan 19 12:05:48 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RnvQq-0003Uo-LK
	for mharc-bug-bash@gnu.org; Thu, 19 Jan 2012 12:05:48 -0500
Received: from eggs.gnu.org ([140.186.70.92]:58951)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <parker.du@alitech.com>) id 1Rnn3C-0002uw-S6
	for bug-bash@gnu.org; Thu, 19 Jan 2012 03:08:55 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <parker.du@alitech.com>) id 1Rnn34-0001UT-8x
	for bug-bash@gnu.org; Thu, 19 Jan 2012 03:08:50 -0500
Received: from nopam.alitech.com ([202.3.176.31]:63926)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <parker.du@alitech.com>) id 1Rnn33-0001OD-ML
	for bug-bash@gnu.org; Thu, 19 Jan 2012 03:08:42 -0500
Received: from localhost (localhost [127.0.0.1])
	by nopam.alitech.com (Postfix) with ESMTP id 2F30A72C0D54;
	Thu, 19 Jan 2012 16:09:55 +0800 (CST)
Received: from twalins2.ali.net (unknown [192.168.200.12])
	by nopam.alitech.com (Postfix) with ESMTP id 8D32572C0CFD;
	Thu, 19 Jan 2012 16:09:54 +0800 (CST)
To: bug-bash@gnu.org,
	bash@packages.debian.org
MIME-Version: 1.0
Subject: string comparing and if-else character or so descriptive subject here
	(for reference)
X-KeepSent: 5621F77D:B8E7619B-4825798A:002C5382;
 type=4; name=$KeepSent
X-Mailer: Lotus Notes Release 8.0.2 August 07, 2008
Message-ID: <OF5621F77D.B8E7619B-ON4825798A.002C5382-4825798A.002CBA2D@alitech.com>
From: Parker.Du@alitech.com
Date: Thu, 19 Jan 2012 16:08:32 +0800
X-MIMETrack: Serialize by Router on TWALINS2/ALI_TPE/ALi(Release 8.0.2FP6|July
	15, 2010) at 2012/01/19 ?? 04:08:35, 
	Serialize complete at 2012/01/19 ?? 04:08:35
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 202.3.176.31
X-Mailman-Approved-At: Thu, 19 Jan 2012 12:05:45 -0500
Content-Type: text/plain; charset="US-ASCII"
X-Content-Filtered-By: Mailman/MimeDel 2.1.14
Cc: q24688@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, 19 Jan 2012 08:08:55 -0000

To: bug-bash@gnu.org,bash@packages.debian.org
Subject: [string comparing and if-else character or so descriptive subject 
here (for reference)]

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' 
-DSHELL -DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/lib 
-g -O2 -Wall
uname output: Linux linux-b2-ali 2.6.35.13-4gkernel #1 SMP Tue Sep 27 
06:25:37 EDT 2011 i686 GNU/Linux
Machine Type: i686-pc-linux-gnu

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

Description:
        [String comapartion wrong , execute do not execute (else)'s 
statements when (if)'s condition is (not true).  ]

Repeat-By:
        [I have attach my .sh file, please check.]

Fix:
        [Description of how to fix the problem.  If you don't know a
        fix for the problem, don't include this section.]


$ uuencode test-string.tar.gz test-string.tar.gz
-------------------------------------------------------------
begin 644 test-string.tar.gz
M_3=Z6%H```3FUK1&`@`A`18```!T+^6CX"?_`RU=`#N82JN@DEZ!0^Z]R<I*
M_%%O2.N>^)VD8;)<"P4:_+"0,IG9&C'RL8@?[7"2YDDA'`A9RD[CPVS"K7$Z
MP"08#_^UYV;0^B@DIW1A_6Q%MS>"8_XUDT@RZANZS!4%BV^TYNF"[ZPO93)=
M[6%*.8AJF3UM#K5BDPQEXKM#T)F-6VMIH^MPI2][;/T47_("6J<6V!^2$(V1
M<\`LC@P?&:S][-L_3+-\I]C7W(GKQH-CTF94&#WK<U+>,\@[!Q_Z;Q_##Y>/
MM4I><5M^G_84/+M3@21K.EG!,PHU!<+-0H8?+QBA6O;%:84A]IL5-&I*,N'%
MG/C?)5NBR]8AUUL62(GN#`MK0!B=P\0_#1UUPH2MERN>;52_4,O;XBA::3:6
MGMG6D(+\XW]EP,`>P299_+#TDXY;%Q2)@8DV&/$$"1\($4Z1G4?4POZ(C/<]
M6Y%(':^:\-OUEF-U&9<X#7SF9"9#,PK[\A8W;[N@MRIVR,"P8<LW(WK`RW*\
MMR7G"DM@'P0J(IT@=16M,AS>J[E_KQR]G1TP$G,!_2J;SZYMM]@I$-DY>.7X
M^0(5=^(Q]&6!A\IW,F(+NN%4J+Z0R=="^RY\7SB^Z)ML]2<)LY_5/B/GX*`5
M%97SJ!*X9(O@/_1N$S#?SN<[0@MP=QV[R]*V.-;D_:V!?JB]5&YA4?!*<I+^
MPL+6'$W6%6J.Q\V_GQ/4F[!]X.<05[$Y,?9A>PX!0#RU>T(B*X3U;9QK&NVS
M:/']EV)/)'NUY!PV1>]H?[+D&WY![U0)+3?*-:=^>6(BP%UX(>GDSW)DW<?-
M3=]]:V=\#5>I/L(ME^3*W7(`3WMW%C=E*GR8@O%]QL0EP:RC>CH.@'\VNHZ=
MQS$ZUD8O1:.@<J'M.`9X)4JR'<HG%V?29]Y17T*P5`?2*U&X@K."2=@9K(ZU
MU7T'))%,4&)-N(P<A2)N<\`LL@1X[J5I<3:Y_E;5?KKMR$-QM!R,H2QI`>:.
M]FQ36`-OG%?\>F_]F6T1,W"3"`5+_;H8)3"5<:%9)[!PC)GAF3OP<1#4OC`3
M"R.3F$;^+J'.'J@=D29`<WSKP?\@YT%T\2UL9Y5S>HZ,H`````"*DN&ZAVA1
9S@`!R0:`4```BO87^['$9_L"``````196@``
`
end
-------------------------------------------------------------

From MAILER-DAEMON Thu Jan 19 12:55:31 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RnwCx-00013Q-6L
	for mharc-bug-bash@gnu.org; Thu, 19 Jan 2012 12:55:31 -0500
Received: from eggs.gnu.org ([140.186.70.92]:57939)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1RnwCp-000125-W0
	for bug-bash@gnu.org; Thu, 19 Jan 2012 12:55:29 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1RnwCl-0007jE-Eh
	for bug-bash@gnu.org; Thu, 19 Jan 2012 12:55:23 -0500
Received: from mx1.redhat.com ([209.132.183.28]:7075)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1RnwCl-0007j9-80
	for bug-bash@gnu.org; Thu, 19 Jan 2012 12:55:19 -0500
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 q0JHtEBQ023860
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Thu, 19 Jan 2012 12:55:14 -0500
Received: from [10.3.113.123] (ovpn-113-123.phx2.redhat.com [10.3.113.123])
	by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
	id q0JHtDmu029798; Thu, 19 Jan 2012 12:55:13 -0500
Message-ID: <4F185900.3040600@redhat.com>
Date: Thu, 19 Jan 2012 10:55:12 -0700
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:9.0) Gecko/20111222 Thunderbird/9.0
MIME-Version: 1.0
To: Parker.Du@alitech.com
Subject: Re: string comparing and if-else character or so descriptive subject
	here (for reference)
References: <OF5621F77D.B8E7619B-ON4825798A.002C5382-4825798A.002CBA2D@alitech.com>
In-Reply-To: <OF5621F77D.B8E7619B-ON4825798A.002C5382-4825798A.002CBA2D@alitech.com>
X-Enigmail-Version: 1.3.4
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="------------enig8982F195559FD820C24CF9B2"
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: q24688@gmail.com, bug-bash@gnu.org, bash@packages.debian.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 19 Jan 2012 17:55:29 -0000

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

On 01/19/2012 01:08 AM, Parker.Du@alitech.com wrote:
> Description:
>         [String comapartion wrong , execute do not execute (else)'s=20
> statements when (if)'s condition is (not true).  ]
>=20
> Repeat-By:
>         [I have attach my .sh file, please check.]
>=20

This is a poor quality bug report.  You did not technically attach
anything; and your inlined uuencoded tar file contains a directory but
no .sh file in that directory.  Plain text bug reports that focus in on
your problem, instead of sending 7 unrelated files in a
difficult-to-extract-format, along with giving us more details about
what you did, what happened, and why you think it was wrong, so that we
aren't playing guessing games, would be appreciated.  That said, I'll
still try to help.

In your compressed directory, you included a file warn/notify with this
snippet of code, which has several issues:

> for LOGIN in `cat warn_list | sed 's/^.*home.//'`

Useless use of cat.  Also, the regular expression ^.* is redundant; no
need to anchor a search if you are already grabbing as many leading
characters as possible.  Finally, the `` notation, while portable to
non-POSIX shells, is archaic; since you are specifically requesting bash
and are therefore not worried about portability, you might as well use
the POSIX notation of $().  You can get the same results with fewer
processes via:

for LOGIN in $(sed '/.*home.//' < warn_list)

> do
>         echo "LOGIN:" $LOGIN
>         if [ "wenx"=3D=3D$LOGIN"x" ];

Your syntax is wrong here.  You are testing if the single string
"wenx=3D=3D$LOGINx" is non-empty, which is always true.  You _meant_ to u=
se:

if [ xwen =3D "x$LOGIN" ];

or the bash-ism:

if [[ wen =3D=3D $LOGIN ]];

Then, in your file warn/notify_me, you have these questionable constructs=
:

>=20
>         for PTS in `who | grep $USER | sed 's/2012.*$//' | sed 's/^\S*\=
s*//'`

No need to waste two processes; any time you see 'grep | sed', you can
almost always rewrite it to be just one sed; 'sed | sed' is not always
collapsible, but in this case it is.  The escapes \S and \s are not
portable, but I'm assuming you don't care about that, given that you are
already restricting yourself to bash.  Use:

for PTS in $(who | sed -n "/$USER/"' { s/2012.*//; s/^\S*\s*//; p; }')

>         do
>                 echo "Hello"  write $USER $PTS
>         done=20
> }
>=20
> cat `ls -1 ../usage-* | sort | tail -n 1` | sort -n | tail -n  `cat tem=
plate | wc -l` >top_usage

Useless use of cat, twice.  Useless use of ls and sort (globbing already
gives names in sorted order, and printf as a built-in is more efficient
than ls at listing one name per line).  Why not:

sort -n $(printf %s\\n ../usage-* | tail -n1) | \
  tail -n $(wc -l < template) > top_usage

> cat template top_usage | sort -n | tail -n `cat template | wc -l`|  >wa=
rn_list

Useless use of cat, twice.  And you probably didn't want that last |.
Why not:

sort -n template top_usage | tail -n $(wc -l < template) > warn_list

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


--------------enig8982F195559FD820C24CF9B2
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.11 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJPGFkBAAoJEKeha0olJ0NqdOQIAIccVbwsIxYECuQmQNQOpSsu
Ox9odinmsfRdsGiiPQVC7d44f2eOvr+rBagVTnjHIC4gl24elvF0sarxsV45vO3p
HeQGftscu1bvEK+9YeyXejDpkwBnjdOybiP/Te+wmvt4ekHRIZ8APRajP6T4liUf
u6GqYh002EQiklK6glt8rTNQRRwuuOS+RxnPvNTLtyx3UwigtztRlw4GmPUOPWz6
fbKuzLAldsMf6rYabQFT5MDQ/3I85jhakqjawhXzhYX/GejZgofhZBsTnDKbK2sQ
YF/qt3FFptjZXEOViCan9v3UvpY3Db/eI0Nu9HEsni8THZafUjkXkztA7uEhxao=
=2njy
-----END PGP SIGNATURE-----

--------------enig8982F195559FD820C24CF9B2--


From MAILER-DAEMON Thu Jan 19 20:17:39 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Ro36p-0007wE-QB
	for mharc-bug-bash@gnu.org; Thu, 19 Jan 2012 20:17:39 -0500
Received: from eggs.gnu.org ([140.186.70.92]:50661)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Ro36m-0007u9-Pa
	for bug-bash@gnu.org; Thu, 19 Jan 2012 20:17:38 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Ro36j-0002VT-Qh
	for bug-bash@gnu.org; Thu, 19 Jan 2012 20:17:36 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:49853
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Ro36h-0002Tm-HB
	for bug-bash@gnu.org; Thu, 19 Jan 2012 20:17:33 -0500
Received: from [192.168.3.140] (Athenae [192.168.3.140])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q0K1HAab026946; Thu, 19 Jan 2012 17:17:13 -0800
Message-ID: <4F18C097.4000902@tlinx.org>
Date: Thu, 19 Jan 2012 17:17:11 -0800
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: read -ei "y" -p "> " bug(s)
References: <4F111784.2050507@tlinx.org> <4F1467FE.2060000@case.edu>
In-Reply-To: <4F1467FE.2060000@case.edu>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Content-Filtered-By: Mailman/MimeDel 2.1.14
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 20 Jan 2012 01:17:38 -0000



Chet Ramey wrote:
> On 1/14/12 12:49 AM, Linda Walsh wrote:
>   
>> /* vim: ts=1 sw=1 et sc fo=cqwa1 tw=78 syntax=css */
>> There's actually 1 parts 2 this, I ran into the 2nd while  testing the
>> first...
>>     
>
> Like Greg Wooledge, I wasn't able to reproduce the second issue with
> `read -N 1' (which I assume is actually something like `read -e -N 1'
> from your description.
>
>   
>> I wanted to be able to check the keyboard if the user had 'typed' ahead,
>> and mean to answer an upcoming question on purpose or if it was left over
>> from a previous
>> y/n single input response.
>>
>> I wanted to do a
>>   read -t 0.01 pre_ans
>>     
>
> As Greg said, use `read -t 0'.
>
>   
>> Well -- it didn't return until the user pressed a key -- so even with a key
>> already
>> loaded, and a limit of 1, telling it to return upon 1 key in the buff, it
>> still
>> didn't return until it got the 2nd key.
>>     
>
> That's where you have a bad assumption: read -N 1 means to read exactly one
> character from the input.  It doesn't exactly mean to return when there's
> one character loaded into the readline buffer,
----
    That's not what the man page __says__.. it may be what you meant, but it
says that it if readline is being used to *read*, then -a places the 
char into
readline's edit buffer -n/-N both say they exit after reading N chars, but
readline already has 'N' chars ready to be read -- nether -n nor -N say 
that
they will only read from they TTY...

    (Note, I don't regard this as **that** important -- certainly no where
near as important as breaking "-e", ...)

> one character and return when you have at least one character in the
> buffer.  If it didn't mean that, how could we allow the user to erase any
> default intput? 
You wouldn't.
>  If you wanted readline to return immediately if you had
> one or more characters preloaded, why would you call read that way in the
> first place?  It doesn't add or change anything.
>   
You would think so.  I wondered the same myself.  But if you wanted to
allow separate library calls that were 'object oriented', in that they could
interact with and modify the input stream without the program needing to
be changed, it would be a useful feature.  But throwing in OO features when
basic math evaluations (that are certainly not 'simple statements' as the
original POSIX spec required for -e to cause an errexit), maybe isn't the
top of the priority list..... maybe fix the docs to be more clear for now,
and put the intent on a future wishlist?

                                  

> By default, when using readline to obtain the line, we take characters from
> the beginning of the returned line buffer.  If we want one character, we
> take the first one.
>
> If you want to experiment with skipping any pre-inserted text, try changing
> the value initializing `rlind'.  You could use something like
>   
----
    ???rlind?   am confused?  where do I do that?  You mean in the bash
source code?   Eeek!... I was writing in Shell.. .. I'm running out of time
to take on more projects...

> 	rlind = deftext && *deftext ? strlen (deftext) : 0;
>
> before the call to edit_line.
>
> Doing that leads to other questions, though.  Say a user hits return when
> a character has been preloaded into the buffer.  Should the code retrieve
> the key the user pressed, or the key in the line buffer?
>   
----
    You do the same thing that you do now... (i.e. the above is already 
an issue).

if I preload a char into the buff, 'say' "a", and the user presses "b", 
and I
specified -n1/-N1 (think it is both, didn't check both in every case).

I get back "a" -- not what the user entered!...

    Now, you can say it shouldn't return immediately,  -- ok fine, but 
is it good let a user press a key that is different and have that key 
ignored?


    As for the other bug/problem...

    I can't reproduce it on cygwin, -- only on linux and only there 
sporadically),  so since it only happens on linux, it must be a linux 
kernel bug (note, this is the reasoning of Eric Blake regarding a 
coreutils bug I found on cygwin; -- not a bug because it's only found in 
cygwin.. must be a cygwin bug! (despite my finding a strong indication 
of the bug in the change notes -- i.e. the behavior in the buggy area 
was overhauled)...

    Anyway, until I find a more repeatable test case, keep on ignoring 
it...(I can reproduce it, but it is usually when I make a mistake in the 
invocation line
which may be part of the problem... ahh... it's editing the line afterwards
no... it has to do with getting some type of error...

>  y

Ishtar:law> read -e -i "y" -n 1 -p "here> "
here>
Ishtar:law>
Ishtar:law> read -e -i "y" -n 1 -p "here> "
here> y

Ishtar:law> read -e -i "y" -n 1 -p "here> "
here> y
Ishtar:law>
Ishtar:law> read -e -i "y" -n 1 -p "here> "
here> y

Ishtar:law>
Ishtar:law> read -e -i "y" -N 1 -p "here> "
here> k
Ishtar:law>
Ishtar:law> k
If 'k' is not a typo you can use command-not-found to lookup the package 
that contains it, like this:
    cnf k
Ishtar:law> ^M^Cad -e -i "y" -N 1 -p "here> "
Ishtar:law>
---
it wasn't until I got an error (the typo), that it went into the
weird mode... and then -- only when I was in 'edit' mode
i.e. after pressing "ESC" in 'vi mode",...

as I use that to re-execute the line... it has happened


Yeah, I think this will do it...

read -e -N 1 -p "here " -i "<CR>        # missing end DQ
^c                                      # control C out
<up-arrow>                              # re-edit line
<end>"<cr>                              #goto end of line, put on " and CR,
---
now if you try to re-edit the line ESC-k, and return, the
return doesn't end the line..

Seems to only happen when you make just about any type of mistake or 
break out
of the normal 'read exit'... likely it skips resetting the term mode or 
something.



From MAILER-DAEMON Sat Jan 21 06:24:13 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RoZ3N-0000ka-Gd
	for mharc-bug-bash@gnu.org; Sat, 21 Jan 2012 06:24:13 -0500
Received: from eggs.gnu.org ([140.186.70.92]:38421)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ck850@web.de>) id 1RoZ3K-0000i0-SB
	for bug-bash@gnu.org; Sat, 21 Jan 2012 06:24:11 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ck850@web.de>) id 1RoZ3J-0005ZA-Od
	for bug-bash@gnu.org; Sat, 21 Jan 2012 06:24:10 -0500
Received: from fmmailgate02.web.de ([217.72.192.227]:36443)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <ck850@web.de>)
	id 1RoZ3J-0005Ye-Gu
	for bug-bash@gnu.org; Sat, 21 Jan 2012 06:24:09 -0500
Received: from moweb002.kundenserver.de (moweb002.kundenserver.de
	[172.19.20.108])
	by fmmailgate02.web.de (Postfix) with ESMTP id CB9A11C0452A5
	for <bug-bash@gnu.org>; Sat, 21 Jan 2012 12:24:07 +0100 (CET)
Received: from Gondolin ([213.89.59.89]) by smtp.web.de (mrweb002) with ESMTPA
	(Nemesis) id 0MgOQQ-1S2PCb2YFy-00NIcE;
	Sat, 21 Jan 2012 12:24:07 +0100
Date: Sat, 21 Jan 2012 12:24:03 +0100
From: Philip <ck850@web.de>
To: bug-bash@gnu.org
Subject: echo '-e' doesn't work as expected, or does it?
Message-ID: <20120121122403.7bb733ac@Gondolin>
X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; i486-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Provags-ID: V02:K0:JHXs20Z6XCyySH7JGVfZkEpqykZ7trHap6KUw3vejWA
	VkvxZi0s15RXy1VhrDn/fBODOcEu/Qc39iPHF37T2EPouvDW6f
	hiogvgMsU/yKURTdVgSMnNmmDhhCMVi3yOuUckn70Rs60wpg4r
	4NIYeSccaLJoZbXQiqXNb6JgZa8c4zxc+gS6+QWMIcOak//s5J
	rK/ecZKA1yUr+8E/bm8Aw==
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: Sat, 21 Jan 2012 11:24:11 -0000

Hi! Short question this time..

$ echo '-e'
does not print -e

$ echo '-e '
does print -e .

Is this the way as it ought to be? GNU bash, Version 4.1.5(1)-release (Debian stable)

Regards


From MAILER-DAEMON Sat Jan 21 06:33:28 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RoZCK-0003fC-8S
	for mharc-bug-bash@gnu.org; Sat, 21 Jan 2012 06:33:28 -0500
Received: from eggs.gnu.org ([140.186.70.92]:54174)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ck850@web.de>) id 1RoZCG-0003a2-Ma
	for bug-bash@gnu.org; Sat, 21 Jan 2012 06:33:25 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ck850@web.de>) id 1RoZCD-0006oa-4e
	for bug-bash@gnu.org; Sat, 21 Jan 2012 06:33:24 -0500
Received: from fmmailgate04.web.de ([217.72.192.242]:54205)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <ck850@web.de>)
	id 1RoZCD-0006oM-00
	for bug-bash@gnu.org; Sat, 21 Jan 2012 06:33:21 -0500
Received: from moweb001.kundenserver.de (moweb001.kundenserver.de
	[172.19.20.114])
	by fmmailgate04.web.de (Postfix) with ESMTP id E363C7122E97
	for <bug-bash@gnu.org>; Sat, 21 Jan 2012 12:33:19 +0100 (CET)
Received: from Gondolin ([213.89.59.89]) by smtp.web.de (mrweb001) with ESMTPA
	(Nemesis) id 0M1noI-1ScYFR323W-00t4lh;
	Sat, 21 Jan 2012 12:33:19 +0100
Date: Sat, 21 Jan 2012 12:33:18 +0100
From: Philip <ck850@web.de>
To: bug-bash@gnu.org
Subject: Re: echo '-e' doesn't work as expected, or does it?
Message-ID: <20120121123318.488c4ca0@Gondolin>
In-Reply-To: <20120121122403.7bb733ac@Gondolin>
References: <20120121122403.7bb733ac@Gondolin>
X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; i486-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Provags-ID: V02:K0:+cP0UGJSLcAsEnT/PgEF9PH4HCGehbqFGTLYHPWsvun
	99e/NBBCJBUOyb2xdDOdXAP9IJ0jBuxAddaorlzPoo36c+CmdE
	Wn81Gi95Qf4tKRctEORcmwlvm10Y3dCERM/yxRDNhLBfOSgWfF
	lT/34uY0I1yeesrIyEIiVcxstW/Mrwddk6nFL7QqYlDqGxIM7H
	XBUNO8orp+Ee9c8GGpaYA==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-Received-From: 217.72.192.242
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?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, 21 Jan 2012 11:33:25 -0000

Am Sat, 21 Jan 2012 12:24:03 +0100
schrieb Philip <ck850@web.de>:

> Hi! Short question this time..
> 
> $ echo '-e'
> does not print -e
> 
> $ echo '-e '
> does print -e .
> 
> Is this the way as it ought to be? GNU bash, Version 4.1.5(1)-release (Debian
> stable)
> 
> Regards
> 

Nevermind! Just found an older thread about this.


From MAILER-DAEMON Sat Jan 21 17:39:36 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rojay-0004lt-Hu
	for mharc-bug-bash@gnu.org; Sat, 21 Jan 2012 17:39:36 -0500
Received: from eggs.gnu.org ([140.186.70.92]:46209)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon@jonshouse.co.uk>) id 1Roe4M-0005Rq-MF
	for bug-bash@gnu.org; Sat, 21 Jan 2012 11:45:35 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jon@jonshouse.co.uk>) id 1Roe4L-0000eB-Gf
	for bug-bash@gnu.org; Sat, 21 Jan 2012 11:45:34 -0500
Received: from [91.84.151.33] (port=59908 helo=mail.jonshouse.co.uk)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon@jonshouse.co.uk>) id 1Roe4L-0000dR-2S
	for bug-bash@gnu.org; Sat, 21 Jan 2012 11:45:33 -0500
Received: from [10.10.10.6] (jonspc [10.10.10.6])
	by mail.jonshouse.co.uk (8.14.1/8.13.8) with ESMTP id q0LGDg9Q030516
	for <bug-bash@gnu.org>; Sat, 21 Jan 2012 16:13:47 GMT
Subject: Cross compile crapout
From: Jonathan Andrews <jon@jonshouse.co.uk>
To: bug-bash@gnu.org
Content-Type: text/plain; charset="UTF-8"
Date: Sat, 21 Jan 2012 16:13:43 +0000
Message-ID: <1327162423.10370.3.camel@jonspc>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.3 (2.28.3-1.fc12) 
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1)
X-Received-From: 91.84.151.33
X-Mailman-Approved-At: Sat, 21 Jan 2012 17:39:33 -0500
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: jon@jonshouse.co.uk
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?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, 21 Jan 2012 16:45:35 -0000

Trying to compile for an arm target I get this

execute_cmd.c: In function 'execute_pipeline':
execute_cmd.c:2205: error: 'job_control' undeclared (first use in this
function)
execute_cmd.c:2205: error: (Each undeclared identifier is reported only
once
execute_cmd.c:2205: error: for each function it appears in.)
execute_cmd.c: In function 'execute_function':
execute_cmd.c:4243: warning: passing argument 1 of 'array_rshift'
discards qualifiers from pointer target type
execute_cmd.c:4245: warning: passing argument 1 of 'array_rshift'
discards qualifiers from pointer target type
execute_cmd.c:4320: warning: passing argument 1 of 'array_shift'
discards qualifiers from pointer target type
execute_cmd.c:4321: warning: passing argument 1 of 'array_shift'
discards qualifiers from pointer target type
make: *** [execute_cmd.o] Error 1


I found the fix here, but it would be nice if it could work its way into
the source for the next release.  

http://lists.gnu.org/archive/html/bug-bash/2011-09/msg00039.html

Thanks,
Jon





From MAILER-DAEMON Sat Jan 21 19:46:13 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RolZU-00009i-Vv
	for mharc-bug-bash@gnu.org; Sat, 21 Jan 2012 19:46:12 -0500
Received: from eggs.gnu.org ([140.186.70.92]:38155)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RolZS-00009c-7N
	for bug-bash@gnu.org; Sat, 21 Jan 2012 19:46:11 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RolZM-0000Vd-NH
	for bug-bash@gnu.org; Sat, 21 Jan 2012 19:46:10 -0500
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:36092)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RolZM-0000VY-B4
	for bug-bash@gnu.org; Sat, 21 Jan 2012 19:46:04 -0500
Received: from mpv7.case.edu (mpv7.tis.CWRU.Edu [129.22.104.170])
	by mpv2.tis.cwru.edu (MOS 4.3.3-GA) with ESMTP id BHI47026;
	Sat, 21 Jan 2012 19:46:02 -0500
Received: from h72.205.189.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.189.205.72]) by mpv7.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SJV06473 (AUTH cpr);
	Sat, 21 Jan 2012 19:46:02 -0500 (EST)
Message-ID: <4F1B5C3C.5020308@case.edu>
Date: Sat, 21 Jan 2012 19:45:48 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: jon@jonshouse.co.uk
Subject: Re: Cross compile crapout
References: <1327162423.10370.3.camel@jonspc>
In-Reply-To: <1327162423.10370.3.camel@jonspc>
X-Enigmail-Version: 1.3.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: Sun, 22 Jan 2012 00:46:11 -0000

On 1/21/12 11:13 AM, Jonathan Andrews wrote:

> I found the fix here, but it would be nice if it could work its way into
> the source for the next release.  
> 
> http://lists.gnu.org/archive/html/bug-bash/2011-09/msg00039.html

This is patch 18 to bash-4.2.

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


From MAILER-DAEMON Sat Jan 21 21:17:53 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Ron0D-0000Cm-12
	for mharc-bug-bash@gnu.org; Sat, 21 Jan 2012 21:17:53 -0500
Received: from eggs.gnu.org ([140.186.70.92]:38075)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Ron0A-0000Cg-VH
	for bug-bash@gnu.org; Sat, 21 Jan 2012 21:17:51 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Ron09-0000PE-Oa
	for bug-bash@gnu.org; Sat, 21 Jan 2012 21:17:50 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:63715)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Ron09-0000P6-JR
	for bug-bash@gnu.org; Sat, 21 Jan 2012 21:17:49 -0500
Received: from mpv8.tis.CWRU.Edu (EHLO mpv8.case.edu) ([129.22.105.116])
	by mpv1.tis.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id BUU33947; Sat, 21 Jan 2012 21:17:47 -0500 (EST)
Received: from h72.205.189.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.189.205.72]) by mpv8.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SQK18438 (AUTH cpr);
	Sat, 21 Jan 2012 21:17:47 -0500 (EST)
Message-ID: <4F1B71BC.6060403@case.edu>
Date: Sat, 21 Jan 2012 21:17:32 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Roger <rogerx.oss@gmail.com>
Subject: Re: Bash readline remap ESC insert/command mode key
References: <20120119065818.GA2709@localhost2.local>
	<20120119071254.GB2709@localhost2.local>
	<20120119072542.GC2709@localhost2.local>
In-Reply-To: <20120119072542.GC2709@localhost2.local>
X-Enigmail-Version: 1.3.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 22 Jan 2012 02:17:51 -0000

On 1/19/12 2:25 AM, Roger wrote:
>> bind -m vi-command '"ii": vi-insertion-mode'
>> bind -m vi-insert '"ii": vi-movement-mode'
>>
>>
>> Or the following should work (untested here) using $HOME/.inputrc:
>>
>> $if mode=vi
>>
>>    set keymap vi-command
>>    "ii": vi-insertion-mode
>>
>>    set keymap vi-insert
>>    "ii": vi-movement-mode
>>
>> $endif
> 
> 
> I've just tested the above inputrc by executing a new bash shell instance and 
> the above inputrc statement works, but there is an undesirable effect when 
> using it.
> 
> While in insert mode, pressing the 'i' key only once causes readline to 
> intercept it and not print the 'i' char to screen if only pressed once.  In 
> order to get the 'i' char printed, I need to immediately press any other key 
> following the 'i' char/key so it is not intercepted by readline as it is not a 
> double 'i' key (ie 'ii').

Yes.  It's ambiguous at that point.  Readline can't tell whether or not
you mean 'ii' until you type the second `i'.  If you type something else,
you must not have meant 'ii' and readline can use the original binding
to self-insert.

Readline doesn't add characters bound to a multi-character key sequence to
the editing buffer and perform redisplay, because it will just have to go
back and erase them later in the majority of cases.

I could look at putting in some sort of inter-character timeout, but I
don't know yet how well the code structure lends itself to 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 Sun Jan 22 07:35:51 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RoweF-0006o7-Pj
	for mharc-bug-bash@gnu.org; Sun, 22 Jan 2012 07:35:51 -0500
Received: from eggs.gnu.org ([140.186.70.92]:53594)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RoweC-0006o0-O7
	for bug-bash@gnu.org; Sun, 22 Jan 2012 07:35:49 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RoweB-0004mf-G1
	for bug-bash@gnu.org; Sun, 22 Jan 2012 07:35:48 -0500
Received: from cordova.acsalaska.net ([209.112.173.243]:10948)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RoweB-0004mK-47
	for bug-bash@gnu.org; Sun, 22 Jan 2012 07:35:47 -0500
Received: from localhost2.local
	(66-230-86-34-rb1.fai.dsl.dynamic.acsalaska.net [66.230.86.34])
	by cordova.acsalaska.net (8.14.4/8.14.4) with ESMTP id q0MCZgoR062538
	for <bug-bash@gnu.org>; Sun, 22 Jan 2012 03:35:43 -0900 (AKST)
	(envelope-from rogerx.oss@gmail.com)
Date: Sun, 22 Jan 2012 03:35:37 -0900
From: Roger <rogerx.oss@gmail.com>
To: bug-bash@gnu.org
Subject: Re: Bash readline remap ESC insert/command mode key
Message-ID: <20120122123536.GA2709@localhost2.local>
References: <20120119065818.GA2709@localhost2.local>
	<20120119071254.GB2709@localhost2.local>
	<20120119072542.GC2709@localhost2.local>
	<4F1B71BC.6060403@case.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4F1B71BC.6060403@case.edu>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3
	(cordova.acsalaska.net [209.112.168.121]);
	Sun, 22 Jan 2012 03:35:43 -0900 (AKST)
X-ACS-Spam-Status: no
X-ACS-Spam-Score: 1.999 (x)
X-ACS-Spam-Tests: KHOP_DYNAMIC,ACS_BOGUS_LOCALHOST
X-ACS-Scanned-By: MD 2.67; SA 3.3.0; spamdefang 1.122
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.112.173.243
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?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, 22 Jan 2012 12:35:50 -0000

> On Sat, Jan 21, 2012 at 09:17:32PM -0500, Chet Ramey wrote:
>
>I could look at putting in some sort of inter-character timeout, but I
>don't know yet how well the code structure lends itself to that.

Ditto.  VIM times-out after a (less then) 1 second pause after nothing else is 
typed.

Readline doesn't time-out after the initial detection.

To me, this would be a simple code snippet insertion, but I wouldn't know where 
to begin. :-/

-- 
Roger
http://rogerx.freeshell.org/


From MAILER-DAEMON Sun Jan 22 12:53:32 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rp1bg-0004RG-Mv
	for mharc-bug-bash@gnu.org; Sun, 22 Jan 2012 12:53:32 -0500
Received: from eggs.gnu.org ([140.186.70.92]:52166)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1RoyaP-0007W0-U7
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 09:40:02 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1RoyaO-0003B0-IV
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 09:40:01 -0500
Received: from sam.nabble.com ([216.139.236.26]:47750)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1RoyaO-0003Aw-B6
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 09:40:00 -0500
Received: from isper.nabble.com ([192.168.236.156])
	by sam.nabble.com with esmtp (Exim 4.72)
	(envelope-from <bounces@nabble.com>) id 1RoyaN-0000bX-5D
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 06:39:59 -0800
Message-ID: <33183345.post@talk.nabble.com>
Date: Sun, 22 Jan 2012 06:39:59 -0800 (PST)
From: tapczan <tapczan@unx.pl>
To: Bug-bash@gnu.org
Subject: test if shell is interactive
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Nabble-From: tapczan@unx.pl
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 216.139.236.26
X-Mailman-Approved-At: Sun, 22 Jan 2012 12:53:31 -0500
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?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, 22 Jan 2012 14:40:02 -0000


Simple script a.sh:

#!/bin/bash
echo "PS1: $PS1"

Variable $PS1 is present:
# echo $PS1
\[\033[01;32m\]$USER@\h \[\033[00m\]\A \[\033[01;34m\]\w\[\033[00m\]\$

Variable $PS1 is environment:
# env | grep PS1
PS1=\[\033[01;32m\]$USER@\h \[\033[00m\]\A \[\033[01;34m\]\w\[\033[00m\]\$

Executing script:
# ./a.sh 
PS1:

Variable PS1 is empty in child process.

Whether the enviroment variable should not be copied to the child process?
Am I doing something wrong?


Popular methods to test if shell is interactive or not don't work for me:

1.
case "$-" in
    *i*)    echo This shell is interactive ;;
    *)    echo This shell is not interactive ;;
esac

2.
if [ -z "$PS1" ]; then
    echo This shell is not interactive
else
    echo This shell is interactive
fi
-- 
View this message in context: http://old.nabble.com/test-if-shell-is-interactive-tp33183345p33183345.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.



From MAILER-DAEMON Sun Jan 22 13:06:13 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rp1nx-0005u1-2n
	for mharc-bug-bash@gnu.org; Sun, 22 Jan 2012 13:06:13 -0500
Received: from eggs.gnu.org ([140.186.70.92]:39859)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1Rp1nt-0005rK-Cx
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 13:06:10 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1Rp1ns-0000Nz-2t
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 13:06:09 -0500
Received: from mail-vx0-f169.google.com ([209.85.220.169]:43605)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1Rp1nr-0000Nu-Ux
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 13:06:08 -0500
Received: by vcbfl11 with SMTP id fl11so1604546vcb.0
	for <Bug-bash@gnu.org>; Sun, 22 Jan 2012 10:06:07 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=aGT/wt8EaVg1uernYPNkL19yacvXPunggrF8dmShfDk=;
	b=TCxcQ3mye6uHv5tOtv2KpAz6QIvyqB9ZtikFTgm0nLQwytKkThw0X7IqLTKymdtp7X
	Gzf0IPKlUtt8r/O8JlrBClZ3RFaE30fcQLcwRfXvM6u5VFYxrgVveV3PYk8Imj+nnZHZ
	6o7PNGHO0dj7n5KkQMTYLt2zblzx17rsk1bgQ=
MIME-Version: 1.0
Received: by 10.220.228.73 with SMTP id jd9mr3185404vcb.58.1327255566984; Sun,
	22 Jan 2012 10:06:06 -0800 (PST)
Sender: pyroinajar@gmail.com
Received: by 10.52.158.7 with HTTP; Sun, 22 Jan 2012 10:06:06 -0800 (PST)
In-Reply-To: <33183345.post@talk.nabble.com>
References: <33183345.post@talk.nabble.com>
Date: Sun, 22 Jan 2012 13:06:06 -0500
X-Google-Sender-Auth: 2YPzW3G9xKnWgEF7nfvgb-mzSYw
Message-ID: <CAPg6Z0827B7VfXb66pa_mL2aeB0h4katWGk4OG2ehrMyrb2F_Q@mail.gmail.com>
Subject: Re: test if shell is interactive
From: DJ Mills <danielmills1@gmail.com>
To: tapczan <tapczan@unx.pl>
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.220.169
Cc: Bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 22 Jan 2012 18:06:10 -0000

On Sun, Jan 22, 2012 at 9:39 AM, tapczan <tapczan@unx.pl> wrote:
> 1.
> case "$-" in
> =A0 =A0*i*) =A0 =A0echo This shell is interactive ;;
> =A0 =A0*) =A0 =A0echo This shell is not interactive ;;
> esac
>

This is the correct way to test. What makes you say it's not working for yo=
u?


From MAILER-DAEMON Sun Jan 22 14:30:40 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rp37g-0003DX-Ry
	for mharc-bug-bash@gnu.org; Sun, 22 Jan 2012 14:30:40 -0500
Received: from eggs.gnu.org ([140.186.70.92]:41607)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1Rp37e-0003DI-Iy
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 14:30:39 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1Rp37d-0001xc-5Z
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 14:30:38 -0500
Received: from sam.nabble.com ([216.139.236.26]:38641)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1Rp37d-0001we-1q
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 14:30:37 -0500
Received: from isper.nabble.com ([192.168.236.156])
	by sam.nabble.com with esmtp (Exim 4.72)
	(envelope-from <bounces@nabble.com>) id 1Rp37V-0000sa-Fp
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 11:30:29 -0800
Message-ID: <33184499.post@talk.nabble.com>
Date: Sun, 22 Jan 2012 11:30:29 -0800 (PST)
From: tapczan <tapczan@unx.pl>
To: Bug-bash@gnu.org
Subject: Re: test if shell is interactive
In-Reply-To: <CAPg6Z0827B7VfXb66pa_mL2aeB0h4katWGk4OG2ehrMyrb2F_Q@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Nabble-From: tapczan@unx.pl
References: <33183345.post@talk.nabble.com>
	<CAPg6Z0827B7VfXb66pa_mL2aeB0h4katWGk4OG2ehrMyrb2F_Q@mail.gmail.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 216.139.236.26
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 22 Jan 2012 19:30:39 -0000



DJ Mills wrote:
> 
> This is the correct way to test. What makes you say it's not working for
> you?
> 

Variable $- value:
# echo $-
himBH

character 'i' meens is interactive, ok.

I have script a.sh:

#!/bin/bash
echo $-

Execution:

# ./a.sh
hB

There is no 'i' so the session is non-interactive?
It was invoked from interactive.
Am I missing something?

I tested on vanilla debian 6.0, ubuntu 11.10 - effect is the same.
-- 
View this message in context: http://old.nabble.com/test-if-shell-is-interactive-tp33183345p33184499.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.



From MAILER-DAEMON Sun Jan 22 15:15:48 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rp3pM-0002Le-1p
	for mharc-bug-bash@gnu.org; Sun, 22 Jan 2012 15:15:48 -0500
Received: from eggs.gnu.org ([140.186.70.92]:44725)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1Rp3pI-0002HG-LO
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 15:15:45 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1Rp3pH-0006wc-QJ
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 15:15:44 -0500
Received: from joseki.proulx.com ([216.17.153.58]:46698)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1Rp3pH-0006wS-JR
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 15:15:43 -0500
Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119])
	by joseki.proulx.com (Postfix) with ESMTP id E7CE1211D8;
	Sun, 22 Jan 2012 13:15:40 -0700 (MST)
Received: by hysteria.proulx.com (Postfix, from userid 1000)
	id 9A3042DCD5; Sun, 22 Jan 2012 13:15:40 -0700 (MST)
Date: Sun, 22 Jan 2012 13:15:40 -0700
From: Bob Proulx <bob@proulx.com>
To: tapczan <tapczan@unx.pl>
Subject: Re: test if shell is interactive
Message-ID: <20120122201540.GA29423@hysteria.proulx.com>
Mail-Followup-To: tapczan <tapczan@unx.pl>, Bug-bash@gnu.org
References: <33183345.post@talk.nabble.com>
	<CAPg6Z0827B7VfXb66pa_mL2aeB0h4katWGk4OG2ehrMyrb2F_Q@mail.gmail.com>
	<33184499.post@talk.nabble.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <33184499.post@talk.nabble.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: Sun, 22 Jan 2012 20:15:45 -0000

tapczan wrote:
> #!/bin/bash
> echo $-
> 
> Execution:
> 
> # ./a.sh
> hB
> 
> There is no 'i' so the session is non-interactive?
> It was invoked from interactive.
> Am I missing something?

Shell scripts are not interactive.  So what you are seeing above is
correct.

Bob


From MAILER-DAEMON Sun Jan 22 15:21:04 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rp3uS-0002ok-R5
	for mharc-bug-bash@gnu.org; Sun, 22 Jan 2012 15:21:04 -0500
Received: from eggs.gnu.org ([140.186.70.92]:56658)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1Rp3uQ-0002oe-B7
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 15:21:03 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1Rp3uO-0007Of-VR
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 15:21:02 -0500
Received: from sam.nabble.com ([216.139.236.26]:41859)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bounces@nabble.com>) id 1Rp3uO-0007OZ-J4
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 15:21:00 -0500
Received: from isper.nabble.com ([192.168.236.156])
	by sam.nabble.com with esmtp (Exim 4.72)
	(envelope-from <bounces@nabble.com>) id 1Rp3uO-0005Im-0P
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 12:21:00 -0800
Message-ID: <33184711.post@talk.nabble.com>
Date: Sun, 22 Jan 2012 12:21:00 -0800 (PST)
From: tapczan <tapczan@unx.pl>
To: Bug-bash@gnu.org
Subject: Re: test if shell is interactive
In-Reply-To: <20120122201540.GA29423@hysteria.proulx.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Nabble-From: tapczan@unx.pl
References: <33183345.post@talk.nabble.com>
	<CAPg6Z0827B7VfXb66pa_mL2aeB0h4katWGk4OG2ehrMyrb2F_Q@mail.gmail.com>
	<33184499.post@talk.nabble.com>
	<20120122201540.GA29423@hysteria.proulx.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 216.139.236.26
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 22 Jan 2012 20:21:03 -0000




Bob Proulx wrote:
> 
> Shell scripts are not interactive.  So what you are seeing above is
> correct.
> 

So, is there any way to test if script (a.sh) was invoked from interactive
session (human) or not (e.g. from cron)?
-- 
View this message in context: http://old.nabble.com/test-if-shell-is-interactive-tp33183345p33184711.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.



From MAILER-DAEMON Sun Jan 22 15:39:28 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rp4CG-0006GG-Tz
	for mharc-bug-bash@gnu.org; Sun, 22 Jan 2012 15:39:28 -0500
Received: from eggs.gnu.org ([140.186.70.92]:50142)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chris@cfajohnson.com>) id 1Rp4CE-0006DU-DZ
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 15:39:27 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chris@cfajohnson.com>) id 1Rp4CD-0000my-91
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 15:39:26 -0500
Received: from ironport2-out.teksavvy.com ([206.248.154.183]:48169)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chris@cfajohnson.com>) id 1Rp4CD-0000mu-6i
	for Bug-bash@gnu.org; Sun, 22 Jan 2012 15:39:25 -0500
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Av0EAClzHE/O+INx/2dsb2JhbABDriOBBoFyAQEFOAIcMwsYHBI5HgYBLb8/jCYEiDuac4RX
X-IronPort-AV: E=Sophos;i="4.71,552,1320642000"; d="scan'208";a="158035590"
Received: from 206-248-131-113.dsl.teksavvy.com (HELO linux.local)
	([206.248.131.113])
	by ironport2-out.teksavvy.com with ESMTP; 22 Jan 2012 15:39:23 -0500
Date: Sun, 22 Jan 2012 15:37:54 -0500 (EST)
From: "Chris F.A. Johnson" <chris@cfajohnson.com>
To: tapczan <tapczan@unx.pl>, Bug-bash@gnu.org
Subject: Re: test if shell is interactive
In-Reply-To: <33184711.post@talk.nabble.com>
Message-ID: <alpine.LMD.2.00.1201221536350.15700@localhost.localdomain>
References: <33183345.post@talk.nabble.com>
	<CAPg6Z0827B7VfXb66pa_mL2aeB0h4katWGk4OG2ehrMyrb2F_Q@mail.gmail.com>
	<33184499.post@talk.nabble.com>
	<20120122201540.GA29423@hysteria.proulx.com>
	<33184711.post@talk.nabble.com>
User-Agent: Alpine 2.00 (LMD 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 206.248.154.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: Sun, 22 Jan 2012 20:39:27 -0000

On Sun, 22 Jan 2012, tapczan wrote:
> Bob Proulx wrote:
>>
>> Shell scripts are not interactive.  So what you are seeing above is
>> correct.
>
> So, is there any way to test if script (a.sh) was invoked from interactive
> session (human) or not (e.g. from cron)?

    Test whether it is attached to a tty:

if [ -t 1 ]
then
    echo Interactive
else
    echo Not interactive
fi

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


From MAILER-DAEMON Sun Jan 22 15:42:36 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rp4FI-0006tZ-MC
	for mharc-bug-bash@gnu.org; Sun, 22 Jan 2012 15:42:36 -0500
Received: from eggs.gnu.org ([140.186.70.92]:50606)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1Rp4FG-0006tR-S0
	for bug-bash@gnu.org; Sun, 22 Jan 2012 15:42:35 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1Rp4FF-00014M-Up
	for bug-bash@gnu.org; Sun, 22 Jan 2012 15:42:34 -0500
Received: from joseki.proulx.com ([216.17.153.58]:46777)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1Rp4FF-00014H-Jn
	for bug-bash@gnu.org; Sun, 22 Jan 2012 15:42:33 -0500
Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119])
	by joseki.proulx.com (Postfix) with ESMTP id 1BDDC211D8;
	Sun, 22 Jan 2012 13:42:33 -0700 (MST)
Received: by hysteria.proulx.com (Postfix, from userid 1000)
	id CCE6E2DCD5; Sun, 22 Jan 2012 13:42:32 -0700 (MST)
Date: Sun, 22 Jan 2012 13:42:32 -0700
From: Bob Proulx <bob@proulx.com>
To: tapczan <tapczan@unx.pl>, bug-bash@gnu.org
Subject: Re: test if shell is interactive
Message-ID: <20120122204232.GA32224@hysteria.proulx.com>
Mail-Followup-To: tapczan <tapczan@unx.pl>, bug-bash@gnu.org
References: <33183345.post@talk.nabble.com>
	<CAPg6Z0827B7VfXb66pa_mL2aeB0h4katWGk4OG2ehrMyrb2F_Q@mail.gmail.com>
	<33184499.post@talk.nabble.com>
	<20120122201540.GA29423@hysteria.proulx.com>
	<33184711.post@talk.nabble.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <33184711.post@talk.nabble.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
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?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, 22 Jan 2012 20:42:35 -0000

tapczan wrote:
> Bob Proulx wrote:
> > Shell scripts are not interactive.  So what you are seeing above is
> > correct.
> 
> So, is there any way to test if script (a.sh) was invoked from interactive
> session (human) or not (e.g. from cron)?

I usually check if the standard input file descriptor is attached to a
tty device or not.

  #!/bin/sh
  if [ -t 0 ]; then
    echo has a tty
  else
    echo does not have a tty
  fi
  exit 0

Or something like:

  $ test -t 0 && echo yes tty || echo no tty

Note: This discussion thread is much better suited for help-bash since
it isn't talking about a bug in bash.  In the future if you are just
asking questions that would be the better list to send them to.

Bob


From MAILER-DAEMON Sun Jan 22 16:52:15 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rp5Kh-0006GV-CR
	for mharc-bug-bash@gnu.org; Sun, 22 Jan 2012 16:52:15 -0500
Received: from eggs.gnu.org ([140.186.70.92]:40983)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rp5Ke-0006FT-Gu
	for bug-bash@gnu.org; Sun, 22 Jan 2012 16:52:13 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rp5KY-0008B7-GU
	for bug-bash@gnu.org; Sun, 22 Jan 2012 16:52:12 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:61571)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rp5KY-0008Av-8v
	for bug-bash@gnu.org; Sun, 22 Jan 2012 16:52:06 -0500
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 BUU80459; Sun, 22 Jan 2012 16:52:05 -0500 (EST)
Received: from h72.205.189.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.189.205.72]) by mpv7.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SJX75403 (AUTH cpr);
	Sun, 22 Jan 2012 16:52:05 -0500 (EST)
Message-ID: <4F1C8506.9090906@case.edu>
Date: Sun, 22 Jan 2012 16:52:06 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Roger <rogerx.oss@gmail.com>
Subject: Re: Bash readline remap ESC insert/command mode key
References: <20120119065818.GA2709@localhost2.local>
	<20120119071254.GB2709@localhost2.local>
	<20120119072542.GC2709@localhost2.local>
	<4F1B71BC.6060403@case.edu>
	<20120122123536.GA2709@localhost2.local>
In-Reply-To: <20120122123536.GA2709@localhost2.local>
X-Enigmail-Version: 1.3.4
Content-Type: multipart/mixed; boundary="------------000801020504000606090803"
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, 22 Jan 2012 21:52:13 -0000

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

On 1/22/12 7:35 AM, Roger wrote:
>> On Sat, Jan 21, 2012 at 09:17:32PM -0500, Chet Ramey wrote:
>>
>> I could look at putting in some sort of inter-character timeout, but I
>> don't know yet how well the code structure lends itself to that.

Pretty easily, as it turns out.  The attached patch adds a half-second
timeout to the key sequence code.  Please let me know whether or not it
works for you.

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/

--------------000801020504000606090803
Content-Type: text/x-patch;
 name="readline.inter-char-timeout.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="readline.inter-char-timeout.patch"

*** ../bash-4.2-patched/lib/readline/readline.c	2010-07-25 17:07:40.000000000 -0400
--- lib/readline/readline.c	2012-01-22 16:47:45.000000000 -0500
***************
*** 856,859 ****
--- 891,900 ----
  #endif
  
+ 	  /* Tentative inter-character timeout for potential multi-key
+ 	     sequences?  If no input within timeout, abort sequence and
+ 	     act as if we got non-matching input. */
+ 	  if (_rl_input_queued (500000) == 0)
+ 	    return (_rl_subseq_result (-2, map, key, got_subseq));
+ 
  	  newkey = _rl_subseq_getchar (key);
  	  if (newkey < 0)

--------------000801020504000606090803--



From MAILER-DAEMON Mon Jan 23 01:08:47 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RpD5C-0007PV-TE
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2012 01:08:46 -0500
Received: from eggs.gnu.org ([140.186.70.92]:46253)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon@jonshouse.co.uk>) id 1RpD5A-0007OA-3a
	for bug-bash@gnu.org; Mon, 23 Jan 2012 01:08:44 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jon@jonshouse.co.uk>) id 1RpD59-00057q-9T
	for bug-bash@gnu.org; Mon, 23 Jan 2012 01:08:44 -0500
Received: from [91.84.151.33] (port=41001 helo=mail.jonshouse.co.uk)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon@jonshouse.co.uk>) id 1RpD58-00050G-Tk
	for bug-bash@gnu.org; Mon, 23 Jan 2012 01:08:43 -0500
Received: from [10.10.10.6] (jonspc [10.10.10.6])
	by mail.jonshouse.co.uk (8.14.1/8.13.8) with ESMTP id q0N6CPQ6014931;
	Mon, 23 Jan 2012 06:12:31 GMT
Subject: Re: Cross compile crapout
From: Jonathan Andrews <jon@jonshouse.co.uk>
To: chet.ramey@case.edu
In-Reply-To: <4F1B5C3C.5020308@case.edu>
References: <1327162423.10370.3.camel@jonspc>  <4F1B5C3C.5020308@case.edu>
Content-Type: text/plain; charset="UTF-8"
Date: Mon, 23 Jan 2012 06:12:26 +0000
Message-ID: <1327299146.16940.22.camel@jonspc>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.3 (2.28.3-1.fc12) 
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1)
X-Received-From: 91.84.151.33
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: jon@jonshouse.co.uk
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?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, 23 Jan 2012 06:08:45 -0000

On Sat, 2012-01-21 at 19:45 -0500, Chet Ramey wrote:
> On 1/21/12 11:13 AM, Jonathan Andrews wrote:
> 
> > I found the fix here, but it would be nice if it could work its way into
> > the source for the next release.  
> > 
> > http://lists.gnu.org/archive/html/bug-bash/2011-09/msg00039.html
> 
> This is patch 18 to bash-4.2.
> 

Ooops! I had not noticed it even had patches, sorry.

It might be worth mentioning the possible existence of patches in README
or INSTALL.

As is normal for projects I had limited time so I just googled "bash
src" and downloaded the newest. 

I needed a statically linked bash for testing an arm board. I did not
expect it to be nearly 3MB though ! It surprises me that a statically
linked bash is bigger than the entire busybox binary i've compiled, or
my kernel image for that matter. Is this bloat gcc, some failing of the
linker or bash itself?  

Thanks,
Jon





From MAILER-DAEMON Mon Jan 23 02:51:00 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RpEg8-0003Zw-OM
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2012 02:51:00 -0500
Received: from eggs.gnu.org ([140.186.70.92]:35278)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1RpEg5-0003XA-Uk
	for bug-bash@gnu.org; Mon, 23 Jan 2012 02:50:58 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1RpEg4-0007Xg-KW
	for bug-bash@gnu.org; Mon, 23 Jan 2012 02:50:57 -0500
Received: from mail-gy0-f169.google.com ([209.85.160.169]:58304)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ormaaj@gmail.com>) id 1RpEg4-0007XO-Hu
	for bug-bash@gnu.org; Mon, 23 Jan 2012 02:50:56 -0500
Received: by ghrr14 with SMTP id r14so1167146ghr.0
	for <bug-bash@gnu.org>; Sun, 22 Jan 2012 23:50:55 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=from:to:subject:date:message-id:user-agent:mime-version
	:content-type:content-transfer-encoding;
	bh=3hQW30IPWMNfOfghIinvfc/FBVdYEnlkHfIbhBv5108=;
	b=GFZfwdT0ctwczHboTYpCFa6yEQq94R8jYXrHQm3WZ7nwAE2cHD3Bt4W+jxzGfY3lg7
	wQuMLF/ynZOsoFrP0IBQAkRgXjGFGQ5k1s5y7oigxzYAUDhHWiJCBc9HkvlfogjcXeUJ
	APIi9izKRffuAEhiRu+lq/MPyDImsDt4i746A=
Received: by 10.236.201.232 with SMTP id b68mr7494366yho.34.1327305055662;
	Sun, 22 Jan 2012 23:50:55 -0800 (PST)
Received: from smorgbox.localnet (174-20-45-171.mpls.qwest.net.
	[174.20.45.171])
	by mx.google.com with ESMTPS id a24sm32786399ana.13.2012.01.22.23.50.54
	(version=SSLv3 cipher=OTHER); Sun, 22 Jan 2012 23:50:55 -0800 (PST)
From: Dan Douglas <ormaaj@gmail.com>
To: bug-bash@gnu.org
Subject: [bug] Bash translates >&$var into &>$var for exported functions.
Date: Mon, 23 Jan 2012 01:50:41 -0600
Message-ID: <2224934.EuubiIqJgO@smorgbox>
User-Agent: KMail/4.7.4 (Linux/3.1.6-pf; KDE/4.7.4; x86_64; ; )
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart5915573.o75PTu6ltE";
	micalg="pgp-sha1"; protocol="application/pgp-signature"
Content-Transfer-Encoding: 7Bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.160.169
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?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, 23 Jan 2012 07:50:59 -0000


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

Hello, In the case of exported functions, Bash interprets a copy descriptor 
followed by an expansion as the >& synonym for &>, resulting in the output 
going to a file named as the value of the FD it's given.  This only applies to 
">&$var" and not "<&$var". I've tested various quoting, Is there some way 
around this?

Gist over here if it's easier to read: https://gist.github.com/1661392

TESTCASE (Overwrites the file named "3" in CWD):
#!/usr/bin/env bash

set -x

f() {
    echo 'hi'
} >&${1}

{ f 3; cat; } <<<'' 3>/dev/stdin

export -f f
export -pf

PS4='* ' BASH_XTRACEFD=4 bash -xc 'f 3; cat' <<<'' 3>/dev/stdin 4>&2

[[ -f 3 ]] && cat ./3
END TESTCASE

OUTPUT:
 ~ $ rm 3; ./exbug
+ f 3
+ echo hi
+ cat
hi
+ export -f f
+ export -pf
f () 
{ 
    echo 'hi'
} &>${1}
declare -fx f
* PS4='* '
* BASH_XTRACEFD=4
+ bash -xc 'f 3; cat'
* f 3
* echo hi
* cat
+ [[ -f 3 ]]
+ cat ./3
hi
END OUTPUT

Bash v. 4.2 w/ patchset 20 on Gentoo Linux amd64.
-- 
Dan Douglas
--nextPart5915573.o75PTu6ltE
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part.

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

iEYEABECAAYFAk8dEVgACgkQMmyDamdg+Mw59wCgrtH8dngPOmVUmdVAggWhElmk
MjcAoKjWzytIhyrfJalrYMAcb/FN58RS
=60mE
-----END PGP SIGNATURE-----

--nextPart5915573.o75PTu6ltE--



From MAILER-DAEMON Mon Jan 23 04:47:56 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RpGVI-0005i3-B0
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2012 04:47:56 -0500
Received: from eggs.gnu.org ([140.186.70.92]:55480)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1RpGVE-0005ag-6O
	for bug-bash@gnu.org; Mon, 23 Jan 2012 04:47:53 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1RpGVA-0005Um-GV
	for bug-bash@gnu.org; Mon, 23 Jan 2012 04:47:52 -0500
Received: from lo.gmane.org ([80.91.229.12]:45674)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1RpGVA-0005Ui-BU
	for bug-bash@gnu.org; Mon, 23 Jan 2012 04:47:48 -0500
Received: from list by lo.gmane.org with local (Exim 4.69)
	(envelope-from <gnu-bug-bash-2@m.gmane.org>) id 1RpGV9-0007tp-5O
	for bug-bash@gnu.org; Mon, 23 Jan 2012 10:47:47 +0100
Received: from dslb-088-068-072-025.pools.arcor-ip.net ([88.68.72.25])
	by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
	id 1AlnuQ-0007hv-00
	for <bug-bash@gnu.org>; Mon, 23 Jan 2012 10:47:47 +0100
Received: from r_goertz by dslb-088-068-072-025.pools.arcor-ip.net with local
	(Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00
	for <bug-bash@gnu.org>; Mon, 23 Jan 2012 10:47:47 +0100
X-Injected-Via-Gmane: http://gmane.org/
To: bug-bash@gnu.org
From: Ralf Goertz <r_goertz@usenet.arcornews.de>
Subject: Re: echo '-e' doesn't work as expected, or does it?
Date: Mon, 23 Jan 2012 10:47:17 +0100
Lines: 14
Message-ID: <jfjabg$7df$1@dough.gmane.org>
References: <20120121122403.7bb733ac@Gondolin>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8Bit
X-Complaints-To: usenet@dough.gmane.org
X-Gmane-NNTP-Posting-Host: dslb-088-068-072-025.pools.arcor-ip.net
User-Agent: KNode/4.7.2
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 80.91.229.12
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?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, 23 Jan 2012 09:47:53 -0000

Philip wrote:

> Hi! Short question this time..
> 
> $ echo '-e'
> does not print -e
> 
> $ echo '-e '
> does print -e .

By the way, neither -e nor -E are explained in the option section of
â€žhelp echoâ€œ. Only -n is mentioned there.

GNU bash, Version 4.2.10(1)-release (x86_64-suse-linux-gnu)



From MAILER-DAEMON Mon Jan 23 04:57:17 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RpGeL-0007G3-D2
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2012 04:57:17 -0500
Received: from eggs.gnu.org ([140.186.70.92]:44064)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1RpGeF-0007Fu-NN
	for bug-bash@gnu.org; Mon, 23 Jan 2012 04:57:15 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1RpGeE-0006vM-BO
	for bug-bash@gnu.org; Mon, 23 Jan 2012 04:57:11 -0500
Received: from mail-iy0-f169.google.com ([209.85.210.169]:54505)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1RpGeE-0006vH-8I
	for bug-bash@gnu.org; Mon, 23 Jan 2012 04:57:10 -0500
Received: by iadj38 with SMTP id j38so5676052iad.0
	for <bug-bash@gnu.org>; Mon, 23 Jan 2012 01:57:08 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=DN0WjvjXOyKF6Ma4B6i5gPtMyVuTE1YnFrcy3YwaQLY=;
	b=BNoNzjigFfBxf5EqiNZvS+djdwgmM8saw+zxaIQROTheW5+v1y9CRKJ0MQCAy/a++N
	YqvjckFiu2iMC2ll3sv0zws8MOEY61PTrXe4OCz/EnIDM4tw1kLuWsc09Rzwjp15UQKQ
	Z379xdpx3iegWpA+iUC6Y34kUic8cIu4D25Oo=
Received: by 10.42.147.72 with SMTP id m8mr7272285icv.56.1327312628404; Mon,
	23 Jan 2012 01:57:08 -0800 (PST)
MIME-Version: 1.0
Received: by 10.42.29.136 with HTTP; Mon, 23 Jan 2012 01:56:47 -0800 (PST)
In-Reply-To: <jfjabg$7df$1@dough.gmane.org>
References: <20120121122403.7bb733ac@Gondolin> <jfjabg$7df$1@dough.gmane.org>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Mon, 23 Jan 2012 11:56:47 +0200
Message-ID: <CAPSX3sQ6u8p27SGVjtGS04wLq6aMALRrhK_s+Jx3Cc17hS5-4Q@mail.gmail.com>
Subject: Re: echo '-e' doesn't work as expected, or does it?
To: Ralf Goertz <r_goertz@usenet.arcornews.de>
Content-Type: text/plain; charset=windows-1252
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.169
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 23 Jan 2012 09:57:15 -0000

On Mon, Jan 23, 2012 at 11:47 AM, Ralf Goertz
<r_goertz@usenet.arcornews.de> wrote:
> Philip wrote:
>
>> Hi! Short question this time..
>>
>> $ echo '-e'
>> does not print -e
>>
>> $ echo '-e '
>> does print -e .
>
> By the way, neither -e nor -E are explained in the option section of
> =84help echo=93. Only -n is mentioned there.
>
> GNU bash, Version 4.2.10(1)-release (x86_64-suse-linux-gnu)
>

you might want to report a bug to suse, here i get:

 echo $BASH_VERSION;help echo
4.2.10(1)-release
echo: echo [-neE] [arg ...]
    Write arguments to the standard output.

    Display the ARGs on the standard output followed by a newline.

    Options:
      -n        do not append a newline
      -e        enable interpretation of the following backslash escapes
      -E        explicitly suppress interpretation of backslash escapes
...


From MAILER-DAEMON Mon Jan 23 05:42:23 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RpHLy-0007HA-Qm
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2012 05:42:22 -0500
Received: from eggs.gnu.org ([140.186.70.92]:51647)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1RpHLw-0007GY-7B
	for bug-bash@gnu.org; Mon, 23 Jan 2012 05:42:21 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1RpHLq-0003kj-BI
	for bug-bash@gnu.org; Mon, 23 Jan 2012 05:42:20 -0500
Received: from mail-out.m-online.net ([212.18.0.9]:39118)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1RpHLq-0003kc-4U
	for bug-bash@gnu.org; Mon, 23 Jan 2012 05:42:14 -0500
Received: from frontend1.mail.m-online.net (unknown [192.168.8.180])
	by mail-out.m-online.net (Postfix) with ESMTP id 3564B1C0F567;
	Mon, 23 Jan 2012 11:42:12 +0100 (CET)
X-Auth-Info: fVx/jaQyvVxdcinuhbip6cpkuFLJ6bE2RZp+bu7zf5k=
Received: from igel.home (ppp-88-217-98-175.dynamic.mnet-online.de
	[88.217.98.175])
	by mail.mnet-online.de (Postfix) with ESMTPA id 0F6BA1C0018E;
	Mon, 23 Jan 2012 11:42:12 +0100 (CET)
Received: by igel.home (Postfix, from userid 501)
	id 72F59CA29A; Mon, 23 Jan 2012 11:42:11 +0100 (CET)
From: Andreas Schwab <schwab@linux-m68k.org>
To: Pierre Gaston <pierre.gaston@gmail.com>
Subject: Re: echo '-e' doesn't work as expected, or does it?
References: <20120121122403.7bb733ac@Gondolin> <jfjabg$7df$1@dough.gmane.org>
	<CAPSX3sQ6u8p27SGVjtGS04wLq6aMALRrhK_s+Jx3Cc17hS5-4Q@mail.gmail.com>
X-Yow: PUMP UP th' VOLUME! My BAGEL TOASTER is in tune with th' UNIVERSAL LIFE
	FORCE!!
Date: Mon, 23 Jan 2012 11:42:10 +0100
In-Reply-To: <CAPSX3sQ6u8p27SGVjtGS04wLq6aMALRrhK_s+Jx3Cc17hS5-4Q@mail.gmail.com>
	(Pierre Gaston's message of "Mon, 23 Jan 2012 11:56:47 +0200")
Message-ID: <m2wr8iwvi5.fsf@igel.home>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
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: Ralf Goertz <r_goertz@usenet.arcornews.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: Mon, 23 Jan 2012 10:42:21 -0000

Pierre Gaston <pierre.gaston@gmail.com> writes:

> On Mon, Jan 23, 2012 at 11:47 AM, Ralf Goertz
> <r_goertz@usenet.arcornews.de> wrote:
>> Philip wrote:
>>
>>> Hi! Short question this time..
>>>
>>> $ echo '-e'
>>> does not print -e
>>>
>>> $ echo '-e '
>>> does print -e .
>>
>> By the way, neither -e nor -E are explained in the option section of
>> â€žhelp echoâ€œ. Only -n is mentioned there.
>>
>> GNU bash, Version 4.2.10(1)-release (x86_64-suse-linux-gnu)
>>
>
> you might want to report a bug to suse, here i get:

It's a bug in --enable-separate-helpfiles: the generated file contains
only one help string for echo, which happens to be the one for !V9_ECHO.

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 Mon Jan 23 08:52:38 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RpKK6-0005Eq-CF
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2012 08:52:38 -0500
Received: from eggs.gnu.org ([140.186.70.92]:47094)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RpKJz-0005CY-40
	for bug-bash@gnu.org; Mon, 23 Jan 2012 08:52:36 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RpKJw-0002vR-I2
	for bug-bash@gnu.org; Mon, 23 Jan 2012 08:52:31 -0500
Received: from denali.acsalaska.net ([209.112.173.242]:44210)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RpKJw-0002v1-95
	for bug-bash@gnu.org; Mon, 23 Jan 2012 08:52:28 -0500
Received: from localhost2.local
	(66-230-88-123-rb1.fai.dsl.dynamic.acsalaska.net [66.230.88.123])
	by denali.acsalaska.net (8.14.4/8.14.4) with ESMTP id q0NDqMUx008030;
	Mon, 23 Jan 2012 04:52:23 -0900 (AKST)
	(envelope-from rogerx.oss@gmail.com)
Date: Mon, 23 Jan 2012 04:52:17 -0900
From: Roger <rogerx.oss@gmail.com>
To: chet.ramey@case.edu
Subject: Re: Bash readline remap ESC insert/command mode key
Message-ID: <20120123135217.GA9935@localhost2.local>
References: <20120119065818.GA2709@localhost2.local>
	<20120119071254.GB2709@localhost2.local>
	<20120119072542.GC2709@localhost2.local>
	<4F1B71BC.6060403@case.edu>
	<20120122123536.GA2709@localhost2.local>
	<4F1C8506.9090906@case.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4F1C8506.9090906@case.edu>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3
	(denali.acsalaska.net [209.112.168.121]);
	Mon, 23 Jan 2012 04:52:23 -0900 (AKST)
X-ACS-Spam-Status: no
X-ACS-Spam-Score: 1.999 (x)
X-ACS-Spam-Tests: KHOP_DYNAMIC,ACS_BOGUS_LOCALHOST
X-ACS-Scanned-By: MD 2.67; SA 3.3.0; spamdefang 1.122
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.112.173.242
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, 23 Jan 2012 13:52:36 -0000

> On Sun, Jan 22, 2012 at 04:52:06PM -0500, Chet Ramey wrote:
>On 1/22/12 7:35 AM, Roger wrote:
>>> On Sat, Jan 21, 2012 at 09:17:32PM -0500, Chet Ramey wrote:
>>>
>>> I could look at putting in some sort of inter-character timeout, but I
>>> don't know yet how well the code structure lends itself to that.
>
>Pretty easily, as it turns out.  The attached patch adds a half-second
>timeout to the key sequence code.  Please let me know whether or not it
>works for you.

Patch seems to work great and I can now type 'exit' without command mode
being spawned when typing the 'i'.

It's behaviour is almost identical to VIM's.

A little more indepth examination, and I can see VIM's wait is approximately 
double of what the readline patch's wait time is.  However, I think the shorter 
wait time is more functional as when typing a double char, it in no way takes 
as long as VIM's wait time unless you type the same char with your finger and 
then use a toe to type the second char.

Matter of fact, I'm starting to find VIM's long wait time length a little 
annoying.  ;-)

Great job at guessing the wait time!

-- 
Roger
http://rogerx.freeshell.org/


From MAILER-DAEMON Mon Jan 23 13:58:35 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RpP6B-0006Rb-A5
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2012 13:58:35 -0500
Received: from eggs.gnu.org ([140.186.70.92]:33373)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <cjns1989@gmail.com>) id 1RpP68-0006RQ-U8
	for bug-bash@gnu.org; Mon, 23 Jan 2012 13:58:33 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <cjns1989@gmail.com>) id 1RpP67-0007aQ-Mg
	for bug-bash@gnu.org; Mon, 23 Jan 2012 13:58:32 -0500
Received: from mta6.srv.hcvlny.cv.net ([167.206.4.212]:49022)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <cjns1989@gmail.com>) id 1RpP67-0007aK-KN
	for bug-bash@gnu.org; Mon, 23 Jan 2012 13:58:31 -0500
Received: from pavo.local (ool-457112ca.dyn.optonline.net [69.113.18.202])
	by mta6.srv.hcvlny.cv.net
	(Sun Java System Messaging Server 6.2-9.20 (built Jul 15 2010))
	with ESMTP id <0LY900EHMM1CK3M0@mta6.srv.hcvlny.cv.net> for
	bug-bash@gnu.org; Mon, 23 Jan 2012 13:58:24 -0500 (EST)
Received: from gavron by pavo.local with local (Exim 4.69)
	(envelope-from <cjns1989@gmail.com>)	id 1RpP5z-0003T6-OR	for
	bug-bash@gnu.org; Mon, 23 Jan 2012 13:58:23 -0500
Date: Mon, 23 Jan 2012 13:58:23 -0500
From: Chris Jones <cjns1989@gmail.com>
Subject: Re: Bash readline remap ESC insert/command mode key
In-reply-to: <20120123135217.GA9935@localhost2.local>
To: bug-bash@gnu.org
Mail-followup-to: bug-bash@gnu.org
Message-id: <20120123185823.GA3530@pavo.local>
MIME-version: 1.0
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Content-disposition: inline
References: <20120119065818.GA2709@localhost2.local>
	<20120119071254.GB2709@localhost2.local>
	<20120119072542.GC2709@localhost2.local> <4F1B71BC.6060403@case.edu>
	<20120122123536.GA2709@localhost2.local> <4F1C8506.9090906@case.edu>
	<20120123135217.GA9935@localhost2.local>
User-Agent: Mutt/1.5.18 (2008-05-17)
X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta)
X-Received-From: 167.206.4.212
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?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, 23 Jan 2012 18:58:34 -0000

On Mon, Jan 23, 2012 at 08:52:17AM EST, Roger wrote:

[..]

> Matter of fact, I'm starting to find VIM's long wait time length
> a little annoying.  ;-)

:h tm
:h ttm

CJ


From MAILER-DAEMON Mon Jan 23 14:58:25 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RpQ25-0000BG-H8
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2012 14:58:25 -0500
Received: from eggs.gnu.org ([140.186.70.92]:35773)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dbmelnikov@gmail.com>) id 1RpQ23-0000Ap-Pu
	for bug-bash@gnu.org; Mon, 23 Jan 2012 14:58:24 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dbmelnikov@gmail.com>) id 1RpQ22-0007g5-QH
	for bug-bash@gnu.org; Mon, 23 Jan 2012 14:58:23 -0500
Received: from mail-vx0-f169.google.com ([209.85.220.169]:49118)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dbmelnikov@gmail.com>) id 1RpQ22-0007g0-Ji
	for bug-bash@gnu.org; Mon, 23 Jan 2012 14:58:22 -0500
Received: by vcbfl11 with SMTP id fl11so2504872vcb.0
	for <bug-bash@gnu.org>; Mon, 23 Jan 2012 11:58:21 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:date:message-id:subject:from:to:content-type;
	bh=XZGOlMOJ2xqV9kcb4JkIqjGjlihfBIWdUIlrq1jhF3U=;
	b=PnY9Qt0DyoO0If01iWTaSHE6eUbaXEhCQuZOAck7nu7WSaNIXejjKrVTaEM8BYCC7l
	kzs3BdKnzBGR9n9WvC6/LWkdfUEGsjSClRzFlJMxUB3bYLnKnmJwyOR2kawAYQMwDIus
	ZBkoEF7pRAh75Q5fMfJh/fVEQ0AkIwH0sCcmo=
MIME-Version: 1.0
Received: by 10.220.228.4 with SMTP id jc4mr5535139vcb.36.1327348701821; Mon,
	23 Jan 2012 11:58:21 -0800 (PST)
Received: by 10.220.189.196 with HTTP; Mon, 23 Jan 2012 11:58:21 -0800 (PST)
Date: Mon, 23 Jan 2012 23:58:21 +0400
Message-ID: <CAG-cbm0Oc4Yq5qoyhf28qNs4q1xiFH1j2iZcedJKRYsLSLMj9w@mail.gmail.com>
Subject: Variable undefines - bug or feature?
From: Denis Melnikov <dbmelnikov@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.220.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: Mon, 23 Jan 2012 19:58:24 -0000

Hi,
after the following fragment of code named variable gets empty:

ls | while read file ; do
  v=1
  break
done
echo $v

Is it a bug or a feature?
GNU bash, version 4.1.2(1)-release

Denis


From MAILER-DAEMON Mon Jan 23 15:00:51 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RpQ4R-0000Ry-R4
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2012 15:00:51 -0500
Received: from eggs.gnu.org ([140.186.70.92]:59855)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1RpQ4L-0000Rr-U9
	for bug-bash@gnu.org; Mon, 23 Jan 2012 15:00:50 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1RpQ4D-000840-GQ
	for bug-bash@gnu.org; Mon, 23 Jan 2012 15:00:45 -0500
Received: from mail-vx0-f169.google.com ([209.85.220.169]:45400)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1RpQ4D-00083u-CZ
	for bug-bash@gnu.org; Mon, 23 Jan 2012 15:00:37 -0500
Received: by vcbfl11 with SMTP id fl11so2506985vcb.0
	for <bug-bash@gnu.org>; Mon, 23 Jan 2012 12:00:33 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=eA5Bml8fQ/36rlOh6nBMAgyNIG7RZ1dov4qicKlDmj0=;
	b=o+haKxaCFh12RG7eE3PELbNu8xrApNEPQYDZeSIN4I/wONKyMaDN4OpgQfQxjYlNvM
	WoJuJ1leTRmEdOiWQYVrWVpImjqCa9yaO3e1EAFEHoqx5mWmaV9jKEqKwTgr1SfkEr/Q
	EJ8gjBQ+rxtj2pobke0GwQIqNmCe6e7kQFuw0=
MIME-Version: 1.0
Received: by 10.220.155.142 with SMTP id s14mr5952602vcw.20.1327348833680;
	Mon, 23 Jan 2012 12:00:33 -0800 (PST)
Sender: pyroinajar@gmail.com
Received: by 10.52.67.232 with HTTP; Mon, 23 Jan 2012 12:00:33 -0800 (PST)
In-Reply-To: <CAG-cbm0Oc4Yq5qoyhf28qNs4q1xiFH1j2iZcedJKRYsLSLMj9w@mail.gmail.com>
References: <CAG-cbm0Oc4Yq5qoyhf28qNs4q1xiFH1j2iZcedJKRYsLSLMj9w@mail.gmail.com>
Date: Mon, 23 Jan 2012 15:00:33 -0500
X-Google-Sender-Auth: vOP5_AWEFDdP4FTsT7Jgy4v5QZc
Message-ID: <CAPg6Z0_K_gPjYDncFX8iLVY==XyYXimmJUA+cOe58ezHnMjOHg@mail.gmail.com>
Subject: Re: Variable undefines - bug or feature?
From: DJ Mills <danielmills1@gmail.com>
To: Denis Melnikov <dbmelnikov@gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.220.169
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 23 Jan 2012 20:00:50 -0000

On Mon, Jan 23, 2012 at 2:58 PM, Denis Melnikov <dbmelnikov@gmail.com> wrot=
e:
> Hi,
> after the following fragment of code named variable gets empty:
>
> ls | while read file ; do
> =A0v=3D1
> =A0break
> done
> echo $v
>
> Is it a bug or a feature?
> GNU bash, version 4.1.2(1)-release
>
> Denis
>

Pipelines create subshells. See http://mywiki.wooledge.org/BashFAQ/024

As an aside, never parse ls. Simply use a glob.


From MAILER-DAEMON Mon Jan 23 19:39:04 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RpUPf-0005HW-Rd
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2012 19:39:03 -0500
Received: from eggs.gnu.org ([140.186.70.92]:60164)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RpUPc-0005Gi-UO
	for bug-bash@gnu.org; Mon, 23 Jan 2012 19:39:02 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RpUPX-0002Zd-DN
	for bug-bash@gnu.org; Mon, 23 Jan 2012 19:39:00 -0500
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:4334)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RpUPX-0002ZZ-4P
	for bug-bash@gnu.org; Mon, 23 Jan 2012 19:38:55 -0500
Received: from mpv7.case.edu (mpv7.tis.cwru.edu [129.22.104.170])
	by mpv2.tis.cwru.edu (MOS 4.3.3-GA) with ESMTP id BHK38158;
	Mon, 23 Jan 2012 19:38:54 -0500
Received: from h72.205.189.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.189.205.72]) by mpv7.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SKD19023 (AUTH cpr);
	Mon, 23 Jan 2012 19:38:53 -0500 (EST)
Message-ID: <4F1DFD9C.5040400@case.edu>
Date: Mon, 23 Jan 2012 19:38:52 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Roger <rogerx.oss@gmail.com>
Subject: Re: Bash readline remap ESC insert/command mode key
References: <20120119065818.GA2709@localhost2.local>
	<20120119071254.GB2709@localhost2.local>
	<20120119072542.GC2709@localhost2.local>
	<4F1B71BC.6060403@case.edu>
	<20120122123536.GA2709@localhost2.local>
	<4F1C8506.9090906@case.edu>
	<20120123135217.GA9935@localhost2.local>
In-Reply-To: <20120123135217.GA9935@localhost2.local>
X-Enigmail-Version: 1.3.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: Tue, 24 Jan 2012 00:39:02 -0000

On 1/23/12 8:52 AM, Roger wrote:

> A little more indepth examination, and I can see VIM's wait is approximately 
> double of what the readline patch's wait time is.  However, I think the shorter 
> wait time is more functional as when typing a double char, it in no way takes 
> as long as VIM's wait time unless you type the same char with your finger and 
> then use a toe to type the second char.
> 
> Matter of fact, I'm starting to find VIM's long wait time length a little 
> annoying.  ;-)
> 
> Great job at guessing the wait time!

Thanks.  Half a second seemed right.

-- 
``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 Jan 23 19:41:54 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RpUSQ-0005gs-4Y
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2012 19:41:54 -0500
Received: from eggs.gnu.org ([140.186.70.92]:42252)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RpUSN-0005gm-VA
	for bug-bash@gnu.org; Mon, 23 Jan 2012 19:41:52 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RpUSM-0002qa-MS
	for bug-bash@gnu.org; Mon, 23 Jan 2012 19:41:51 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:17003)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RpUSM-0002qW-G1
	for bug-bash@gnu.org; Mon, 23 Jan 2012 19:41:50 -0500
Received: from mpv8.tis.CWRU.Edu (EHLO mpv8.case.edu) ([129.22.105.116])
	by mpv1.tis.cwru.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id BUV73058; Mon, 23 Jan 2012 19:41:49 -0500 (EST)
Received: from h72.205.189.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.189.205.72]) by mpv8.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SQS25812 (AUTH cpr);
	Mon, 23 Jan 2012 19:41:49 -0500 (EST)
Message-ID: <4F1DFE4C.8070500@case.edu>
Date: Mon, 23 Jan 2012 19:41:48 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Denis Melnikov <dbmelnikov@gmail.com>
Subject: Re: Variable undefines - bug or feature?
References: <CAG-cbm0Oc4Yq5qoyhf28qNs4q1xiFH1j2iZcedJKRYsLSLMj9w@mail.gmail.com>
In-Reply-To: <CAG-cbm0Oc4Yq5qoyhf28qNs4q1xiFH1j2iZcedJKRYsLSLMj9w@mail.gmail.com>
X-Enigmail-Version: 1.3.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 24 Jan 2012 00:41:53 -0000

On 1/23/12 2:58 PM, Denis Melnikov wrote:
> Hi,
> after the following fragment of code named variable gets empty:
> 
> ls | while read file ; do
>   v=1
>   break
> done
> echo $v
> 
> Is it a bug or a feature?
> GNU bash, version 4.1.2(1)-release

All components of a pipeline generally run in separate processes.  A
child process can't affect its parent.  If you upgrade to bash-4.2, look
at the `lastpipe' option to run the last component in the parent shell
process.

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 Jan 23 20:22:17 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RpV5V-000200-0k
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2012 20:22:17 -0500
Received: from eggs.gnu.org ([140.186.70.92]:53730)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RpV5S-0001zu-3k
	for bug-bash@gnu.org; Mon, 23 Jan 2012 20:22:15 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RpV5Q-0006ov-Pv
	for bug-bash@gnu.org; Mon, 23 Jan 2012 20:22:14 -0500
Received: from denali.acsalaska.net ([209.112.173.242]:33607)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RpV5Q-0006or-Ah
	for bug-bash@gnu.org; Mon, 23 Jan 2012 20:22:12 -0500
Received: from localhost2.local
	(66-230-83-248-rb1.fai.dsl.dynamic.acsalaska.net [66.230.83.248])
	by denali.acsalaska.net (8.14.4/8.14.4) with ESMTP id q0O1M8eD062287;
	Mon, 23 Jan 2012 16:22:08 -0900 (AKST)
	(envelope-from rogerx.oss@gmail.com)
Date: Mon, 23 Jan 2012 16:22:00 -0900
From: Roger <rogerx.oss@gmail.com>
To: chet.ramey@case.edu
Subject: Re: Bash readline remap ESC insert/command mode key
Message-ID: <20120124001647.GB9935@localhost2.local>
References: <20120119065818.GA2709@localhost2.local>
	<20120119071254.GB2709@localhost2.local>
	<20120119072542.GC2709@localhost2.local>
	<4F1B71BC.6060403@case.edu>
	<20120122123536.GA2709@localhost2.local>
	<4F1C8506.9090906@case.edu>
	<20120123135217.GA9935@localhost2.local>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20120123135217.GA9935@localhost2.local>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3
	(denali.acsalaska.net [209.112.168.121]);
	Mon, 23 Jan 2012 16:22:09 -0900 (AKST)
X-ACS-Spam-Status: no
X-ACS-Spam-Score: 1.999 (x)
X-ACS-Spam-Tests: KHOP_DYNAMIC,ACS_BOGUS_LOCALHOST
X-ACS-Scanned-By: MD 2.67; SA 3.3.0; spamdefang 1.122
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.112.173.242
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 24 Jan 2012 01:22:15 -0000

> On Mon, Jan 23, 2012 at 04:52:17AM -0900, Roger wrote:
>> On Sun, Jan 22, 2012 at 04:52:06PM -0500, Chet Ramey wrote:
>>On 1/22/12 7:35 AM, Roger wrote:
>>>> On Sat, Jan 21, 2012 at 09:17:32PM -0500, Chet Ramey wrote:
>>>>
>>>> I could look at putting in some sort of inter-character timeout, but I
>>>> don't know yet how well the code structure lends itself to that.
>>
>>Pretty easily, as it turns out.  The attached patch adds a half-second
>>timeout to the key sequence code.  Please let me know whether or not it
>>works for you.
>
>Patch seems to work great and I can now type 'exit' without command mode
>being spawned when typing the 'i'.
>
>It's behaviour is almost identical to VIM's.

Found a bug.

Think this timing patch is omitting readline support on reverse history search.  
ie:

<ctrl+r> and try typing "ping"

The display will only show "png"


There seems to be more then one spot the timing patch needs to apply.

-- 
Roger
http://rogerx.freeshell.org/


From MAILER-DAEMON Mon Jan 23 20:30:37 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RpVDZ-0002bv-M0
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2012 20:30:37 -0500
Received: from eggs.gnu.org ([140.186.70.92]:37170)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RpVDV-0002Yi-4W
	for bug-bash@gnu.org; Mon, 23 Jan 2012 20:30:34 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RpVDP-0007iL-Jx
	for bug-bash@gnu.org; Mon, 23 Jan 2012 20:30:32 -0500
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:22831)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RpVDP-0007iF-E8
	for bug-bash@gnu.org; Mon, 23 Jan 2012 20:30:27 -0500
Received: from mpv7.case.edu (mpv7.tis.cwru.edu [129.22.104.170])
	by mpv2.tis.cwru.edu (MOS 4.3.3-GA) with ESMTP id BHK41175;
	Mon, 23 Jan 2012 20:30:26 -0500
Received: from h72.205.189.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.189.205.72]) by mpv7.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SKD30248 (AUTH cpr);
	Mon, 23 Jan 2012 20:30:25 -0500 (EST)
Message-ID: <4F1E09B0.6020707@case.edu>
Date: Mon, 23 Jan 2012 20:30:24 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: jon@jonshouse.co.uk
Subject: Re: Cross compile crapout
References: <1327162423.10370.3.camel@jonspc> <4F1B5C3C.5020308@case.edu>
	<1327299146.16940.22.camel@jonspc>
In-Reply-To: <1327299146.16940.22.camel@jonspc>
X-Enigmail-Version: 1.3.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: Tue, 24 Jan 2012 01:30:34 -0000

On 1/23/12 1:12 AM, Jonathan Andrews wrote:

> I needed a statically linked bash for testing an arm board. I did not
> expect it to be nearly 3MB though ! It surprises me that a statically
> linked bash is bigger than the entire busybox binary i've compiled, or
> my kernel image for that matter. Is this bloat gcc, some failing of the
> linker or bash itself?  

That's probably the size of the C library on your machine.  The only
difference between a static bash and a `normal' bash is that the system
libraries are linked in instead of being dynamically linked at run time.

I built a minimal bash (--enable-minimal-config) on my machine (Mac OS X,
where static linking isn't possible), and it ended up being about half
as big as a bash-4.2.20 build.  I had to fix a few things to do it.

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 Jan 23 22:13:34 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RpWpC-00022j-6J
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2012 22:13:34 -0500
Received: from eggs.gnu.org ([140.186.70.92]:57181)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon@jonshouse.co.uk>) id 1RpWp9-00022d-Hu
	for bug-bash@gnu.org; Mon, 23 Jan 2012 22:13:32 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jon@jonshouse.co.uk>) id 1RpWp8-0002Jr-CU
	for bug-bash@gnu.org; Mon, 23 Jan 2012 22:13:31 -0500
Received: from [91.84.151.33] (port=48423 helo=mail.jonshouse.co.uk)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon@jonshouse.co.uk>) id 1RpWp8-0002Jn-1C
	for bug-bash@gnu.org; Mon, 23 Jan 2012 22:13:30 -0500
Received: from [10.10.10.6] (jonspc [10.10.10.6])
	by mail.jonshouse.co.uk (8.14.1/8.13.8) with ESMTP id q0O3HTQG002506;
	Tue, 24 Jan 2012 03:17:34 GMT
Subject: Re: Cross compile crapout
From: Jonathan Andrews <jon@jonshouse.co.uk>
To: chet.ramey@case.edu
In-Reply-To: <4F1E09B0.6020707@case.edu>
References: <1327162423.10370.3.camel@jonspc>  <4F1B5C3C.5020308@case.edu>
	<1327299146.16940.22.camel@jonspc>  <4F1E09B0.6020707@case.edu>
Content-Type: text/plain; charset="UTF-8"
Date: Tue, 24 Jan 2012 03:17:30 +0000
Message-ID: <1327375050.917.11.camel@jonspc>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.3 (2.28.3-1.fc12) 
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1)
X-Received-From: 91.84.151.33
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: jon@jonshouse.co.uk
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 24 Jan 2012 03:13:32 -0000

On Mon, 2012-01-23 at 20:30 -0500, Chet Ramey wrote:
> On 1/23/12 1:12 AM, Jonathan Andrews wrote:
> 
> > I needed a statically linked bash for testing an arm board. I did not
> > expect it to be nearly 3MB though ! It surprises me that a statically
> > linked bash is bigger than the entire busybox binary i've compiled, or
> > my kernel image for that matter. Is this bloat gcc, some failing of the
> > linker or bash itself?  
> 
> That's probably the size of the C library on your machine.  The only
> difference between a static bash and a `normal' bash is that the system
> libraries are linked in instead of being dynamically linked at run time.
Im not a gcc expect, I thought the idea of the linker was also to drop
unused code but this seems not to be true with gcc as default.  

http://www.google.com/url?sa=t&rct=j&q=gcc%20linker%20unused%20code&source=web&cd=5&ved=0CEYQFjAE&url=http%3A%2F%2Felinux.org%2Fimages%2F2%2F2d%2FELC2010-gc-sections_Denys_Vlasenko.pdf&ei=Tx8eT5mUGczRswaZju3eDA&usg=AFQjCNF3miTnzqYNsiiyei_SQDlDxG10TQ&cad=rja

http://gcc.gnu.org/ml/gcc-help/2003-08/msg00128.html

I've been trying to compile bash static with the extra parameters, no
joy so far - finger trouble on my part I expect.


> I built a minimal bash (--enable-minimal-config) on my machine (Mac OS X,
> where static linking isn't possible), and it ended up being about half
> as big as a bash-4.2.20 build.  I had to fix a few things to do it.
Maybe this is one of the things ?

I've applied the patches, tried this :

(script)
export CC=arm-softfloat-linux-gnu-gcc
./configure --build=i386-linux --host=arm-linux --enable-static-link --without-bash-malloc --enable-minimal-config
make


Get this :

arm-softfloat-linux-gnu-gcc  -DPROGRAM='"bash"' -DCONF_HOSTTYPE='"arm"' -DCONF_OSTYPE='"linux-gnu"' -DCONF_MACHTYPE='"arm-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 -c y.tab.c
./parse.y: In function 'shell_getc':
./parse.y:2399: error: label 'pop_alias' used but not defined
make: *** [y.tab.o] Error 1


Any ideas ?

Thanks,
Jon





From MAILER-DAEMON Tue Jan 24 08:09:49 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rpg8D-0006qK-Ij
	for mharc-bug-bash@gnu.org; Tue, 24 Jan 2012 08:09:49 -0500
Received: from eggs.gnu.org ([140.186.70.92]:46060)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rpg82-0006nK-So
	for bug-bash@gnu.org; Tue, 24 Jan 2012 08:09:47 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rpg7t-0001oO-78
	for bug-bash@gnu.org; Tue, 24 Jan 2012 08:09:38 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:34640)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rpg7s-0001oC-ST
	for bug-bash@gnu.org; Tue, 24 Jan 2012 08:09:29 -0500
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 BUW23222; Tue, 24 Jan 2012 08:09:27 -0500 (EST)
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 AQM84096 (AUTH cpr);
	Tue, 24 Jan 2012 08:09:26 -0500 (EST)
Message-ID: <4F1EAD86.6000306@case.edu>
Date: Tue, 24 Jan 2012 08:09:26 -0500
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: jon@jonshouse.co.uk
Subject: Re: Cross compile crapout
References: <1327162423.10370.3.camel@jonspc> <4F1B5C3C.5020308@case.edu>
	<1327299146.16940.22.camel@jonspc> <4F1E09B0.6020707@case.edu>
	<1327375050.917.11.camel@jonspc>
In-Reply-To: <1327375050.917.11.camel@jonspc>
X-Enigmail-Version: 1.3.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 24 Jan 2012 13:09:47 -0000

On 1/23/12 10:17 PM, Jonathan Andrews wrote:

> Im not a gcc expect, I thought the idea of the linker was also to drop
> unused code but this seems not to be true with gcc as default.

Sure, but it's the difference between all of the libc functions you use
and none of them, not what you use from libc and what you don't.

> 
> http://www.google.com/url?sa=t&rct=j&q=gcc%20linker%20unused%20code&source=web&cd=5&ved=0CEYQFjAE&url=http%3A%2F%2Felinux.org%2Fimages%2F2%2F2d%2FELC2010-gc-sections_Denys_Vlasenko.pdf&ei=Tx8eT5mUGczRswaZju3eDA&usg=AFQjCNF3miTnzqYNsiiyei_SQDlDxG10TQ&cad=rja
> 
> http://gcc.gnu.org/ml/gcc-help/2003-08/msg00128.html
> 
> I've been trying to compile bash static with the extra parameters, no
> joy so far - finger trouble on my part I expect.
> 
> 
>> I built a minimal bash (--enable-minimal-config) on my machine (Mac OS X,
>> where static linking isn't possible), and it ended up being about half
>> as big as a bash-4.2.20 build.  I had to fix a few things to do it.
> Maybe this is one of the things ?

It is.  Just comment out the goto as a quick fix.

> 
> I've applied the patches, tried this :
> 
> (script)
> export CC=arm-softfloat-linux-gnu-gcc
> ./configure --build=i386-linux --host=arm-linux --enable-static-link --without-bash-malloc --enable-minimal-config
> make
> 
> 
> Get this :
> 
> arm-softfloat-linux-gnu-gcc  -DPROGRAM='"bash"' -DCONF_HOSTTYPE='"arm"' -DCONF_OSTYPE='"linux-gnu"' -DCONF_MACHTYPE='"arm-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 -c y.tab.c
> ./parse.y: In function 'shell_getc':
> ./parse.y:2399: error: label 'pop_alias' used but not defined
> make: *** [y.tab.o] Error 1

There are a few cases like this that prevent a minimally-configured
bash from building.  In this case, it's that there is a `goto pop_alias'
but the pop_alias label is protected by an #ifdef.

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 Jan 24 10:05:13 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rphvt-0003nW-FU
	for mharc-bug-bash@gnu.org; Tue, 24 Jan 2012 10:05:13 -0500
Received: from eggs.gnu.org ([140.186.70.92]:43235)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon@jonshouse.co.uk>) id 1Rphvm-0003ko-6d
	for bug-bash@gnu.org; Tue, 24 Jan 2012 10:05:11 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jon@jonshouse.co.uk>) id 1Rphvd-0005cI-PL
	for bug-bash@gnu.org; Tue, 24 Jan 2012 10:05:06 -0500
Received: from [91.84.151.33] (port=56000 helo=mail.jonshouse.co.uk)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jon@jonshouse.co.uk>) id 1Rphvd-0005c7-Fj
	for bug-bash@gnu.org; Tue, 24 Jan 2012 10:04:57 -0500
Received: from [10.10.10.6] (jonspc [10.10.10.6])
	by mail.jonshouse.co.uk (8.14.1/8.13.8) with ESMTP id q0OF8pGd021914;
	Tue, 24 Jan 2012 15:08:57 GMT
Subject: Re: Cross compile crapout
From: Jonathan Andrews <jon@jonshouse.co.uk>
To: chet.ramey@case.edu
In-Reply-To: <4F1EAD86.6000306@case.edu>
References: <1327162423.10370.3.camel@jonspc>  <4F1B5C3C.5020308@case.edu>
	<1327299146.16940.22.camel@jonspc>  <4F1E09B0.6020707@case.edu>
	<1327375050.917.11.camel@jonspc>  <4F1EAD86.6000306@case.edu>
Content-Type: text/plain; charset="UTF-8"
Date: Tue, 24 Jan 2012 15:08:52 +0000
Message-ID: <1327417732.11846.46.camel@jonspc>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.3 (2.28.3-1.fc12) 
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1)
X-Received-From: 91.84.151.33
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: jon@jonshouse.co.uk
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 24 Jan 2012 15:05:12 -0000

On Tue, 2012-01-24 at 08:09 -0500, Chet Ramey wrote: 
> On 1/23/12 10:17 PM, Jonathan Andrews wrote:
> 
> > Im not a gcc expect, I thought the idea of the linker was also to drop
> > unused code but this seems not to be true with gcc as default.
> 
> Sure, but it's the difference between all of the libc functions you use
> and none of them, not what you use from libc and what you don't.
gcc never fails to surprise me, at the moment not in a positive way :-(

> > 
> > http://www.google.com/url?sa=t&rct=j&q=gcc%20linker%20unused%20code&source=web&cd=5&ved=0CEYQFjAE&url=http%3A%2F%2Felinux.org%2Fimages%2F2%2F2d%2FELC2010-gc-sections_Denys_Vlasenko.pdf&ei=Tx8eT5mUGczRswaZju3eDA&usg=AFQjCNF3miTnzqYNsiiyei_SQDlDxG10TQ&cad=rja
> > 
> > http://gcc.gnu.org/ml/gcc-help/2003-08/msg00128.html
> > 
> > I've been trying to compile bash static with the extra parameters, no
> > joy so far - finger trouble on my part I expect.
> > 
> > 
> >> I built a minimal bash (--enable-minimal-config) on my machine (Mac OS X,
> >> where static linking isn't possible), and it ended up being about half
> >> as big as a bash-4.2.20 build.  I had to fix a few things to do it.
> > Maybe this is one of the things ?
> 
> It is.  Just comment out the goto as a quick fix.
OK

> > 
> > I've applied the patches, tried this :
> > 
> > (script)
> > export CC=arm-softfloat-linux-gnu-gcc
> > ./configure --build=i386-linux --host=arm-linux --enable-static-link --without-bash-malloc --enable-minimal-config
> > make
> > 
> > 
> > Get this :
> > 
> > arm-softfloat-linux-gnu-gcc  -DPROGRAM='"bash"' -DCONF_HOSTTYPE='"arm"' -DCONF_OSTYPE='"linux-gnu"' -DCONF_MACHTYPE='"arm-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 -c y.tab.c
> > ./parse.y: In function 'shell_getc':
> > ./parse.y:2399: error: label 'pop_alias' used but not defined
> > make: *** [y.tab.o] Error 1
> 
> There are a few cases like this that prevent a minimally-configured
> bash from building.  In this case, it's that there is a `goto pop_alias'
> but the pop_alias label is protected by an #ifdef.

I see bash has many tests to qualify the interpreter, could it not have
a similar thing for builds, a set of the most sensible configure/make
permutations that need to be passed after each patch ?
I'm not familiar enough to the code to offer anything sensible or I
would write some.


Another one, introduced in patch5 possibly? ... 

arm-softfloat-linux-gnu-gcc  -DPROGRAM='"bash"' -DCONF_HOSTTYPE='"arm"' -DCONF_OSTYPE='"linux-gnu"' -DCONF_MACHTYPE='"arm-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 -c variables.c
variables.c:4234: error: 'sv_tz' undeclared here (not in a function)
make: *** [variables.o] Error 1


Also from previous builds:

bash-4.2/bashline.c:2105: warning: Using 'endservent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

WTF ! Words fail me, I bet some c++ lover has made this mess for
me ..... I feel so old..... take me back to 1986, a happy time ....

Is it even possible to build a statically linked bash?
I've done it before but that was in the land time forget, around kernel
2.4.24, when gcc started with a "3." and worked :-( ggrrrrr

Thanks,
Jon





From MAILER-DAEMON Tue Jan 24 11:29:11 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RpjF9-0007tJ-Dy
	for mharc-bug-bash@gnu.org; Tue, 24 Jan 2012 11:29:11 -0500
Received: from eggs.gnu.org ([140.186.70.92]:48512)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <james_avera@yahoo.com>) id 1Rpd46-0005NC-8f
	for bug-bash@gnu.org; Tue, 24 Jan 2012 04:53:26 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <james_avera@yahoo.com>) id 1Rpd42-0000DE-6l
	for bug-bash@gnu.org; Tue, 24 Jan 2012 04:53:22 -0500
Received: from qmta08.westchester.pa.mail.comcast.net ([76.96.62.80]:50106)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <james_avera@yahoo.com>) id 1Rpd42-0000D7-49
	for bug-bash@gnu.org; Tue, 24 Jan 2012 04:53:18 -0500
Received: from omta20.westchester.pa.mail.comcast.net ([76.96.62.71])
	by qmta08.westchester.pa.mail.comcast.net with comcast
	id RMqu1i0071YDfWL58MtHpy; Tue, 24 Jan 2012 09:53:17 +0000
Received: from [10.0.0.4] ([24.130.45.126])
	by omta20.westchester.pa.mail.comcast.net with comcast
	id RMtG1i00P2jLX0g3gMtHjB; Tue, 24 Jan 2012 09:53:17 +0000
Message-ID: <4F1E7F8A.2020404@yahoo.com>
Date: Tue, 24 Jan 2012 01:53:14 -0800
From: Jim Avera <james_avera@yahoo.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:8.0) Gecko/20111124 Thunderbird/8.0
MIME-Version: 1.0
To: bug-bash@gnu.org, bash@packages.debian.org
Subject: set -e in (subshells) does not work independently of outer context
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 76.96.62.80
X-Mailman-Approved-At: Tue, 24 Jan 2012 11:29:09 -0500
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: james_avera@yahoo.com
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 24 Jan 2012 09:53:26 -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   -g -O2 -Wall
uname output: Linux lxjima 3.0.0-15-generic #25-Ubuntu SMP Mon Jan 2 
17:44:42 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

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

Description:
set -e in (subshells) should be independent of surrounding context.
The man page says "[set -e] applies to the shell environment and
each subshell environment separately",
but actually set -e is prevented from working in a (subshell) if it is 
disabled in the
surrounding context.

Repeat-By:
     set +e
     (
       set -e
       cat /non/existent/path
       echo "Did not abort.  Isn't this a bug?"
     ) || true

Discussion:
     Set -e rightly ignores errors in the outer shell because of
     the || expression, but it is not clear why that should have any effect
     inside the (subshell) expression.

     For example, if you say
       set -e
       set -o errtrace
       trap 'echo -e "Command failed unexpectedly at \c"; caller 0; exit 
1' ERR

     then you might hope to find out the location of any unexpected command
     failures.  However, commands which fail in (subshell code) like above
     will not cause the trap because they will not abort the subshell.

     In summary, shouldn't set -e in (subshell code) operate independently
     of the surrounding context?



From MAILER-DAEMON Tue Jan 24 11:41:47 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RpjRL-00049j-5Q
	for mharc-bug-bash@gnu.org; Tue, 24 Jan 2012 11:41:47 -0500
Received: from eggs.gnu.org ([140.186.70.92]:53076)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1RpjRH-00049J-M5
	for bug-bash@gnu.org; Tue, 24 Jan 2012 11:41:45 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1RpjRC-0004RT-QV
	for bug-bash@gnu.org; Tue, 24 Jan 2012 11:41:43 -0500
Received: from mx1.redhat.com ([209.132.183.28]:18048)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1RpjRC-0004RL-Ji
	for bug-bash@gnu.org; Tue, 24 Jan 2012 11:41:38 -0500
Received: from int-mx12.intmail.prod.int.phx2.redhat.com
	(int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0OGfbIe027504
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Tue, 24 Jan 2012 11:41:37 -0500
Received: from [10.3.113.142] (ovpn-113-142.phx2.redhat.com [10.3.113.142])
	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id q0OGfa7o012592; Tue, 24 Jan 2012 11:41:36 -0500
Message-ID: <4F1EDF40.5030808@redhat.com>
Date: Tue, 24 Jan 2012 09:41:36 -0700
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:9.0) Gecko/20111222 Thunderbird/9.0
MIME-Version: 1.0
To: james_avera@yahoo.com
Subject: Re: set -e in (subshells) does not work independently of outer context
References: <4F1E7F8A.2020404@yahoo.com>
In-Reply-To: <4F1E7F8A.2020404@yahoo.com>
X-Enigmail-Version: 1.3.4
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="------------enigE0E28747C7E4E84FFDE54CCB"
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.132.183.28
Cc: 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: Tue, 24 Jan 2012 16:41:45 -0000

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

On 01/24/2012 02:53 AM, Jim Avera wrote:
> Description:
> set -e in (subshells) should be independent of surrounding context.
> The man page says "[set -e] applies to the shell environment and
> each subshell environment separately",
> but actually set -e is prevented from working in a (subshell) if it is
> disabled in the
> surrounding context.
>=20
> Repeat-By:
>     set +e
>     (
>       set -e
>       cat /non/existent/path
>       echo "Did not abort.  Isn't this a bug?"
>     ) || true

Alas, POSIX requires this behavior.
http://austingroupbugs.net/view.php?id=3D52


>     In summary, shouldn't set -e in (subshell code) operate independent=
ly
>     of the surrounding context?

No.  The POSIX description is clear that surrounding context affects
whether set -e is ignored in a subshell.

  2) The -e setting shall be ignored when executing the compound
          list following the while, until, if, or elif reserved word,
          a pipeline beginning with the ! reserved word, or any
          command of an AND-OR list other than the last.

My personal advice - don't ever expect 'set -e' to work; there are just
too many pitfalls and buggy shell implementations with differing
interpretations to ever expect it to be useful, even if there is a
standardized documentation for how it should behave, and even if bash
has (finally) caught up to the standards.

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


--------------enigE0E28747C7E4E84FFDE54CCB
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.11 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJPHt9AAAoJEKeha0olJ0NqroQIAKL06nY4v1HfXXJDM2UFa0F+
qXFIXCxN0KRC5kGRxsaLTYyIs+MO6P+rnm9ieGPNWowrT9lBPRBRJ5CD73R0MIfP
+bYSlV/h9gxraXopI/HdVXVCqLENIAzbG8jdMyMh6Xn3IKUimttyF2mGb062fv9q
wweMgE7ZX5d/ZQOnNh+NezMY7kUFeLuMSPlv96JKh3xOWzErxXFJGTzTbL2rhPg7
bX23WybVbOHzTvRONTB1DS8gu3znFbr0znZCUTe1T/Rcgs5qjP2z3VXKbLv6WjCk
+fgk9mA7Z3rALizo86cyVD2pDKRhYFj9XTKSjE12z42DCtbmJVB6Ek8g/Z5QGts=
=FO2/
-----END PGP SIGNATURE-----

--------------enigE0E28747C7E4E84FFDE54CCB--


From MAILER-DAEMON Tue Jan 24 11:52:21 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RpjbZ-00063s-Lc
	for mharc-bug-bash@gnu.org; Tue, 24 Jan 2012 11:52:21 -0500
Received: from eggs.gnu.org ([140.186.70.92]:35814)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RpjbP-0005v2-Ji
	for bug-bash@gnu.org; Tue, 24 Jan 2012 11:52:19 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RpjbK-0005q4-IV
	for bug-bash@gnu.org; Tue, 24 Jan 2012 11:52:11 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:8419)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RpjbK-0005pz-FR
	for bug-bash@gnu.org; Tue, 24 Jan 2012 11:52:06 -0500
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 BUW63237; Tue, 24 Jan 2012 11:52:05 -0500 (EST)
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 AQN24374 (AUTH cpr);
	Tue, 24 Jan 2012 11:52:05 -0500 (EST)
Message-ID: <4F1EE1B4.6050704@case.edu>
Date: Tue, 24 Jan 2012 11:52:04 -0500
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: jon@jonshouse.co.uk
Subject: Re: Cross compile crapout
References: <1327162423.10370.3.camel@jonspc> <4F1B5C3C.5020308@case.edu>
	<1327299146.16940.22.camel@jonspc> <4F1E09B0.6020707@case.edu>
	<1327375050.917.11.camel@jonspc> <4F1EAD86.6000306@case.edu>
	<1327417732.11846.46.camel@jonspc>
In-Reply-To: <1327417732.11846.46.camel@jonspc>
X-Enigmail-Version: 1.3.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 24 Jan 2012 16:52:19 -0000

On 1/24/12 10:08 AM, Jonathan Andrews wrote:

> Also from previous builds:
> 
> bash-4.2/bashline.c:2105: warning: Using 'endservent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
> 
> WTF ! Words fail me, I bet some c++ lover has made this mess for
> me ..... I feel so old..... take me back to 1986, a happy time ....
> 
> Is it even possible to build a statically linked bash?
> I've done it before but that was in the land time forget, around kernel
> 2.4.24, when gcc started with a "3." and worked :-( ggrrrrr

It's possible but has varying degrees of difficulty on different systems.
It's not possible at all on Mac OS X, requires a mix of static and
dynamic linking on Solaris and Linux, and is probably possible (though I
have not tried recently) on the BSDs.

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 Jan 24 12:04:26 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RpjnG-0003wJ-Hn
	for mharc-bug-bash@gnu.org; Tue, 24 Jan 2012 12:04:26 -0500
Received: from eggs.gnu.org ([140.186.70.92]:33915)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rpjn9-0003vF-Gs
	for bug-bash@gnu.org; Tue, 24 Jan 2012 12:04:25 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rpjn4-0007qJ-GT
	for bug-bash@gnu.org; Tue, 24 Jan 2012 12:04:19 -0500
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:20542)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rpjn4-0007qB-8k
	for bug-bash@gnu.org; Tue, 24 Jan 2012 12:04:14 -0500
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 BHL02306;
	Tue, 24 Jan 2012 12:03:38 -0500
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 ARB34051 (AUTH cpr);
	Tue, 24 Jan 2012 12:03:38 -0500 (EST)
Message-ID: <4F1EE46A.8090706@case.edu>
Date: Tue, 24 Jan 2012 12:03:38 -0500
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: james_avera@yahoo.com
Subject: Re: set -e in (subshells) does not work independently of outer context
References: <4F1E7F8A.2020404@yahoo.com>
In-Reply-To: <4F1E7F8A.2020404@yahoo.com>
X-Enigmail-Version: 1.3.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, bash@packages.debian.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, 24 Jan 2012 17:04:25 -0000

On 1/24/12 4:53 AM, Jim Avera wrote:

> Bash Version: 4.2
> Patch Level: 10
> Release Status: release
> 
> Description:
> set -e in (subshells) should be independent of surrounding context.
> The man page says "[set -e] applies to the shell environment and
> each subshell environment separately",
> but actually set -e is prevented from working in a (subshell) if it is
> disabled in the
> surrounding context.

That sentence is cribbed from the Posix description, and means that if
the -e setting is active in a subshell, it affects whether or not that
subshell exits on command failure, but the outer shell may or may not
exit depending on its context.

The Posix example is

	set -e; (false; echo one) | cat; echo two

where the subshell inherits set -e because it's not in a place where it's
ignored, and exits due to the `false' failing, but does not affect the
exit status of the pipeline.  The failure of the subshell does not imply
the failure of the pipeline.

As Eric said, the other parts of the Posix description make it clear that
the `ignoring set -e' status is inherited by subshells.

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


From MAILER-DAEMON Wed Jan 25 08:43:59 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rq38p-0006as-Bx
	for mharc-bug-bash@gnu.org; Wed, 25 Jan 2012 08:43:59 -0500
Received: from eggs.gnu.org ([140.186.70.92]:41985)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rq38k-0006aI-2q
	for bug-bash@gnu.org; Wed, 25 Jan 2012 08:43:58 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rq38e-0001Wd-91
	for bug-bash@gnu.org; Wed, 25 Jan 2012 08:43:53 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:43754)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rq38e-0001WT-4s
	for bug-bash@gnu.org; Wed, 25 Jan 2012 08:43:48 -0500
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 BUX42840; Wed, 25 Jan 2012 08:43:46 -0500 (EST)
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 AQO61753 (AUTH cpr);
	Wed, 25 Jan 2012 08:43:46 -0500 (EST)
Message-ID: <4F200712.6020700@case.edu>
Date: Wed, 25 Jan 2012 08:43:46 -0500
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Roger <rogerx.oss@gmail.com>
Subject: Re: Bash readline remap ESC insert/command mode key
References: <20120119065818.GA2709@localhost2.local>
	<20120119071254.GB2709@localhost2.local>
	<20120119072542.GC2709@localhost2.local>
	<4F1B71BC.6060403@case.edu>
	<20120122123536.GA2709@localhost2.local>
	<4F1C8506.9090906@case.edu>
	<20120123135217.GA9935@localhost2.local>
	<20120124001647.GB9935@localhost2.local>
In-Reply-To: <20120124001647.GB9935@localhost2.local>
X-Enigmail-Version: 1.3.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bug-bash@gnu.org, chet.ramey@case.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 25 Jan 2012 13:43:58 -0000

On 1/23/12 8:22 PM, Roger wrote:

>> Patch seems to work great and I can now type 'exit' without command mode
>> being spawned when typing the 'i'.
>>
>> It's behaviour is almost identical to VIM's.
> 
> Found a bug.

That's not really related to the timing issue, since the `i' is dropped
completely, though the fix may involve using the same code.  I'll take a
look.  Thanks for the report.

Chet

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


From MAILER-DAEMON Wed Jan 25 10:14:24 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rq4YK-0006hj-GJ
	for mharc-bug-bash@gnu.org; Wed, 25 Jan 2012 10:14:24 -0500
Received: from eggs.gnu.org ([140.186.70.92]:39741)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rq4YD-0006eU-3V
	for bug-bash@gnu.org; Wed, 25 Jan 2012 10:14:22 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rq4Y6-0003gQ-RO
	for bug-bash@gnu.org; Wed, 25 Jan 2012 10:14:17 -0500
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:58787)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rq4Y6-0003gM-Mf
	for bug-bash@gnu.org; Wed, 25 Jan 2012 10:14:10 -0500
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 BHL83871;
	Wed, 25 Jan 2012 10:14:09 -0500
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 ARC89025 (AUTH cpr);
	Wed, 25 Jan 2012 10:13:52 -0500 (EST)
Message-ID: <4F201C30.8020802@case.edu>
Date: Wed, 25 Jan 2012 10:13:52 -0500
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Andreas Schwab <schwab@linux-m68k.org>
Subject: Re: echo '-e' doesn't work as expected, or does it?
References: <20120121122403.7bb733ac@Gondolin> <jfjabg$7df$1@dough.gmane.org>
	<CAPSX3sQ6u8p27SGVjtGS04wLq6aMALRrhK_s+Jx3Cc17hS5-4Q@mail.gmail.com>
	<m2wr8iwvi5.fsf@igel.home>
In-Reply-To: <m2wr8iwvi5.fsf@igel.home>
X-Enigmail-Version: 1.3.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,
	Pierre Gaston <pierre.gaston@gmail.com>,
	Ralf Goertz <r_goertz@usenet.arcornews.de>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: chet.ramey@case.edu
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 25 Jan 2012 15:14:22 -0000

On 1/23/12 5:42 AM, Andreas Schwab wrote:

>> you might want to report a bug to suse, here i get:
> 
> It's a bug in --enable-separate-helpfiles: the generated file contains
> only one help string for echo, which happens to be the one for !V9_ECHO.

It seems like the only way to solve this reliably is to rework how the
separate helpfiles are generated.  I'll have to look at that for a future
version.  The separate helpfiles feature doesn't appear heavily used.

Chet


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


From MAILER-DAEMON Wed Jan 25 11:27:38 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rq5hC-0007S6-U8
	for mharc-bug-bash@gnu.org; Wed, 25 Jan 2012 11:27:38 -0500
Received: from eggs.gnu.org ([140.186.70.92]:35137)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1Rq5h8-0006P5-5D
	for bug-bash@gnu.org; Wed, 25 Jan 2012 11:27:35 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1Rq5VT-0005Lm-6Z
	for bug-bash@gnu.org; Wed, 25 Jan 2012 11:15:36 -0500
Received: from mx1.redhat.com ([209.132.183.28]:15591)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1Rq5VS-0005Lg-Oz
	for bug-bash@gnu.org; Wed, 25 Jan 2012 11:15:31 -0500
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 q0PGFTag022265
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Wed, 25 Jan 2012 11:15:29 -0500
Received: from [10.3.113.142] (ovpn-113-142.phx2.redhat.com [10.3.113.142])
	by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
	id q0PGFTq9001080; Wed, 25 Jan 2012 11:15:29 -0500
Message-ID: <4F202AA1.5050802@redhat.com>
Date: Wed, 25 Jan 2012 09:15:29 -0700
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:9.0) Gecko/20111222 Thunderbird/9.0
MIME-Version: 1.0
To: james_avera@yahoo.com, Bash - Bug <bug-bash@gnu.org>
Subject: Re: set -e in (subshells) does not work independently of outer context
References: <4F1E7F8A.2020404@yahoo.com> <4F1EDF40.5030808@redhat.com>
	<4F1F60A0.3050904@yahoo.com>
In-Reply-To: <4F1F60A0.3050904@yahoo.com>
X-Enigmail-Version: 1.3.4
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="------------enig29FC6A41AEF6C865189B93A9"
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: Wed, 25 Jan 2012 16:27:36 -0000

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

[re-adding the list - also, please don't top-post on technical lists]

On 01/24/2012 06:53 PM, Jim Avera wrote:
> Thanks for the quick reply.  I read the referenced article and don't
> think it says that at all.
> (http://austingroupbugs.net/view.php?id=3D52).   In fact it seems to im=
ply
> that -e *should* work inside subshell commands even if -e is otherwise
> being ignored (presumably because it is in a conditional context, etc.)=
:
>=20
> <quote>
> 3) If the exit status of a compound command **other than a subshell**
> command was the result of a failure while -e was being ignored, then -e=

> shall not apply to this command. </quote> [emphasis added]
>=20
> So what is the implication of this statement if the compound -is- a
> subshell command?  Why was the exception "other than a subshell command=
"
> specified?
> Presumably -e should apply regardless of whether it was being ignored
> outside in such cases.
>=20
> I checked, and bash's current behavior matches ksh.   So it is compatib=
le.
>=20
> But as I read the specification, bash (and ksh) do something different.=


Consider:

$ ksh -c 'set -e; { false && :; }; echo $?'
1
$ bash -c 'set -e; { false && :; }; echo $?'
1

This echoes 1.  Why?  Inside the compound command, we have an AND-OR
list; which means that the left half of the list is in a context where
-e is ignored (the 'false'); but based on the semantics of &&, the right
half is not executed.  That means the overall compound command (the '{
false && :; }') executed with a failure - but the _reason_ it failed was
due to a failure of the AND-OR command, which was in turn due to the
failure of the simple command 'false' in a context where -e is ignored.
 Therefore, the compound command has a non-zero status, but does not
trigger an exit for -e, even though -e is in effect for the overall
compound command.

Now, repeat the test with a subshell:

$ ksh -c 'set -e; ( false && : ); echo $?'
$ bash -c 'set -e; ( false && : ); echo $?'

Notice - no exit status.  Why?  Because sub-shells are the only compound
command where a non-zero status, caused for any reason (including
reasons where set -e was ignored), is fatal to the parent script.

That's what point 3 is trying to tell you.

Point 3 is _not_ requiring subshells to override the contexts where set
-e is ignored.  That is, once you are in a context where -e is ignored,
there is NOTHING you can do to get -e obeyed again, not even a subshell.

$ bash -c 'set -e; if (set -e; false; echo hi); then :; fi; echo $?'
hi
0

Even though we called set -e twice (both in the parent and in the
subshell), the fact that the subshell exists in a context where -e is
ignored (the condition of an if statement), there is nothing we can do
in the subshell to re-enable -e.

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


--------------enig29FC6A41AEF6C865189B93A9
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.11 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJPICqhAAoJEKeha0olJ0NqXxIH/0erZx5CtDNXqSSmRBBkdbsL
dKl8auDPd630yfjgSlomQuMtdntnK8d1l1lmuZYZIU8KWBiVITEGP+d7joBePThk
xD3tPGuk56zkZvu3KabtSNR1Dp1Dh5F1iN7xFiKkHz/3fMKmA2hpwNrgLENIufJh
tcrMK+BmDj5Sh9x0luq95ag4lSU4P8G9zmMaGHeSJjHxsWhXkItib3sTbXihY6Nj
3fi2puMPFvjmrhee2MZQ3mhdR0vYzyZ1zn+rCNbpsnMSAzKUrtnYYdGm3hXwdPBT
IDz0ozoN1+Gl/d069qcNXD2QKQoPsoJMLiouBMMdqAVPbjio7e263Dn7GGRqLLY=
=2I9z
-----END PGP SIGNATURE-----

--------------enig29FC6A41AEF6C865189B93A9--


From MAILER-DAEMON Wed Jan 25 13:57:34 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rq82I-0006Uf-Rr
	for mharc-bug-bash@gnu.org; Wed, 25 Jan 2012 13:57:34 -0500
Received: from eggs.gnu.org ([140.186.70.92]:44160)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <cjns1989@gmail.com>) id 1Rq82A-0006QH-Im
	for bug-bash@gnu.org; Wed, 25 Jan 2012 13:57:32 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <cjns1989@gmail.com>) id 1Rq824-0007sQ-Tt
	for bug-bash@gnu.org; Wed, 25 Jan 2012 13:57:26 -0500
Received: from mta6.srv.hcvlny.cv.net ([167.206.4.212]:54110)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <cjns1989@gmail.com>) id 1Rq824-0007sM-NU
	for bug-bash@gnu.org; Wed, 25 Jan 2012 13:57:20 -0500
Received: from pavo.local (ool-457112ca.dyn.optonline.net [69.113.18.202])
	by mta6.srv.hcvlny.cv.net
	(Sun Java System Messaging Server 6.2-9.20 (built Jul 15 2010))
	with ESMTP id <0LYD004YMBBIA180@mta6.srv.hcvlny.cv.net> for
	bug-bash@gnu.org; Wed, 25 Jan 2012 13:57:18 -0500 (EST)
Received: from gavron by pavo.local with local (Exim 4.69)
	(envelope-from <cjns1989@gmail.com>)	id 1Rq822-0000XW-Ey	for
	bug-bash@gnu.org; Wed, 25 Jan 2012 13:57:18 -0500
Date: Wed, 25 Jan 2012 13:57:18 -0500
From: Chris Jones <cjns1989@gmail.com>
Subject: Re: Bash readline remap ESC insert/command mode key
In-reply-to: <4F1DFD9C.5040400@case.edu>
To: bug-bash@gnu.org
Mail-followup-to: bug-bash@gnu.org
Message-id: <20120125185718.GA23111@pavo.local>
MIME-version: 1.0
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Content-disposition: inline
References: <20120119065818.GA2709@localhost2.local>
	<20120119071254.GB2709@localhost2.local>
	<20120119072542.GC2709@localhost2.local> <4F1B71BC.6060403@case.edu>
	<20120122123536.GA2709@localhost2.local> <4F1C8506.9090906@case.edu>
	<20120123135217.GA9935@localhost2.local> <4F1DFD9C.5040400@case.edu>
User-Agent: Mutt/1.5.18 (2008-05-17)
X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta)
X-Received-From: 167.206.4.212
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 25 Jan 2012 18:57:32 -0000

On Mon, Jan 23, 2012 at 07:38:52PM EST, Chet Ramey wrote:
> On 1/23/12 8:52 AM, Roger wrote:
> 
> > A little more indepth examination, and I can see VIM's wait is
> > approximately double of what the readline patch's wait time is.
> > However, I think the shorter wait time is more functional as when
> > typing a double char, it in no way takes as long as VIM's wait time
> > unless you type the same char with your finger and then use a toe to
> > type the second char.
> > 
> > Matter of fact, I'm starting to find VIM's long wait time length
> > a little annoying.  ;-)
> > 
> > Great job at guessing the wait time!
> 
> Thanks.  Half a second seemed right.

In Vim, I have set the timeout to 200 milliseconds rather than the
default 1000 (one whole second). 

This amounts to a typing speed of c. 5 characters per second or 60 wpm,
a reasonable goal for the average typist.

CJ







From MAILER-DAEMON Wed Jan 25 16:02:18 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rq9z0-0006Tr-IH
	for mharc-bug-bash@gnu.org; Wed, 25 Jan 2012 16:02:18 -0500
Received: from eggs.gnu.org ([140.186.70.92]:36643)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rq9yx-0006Rh-Dt
	for bug-bash@gnu.org; Wed, 25 Jan 2012 16:02:16 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rq9yv-0001Bb-TW
	for bug-bash@gnu.org; Wed, 25 Jan 2012 16:02:15 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:11729)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rq9yv-0001BP-QU
	for bug-bash@gnu.org; Wed, 25 Jan 2012 16:02:13 -0500
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 BUX91012; Wed, 25 Jan 2012 16:02:13 -0500 (EST)
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 ARD55828 (AUTH cpr);
	Wed, 25 Jan 2012 16:02:12 -0500 (EST)
Message-ID: <4F206DD4.7090207@case.edu>
Date: Wed, 25 Jan 2012 16:02:12 -0500
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Dan Douglas <ormaaj@gmail.com>
Subject: Re: [bug] Bash translates >&$var into &>$var for exported functions.
References: <2224934.EuubiIqJgO@smorgbox>
In-Reply-To: <2224934.EuubiIqJgO@smorgbox>
X-Enigmail-Version: 1.3.4
Content-Type: multipart/mixed; boundary="------------030809090302020507090500"
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: Wed, 25 Jan 2012 21:02:16 -0000

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

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

On 1/23/12 2:50 AM, Dan Douglas wrote:
> Hello, In the case of exported functions, Bash interprets a copy descriptor 
> followed by an expansion as the >& synonym for &>, resulting in the output 
> going to a file named as the value of the FD it's given.  This only applies to 
> ">&$var" and not "<&$var". I've tested various quoting, Is there some way 
> around this?

Nope, it's a bug.  The command printing code is a little aggressive about
translating >& to &>.  I've attached a patch that should be enough to
get you by.

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/

iEYEARECAAYFAk8gbdQACgkQu1hp8GTqdKuy+wCgkdDB7H/C6gUj1X1q8u/UWang
AnYAn2SoWursp9ew88MBhY5dalLn1gSZ
=lgmc
-----END PGP SIGNATURE-----

--------------030809090302020507090500
Content-Type: application/x-patch;
 name="print-redirects.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="print-redirects.patch"

KioqIC4uL2Jhc2gtNC4yLXBhdGNoZWQvcHJpbnRfY21kLmMJMjAxMS0wNC0yMSAxNjo1Mzow
MS4wMDAwMDAwMDAgLTA0MDAKLS0tIHByaW50X2NtZC5jCTIwMTItMDEtMjUgMTU6NTU6NDku
MDAwMDAwMDAwIC0wNTAwCioqKioqKioqKioqKioqKgoqKiogMTE0LDExNyAqKioqCi0tLSAx
MTQsMTIwIC0tLS0KICAjZGVmaW5lIENIRUNLX1hUUkFDRV9GUAl4dHJhY2VfZnAgPSAoeHRy
YWNlX2ZwID8geHRyYWNlX2ZwIDogc3RkZXJyKQogIAorIC8qIHNoZWxsIGV4cGFuc2lvbiBj
aGFyYWN0ZXJzOiB1c2VkIGluIHByaW50X3JlZGlyZWN0aW9uX2xpc3QgKi8KKyAjZGVmaW5l
IEVYUENIQVIoYykgKChjKSA9PSAneycgfHwgKGMpID09ICd+JyB8fCAoYykgPT0gJyQnIHx8
IChjKSA9PSAnYCcpCisgCiAgI2RlZmluZSBQUklOVF9ERUZFUlJFRF9IRVJFRE9DUyh4KSBc
CiAgICBkbyB7IFwKKioqKioqKioqKioqKioqCioqKiA5ODQsOTg3ICoqKioKLS0tIDEwMDAs
MTAwNCAtLS0tCiAgewogICAgUkVESVJFQ1QgKmhlcmVkb2NzLCAqaGR0YWlsLCAqbmV3cmVk
aXI7CisgICBjaGFyICpydzsKICAKICAgIGhlcmVkb2NzID0gKFJFRElSRUNUICopTlVMTDsK
KioqKioqKioqKioqKioqCioqKiAxMDA1LDEwMTIgKioqKgogIAkgICAgaGR0YWlsID0gaGVy
ZWRvY3MgPSBuZXdyZWRpcjsKICAJfQohICAgICAgIGVsc2UgaWYgKHJlZGlyZWN0cy0+aW5z
dHJ1Y3Rpb24gPT0gcl9kdXBsaWNhdGluZ19vdXRwdXRfd29yZCAmJiByZWRpcmVjdHMtPnJl
ZGlyZWN0b3IuZGVzdCA9PSAxKQogIAl7CiAgCSAgLyogVGVtcG9yYXJpbHkgdHJhbnNsYXRl
IGl0IGFzIHRoZSBleGVjdXRpb24gY29kZSBkb2VzLiAqLwohIAkgIHJlZGlyZWN0cy0+aW5z
dHJ1Y3Rpb24gPSByX2Vycl9hbmRfb3V0OwogIAkgIHByaW50X3JlZGlyZWN0aW9uIChyZWRp
cmVjdHMpOwogIAkgIHJlZGlyZWN0cy0+aW5zdHJ1Y3Rpb24gPSByX2R1cGxpY2F0aW5nX291
dHB1dF93b3JkOwotLS0gMTAyMiwxMDMxIC0tLS0KICAJICAgIGhkdGFpbCA9IGhlcmVkb2Nz
ID0gbmV3cmVkaXI7CiAgCX0KISAgICAgICBlbHNlIGlmIChyZWRpcmVjdHMtPmluc3RydWN0
aW9uID09IHJfZHVwbGljYXRpbmdfb3V0cHV0X3dvcmQgJiYgKHJlZGlyZWN0cy0+ZmxhZ3Mg
JiBSRURJUl9WQVJBU1NJR04pID09IDAgJiYgcmVkaXJlY3RzLT5yZWRpcmVjdG9yLmRlc3Qg
PT0gMSkKICAJewogIAkgIC8qIFRlbXBvcmFyaWx5IHRyYW5zbGF0ZSBpdCBhcyB0aGUgZXhl
Y3V0aW9uIGNvZGUgZG9lcy4gKi8KISAJICBydyA9IHJlZGlyZWN0cy0+cmVkaXJlY3RlZS5m
aWxlbmFtZS0+d29yZDsKISAJICBpZiAocncgJiYgKnJ3ICE9ICctJyAmJiBESUdJVCAoKnJ3
KSA9PSAwICYmIEVYUENIQVIgKCpydykgPT0gMCkKISAJICAgIHJlZGlyZWN0cy0+aW5zdHJ1
Y3Rpb24gPSByX2Vycl9hbmRfb3V0OwogIAkgIHByaW50X3JlZGlyZWN0aW9uIChyZWRpcmVj
dHMpOwogIAkgIHJlZGlyZWN0cy0+aW5zdHJ1Y3Rpb24gPSByX2R1cGxpY2F0aW5nX291dHB1
dF93b3JkOwo=
--------------030809090302020507090500--



From MAILER-DAEMON Wed Jan 25 20:28:30 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RqE8c-0004Zu-4E
	for mharc-bug-bash@gnu.org; Wed, 25 Jan 2012 20:28:30 -0500
Received: from eggs.gnu.org ([140.186.70.92]:55195)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RqE8Z-0004Z7-Kj
	for bug-bash@gnu.org; Wed, 25 Jan 2012 20:28:28 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RqE8P-0001Fw-Ea
	for bug-bash@gnu.org; Wed, 25 Jan 2012 20:28:27 -0500
Received: from cordova.acsalaska.net ([209.112.173.243]:8474)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RqE8P-0001FU-4B
	for bug-bash@gnu.org; Wed, 25 Jan 2012 20:28:17 -0500
Received: from localhost2.local
	(209-193-57-75-rb1.fai.dsl.dynamic.acsalaska.net [209.193.57.75])
	by cordova.acsalaska.net (8.14.4/8.14.4) with ESMTP id q0Q1SDgl095410
	for <bug-bash@gnu.org>; Wed, 25 Jan 2012 16:28:13 -0900 (AKST)
	(envelope-from rogerx.oss@gmail.com)
Date: Wed, 25 Jan 2012 16:28:13 -0900
From: Roger <rogerx.oss@gmail.com>
To: bug-bash@gnu.org
Subject: Re: Bash readline remap ESC insert/command mode key
Message-ID: <20120126012813.GA2744@localhost2.local>
References: <20120119065818.GA2709@localhost2.local>
	<20120119071254.GB2709@localhost2.local>
	<20120119072542.GC2709@localhost2.local>
	<4F1B71BC.6060403@case.edu>
	<20120122123536.GA2709@localhost2.local>
	<4F1C8506.9090906@case.edu>
	<20120123135217.GA9935@localhost2.local>
	<4F1DFD9C.5040400@case.edu> <20120125185718.GA23111@pavo.local>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20120125185718.GA23111@pavo.local>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3
	(cordova.acsalaska.net [209.112.168.121]);
	Wed, 25 Jan 2012 16:28:14 -0900 (AKST)
X-ACS-Spam-Status: no
X-ACS-Spam-Score: 1.999 (x)
X-ACS-Spam-Tests: KHOP_DYNAMIC,ACS_BOGUS_LOCALHOST
X-ACS-Scanned-By: MD 2.67; SA 3.3.0; spamdefang 1.122
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.112.173.243
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 26 Jan 2012 01:28:28 -0000

>In Vim, I have set the timeout to 200 milliseconds rather than the
>default 1000 (one whole second). 
>
>This amounts to a typing speed of c. 5 characters per second or 60 wpm,
>a reasonable goal for the average typist.

ditto. about half the default is much better.

-- 
Roger
http://rogerx.freeshell.org/


From MAILER-DAEMON Sat Jan 28 16:10:16 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RrFXM-00068m-QG
	for mharc-bug-bash@gnu.org; Sat, 28 Jan 2012 16:10:16 -0500
Received: from eggs.gnu.org ([140.186.70.92]:45495)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <law@tlinx.org>) id 1RrFXJ-00068g-OD
	for bug-bash@gnu.org; Sat, 28 Jan 2012 16:10:14 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <law@tlinx.org>) id 1RrFXI-0001lI-F8
	for bug-bash@gnu.org; Sat, 28 Jan 2012 16:10:13 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:33727
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <law@tlinx.org>) id 1RrFXH-0001kx-NQ
	for bug-bash@gnu.org; Sat, 28 Jan 2012 16:10:12 -0500
Received: from [192.168.3.11] (Athena [192.168.3.11])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q0SLA5F7012125
	for <bug-bash@gnu.org>; Sat, 28 Jan 2012 13:10:08 -0800
Message-ID: <4F246335.808@tlinx.org>
Date: Sat, 28 Jan 2012 13:05:57 -0800
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US;
	rv:1.8.1.24) Gecko/20100228 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666
MIME-Version: 1.0
To: bug-bash <bug-bash@gnu.org>
Subject: bash man page needs more examples...(i.e. >0)
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 28 Jan 2012 21:10:14 -0000

reading the section no constants:
       Constants with a leading 0 are interpreted as octal numbers.  A 
leading
       0x  or  0X  denotes  hexadecimal.   Otherwise,  numbers  take  
the form
       [base#]n, where base is a decimal number between 2 and 64  
representing
       the arithmetic base, and n is a number in that base.  If base# is 
omit-
       ted, then base 10 is used.  The digits greater than 9  are  
represented
       by  the  lowercase  letters,  the  uppercase letters, @, and _, 
in that
       order.  If base is less than or equal to 36,  lowercase  and  
uppercase
       letters may be used interchangeably to represent numbers between 
10 and
       35.

declare -i var
var=0x20; echo $var
32

ok, fine, now lest try decimal, digits > 9 represented by lower case, so
'a' seems like it would be used for base

var=a32 ;echo $var
0
                                     #nope, maybe I have to have a 
leading 0...
var=0a32; echo $var
-bash: 0a32: value too great for base (error token is "0a32")
                                      #nope, maybe he mean for me to 
actually use # after
the base...?

var=a#32; echo $var
-bash: a#32: syntax error: invalid arithmetic operator (error token is 
"#32")

                                     #nep!... Geez, Um, just exactly  
HOW should one
determine the syntax from the above?

???
thanks (I think?   though a few examples would be nice in several 
areas...)...





From MAILER-DAEMON Sat Jan 28 16:33:23 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RrFtj-0008FM-Kp
	for mharc-bug-bash@gnu.org; Sat, 28 Jan 2012 16:33:23 -0500
Received: from eggs.gnu.org ([140.186.70.92]:34769)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1RrFti-0008FF-3B
	for bug-bash@gnu.org; Sat, 28 Jan 2012 16:33:22 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1RrFtg-0004P2-Go
	for bug-bash@gnu.org; Sat, 28 Jan 2012 16:33:22 -0500
Received: from mail-out.m-online.net ([212.18.0.10]:55819)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1RrFtg-0004Ou-CJ
	for bug-bash@gnu.org; Sat, 28 Jan 2012 16:33:20 -0500
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 0F8DA1800185;
	Sat, 28 Jan 2012 22:33:16 +0100 (CET)
X-Auth-Info: cFFuAUUFNx8Zdwl8jyYf5XLerB40sDGPlU12tu7sUa0=
Received: from igel.home (ppp-88-217-122-153.dynamic.mnet-online.de
	[88.217.122.153])
	by mail.mnet-online.de (Postfix) with ESMTPA id DDBD81C0012D;
	Sat, 28 Jan 2012 22:33:16 +0100 (CET)
Received: by igel.home (Postfix, from userid 501)
	id 8EECCCA29F; Sat, 28 Jan 2012 22:33:16 +0100 (CET)
From: Andreas Schwab <schwab@linux-m68k.org>
To: Linda Walsh <bash@tlinx.org>
Subject: Re: bash man page needs more examples...(i.e. >0)
References: <4F246335.808@tlinx.org>
X-Yow: YOW!!!  I am having fun!!!
Date: Sat, 28 Jan 2012 22:33:16 +0100
In-Reply-To: <4F246335.808@tlinx.org> (Linda Walsh's message of "Sat, 28 Jan
	2012 13:05:57 -0800")
Message-ID: <m2pqe3fr6r.fsf@igel.home>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (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 <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, 28 Jan 2012 21:33:23 -0000

Linda Walsh <bash@tlinx.org> writes:

> var=0a32; echo $var
> -bash: 0a32: value too great for base (error token is "0a32")

Which part of "Constants with a leading 0 are interpreted as octal
numbers" did you not understand?

> var=a#32; echo $var
> -bash: a#32: syntax error: invalid arithmetic operator (error token is
> "#32")

Which part of "base is a decimal number between 2 and 64" did you not
understand?

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 Jan 29 05:02:57 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RrRb7-0006hr-Cu
	for mharc-bug-bash@gnu.org; Sun, 29 Jan 2012 05:02:57 -0500
Received: from eggs.gnu.org ([140.186.70.92]:54354)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <law@tlinx.org>) id 1RrRb4-0006hk-VC
	for bug-bash@gnu.org; Sun, 29 Jan 2012 05:02:55 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <law@tlinx.org>) id 1RrRb4-0001VN-0H
	for bug-bash@gnu.org; Sun, 29 Jan 2012 05:02:54 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:56647
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <law@tlinx.org>) id 1RrRb3-0001VC-6h
	for bug-bash@gnu.org; Sun, 29 Jan 2012 05:02:53 -0500
Received: from [192.168.3.11] (Athena [192.168.3.11])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q0TA2kCI011423; Sun, 29 Jan 2012 02:02:50 -0800
Message-ID: <4F24B2CE.9070600@tlinx.org>
Date: Sat, 28 Jan 2012 18:45:34 -0800
From: Linda Walsh <bash@tlinx.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US;
	rv:1.8.1.24) Gecko/20100228 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666
MIME-Version: 1.0
To: Andreas Schwab <schwab@linux-m68k.org>
Subject: Re: bash man page needs more examples...(i.e. >0)
References: <4F246335.808@tlinx.org> <m2pqe3fr6r.fsf@igel.home>
In-Reply-To: <m2pqe3fr6r.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: bug-bash <bug-bash@gnu.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 29 Jan 2012 10:02:55 -0000

Andreas Schwab wrote:
> Linda Walsh <bash@tlinx.org> writes:
>
>   
>> var=0a32; echo $var
>> -bash: 0a32: value too great for base (error token is "0a32")
>>     
>
> Which part of "Constants with a leading 0 are interpreted as octal
> numbers" did you not understand?
>   
The part that said the ones that start with 0 and are followed by an 
'x', indicating hex
don't mean octal -- someone might thing that 0 followed by a base 
indicator might
be a valid construction, presuming that had any creativity or ability to 
come up with
alternatives.


>   
>> var=a#32; echo $var
>> -bash: a#32: syntax error: invalid arithmetic operator (error token is
>> "#32")
>>     
>
> Which part of "base is a decimal number between 2 and 64" did you not
> understand?
>   

The part that says:
      digits greater than 9  are  represented
      by  the  lowercase  letters,  the  uppercase letters, @, and _, in 
that
      order. 
----
    Again, What part of that do you not get?   Obviously, you are saying 
that you either are just
as confused as I am or you haven't read the documentation (or at least 
not in the same way I read
it...)...

     It is notable, that while you are able to point out things that I 
already knew didn't work, you didn't point out what DID work.

    Thanks for your backhanded answer to the question...I now understand 
what was meant were, but the man page is far from clear, IMO, there are 
obviously (see above) alternative interpretations that are incorrect. 

ie. it means decimal numbers before the # sign, and letters after it. 

I love you too dear!

;-)




From MAILER-DAEMON Sun Jan 29 05:13:26 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RrRlG-000803-61
	for mharc-bug-bash@gnu.org; Sun, 29 Jan 2012 05:13:26 -0500
Received: from eggs.gnu.org ([140.186.70.92]:41417)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1RrRlE-0007zw-6k
	for bug-bash@gnu.org; Sun, 29 Jan 2012 05:13:24 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1RrRlD-0003Ph-7v
	for bug-bash@gnu.org; Sun, 29 Jan 2012 05:13:24 -0500
Received: from mail-out.m-online.net ([212.18.0.10]:47805)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1RrRlD-0003Pc-2q
	for bug-bash@gnu.org; Sun, 29 Jan 2012 05:13:23 -0500
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 76C101800157;
	Sun, 29 Jan 2012 11:13:20 +0100 (CET)
X-Auth-Info: NopkaetKJlGB9mQDQMCArjyVnz79xtCKPCn3sOsvEG0=
Received: from linux.local (ppp-93-104-154-148.dynamic.mnet-online.de
	[93.104.154.148])
	by mail.mnet-online.de (Postfix) with ESMTPA id A425A1C0006B;
	Sun, 29 Jan 2012 11:13:20 +0100 (CET)
Received: by linux.local (Postfix, from userid 501)
	id B261F1E5266; Sun, 29 Jan 2012 11:13:20 +0100 (CET)
From: Andreas Schwab <schwab@linux-m68k.org>
To: Linda Walsh <bash@tlinx.org>
Subject: Re: bash man page needs more examples...(i.e. >0)
References: <4F246335.808@tlinx.org> <m2pqe3fr6r.fsf@igel.home>
	<4F24B2CE.9070600@tlinx.org>
X-Yow: I selected E5...  but I didn't hear ``Sam the Sham and the Pharaohs''!
Date: Sun, 29 Jan 2012 11:13:20 +0100
In-Reply-To: <4F24B2CE.9070600@tlinx.org> (Linda Walsh's message of "Sat, 28
	Jan 2012 18:45:34 -0800")
Message-ID: <m2k44ahl4v.fsf@linux-m68k.org>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (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 <bug-bash@gnu.org>
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 29 Jan 2012 10:13:24 -0000

Linda Walsh <bash@tlinx.org> writes:

> The part that says:
>      digits greater than 9  are  represented
>      by  the  lowercase  letters,  the  uppercase letters, @, and _, in
> that
>      order. ----
>    Again, What part of that do you not get?

Which part of "decimal number" did you not understand?

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 Jan 29 13:30:57 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RrZWj-0002Vg-TZ
	for mharc-bug-bash@gnu.org; Sun, 29 Jan 2012 13:30:57 -0500
Received: from eggs.gnu.org ([140.186.70.92]:57890)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RrZWe-0002VZ-9Z
	for bug-bash@gnu.org; Sun, 29 Jan 2012 13:30:55 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RrZWa-0003Ij-8J
	for bug-bash@gnu.org; Sun, 29 Jan 2012 13:30:52 -0500
Received: from denali.acsalaska.net ([209.112.173.242]:19144)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rogerx.oss@gmail.com>) id 1RrZWZ-0003Ib-Uo
	for bug-bash@gnu.org; Sun, 29 Jan 2012 13:30:48 -0500
Received: from localhost2.local
	(216-67-48-142-rb1.fai.dsl.dynamic.acsalaska.net [216.67.48.142])
	by denali.acsalaska.net (8.14.4/8.14.4) with ESMTP id q0TIUiKn049863
	for <bug-bash@gnu.org>; Sun, 29 Jan 2012 09:30:45 -0900 (AKST)
	(envelope-from rogerx.oss@gmail.com)
Date: Sun, 29 Jan 2012 09:30:41 -0900
From: Roger <rogerx.oss@gmail.com>
To: bug-bash@gnu.org
Subject: Re: bash man page needs more examples...(i.e. >0)
Message-ID: <20120129183041.GB2717@localhost2.local>
References: <4F246335.808@tlinx.org> <m2pqe3fr6r.fsf@igel.home>
	<4F24B2CE.9070600@tlinx.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4F24B2CE.9070600@tlinx.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.2.3
	(denali.acsalaska.net [209.112.168.121]);
	Sun, 29 Jan 2012 09:30:45 -0900 (AKST)
X-ACS-Spam-Status: no
X-ACS-Spam-Score: 1.999 (x)
X-ACS-Spam-Tests: KHOP_DYNAMIC,ACS_BOGUS_LOCALHOST
X-ACS-Scanned-By: MD 2.67; SA 3.3.0; spamdefang 1.122
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.112.173.242
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 29 Jan 2012 18:30:56 -0000

> On Sat, Jan 28, 2012 at 06:45:34PM -0800, Linda Walsh wrote:
>Andreas Schwab wrote:
>> Linda Walsh <bash@tlinx.org> writes:
>>
>>   
>>> var=0a32; echo $var
>>> -bash: 0a32: value too great for base (error token is "0a32")
>>>     
>>
>> Which part of "Constants with a leading 0 are interpreted as octal
>> numbers" did you not understand?
>>   
>The part that said the ones that start with 0 and are followed by an 
>'x', indicating hex
>don't mean octal -- someone might thing that 0 followed by a base 
>indicator might
>be a valid construction, presuming that had any creativity or ability to 
>come up with
>alternatives.

Although you have a point, once you find the definition of hex and octal 
numbers, you likely won't confuse this point.

If somebody doesn't understand a word, they usually define it first before 
assuming something as such.

Basically, hex uses numbers and a-f letters.  Octal uses only numbers.  (Took 
me awhile before I understood octal.)

-- 
Roger
http://rogerx.freeshell.org/


From MAILER-DAEMON Sun Jan 29 21:21:18 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rrgru-0003iq-2H
	for mharc-bug-bash@gnu.org; Sun, 29 Jan 2012 21:21:18 -0500
Received: from eggs.gnu.org ([140.186.70.92]:44479)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rrgrr-0003gv-9H
	for bug-bash@gnu.org; Sun, 29 Jan 2012 21:21:16 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rrgrn-000260-JS
	for bug-bash@gnu.org; Sun, 29 Jan 2012 21:21:15 -0500
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:49268)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rrgrn-00025w-F0
	for bug-bash@gnu.org; Sun, 29 Jan 2012 21:21:11 -0500
Received: from mpv7.case.edu (mpv7.tis.cwru.edu [129.22.104.170])
	by mpv2.tis.cwru.edu (MOS 4.3.3-GA) with ESMTP id BHO81855;
	Sun, 29 Jan 2012 21:21:10 -0500
Received: from h72.205.189.173.dynamic.ip.windstream.net (EHLO z4.local)
	([173.189.205.72]) by mpv7.case.edu (MOS 4.3.3-GA FastPath queued)
	with ESMTP id SLI55016 (AUTH cpr);
	Sun, 29 Jan 2012 21:21:10 -0500 (EST)
Message-ID: <4F25FE8C.4050103@case.edu>
Date: Sun, 29 Jan 2012 21:21:00 -0500
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:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Linda Walsh <bash@tlinx.org>
Subject: Re: bash man page needs more examples...(i.e. >0)
References: <4F246335.808@tlinx.org> <m2pqe3fr6r.fsf@igel.home>
	<4F24B2CE.9070600@tlinx.org>
In-Reply-To: <4F24B2CE.9070600@tlinx.org>
X-Enigmail-Version: 1.3.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: Andreas Schwab <schwab@linux-m68k.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, 30 Jan 2012 02:21:16 -0000

On 1/28/12 9:45 PM, Linda Walsh wrote:

> The part that says:
>      digits greater than 9  are  represented
>      by  the  lowercase  letters,  the  uppercase letters, @, and _, in that
>      order. ----

OK.  How about if that sentence began with `When specifying n, the
digits greater ...'?

-- 
``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 Jan 30 10:29:07 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RrtAJ-0001b1-KL
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2012 10:29:07 -0500
Received: from eggs.gnu.org ([140.186.70.92]:55561)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1RrtAC-0001V9-LO
	for bug-bash@gnu.org; Mon, 30 Jan 2012 10:29:04 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1RrtAB-0004Ic-Hr
	for bug-bash@gnu.org; Mon, 30 Jan 2012 10:29:00 -0500
Received: from mail-vw0-f41.google.com ([209.85.212.41]:35257)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1RrtAB-0004IV-FX
	for bug-bash@gnu.org; Mon, 30 Jan 2012 10:28:59 -0500
Received: by vbbfd1 with SMTP id fd1so3311602vbb.0
	for <bug-bash@gnu.org>; Mon, 30 Jan 2012 07:28:58 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=WoGh78YHKpgibdS75iewX7d9uGrSQDth3LUrC01B25Q=;
	b=DWjW8ylyACBXIOqml+SH1mk3hJ3uqCqKwO7X5nptoAimRDdK8iTC65BZQ1cch1kEdn
	lGz53czDk3KZlDplE5i7BuEz2pWJBaJfNVezRO+coGnJRND5+GOEPRjG5IGoOD090qga
	ltX5+5KYoO9X2QPoJgQjbzksoyTiJgGX8wX4Q=
MIME-Version: 1.0
Received: by 10.52.24.35 with SMTP id r3mr8162130vdf.81.1327937338330; Mon, 30
	Jan 2012 07:28:58 -0800 (PST)
Sender: pyroinajar@gmail.com
Received: by 10.52.67.232 with HTTP; Mon, 30 Jan 2012 07:28:58 -0800 (PST)
In-Reply-To: <4F25FE8C.4050103@case.edu>
References: <4F246335.808@tlinx.org> <m2pqe3fr6r.fsf@igel.home>
	<4F24B2CE.9070600@tlinx.org> <4F25FE8C.4050103@case.edu>
Date: Mon, 30 Jan 2012 10:28:58 -0500
X-Google-Sender-Auth: o5yCXk9VEnFcUDa4MCZpBiMYPTM
Message-ID: <CAPg6Z09BvxTZSbSYwzAbr26zS21cM1egdGB8aU+eEr31M=FW1A@mail.gmail.com>
Subject: Re: bash man page needs more examples...(i.e. >0)
From: DJ Mills <danielmills1@gmail.com>
To: chet.ramey@case.edu
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.212.41
Cc: Linda Walsh <bash@tlinx.org>, Andreas Schwab <schwab@linux-m68k.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, 30 Jan 2012 15:29:04 -0000

> OK. =A0How about if that sentence began with `When specifying n, the
> digits greater ...'?

declare -i foo; foo=3D20#a2; echo "$foo"
202

[base#]n, 'base' is a INTEGER 2-64, then '#', followed by the number.


From MAILER-DAEMON Mon Jan 30 13:02:06 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RrvYM-0007e7-Sf
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2012 13:02:06 -0500
Received: from eggs.gnu.org ([140.186.70.92]:46129)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <iyosifov@gmail.com>) id 1RrvYK-0007e1-W5
	for bug-bash@gnu.org; Mon, 30 Jan 2012 13:02:05 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <iyosifov@gmail.com>) id 1RrvYF-0003JY-Fc
	for bug-bash@gnu.org; Mon, 30 Jan 2012 13:02:04 -0500
Received: from mail-ey0-f169.google.com ([209.85.215.169]:65324)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <iyosifov@gmail.com>) id 1RrvYF-0003JF-9h
	for bug-bash@gnu.org; Mon, 30 Jan 2012 13:01:59 -0500
Received: by eaaa11 with SMTP id a11so1484131eaa.0
	for <bug-bash@gnu.org>; Mon, 30 Jan 2012 10:01:58 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=subject:from:to:content-type:date:message-id:mime-version:x-mailer
	:content-transfer-encoding;
	bh=LyZuTf4k2zHfC6m+Qvm7TiGAjBD33U50jZ4P3bQIvOw=;
	b=CcN/d2oKKwByscd+9d1Jl+Ym7uEqGpOaKx2YlZohG1/4m3VDiaw5QlnWSGyutgHyMX
	W6gddIbkvWJBQVxSjdoia1VXDWnYWj1YhCzR1Euj508U20GHw0UfqEpJ++BB11LUAf1o
	Z6I4IMSmIQjsVjdFtFI+aWwi1jT/lqhlCldwY=
Received: by 10.213.28.5 with SMTP id k5mr3083445ebc.35.1327946518306;
	Mon, 30 Jan 2012 10:01:58 -0800 (PST)
Received: from [78.90.84.135] ([78.90.84.135])
	by mx.google.com with ESMTPS id t11sm48416902eea.10.2012.01.30.10.01.56
	(version=TLSv1/SSLv3 cipher=OTHER);
	Mon, 30 Jan 2012 10:01:57 -0800 (PST)
Subject: How to enable infinite command history
From: Ivan Yosifov <iyosifov@gmail.com>
To: bug-bash@gnu.org
Content-Type: text/plain; charset="UTF-8"
Date: Mon, 30 Jan 2012 20:01:55 +0200
Message-ID: <1327946515.5883.20.camel@sora.yosifov.net>
Mime-Version: 1.0
X-Mailer: Evolution 2.30.3 
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.215.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: Mon, 30 Jan 2012 18:02:05 -0000

Hi everyone, 

I got an admittedly basic question but I'm really at my wits' end with
this. 

How do I enable infinite command history ?

One simple suggestion I've seen online is to set HISTSIZE and
HISTFILESIZE to a large number. This is not what I need, I want
genuinely unconstrained history file growth. 

Another idea I've seen is to unset HISTSIZE and HISTFILESIZE. This
doesn't seem to work, the history file is being cropped to the default
of 500 lines.

I'm probably missing something obvious but any help is appreciated. I'm
running Bash 4.1.5 (Debian Squeeze).

Kind regards,
Ivan Yosifov



From MAILER-DAEMON Mon Jan 30 13:17:28 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RrvnE-0002dy-Cu
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2012 13:17:28 -0500
Received: from eggs.gnu.org ([140.186.70.92]:35914)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Rrvn7-0002do-Gw
	for bug-bash@gnu.org; Mon, 30 Jan 2012 13:17:27 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Rrvmz-0001OI-MN
	for bug-bash@gnu.org; Mon, 30 Jan 2012 13:17:21 -0500
Received: from mail-gx0-f169.google.com ([209.85.161.169]:56377)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Rrvmz-0001Ne-Jl
	for bug-bash@gnu.org; Mon, 30 Jan 2012 13:17:13 -0500
Received: by ggnr5 with SMTP id r5so1530364ggn.0
	for <bug-bash@gnu.org>; Mon, 30 Jan 2012 10:17:12 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type;
	bh=YyjZ+h91SSzqT1yXXzpYeJiD93VUO7EiYb/NTSytdf0=;
	b=oDLxmFkEIPll5tONp58IVHyENmGO6erllRbRLH4rgfpYTOHrzn7v9SsLX7dwFl5YpX
	mZwfJRgt7HreDeMwt1Kg0W6/C5xSbW/H+6SBafkTrJeXNSMcCG5v01ymj/XfFenIh8pp
	8ZDFQsW6KOKSKr4K1IrdzYkykbdmodQf3hoxQ=
Received: by 10.50.236.67 with SMTP id us3mr19033675igc.14.1327947432380; Mon,
	30 Jan 2012 10:17:12 -0800 (PST)
MIME-Version: 1.0
Received: by 10.42.29.136 with HTTP; Mon, 30 Jan 2012 10:16:51 -0800 (PST)
In-Reply-To: <1327946515.5883.20.camel@sora.yosifov.net>
References: <1327946515.5883.20.camel@sora.yosifov.net>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Mon, 30 Jan 2012 20:16:51 +0200
Message-ID: <CAPSX3sQx0-1rYBKPHxqFP-CzF4T+YJkaeHkFeEnZ8y=ttPZCWg@mail.gmail.com>
Subject: Re: How to enable infinite command history
To: Ivan Yosifov <iyosifov@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.161.169
Cc: bug-bash@gnu.org
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 30 Jan 2012 18:17:27 -0000

On Mon, Jan 30, 2012 at 8:01 PM, Ivan Yosifov <iyosifov@gmail.com> wrote:
> Hi everyone,
>
> I got an admittedly basic question but I'm really at my wits' end with
> this.
>
> How do I enable infinite command history ?
>
> One simple suggestion I've seen online is to set HISTSIZE and
> HISTFILESIZE to a large number. This is not what I need, I want
> genuinely unconstrained history file growth.
>
> Another idea I've seen is to unset HISTSIZE and HISTFILESIZE. This
> doesn't seem to work, the history file is being cropped to the default
> of 500 lines.
>
> I'm probably missing something obvious but any help is appreciated. I'm
> running Bash 4.1.5 (Debian Squeeze).

I don't think there is a way.
But do you plan to use bash normally?
Setting HISTFILESIZE to 2147483647 gives you 68 years of history at
one command per seconds
(I hope I got my math right)
with say 5 chars per commands it's something like 5GB of history.


From MAILER-DAEMON Mon Jan 30 14:02:49 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RrwV7-0005UL-AT
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2012 14:02:49 -0500
Received: from eggs.gnu.org ([140.186.70.92]:47942)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1RrwV0-0005D3-QJ
	for bug-bash@gnu.org; Mon, 30 Jan 2012 14:02:47 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1RrwUw-0005hm-NQ
	for bug-bash@gnu.org; Mon, 30 Jan 2012 14:02:42 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:38513
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1RrwUw-0005fr-8s
	for bug-bash@gnu.org; Mon, 30 Jan 2012 14:02:38 -0500
Received: from [192.168.3.140] (Athenae [192.168.3.140])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q0UJ2ReZ024864; Mon, 30 Jan 2012 11:02:29 -0800
Message-ID: <4F26E941.4070504@tlinx.org>
Date: Mon, 30 Jan 2012 11:02:25 -0800
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: DJ Mills <danielmills1@gmail.com>
Subject: Re: bash man page needs more examples...(i.e. >0)
References: <4F246335.808@tlinx.org>	<m2pqe3fr6r.fsf@igel.home>	<4F24B2CE.9070600@tlinx.org>	<4F25FE8C.4050103@case.edu>
	<CAPg6Z09BvxTZSbSYwzAbr26zS21cM1egdGB8aU+eEr31M=FW1A@mail.gmail.com>
In-Reply-To: <CAPg6Z09BvxTZSbSYwzAbr26zS21cM1egdGB8aU+eEr31M=FW1A@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
	q0UJ2ReZ024864
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Cc: Andreas Schwab <schwab@linux-m68k.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, 30 Jan 2012 19:02:47 -0000



DJ Mills wrote:

>> OK. =EF=BF=BDHow about if that sentence began with `When specifying n,=
 the
>> digits greater ...'?
>=20
> declare -i foo; foo=3D20#a2; echo "$foo"
> 202
>=20
> [base#]n, 'base' is a INTEGER 2-64, then '#', followed by the number.


^^^ That's much more clear!



From MAILER-DAEMON Mon Jan 30 14:17:04 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rrwiu-00010I-PN
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2012 14:17:04 -0500
Received: from eggs.gnu.org ([140.186.70.92]:41519)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Rrwir-0000wl-74
	for bug-bash@gnu.org; Mon, 30 Jan 2012 14:17:02 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Rrwin-0004SB-4o
	for bug-bash@gnu.org; Mon, 30 Jan 2012 14:17:01 -0500
Received: from mail-gx0-f169.google.com ([209.85.161.169]:51911)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pierre.gaston@gmail.com>) id 1Rrwim-0004Rq-UK
	for bug-bash@gnu.org; Mon, 30 Jan 2012 14:16:57 -0500
Received: by ggnr5 with SMTP id r5so1577008ggn.0
	for <bug-bash@gnu.org>; Mon, 30 Jan 2012 11:16:56 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=17wvZetOLbnA9Lx5cvcz5Nst9R8bWdOz4LXth7gTtn8=;
	b=sgKZa5sg5gF49eqZza9QKZCia3TohziAoDvNa/RZ06B17Y5ZdheK+PoVrzzOg3s/+g
	kMEVfrWcJjMLLgNFvwXthM4+RP1Y/tw9JzuyS1ymtFbhC7ZCGCzTiYoAnOShXj0Wbtm0
	HmtvOyqnoyStDn5yjaSKSgVpSSaI6/DCgjFuA=
Received: by 10.50.236.67 with SMTP id us3mr19231336igc.14.1327951016044; Mon,
	30 Jan 2012 11:16:56 -0800 (PST)
MIME-Version: 1.0
Received: by 10.42.29.136 with HTTP; Mon, 30 Jan 2012 11:16:33 -0800 (PST)
In-Reply-To: <4F26E941.4070504@tlinx.org>
References: <4F246335.808@tlinx.org> <m2pqe3fr6r.fsf@igel.home>
	<4F24B2CE.9070600@tlinx.org> <4F25FE8C.4050103@case.edu>
	<CAPg6Z09BvxTZSbSYwzAbr26zS21cM1egdGB8aU+eEr31M=FW1A@mail.gmail.com>
	<4F26E941.4070504@tlinx.org>
From: Pierre Gaston <pierre.gaston@gmail.com>
Date: Mon, 30 Jan 2012 21:16:33 +0200
Message-ID: <CAPSX3sT-UV_At7saGfYva1msf3j0-zPnWo0fdRxU6vbTLNpMmw@mail.gmail.com>
Subject: Re: bash man page needs more examples...(i.e. >0)
To: Linda Walsh <bash@tlinx.org>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.161.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: Mon, 30 Jan 2012 19:17:02 -0000

On Mon, Jan 30, 2012 at 9:02 PM, Linda Walsh <bash@tlinx.org> wrote:
>
>
> DJ Mills wrote:
>
>>> OK. =EF=BF=BDHow about if that sentence began with `When specifying n, =
the
>>> digits greater ...'?
>>
>>
>> declare -i foo; foo=3D20#a2; echo "$foo"
>> 202
>>
>> [base#]n, 'base' is a INTEGER 2-64, then '#', followed by the number.
>
>
>
> ^^^ That's much more clear!

But then one could think that the integer 0xa is a valid base which is
not the case since it's not a decimal number


From MAILER-DAEMON Mon Jan 30 14:22:45 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RrwoP-0001qg-Tg
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2012 14:22:45 -0500
Received: from eggs.gnu.org ([140.186.70.92]:38433)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RrwoK-0001qA-NG
	for bug-bash@gnu.org; Mon, 30 Jan 2012 14:22:44 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RrwoF-00081e-P0
	for bug-bash@gnu.org; Mon, 30 Jan 2012 14:22:40 -0500
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:59691)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RrwoF-00081U-KC
	for bug-bash@gnu.org; Mon, 30 Jan 2012 14:22:35 -0500
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 BHP41098;
	Mon, 30 Jan 2012 14:22:34 -0500
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 AQW14405; Mon, 30 Jan 2012 14:22:34 -0500 (EST)
Date: Mon, 30 Jan 2012 14:21:55 -0500
From: Chet Ramey <chet.ramey@case.edu>
Sender: Chet Ramey <chet@caleb.ins.cwru.edu>
To: danielmills1@gmail.com
Subject: Re: bash man page needs more examples...(i.e. >0)
References: <4F246335.808@tlinx.org>	<m2pqe3fr6r.fsf@igel.home>	<4F24B2CE.9070600@tlinx.org>	<4F25FE8C.4050103@case.edu>
	<CAPg6Z09BvxTZSbSYwzAbr26zS21cM1egdGB8aU+eEr31M=FW1A@mail.gmail.com>
In-Reply-To: Message from danielmills1@gmail.com of Mon,
	30 Jan 2012 10:28:58 -0500 (id
	<CAPg6Z09BvxTZSbSYwzAbr26zS21cM1egdGB8aU+eEr31M=FW1A@mail.gmail.com>)
Message-ID: <120130192155.AA88869.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: bash@tlinx.org, schwab@linux-m68k.org, bug-bash@gnu.org, chet@po.cwru.edu,
	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, 30 Jan 2012 19:22:44 -0000

> > OK.  How about if that sentence began with `When specifying n, the
> > digits greater ...'?
> 
> declare -i foo; foo=20#a2; echo "$foo"
> 202
> 
> [base#]n, 'base' is a INTEGER 2-64, then '#', followed by the number.

How is `INTEGER' any clearer?  Integer constants can be specified as octal
or hex.

-- 
``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 Jan 30 14:24:53 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RrwqT-0001yx-4O
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2012 14:24:53 -0500
Received: from eggs.gnu.org ([140.186.70.92]:58774)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1RrwqM-0001ym-9B
	for bug-bash@gnu.org; Mon, 30 Jan 2012 14:24:51 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1RrwqG-0000Cf-SN
	for bug-bash@gnu.org; Mon, 30 Jan 2012 14:24:46 -0500
Received: from mail-vx0-f169.google.com ([209.85.220.169]:47688)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1RrwqG-0000CI-Oh
	for bug-bash@gnu.org; Mon, 30 Jan 2012 14:24:40 -0500
Received: by vcbfl11 with SMTP id fl11so3541298vcb.0
	for <bug-bash@gnu.org>; Mon, 30 Jan 2012 11:24:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=/YFKemz3L9jpbJTT+kU0dZ6uXI+az71PZ6jm2yXkc54=;
	b=oGTc1g90xNgCRal/Z7didAlUZ2EsTyl7sGmtdQrJwddzDocqXItsMXvnb3zEIaiasv
	+asvszzyQkdAuR4aJHh1dGPHGdYhG5QaVXaZdM8OMlJcgL0OcC9L+BVY4syxolo5puLg
	KrkMl+wj2mHuvhA1eue+nCzUfcE3HNwATk0+0=
MIME-Version: 1.0
Received: by 10.220.106.144 with SMTP id x16mr8230159vco.20.1327951480326;
	Mon, 30 Jan 2012 11:24:40 -0800 (PST)
Sender: pyroinajar@gmail.com
Received: by 10.52.67.232 with HTTP; Mon, 30 Jan 2012 11:24:40 -0800 (PST)
In-Reply-To: <120130192155.AA88869.SM@caleb.ins.cwru.edu>
References: <4F246335.808@tlinx.org> <m2pqe3fr6r.fsf@igel.home>
	<4F24B2CE.9070600@tlinx.org> <4F25FE8C.4050103@case.edu>
	<CAPg6Z09BvxTZSbSYwzAbr26zS21cM1egdGB8aU+eEr31M=FW1A@mail.gmail.com>
	<120130192155.AA88869.SM@caleb.ins.cwru.edu>
Date: Mon, 30 Jan 2012 14:24:40 -0500
X-Google-Sender-Auth: Psn9ITU5xbVtZw1_RWACT2KazJw
Message-ID: <CAPg6Z0-i1c0FuJbHscMwW8bWR=qeMy36iQF1hzYbsn4QZjcAdw@mail.gmail.com>
Subject: Re: bash man page needs more examples...(i.e. >0)
From: DJ Mills <danielmills1@gmail.com>
To: chet.ramey@case.edu
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.220.169
Cc: bash@tlinx.org, schwab@linux-m68k.org, bug-bash@gnu.org, chet@po.cwru.edu
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 30 Jan 2012 19:24:51 -0000

> How is `INTEGER' any clearer? =A0Integer constants can be specified as oc=
tal
> or hex.

Well, ok. The quoted section from the man page specifies a decimal.


From MAILER-DAEMON Mon Jan 30 14:32:21 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rrwxh-0006HC-NJ
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2012 14:32:21 -0500
Received: from eggs.gnu.org ([140.186.70.92]:41917)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Rrwxb-0006GU-1y
	for bug-bash@gnu.org; Mon, 30 Jan 2012 14:32:20 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Rrwxa-0003mG-7i
	for bug-bash@gnu.org; Mon, 30 Jan 2012 14:32:15 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:38640
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1RrwxZ-0003lX-LL
	for bug-bash@gnu.org; Mon, 30 Jan 2012 14:32:14 -0500
Received: from [192.168.3.140] (Athenae [192.168.3.140])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q0UJW6VT030189; Mon, 30 Jan 2012 11:32:08 -0800
Message-ID: <4F26F034.3070002@tlinx.org>
Date: Mon, 30 Jan 2012 11:32:04 -0800
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: DJ Mills <danielmills1@gmail.com>
Subject: Re: bash man page needs more examples...(i.e. >0)
References: <4F246335.808@tlinx.org>	<m2pqe3fr6r.fsf@igel.home>	<4F24B2CE.9070600@tlinx.org>	<4F25FE8C.4050103@case.edu>
	<CAPg6Z09BvxTZSbSYwzAbr26zS21cM1egdGB8aU+eEr31M=FW1A@mail.gmail.com>
In-Reply-To: <CAPg6Z09BvxTZSbSYwzAbr26zS21cM1egdGB8aU+eEr31M=FW1A@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
	q0UJW6VT030189
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 173.164.175.65
Cc: Andreas Schwab <schwab@linux-m68k.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, 30 Jan 2012 19:32:20 -0000



DJ Mills wrote:

>> OK. =EF=BF=BDHow about if that sentence began with `When specifying n,=
 the
>> digits greater ...'?
>=20
> declare -i foo; foo=3D20#a2; echo "$foo"
> 202
>=20
> [base#]n, 'base' is a INTEGER 2-64, then '#', followed by the number.


---

Slightly more exact/pedantic, how about:

  Syntax for integer constants is "[BASE#]STRING", where BASE is in set {=
2..64},
'#' is the literal,  'hash' or 'crosshatch' (U+0023), and STRING represen=
ts a=20
value in the BASE, using ordered characters:  0-9a-zA-Z@_, where
a =3D 11, b =3D 12, ... A =3D 37, B =3D 38, Z =3D 61, @ =3D 62, _ =3D 63.







From MAILER-DAEMON Mon Jan 30 14:52:44 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RrxHQ-0001IN-5d
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2012 14:52:44 -0500
Received: from eggs.gnu.org ([140.186.70.92]:54562)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RrxHK-0001IH-DY
	for bug-bash@gnu.org; Mon, 30 Jan 2012 14:52:42 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RrxHG-0006jJ-Pz
	for bug-bash@gnu.org; Mon, 30 Jan 2012 14:52:38 -0500
Received: from mpv1.tis.cwru.edu ([129.22.105.36]:36662)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1RrxHG-0006j8-M7
	for bug-bash@gnu.org; Mon, 30 Jan 2012 14:52:34 -0500
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 BVB72885 (AUTH cpr);
	Mon, 30 Jan 2012 14:52:33 -0500 (EST)
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 AQW20252 (AUTH cpr);
	Mon, 30 Jan 2012 14:52:32 -0500 (EST)
Message-ID: <4F26F500.2010803@case.edu>
Date: Mon, 30 Jan 2012 14:52:32 -0500
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: DJ Mills <danielmills1@gmail.com>
Subject: Re: bash man page needs more examples...(i.e. >0)
References: <4F246335.808@tlinx.org> <m2pqe3fr6r.fsf@igel.home>
	<4F24B2CE.9070600@tlinx.org> <4F25FE8C.4050103@case.edu>
	<CAPg6Z09BvxTZSbSYwzAbr26zS21cM1egdGB8aU+eEr31M=FW1A@mail.gmail.com>
	<120130192155.AA88869.SM@caleb.ins.cwru.edu>
	<CAPg6Z0-i1c0FuJbHscMwW8bWR=qeMy36iQF1hzYbsn4QZjcAdw@mail.gmail.com>
In-Reply-To: <CAPg6Z0-i1c0FuJbHscMwW8bWR=qeMy36iQF1hzYbsn4QZjcAdw@mail.gmail.com>
X-Enigmail-Version: 1.3.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 129.22.105.36
Cc: bash@tlinx.org, schwab@linux-m68k.org, bug-bash@gnu.org, chet@po.cwru.edu,
	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, 30 Jan 2012 19:52:42 -0000

On 1/30/12 2:24 PM, DJ Mills wrote:
>> How is `INTEGER' any clearer?  Integer constants can be specified as octal
>> or hex.
> 
> Well, ok. The quoted section from the man page specifies a decimal.

How about `decimal whole number between 2 and 64'?

-- 
``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 Jan 30 16:14:34 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RryYc-0003nW-Mz
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2012 16:14:34 -0500
Received: from eggs.gnu.org ([140.186.70.92]:42754)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1RryYa-0003nJ-8Y
	for bug-bash@gnu.org; Mon, 30 Jan 2012 16:14:33 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1RryYZ-0006fs-7e
	for bug-bash@gnu.org; Mon, 30 Jan 2012 16:14:32 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:39026
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1RryYY-0006fj-QI
	for bug-bash@gnu.org; Mon, 30 Jan 2012 16:14:31 -0500
Received: from [192.168.3.140] (Athenae [192.168.3.140])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q0ULERZP013776
	for <bug-bash@gnu.org>; Mon, 30 Jan 2012 13:14:29 -0800
Message-ID: <4F270832.6050003@tlinx.org>
Date: Mon, 30 Jan 2012 13:14:26 -0800
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@gnu.org
Subject: (low priority) BUG: too large history=nohistory? (was: Re: How to
	enable infinite command history)
References: <1327946515.5883.20.camel@sora.yosifov.net>
	<CAPSX3sQx0-1rYBKPHxqFP-CzF4T+YJkaeHkFeEnZ8y=ttPZCWg@mail.gmail.com>
In-Reply-To: <CAPSX3sQx0-1rYBKPHxqFP-CzF4T+YJkaeHkFeEnZ8y=ttPZCWg@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 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, 30 Jan 2012 21:14:33 -0000

It seems there is a a platform dependent bug somewhere:

 > HISTSIZE=$(((3**15))
echo $HISTSIZE
1000000000000000
--- but you have no history...


Pierre Gaston wrote:

> Setting HISTFILESIZE to 2147483647 gives you 68 years of history at
> one command per seconds
> (I hope I got my math right)
> with say 5 chars per commands it's something like 5GB of history.
> 



From MAILER-DAEMON Mon Jan 30 16:28:15 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rrylr-000804-50
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2012 16:28:15 -0500
Received: from eggs.gnu.org ([140.186.70.92]:38844)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Rryll-0007zk-RT
	for bug-bash@gnu.org; Mon, 30 Jan 2012 16:28:14 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Rrylg-0008FP-VG
	for bug-bash@gnu.org; Mon, 30 Jan 2012 16:28:09 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:39055
	helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1Rrylg-0008ET-Hy
	for bug-bash@gnu.org; Mon, 30 Jan 2012 16:28:04 -0500
Received: from [192.168.3.140] (Athenae [192.168.3.140])
	by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id
	q0ULRxND014865
	for <bug-bash@gnu.org>; Mon, 30 Jan 2012 13:28:02 -0800
Message-ID: <4F270B5E.7060509@tlinx.org>
Date: Mon, 30 Jan 2012 13:27:58 -0800
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: set -e in (subshells) does not work independently of outer context
References: <4F1E7F8A.2020404@yahoo.com> <4F1EE46A.8090706@case.edu>
In-Reply-To: <4F1EE46A.8090706@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
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 30 Jan 2012 21:28:14 -0000



Chet Ramey wrote:

> As Eric said, the other parts of the Posix description make it clear that
> the `ignoring set -e' status is inherited by subshells.

----
	The original POSIX standard made this clear -- in that
it was only a failure of a 'simple' command that resulted' in
an err-exit'.

Since a subshell is not a 'simple command', it would not qualify
just like ((n=0)) isn't a simple command, so shouldn't trigger an
error exit...(but has in some recent versions)....

Is that fixed in bash  now?






From MAILER-DAEMON Mon Jan 30 16:55:00 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RrzBk-0002b6-G2
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2012 16:55:00 -0500
Received: from eggs.gnu.org ([140.186.70.92]:56495)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1RrzBh-0002aN-QS
	for bug-bash@gnu.org; Mon, 30 Jan 2012 16:54:58 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1RrzBg-0000MZ-BD
	for bug-bash@gnu.org; Mon, 30 Jan 2012 16:54:57 -0500
Received: from mx1.redhat.com ([209.132.183.28]:17200)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1RrzBf-0000MN-Vw
	for bug-bash@gnu.org; Mon, 30 Jan 2012 16:54:56 -0500
Received: from int-mx12.intmail.prod.int.phx2.redhat.com
	(int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0ULssnv024119
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Mon, 30 Jan 2012 16:54:54 -0500
Received: from [10.3.113.145] (ovpn-113-145.phx2.redhat.com [10.3.113.145])
	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id q0ULssaw008033; Mon, 30 Jan 2012 16:54:54 -0500
Message-ID: <4F2711AE.3060706@redhat.com>
Date: Mon, 30 Jan 2012 14:54:54 -0700
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:9.0) Gecko/20111222 Thunderbird/9.0
MIME-Version: 1.0
To: Linda Walsh <bash@tlinx.org>
Subject: Re: set -e in (subshells) does not work independently of outer context
References: <4F1E7F8A.2020404@yahoo.com> <4F1EE46A.8090706@case.edu>
	<4F270B5E.7060509@tlinx.org>
In-Reply-To: <4F270B5E.7060509@tlinx.org>
X-Enigmail-Version: 1.3.5
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="------------enigF3113618090BF30D357B95EA"
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.132.183.28
Cc: 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, 30 Jan 2012 21:54:58 -0000

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

On 01/30/2012 02:27 PM, Linda Walsh wrote:
>=20
>=20
> Chet Ramey wrote:
>=20
>> As Eric said, the other parts of the Posix description make it clear t=
hat
>> the `ignoring set -e' status is inherited by subshells.
>=20
> ----
>     The original POSIX standard made this clear -- in that
> it was only a failure of a 'simple' command that resulted' in
> an err-exit'.

Have you not read the link I pointed to?  The whole point of
http://austingroupbugs.net/view.php?id=3D52 is a claim that the POSIX 200=
1
wording for 'set -e' was buggy, because it was inconsistent with
traditional practice, and therefore that particular bug report provides
the approved TC1 wording for how 'set -e' must behave, when using only
the shell features documented by POSIX.

> Since a subshell is not a 'simple command', it would not qualify
> just like ((n=3D0)) isn't a simple command, so shouldn't trigger an
> error exit...(but has in some recent versions)....

The corrected POSIX wording makes it clear that any command, simple or
otherwise, that does not meet the list of three exclusions, causes the
shell to exit.  It's just that the three exclusions are quite broad
(anything on the left side of a pipe && or ||, anything in the
conditional statement of a compound command, and anything except
subshells that has non-zero status due to a failed inner command in a
context where set -e did not abort the inner command).  Bash 4.2 took
great pains to comply to the POSIX wording in that particular bug
report, seeing as how the original wording in POSIX 2001 was deemed buggy=
=2E

>=20
> Is that fixed in bash  now?

Yes, bash 4.2 strives to obey the POSIX wording as set forth in POSIX
bug 52.  The fact that earlier bash versions did not obey the later
POSIX wording, and were therefore incompatible with ksh behavior, is a
historical wart due to the wording bug in POSIX.

That said, ((n=3D0)) is not described by POSIX.  Here, bash might do
better to treat ((n=3D0)) the same way as ksh, even though in isolation,
it is a command exiting with non-zero status.

$ bash -c 'set -e; ((foo=3D0)); echo $?.$foo'
$ ksh -c 'set -e; ((foo=3D0)); echo $?.$foo'
1.0

Or, put another way, if POSIX were to standardize (()), then it would
probably have to amend bug 52 to describe whether (()) forms a fourth
exception to the list of commands where set -e does not cause an exit on
non-zero status.  But without a standard to follow, the fact that ksh
and bash differ in behavior is a fact of life, and you shouldn't be
using non-POSIX extensions if you want your script to be portable to
both shells.

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


--------------enigF3113618090BF30D357B95EA
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.11 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJPJxGuAAoJEKeha0olJ0NqB/kH/1nqSVWqRrXH9FH1DfUkune6
RHFq0ZR3lLZwvtmDJ7TwALwxhFuATJ8+4bs1j9Qo9UkzneU1MqLsby7oWhRe/6ag
4VUg4q4x5ubB+QVXf6cyKaKK5yf1YhPZxCKCrsigLbxhrrPoq5jnO7imf2kgfbdt
tHUzpxIjH5khDh3PgFwjVR+7Czh4ZdjsT9BdBFQB7dXsQxcea3+9Ix7r+czbf6Jb
8p0BBHnJMejauwq+1xL2RLIVSgZ+FIMS2XlOGG0ykPuCfEbZMtgdfWbWkofO8Yd5
ughP5ZMfy9huPP0wo03X88fh5rvizvX2ui1X1st8xxSo567gpueFv6dMbtIj7V4=
=gMEN
-----END PGP SIGNATURE-----

--------------enigF3113618090BF30D357B95EA--


From MAILER-DAEMON Mon Jan 30 17:21:00 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Rrzau-0004oT-HF
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2012 17:21:00 -0500
Received: from eggs.gnu.org ([140.186.70.92]:53734)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rrzar-0004lS-8Q
	for bug-bash@gnu.org; Mon, 30 Jan 2012 17:20:58 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rrzap-0005nq-Qx
	for bug-bash@gnu.org; Mon, 30 Jan 2012 17:20:57 -0500
Received: from mpv2.tis.cwru.edu ([129.22.105.37]:2310)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1Rrzap-0005nm-NH
	for bug-bash@gnu.org; Mon, 30 Jan 2012 17:20:55 -0500
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 BHP57917;
	Mon, 30 Jan 2012 17:20:54 -0500
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 AQW46155 (AUTH cpr);
	Mon, 30 Jan 2012 17:20:54 -0500 (EST)
Message-ID: <4F2717C6.1010306@case.edu>
Date: Mon, 30 Jan 2012 17:20:54 -0500
From: Chet Ramey <chet.ramey@case.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7;
	rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: Linda Walsh <bash@tlinx.org>
Subject: Re: (low priority) BUG: too large history=nohistory?
References: <1327946515.5883.20.camel@sora.yosifov.net>
	<CAPSX3sQx0-1rYBKPHxqFP-CzF4T+YJkaeHkFeEnZ8y=ttPZCWg@mail.gmail.com>
	<4F270832.6050003@tlinx.org>
In-Reply-To: <4F270832.6050003@tlinx.org>
X-Enigmail-Version: 1.3.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: Mon, 30 Jan 2012 22:20:58 -0000

On 1/30/12 4:14 PM, Linda Walsh wrote:
> It seems there is a a platform dependent bug somewhere:
> 
>> HISTSIZE=$(((3**15))
> echo $HISTSIZE
> 1000000000000000
> --- but you have no history...

It depends on how the platform does integer truncation.  Bash uses intmax_t
for its numbers internally; the readline and history libraries use ints.
On a platform where sizeof(intmax_t) == 8 and sizeof(int)==4, you'll get
truncation.  On a RHEL5 box I happen to have handy, that still means you
get a max history size of 14348907 after correcting and performing the
assignment above.

-- 
``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 Jan 31 12:08:36 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RsHC8-0007aX-DQ
	for mharc-bug-bash@gnu.org; Tue, 31 Jan 2012 12:08:36 -0500
Received: from eggs.gnu.org ([140.186.70.92]:51471)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <iyosifov@gmail.com>) id 1RsHBz-00077B-86
	for bug-bash@gnu.org; Tue, 31 Jan 2012 12:08:34 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <iyosifov@gmail.com>) id 1RsHBq-0003Ay-JG
	for bug-bash@gnu.org; Tue, 31 Jan 2012 12:08:27 -0500
Received: from mail-ey0-f169.google.com ([209.85.215.169]:50984)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <iyosifov@gmail.com>) id 1RsHBq-0003AJ-5k
	for bug-bash@gnu.org; Tue, 31 Jan 2012 12:08:18 -0500
Received: by eaag11 with SMTP id g11so74884eaa.0
	for <bug-bash@gnu.org>; Tue, 31 Jan 2012 09:08:16 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=subject:from:to:in-reply-to:references:content-type:date:message-id
	:mime-version:x-mailer:content-transfer-encoding;
	bh=nEAwRJgKFkoSMi1KDGnNaakZ3WIngeqwYixhXLox910=;
	b=IMDhWsI0ch3jrh0cMxsa5JHPFQCerhJ6ws+ZP9mkpP444lMDkXS9G3btdjRixFALMa
	+IXSzIt1lj6EbX9ACLT4rK48AGhu8CAYBWj0EyfVQS8zUbjGv+sg/iO/OzyYAWJGOfpl
	DKefrG1q02TTT5mKDu1DLeCMVAgLcj/sprNWs=
Received: by 10.213.17.4 with SMTP id q4mr521593eba.44.1328029696632;
	Tue, 31 Jan 2012 09:08:16 -0800 (PST)
Received: from [78.90.84.135] ([78.90.84.135])
	by mx.google.com with ESMTPS id o49sm39551643eeb.7.2012.01.31.09.08.15
	(version=TLSv1/SSLv3 cipher=OTHER);
	Tue, 31 Jan 2012 09:08:16 -0800 (PST)
Subject: Re: How to enable infinite command history
From: Ivan Yosifov <iyosifov@gmail.com>
To: bug-bash@gnu.org
In-Reply-To: <CAPSX3sQx0-1rYBKPHxqFP-CzF4T+YJkaeHkFeEnZ8y=ttPZCWg@mail.gmail.com>
References: <1327946515.5883.20.camel@sora.yosifov.net>
	<CAPSX3sQx0-1rYBKPHxqFP-CzF4T+YJkaeHkFeEnZ8y=ttPZCWg@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"
Date: Tue, 31 Jan 2012 19:08:14 +0200
Message-ID: <1328029694.14288.25.camel@sora.yosifov.net>
Mime-Version: 1.0
X-Mailer: Evolution 2.30.3 
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.215.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: Tue, 31 Jan 2012 17:08:34 -0000

On Mon, 2012-01-30 at 20:16 +0200, Pierre Gaston wrote:
> On Mon, Jan 30, 2012 at 8:01 PM, Ivan Yosifov <iyosifov@gmail.com> wrote:
> > Hi everyone,
> >
> > I got an admittedly basic question but I'm really at my wits' end with
> > this.
> >
> > How do I enable infinite command history ?
> >
> > One simple suggestion I've seen online is to set HISTSIZE and
> > HISTFILESIZE to a large number. This is not what I need, I want
> > genuinely unconstrained history file growth.
> >
> > Another idea I've seen is to unset HISTSIZE and HISTFILESIZE. This
> > doesn't seem to work, the history file is being cropped to the default
> > of 500 lines.
> >
> > I'm probably missing something obvious but any help is appreciated. I'm
> > running Bash 4.1.5 (Debian Squeeze).
> 
> I don't think there is a way.
> But do you plan to use bash normally?
> Setting HISTFILESIZE to 2147483647 gives you 68 years of history at
> one command per seconds
> (I hope I got my math right)
> with say 5 chars per commands it's something like 5GB of history.

On Mon, 2012-01-30 at 20:16 +0200, Pierre Gaston wrote:
On Mon, Jan 30, 2012 at 8:01 PM, Ivan Yosifov <iyosifov@gmail.com>
wrote:
> > Hi everyone,
> >
> > I got an admittedly basic question but I'm really at my wits' end
with
> > this.
> >
> > How do I enable infinite command history ?
> >
> > One simple suggestion I've seen online is to set HISTSIZE and
> > HISTFILESIZE to a large number. This is not what I need, I want
> > genuinely unconstrained history file growth.
> >
> > Another idea I've seen is to unset HISTSIZE and HISTFILESIZE. This
> > doesn't seem to work, the history file is being cropped to the
default
> > of 500 lines.
> >
> > I'm probably missing something obvious but any help is appreciated.
I'm
> > running Bash 4.1.5 (Debian Squeeze).
> 
> I don't think there is a way.
> But do you plan to use bash normally?
> Setting HISTFILESIZE to 2147483647 gives you 68 years of history at
> one command per seconds
> (I hope I got my math right)
> with say 5 chars per commands it's something like 5GB of history.
> 
Thank you for stating it clearly. I suppose I'll either use the above
number or mess a bit with the source. 

My actual use case for this is as follows: 

Sometimes I run some useful and non-trivial command that I don't want to
bother writing down somewhere separate but I want to be able to find
later by grepping the history file. For example, more than a year ago I
used a pipeline to convert a .flac music file to .mp3. I still remember
the the name of the song involved so I could easily find the command
with grep (if the history file still had it, of course). 

On the other hand, I do a lot of work from the shell anyway. So the
history file gets flooded with trivia like make invocations, cd <some
autocompleted name that could be 200 characters long>, etc, etc. 

In the end, I had set HISTFILESIZE to some supposedly large number and a
year later I couldn't find the flac->mp3 command any more, so I wanted
the history rotation turned off entirely. I got hundreds of GB of free
hdd space so I absolutely don't care about the size of the history file.
Maybe my limit wasn't large enough (wasn't 2147483647 though was still
"big") or maybe I messed up something else and it didn't work. 




From MAILER-DAEMON Tue Jan 31 12:23:33 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RsHQb-0002QJ-Kv
	for mharc-bug-bash@gnu.org; Tue, 31 Jan 2012 12:23:33 -0500
Received: from eggs.gnu.org ([140.186.70.92]:55396)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1RsHQU-0002PH-EA
	for bug-bash@gnu.org; Tue, 31 Jan 2012 12:23:32 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1RsHQL-00061k-QV
	for bug-bash@gnu.org; Tue, 31 Jan 2012 12:23:26 -0500
Received: from mail-vw0-f41.google.com ([209.85.212.41]:47962)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <pyroinajar@gmail.com>) id 1RsHQL-00061H-NX
	for bug-bash@gnu.org; Tue, 31 Jan 2012 12:23:17 -0500
Received: by vbip1 with SMTP id p1so267411vbi.0
	for <bug-bash@gnu.org>; Tue, 31 Jan 2012 09:23:16 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type;
	bh=IBiKL1OGidc+rDdZrKKTBG3NyCE7RZ8YhWP3fN4/zb8=;
	b=X9t5LUmsePoY4Bx/veIlZhxIfz86kVW3mLSEmGo5w4SCF6xHyXwExVcY4aoR8kBEhi
	PGhYcc46f9usa2ohO8OmRmU0xX6xIXNN6vJ0oDkhLlj18yF5b2NQPVmWlPwXKNu613cH
	d06L+zHrrg5bSYqNfWpQXbvtZx8nsu3f5G4Mw=
MIME-Version: 1.0
Received: by 10.52.24.35 with SMTP id r3mr11281597vdf.81.1328030596589; Tue,
	31 Jan 2012 09:23:16 -0800 (PST)
Sender: pyroinajar@gmail.com
Received: by 10.52.67.232 with HTTP; Tue, 31 Jan 2012 09:23:16 -0800 (PST)
In-Reply-To: <1328029694.14288.25.camel@sora.yosifov.net>
References: <1327946515.5883.20.camel@sora.yosifov.net>
	<CAPSX3sQx0-1rYBKPHxqFP-CzF4T+YJkaeHkFeEnZ8y=ttPZCWg@mail.gmail.com>
	<1328029694.14288.25.camel@sora.yosifov.net>
Date: Tue, 31 Jan 2012 12:23:16 -0500
X-Google-Sender-Auth: t-0X40KuzFEusU3F_BAzkx0AIvI
Message-ID: <CAPg6Z0_BQkO1aYt0Zst2-yWDSx0yFKtaiUcaKS7ms7_p6rbNxA@mail.gmail.com>
Subject: Re: How to enable infinite command history
From: DJ Mills <danielmills1@gmail.com>
To: Ivan Yosifov <iyosifov@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.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: Tue, 31 Jan 2012 17:23:32 -0000

On Tue, Jan 31, 2012 at 12:08 PM, Ivan Yosifov <iyosifov@gmail.com> wrote:
> On Mon, 2012-01-30 at 20:16 +0200, Pierre Gaston wrote:
>> On Mon, Jan 30, 2012 at 8:01 PM, Ivan Yosifov <iyosifov@gmail.com> wrote:
>> > Hi everyone,
>> >
>> > I got an admittedly basic question but I'm really at my wits' end with
>> > this.
>> >
>> > How do I enable infinite command history ?
>> >
>> > One simple suggestion I've seen online is to set HISTSIZE and
>> > HISTFILESIZE to a large number. This is not what I need, I want
>> > genuinely unconstrained history file growth.
>> >
>> > Another idea I've seen is to unset HISTSIZE and HISTFILESIZE. This
>> > doesn't seem to work, the history file is being cropped to the default
>> > of 500 lines.
>> >
>> > I'm probably missing something obvious but any help is appreciated. I'm
>> > running Bash 4.1.5 (Debian Squeeze).
>>
>> I don't think there is a way.
>> But do you plan to use bash normally?
>> Setting HISTFILESIZE to 2147483647 gives you 68 years of history at
>> one command per seconds
>> (I hope I got my math right)
>> with say 5 chars per commands it's something like 5GB of history.
>
> On Mon, 2012-01-30 at 20:16 +0200, Pierre Gaston wrote:
> On Mon, Jan 30, 2012 at 8:01 PM, Ivan Yosifov <iyosifov@gmail.com>
> wrote:
>> > Hi everyone,
>> >
>> > I got an admittedly basic question but I'm really at my wits' end
> with
>> > this.
>> >
>> > How do I enable infinite command history ?
>> >
>> > One simple suggestion I've seen online is to set HISTSIZE and
>> > HISTFILESIZE to a large number. This is not what I need, I want
>> > genuinely unconstrained history file growth.
>> >
>> > Another idea I've seen is to unset HISTSIZE and HISTFILESIZE. This
>> > doesn't seem to work, the history file is being cropped to the
> default
>> > of 500 lines.
>> >
>> > I'm probably missing something obvious but any help is appreciated.
> I'm
>> > running Bash 4.1.5 (Debian Squeeze).
>>
>> I don't think there is a way.
>> But do you plan to use bash normally?
>> Setting HISTFILESIZE to 2147483647 gives you 68 years of history at
>> one command per seconds
>> (I hope I got my math right)
>> with say 5 chars per commands it's something like 5GB of history.
>>
> Thank you for stating it clearly. I suppose I'll either use the above
> number or mess a bit with the source.
>
> My actual use case for this is as follows:
>
> Sometimes I run some useful and non-trivial command that I don't want to
> bother writing down somewhere separate but I want to be able to find
> later by grepping the history file. For example, more than a year ago I
> used a pipeline to convert a .flac music file to .mp3. I still remember
> the the name of the song involved so I could easily find the command
> with grep (if the history file still had it, of course).
>
> On the other hand, I do a lot of work from the shell anyway. So the
> history file gets flooded with trivia like make invocations, cd <some
> autocompleted name that could be 200 characters long>, etc, etc.
>
> In the end, I had set HISTFILESIZE to some supposedly large number and a
> year later I couldn't find the flac->mp3 command any more, so I wanted
> the history rotation turned off entirely. I got hundreds of GB of free
> hdd space so I absolutely don't care about the size of the history file.
> Maybe my limit wasn't large enough (wasn't 2147483647 though was still
> "big") or maybe I messed up something else and it didn't work.
>
>
>

Consider looking at http://mywiki.wooledge.org/BashFAQ/088, and archiving
old history files. A history file that large will considerably slow down bash.

Also, you may want to look into HISTIGNORE and related variables, to avoid
storing those trivial commands.


From MAILER-DAEMON Tue Jan 31 12:24:14 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1RsHRG-0002Y2-Oa
	for mharc-bug-bash@gnu.org; Tue, 31 Jan 2012 12:24:14 -0500
Received: from eggs.gnu.org ([140.186.70.92]:55595)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dennistwilliamson@gmail.com>) id 1RsHR9-0002XO-Ob
	for bug-bash@gnu.org; Tue, 31 Jan 2012 12:24:13 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dennistwilliamson@gmail.com>) id 1RsHR2-0006CR-1I
	for bug-bash@gnu.org; Tue, 31 Jan 2012 12:24:07 -0500
Received: from mail-iy0-f169.google.com ([209.85.210.169]:47507)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dennistwilliamson@gmail.com>) id 1RsHR1-0006C3-SE
	for bug-bash@gnu.org; Tue, 31 Jan 2012 12:24:00 -0500
Received: by iagz16 with SMTP id z16so321720iag.0
	for <bug-bash@gnu.org>; Tue, 31 Jan 2012 09:23:58 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type;
	bh=0uYVtMzGMdQUQcCHDTt9mEfqInbuZCwrnBiJvrGMDJ4=;
	b=LYA50FekMsET7xhI0tqmgchrPx3Ih14BzP3UOnVN54Uaxh7nO7GwWLoVSla9aM37Vc
	GkLo6ZAlDY5BZGp45YzsVsvgqvrK+PJqGb4N3zqGYsHGNB5T4hIe7Y2HN/0pBv8KcxuX
	Uz4amCNwBDrtZVbgKzw5tbCWKFXNTrJTOKNHA=
MIME-Version: 1.0
Received: by 10.42.144.2 with SMTP id z2mr16253773icu.18.1328030638596; Tue,
	31 Jan 2012 09:23:58 -0800 (PST)
Received: by 10.42.134.193 with HTTP; Tue, 31 Jan 2012 09:23:58 -0800 (PST)
Received: by 10.42.134.193 with HTTP; Tue, 31 Jan 2012 09:23:58 -0800 (PST)
In-Reply-To: <1328029694.14288.25.camel@sora.yosifov.net>
References: <1327946515.5883.20.camel@sora.yosifov.net>
	<CAPSX3sQx0-1rYBKPHxqFP-CzF4T+YJkaeHkFeEnZ8y=ttPZCWg@mail.gmail.com>
	<1328029694.14288.25.camel@sora.yosifov.net>
Date: Tue, 31 Jan 2012 11:23:58 -0600
Message-ID: <CANaoh6JtdsgLT0ZjAwpH6xgAFYcnSG01OdLP2wQ00L1i-459dw@mail.gmail.com>
Subject: Re: How to enable infinite command history
From: Dennis Williamson <dennistwilliamson@gmail.com>
To: Ivan Yosifov <iyosifov@gmail.com>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.210.169
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: Tue, 31 Jan 2012 17:24:13 -0000

On Jan 31, 2012 11:08 AM, "Ivan Yosifov" <iyosifov@gmail.com> wrote:
>
> On Mon, 2012-01-30 at 20:16 +0200, Pierre Gaston wrote:
> > On Mon, Jan 30, 2012 at 8:01 PM, Ivan Yosifov <iyosifov@gmail.com>
wrote:
> > > Hi everyone,
> > >
> > > I got an admittedly basic question but I'm really at my wits' end with
> > > this.
> > >
> > > How do I enable infinite command history ?
> > >
> > > One simple suggestion I've seen online is to set HISTSIZE and
> > > HISTFILESIZE to a large number. This is not what I need, I want
> > > genuinely unconstrained history file growth.
> > >
> > > Another idea I've seen is to unset HISTSIZE and HISTFILESIZE. This
> > > doesn't seem to work, the history file is being cropped to the default
> > > of 500 lines.
> > >
> > > I'm probably missing something obvious but any help is appreciated.
I'm
> > > running Bash 4.1.5 (Debian Squeeze).
> >
> > I don't think there is a way.
> > But do you plan to use bash normally?
> > Setting HISTFILESIZE to 2147483647 gives you 68 years of history at
> > one command per seconds
> > (I hope I got my math right)
> > with say 5 chars per commands it's something like 5GB of history.
>
> On Mon, 2012-01-30 at 20:16 +0200, Pierre Gaston wrote:
> On Mon, Jan 30, 2012 at 8:01 PM, Ivan Yosifov <iyosifov@gmail.com>
> wrote:
> > > Hi everyone,
> > >
> > > I got an admittedly basic question but I'm really at my wits' end
> with
> > > this.
> > >
> > > How do I enable infinite command history ?
> > >
> > > One simple suggestion I've seen online is to set HISTSIZE and
> > > HISTFILESIZE to a large number. This is not what I need, I want
> > > genuinely unconstrained history file growth.
> > >
> > > Another idea I've seen is to unset HISTSIZE and HISTFILESIZE. This
> > > doesn't seem to work, the history file is being cropped to the
> default
> > > of 500 lines.
> > >
> > > I'm probably missing something obvious but any help is appreciated.
> I'm
> > > running Bash 4.1.5 (Debian Squeeze).
> >
> > I don't think there is a way.
> > But do you plan to use bash normally?
> > Setting HISTFILESIZE to 2147483647 gives you 68 years of history at
> > one command per seconds
> > (I hope I got my math right)
> > with say 5 chars per commands it's something like 5GB of history.
> >
> Thank you for stating it clearly. I suppose I'll either use the above
> number or mess a bit with the source.
>
> My actual use case for this is as follows:
>
> Sometimes I run some useful and non-trivial command that I don't want to
> bother writing down somewhere separate but I want to be able to find
> later by grepping the history file. For example, more than a year ago I
> used a pipeline to convert a .flac music file to .mp3. I still remember
> the the name of the song involved so I could easily find the command
> with grep (if the history file still had it, of course).
>
> On the other hand, I do a lot of work from the shell anyway. So the
> history file gets flooded with trivia like make invocations, cd <some
> autocompleted name that could be 200 characters long>, etc, etc.
>
> In the end, I had set HISTFILESIZE to some supposedly large number and a
> year later I couldn't find the flac->mp3 command any more, so I wanted
> the history rotation turned off entirely. I got hundreds of GB of free
> hdd space so I absolutely don't care about the size of the history file.
> Maybe my limit wasn't large enough (wasn't 2147483647 though was still
> "big") or maybe I messed up something else and it didn't work.
>
>
>

I have the same use case. Try one of my logging functions at
http://stackoverflow.com/945288/26428 By setting it up to use a separate
logging file, you can accumulate as much history as you like. It also saves
the current directory and other information. The Bash history file will
still function normally.

