From MAILER-DAEMON Sun Jan 01 17:51:14 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cNoyA-0005uU-Kg
	for mharc-bug-bash@gnu.org; Sun, 01 Jan 2017 17:51:14 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:34070)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rmk+bug-bash=gnu.org@armlinux.org.uk>)
	id 1cNnGM-0001wF-Lg
	for bug-bash@gnu.org; Sun, 01 Jan 2017 16:01:55 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rmk+bug-bash=gnu.org@armlinux.org.uk>)
	id 1cNnGH-0002h6-QL
	for bug-bash@gnu.org; Sun, 01 Jan 2017 16:01:54 -0500
Received: from pandora.armlinux.org.uk ([78.32.30.218]:42502)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <rmk+bug-bash=gnu.org@armlinux.org.uk>)
	id 1cNnGH-0002gW-9o
	for bug-bash@gnu.org; Sun, 01 Jan 2017 16:01:49 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=armlinux.org.uk; s=pandora-2014; 
	h=Date:Sender:Message-Id:Subject:To:From;
	bh=FFknXjtD1ec8PaTkM94hIDDYh3cKqWmntI/SeM/SBE0=; 
	b=qZsA495obDUHJRn5SLCF6vkz9wvxprg/Vwk6exggXhvJe4kJdk6hla+ZDBzvpZXyT9vroKoGF2LPChbJknFGJodSodEo1kTu/wQerL8gG1hkX4VLpZofY1JlhPedMe9RWqMI40iCPbspHuHtmmiq4+WxxqfUXKDaWYUi/Seg4xA=;
Received: from flint.armlinux.org.uk
	([2002:4e20:1eda:1:201:2ff:fe14:8fad]:34486)
	by pandora.armlinux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256)
	(Exim 4.82_1-5b7a7c0-XX) (envelope-from <rmk@armlinux.org.uk>)
	id 1cNnG4-0001b9-Ph; Sun, 01 Jan 2017 21:01:37 +0000
Received: from rmk by flint.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX)
	(envelope-from <rmk@flint.armlinux.org.uk>)
	id 1cNnFx-0007G2-S2; Sun, 01 Jan 2017 21:01:29 +0000
From: rmk@armlinux.org.uk
To: bug-bash@gnu.org,bash@packages.debian.org
Subject: bash randomly logs out on VT / serial console
Message-Id: <E1cNnFx-0007G2-S2@flint.armlinux.org.uk>
Sender: Russell King <rmk@armlinux.org.uk>
Date: Sun, 01 Jan 2017 21:01:29 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 78.32.30.218
X-Mailman-Approved-At: Sun, 01 Jan 2017 17:51:13 -0500
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 01 Jan 2017 21:01:55 -0000

Configuration Information [Automatically generated, do not change]:
Machine: aarch64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='aarch64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='aarch64-unknown-linux-gnu' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I../. -I.././include -I.././lib  -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall
uname output: Linux mcbin 4.9.0+ #249 SMP PREEMPT Sun Jan 1 17:28:33 GMT 2017 aarch64 aarch64 aarch64 GNU/Linux
Machine Type: aarch64-unknown-linux-gnu

Bash Version: 4.3
Patch Level: 30
Release Status: release

Description:
	Running:
		while :; do s=$(sleep .005 | cat); echo $s; done | uniq
	in a login shell on a virtual terminal or serial console results
	in the shell randomly logging out after ^C.

	Debugging reveals that:
	(a) the top-level shell sets the terminal PGRP and current process
	 group to the shell's process ID (shell_pgrp as bash calls it).
	 However, when bash gets around to reading input, it receives an
	 EIO error - kernel debugging shows that this is because the TTY
	 PGRP does not match the processes PGRP at this point.
	(b) the sub-shell running the "while" does not wait for the $(...)
	 to finish before sending itself a SIGINT.
	(c) the sub-sub-shell for the $(...) waits for the "sleep" command
	 to terminate, and then sets the PGRP and current process group to
	 original_pgrp, which is the login process ID.

	stracing the shell (strace -tt -ff -o str.bash -p <shell-pid>)
	and grepping the resulting log files for SPGRP shows:

str.bash.10928:17:38:38.745323 ioctl(255, TIOCGPGRP, [14119]) = 0
str.bash.10928:17:38:39.478119 ioctl(255, TIOCSPGRP, [10928]) = 0
str.bash.10928:17:38:39.480458 ioctl(255, TIOCSPGRP, [10928]) = 0
str.bash.10928:17:38:39.902027 ioctl(255, TIOCSPGRP, [10875]) = 0
str.bash.14119:17:38:38.719282 ioctl(255, TIOCSPGRP, [14119]) = 0
str.bash.14119:17:38:39.476968 ioctl(255, TIOCSPGRP, [10875]) = 0
str.bash.14120:17:38:38.718508 ioctl(255, TIOCSPGRP, [14119]) = 0
str.bash.14241:17:38:39.485459 ioctl(255, TIOCSPGRP, [10875]) = 0
str.bash.14243:17:38:39.477927 ioctl(255, TIOCSPGRP, [10875]) = 0

	and stracing the login shell for terminal IO:
str.bash.10928:17:38:39.482909 write(2, "root@mcbin:~# ", 14) = 14
str.bash.10928:17:38:39.483027 read(0, "\33", 1)       = 1
str.bash.10928:17:38:39.870424 read(0, 0x7fc81f8737, 1) = -1 EIO (Input/output error)
str.bash.10928:17:38:39.884115 write(2, "\7", 1)       = 1
str.bash.10928:17:38:39.884212 read(0, 0x7fc81f87a7, 1) = -1 EIO (Input/output error)
str.bash.10928:17:38:39.899960 write(2, "logout\n", 7) = 7

	From the timestamps, you can see that PID 14241 changed the TTY
	PGRP between the write-out of the prompt, reading the first
	character of input, and attempting to read the subsequent
	characters - resulting in the shell logging itself out.

	Here, pid 10875 was the login process.

	Adding debug into give_terminal_to() changes the timing enough
	that it becomes very difficult to trigger.  Remove the debug and
	it seems to be soo easy that bash is painful to use on such a
	terminal.

	(My command which discovered this was slightly more complex and
	 useful than the above, but the above is a simpler test case
	 which reproduces the problem.)

Repeat-By:
	Login on a serial console.  Probably logging in on a Linux
	virtual terminal will also be good enough.  Not a SSH connection,
	there needs to be a login(8) process as bash's parent.

	Run:
	  while :; do s=$(sleep .005 | cat); echo $s; done | uniq

	Hit ^c.  Repeat a few times.  Tested on a quad-core ARM64 machine
	and a dual-core 32-bit ARM machine.


From MAILER-DAEMON Sun Jan 01 21:15:06 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cNs9S-0001aG-42
	for mharc-bug-bash@gnu.org; Sun, 01 Jan 2017 21:15:06 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:33689)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cNs9P-0001Zx-I2
	for bug-bash@gnu.org; Sun, 01 Jan 2017 21:15:05 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cNs9K-0003yI-H1
	for bug-bash@gnu.org; Sun, 01 Jan 2017 21:15:03 -0500
Received: from mpv2-2015.cwru.edu ([129.22.103.227]:32672
	helo=mpv1-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1cNs9K-0003y2-DL
	for bug-bash@gnu.org; Sun, 01 Jan 2017 21:14:58 -0500
Received: from mpv7-2015.CWRU.Edu (EHLO mpv7-2015.case.edu) ([129.22.103.242])
	by mpv2-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AKK05747; Sun, 01 Jan 2017 21:14:47 -0500 (EST)
Received: from h177.182.142.40.ip.windstream.net (EHLO jenna.local)
	([40.142.182.177])
	by mpv7-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id FLU56907 (AUTH cpr);
	Sun, 01 Jan 2017 21:14:47 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: bash randomly logs out on VT / serial console
References: <E1cNnFx-0007G2-S2@flint.armlinux.org.uk>
To: rmk@armlinux.org.uk, bug-bash@gnu.org, bash@packages.debian.org
Cc: chet.ramey@case.edu
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
Message-ID: <7a33e5a0-ff66-0116-1aa0-4a52edfdc40d@case.edu>
Date: Sun, 1 Jan 2017 21:14:45 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0)
	Gecko/20100101 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <E1cNnFx-0007G2-S2@flint.armlinux.org.uk>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv2-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.227
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Jan 2017 02:15:05 -0000

On 1/1/17 4:01 PM, rmk@armlinux.org.uk wrote:
> Bash Version: 4.3
> Patch Level: 30
> Release Status: release
> 
> Description:
> 	Running:
> 		while :; do s=$(sleep .005 | cat); echo $s; done | uniq
> 	in a login shell on a virtual terminal or serial console results
> 	in the shell randomly logging out after ^C.

I believe this is fixed in bash-4.4.

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


From MAILER-DAEMON Mon Jan 02 06:10:08 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cO0VE-0007Rp-M9
	for mharc-bug-bash@gnu.org; Mon, 02 Jan 2017 06:10:08 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:52175)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rmk+bug-bash=gnu.org@armlinux.org.uk>)
	id 1cO0V9-0007Pt-Ih
	for bug-bash@gnu.org; Mon, 02 Jan 2017 06:10:07 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rmk+bug-bash=gnu.org@armlinux.org.uk>)
	id 1cO0V8-0003QM-7H
	for bug-bash@gnu.org; Mon, 02 Jan 2017 06:10:03 -0500
Received: from pandora.armlinux.org.uk
	([2001:4d48:ad52:3201:214:fdff:fe10:1be6]:57574)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <rmk+bug-bash=gnu.org@armlinux.org.uk>)
	id 1cO0V7-0003MY-K5
	for bug-bash@gnu.org; Mon, 02 Jan 2017 06:10:02 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=armlinux.org.uk; s=pandora-2014; 
	h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date;
	bh=yPhmPFC9IBRJp49Bp2zJkS5zik6ttaf43e/L+Anaxhk=; 
	b=HmnkJM5FAVTSUVb7OJEi2lRBX1CQ9lImNPbTqtSIgxervjNcpE6nMxmVYfAKg0vOtQSZOCxgahpNu2icdwMy4HKqds0kb4LvxHmrce28XXlaEyXZ8YfMzJCcbF6UK0DnC06KxXUxxIEL0ncyiCy6UuCDfcSTfw3DMEVyVKbGWuI=;
Received: from flint.armlinux.org.uk
	([2001:4d48:ad52:3201:201:2ff:fe14:8fad]:60496)
	by pandora.armlinux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256)
	(Exim 4.82_1-5b7a7c0-XX) (envelope-from <rmk@armlinux.org.uk>)
	id 1cO0Uy-00052P-FP; Mon, 02 Jan 2017 11:09:52 +0000
Received: from rmk by flint.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX)
	(envelope-from <rmk@flint.armlinux.org.uk>)
	id 1cO0Ur-0004lY-U8; Mon, 02 Jan 2017 11:09:46 +0000
Date: Mon, 2 Jan 2017 11:09:45 +0000
From: Russell King <rmk@armlinux.org.uk>
To: Chet Ramey <chet.ramey@case.edu>
Cc: bug-bash@gnu.org, bash@packages.debian.org
Subject: Re: bash randomly logs out on VT / serial console
Message-ID: <20170102110945.GA31148@flint.armlinux.org.uk>
References: <E1cNnFx-0007G2-S2@flint.armlinux.org.uk>
	<7a33e5a0-ff66-0116-1aa0-4a52edfdc40d@case.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <7a33e5a0-ff66-0116-1aa0-4a52edfdc40d@case.edu>
User-Agent: Mutt/1.5.23 (2014-03-12)
Sender: Russell King <rmk@armlinux.org.uk>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2001:4d48:ad52:3201:214:fdff:fe10:1be6
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Jan 2017 11:10:07 -0000

On Sun, Jan 01, 2017 at 09:14:45PM -0500, Chet Ramey wrote:
> On 1/1/17 4:01 PM, rmk@armlinux.org.uk wrote:
> > Bash Version: 4.3
> > Patch Level: 30
> > Release Status: release
> > 
> > Description:
> > 	Running:
> > 		while :; do s=$(sleep .005 | cat); echo $s; done | uniq
> > 	in a login shell on a virtual terminal or serial console results
> > 	in the shell randomly logging out after ^C.
> 
> I believe this is fixed in bash-4.4.

Thank you for your reply.

However, while testing bash-4.4 with the five additional patches (bringing
it to 4.4.5) shows that it is not fixed in bash-4.4 - see below.  The line
from __tty_check_change() is from the debug I added to the kernel, which
shows that the reason for the EIO error is because the tty pgrp doesn't
match the process' pgrp.

# ps -ef | grep ttyS0
root     29257     1  0 10:44 ttyS0    00:00:00 /bin/login --
root     29293 29257  0 10:45 ttyS0    00:00:00 -bash

root@mcbin:~# while :; do s=$(sleep .005 | cat); echo $s; done | uniq

^C
root@mcbin:~# while :; do s=$(sleep .005 | cat); echo $s; done | uniq

^C
root@mcbin:~# __tty_check_change: tty=ffffffc0e74bd800 current pgrp=29293(ffffffc0e795fc00) tty pgrp=29257(ffffffc0e795f080)
logout

-- 
Russell King


From MAILER-DAEMON Mon Jan 02 06:32:19 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cO0qh-0001Fg-LQ
	for mharc-bug-bash@gnu.org; Mon, 02 Jan 2017 06:32:19 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:55726)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@eggsh.com>) id 1cO0qf-0001ET-26
	for bug-bash@gnu.org; Mon, 02 Jan 2017 06:32:18 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@eggsh.com>) id 1cO0qb-0002qE-UQ
	for bug-bash@gnu.org; Mon, 02 Jan 2017 06:32:17 -0500
Received: from mail-co1nam03on0062.outbound.protection.outlook.com
	([104.47.40.62]:60768
	helo=NAM03-CO1-obe.outbound.protection.outlook.com)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <bash@eggsh.com>) id 1cO0qb-0002pr-KK
	for bug-bash@gnu.org; Mon, 02 Jan 2017 06:32:13 -0500
Received: from DM5PR05CA0009.namprd05.prod.outlook.com (10.173.226.19) by
	CY4PR05MB2949.namprd05.prod.outlook.com (10.169.183.147) with Microsoft
	SMTP Server (version=TLS1_2,
	cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id
	15.1.829.3; Mon, 2 Jan 2017 09:59:50 +0000
Received: from SN1NAM02FT034.eop-nam02.prod.protection.outlook.com
	(2a01:111:f400:7e44::201) by DM5PR05CA0009.outlook.office365.com
	(2603:10b6:3:d4::19) with Microsoft SMTP Server (version=TLS1_2,
	cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.829.4 via
	Frontend Transport; Mon, 2 Jan 2017 09:59:50 +0000
Authentication-Results: spf=none (sender IP is 149.173.1.110)
	smtp.mailfrom=eggsh.com; gnu.org; dkim=none (message not signed)
	header.d=none;gnu.org; dmarc=none action=none header.from=eggsh.com;
Received-SPF: None (protection.outlook.com: eggsh.com does not designate
	permitted sender hosts)
Received: from mail.sas.com (149.173.1.110) by
	SN1NAM02FT034.mail.protection.outlook.com (10.152.72.141) with
	Microsoft SMTP Server (version=TLS1_2,
	cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id
	15.1.803.8 via Frontend Transport; Mon, 2 Jan 2017 09:59:49 +0000
Received: from [10.48.17.145] (10.48.17.145) by mercedge04d.na.sas.com
	(10.13.5.6) with Microsoft SMTP Server id 15.0.1178.4; Mon, 2 Jan 2017
	04:59:49 -0500
Subject: Re: [Help-bash] Bash Trap: How to Get Line Number of a Subprocess
	with Non-Zero Status
To: <bug-bash@gnu.org>, <help-bash@gnu.org>
References: <8f5c1889-71a0-c3aa-8f80-66fbf4df9382@eggsh.com>
	<CAOSMAuuv7TeH7FtVUpG_XhxxmwRV-hg6eCYwiGp00t0V5a=Zmw@mail.gmail.com>
	<81e32164-3262-786c-d6fc-04a9aaf4e145@case.edu>
From: Steve Amerige <bash@eggsh.com>
CC: <chet.ramey@case.edu>
Message-ID: <586A2495.10206@eggsh.com>
Date: Mon, 2 Jan 2017 04:59:49 -0500
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101
	Thunderbird/38.3.0
MIME-Version: 1.0
In-Reply-To: <81e32164-3262-786c-d6fc-04a9aaf4e145@case.edu>
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-EOPAttributedMessage: 0
X-Matching-Connectors: 131278247900520206;
	(a487569f-4b37-48fa-ca7c-08d3b03e4256); ()
X-Forefront-Antispam-Report: CIP:149.173.1.110; IPV:NLI; CTRY:US; EFV:NLI;
	SFV:NSPM;
	SFS:(10009020)(7916002)(336005)(39450400003)(39400400002)(39840400002)(39410400002)(39380400002)(39850400002)(2980300002)(428002)(24454002)(189002)(377454003)(199003)(106466001)(105586002)(23846002)(92566002)(4001350100001)(2906002)(38730400001)(50466002)(5001770100001)(189998001)(65956001)(65806001)(626004)(5660300001)(104016004)(83506001)(64126003)(4326007)(2950100002)(65816999)(76176999)(54356999)(50986999)(23676002)(36756003)(229853002)(33656002)(86362001)(356003)(7906003)(246002)(77096006)(101416001)(8936002)(2870700001)(606005)(8676002)(3940600001)(42262002);
	DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR05MB2949; H:mail.sas.com;
	FPR:; SPF:None; PTR:mercedge04d.na.sas.com; MX:1; A:1; LANG:en; 
X-Microsoft-Exchange-Diagnostics: 1; SN1NAM02FT034;
	1:gT3VchPsF+tj5PONDa5g/shkHGwfaO5ebGFCxGI8cImyyO0PcNcYPkrw77/LS3IWQgd51ieHUEC/WIGtm2oiQQtMYQXO5NxIRj7Uy3FMvz1ecUXAAjQwKUAGSJ7yqiSVKKTweumhRbRYF2SypgHWJCfQ/SwZPyzcXU+J9pqB4wtedkiqVzDeU7lWFk+i1wYTs8N49YaCVOOchpM80npt0H+3R5ofxkVSyCLTSihSMIXtj96h42yuf/ix5AoYQ08W19R86uXB9P9qn0rqJU7CXsr2M6+LdH/4zPjHZTeZGEeoYe89Zj2Ew/pi/MhkdVVjpGSNH921leOJhftTQAc0JHkdIYRUy88uOKD+C4pRF03fkGut19WwIiaYezgsoCDgX/CKNweN681DYTo8sz2e7muIzU2FnQrcpOrvhkdFHVdJAnCH6jVMszwHgdMdTUP91EXUd1Nfbqn4+uUndTULY9bm9E7LszdP09R0gSJ8b5i17eilI5mn1EK6in7D4dZgHLvhHIt3ajAhDKmbQwrHOhH3Kmu8aMJBU1V6KjukL2wFThIULbeE0zPGI8GYKSw8lYGdB5HHRcbJS9piyr1jSw==
X-MS-Office365-Filtering-Correlation-Id: d35d63e3-ed1b-434b-15c1-08d432f61746
X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY4PR05MB2949;
X-Microsoft-Exchange-Diagnostics: 1; CY4PR05MB2949;
	3:c/aI6afKIpp/RIbILXQvKnaL2bP0cLXlFYTTroaqn/XqJGpc5VVcIKMKY02q4cXrmoC9mxfajjDimdSiiM3HokvLR4+IIwwdQaGD7hlhb+MAfdW8C7fP9naP8Lw2Mmr5d9frDOk2Ya6I3MWAw2B+R8esU18aGU0rknF3OfopzP7wzJikcEklT2Ph2mqk2j63n3I7POAwyuCin9G/MYbxLD1Pb6DV3yoCsGFdZGCWcF8JEhs5RCsBgywXWxyyerz55RfAZLKvI7I4uZCDHxW1MbdrKneIYLE3GM7PZV1BdAuQ48aRn2u1MOxlav3W8YXomU/5S0bs/3qzIXjPvX0swSg0/tTF+f0fkL2bh0rSICLZUEVizRC3m3yJdrkWcs4C
X-Microsoft-Exchange-Diagnostics: 1; CY4PR05MB2949;
	25:KsJ3+YypyRxqknIjhV/tVkvbS2FMEufcQrXfqQwsNhXlCSNKpN6tC5B2yNg1L0595Dao/QgkeDP6XDLCMVH92C3k6F8XCsP5+RNRcSE00quleqTzeVpGYaG4YmkwtEGp1WK6NH0vCX34kJtsRYkku2XOCQ+q2UPYoFsu4bwivTsbF6zWKEPWqhqfIpcQcJoTOWJ+NnWrg9yu1O4S0q4TzGE4JJt2fAKmlcFc9+NAA6+mr9E4GmF/qDT9Vp2KdEebl+zWa8JnABjUWEx76iMuBBXCQfVy5+aKrKIIym8jUOwCK7n2CBes1/EfOt39DsYqzrnGSoRfY/oniyc9FdZigvGaZU/AIFAdUYA7P9gJKGXB2xeo8NrYyvyBI5v5iZ9fKsAHcXJnlBdlA6EMAnpoFtTMCQ/17Mxvc6GzofGDB0/RDY2aY+MCOQyl/K/+H6O5xbx1pSlSXEm3whCbSl86SCTzcYYiPGIZV+uOMM/wAQrxBy1e6NGcuIVuaaqxjmX6YLzx7/9CwpeAb59HBvMuywDYDrRRGndHCP99Ss9qfRRphaqhg6rtyA7RD/O1ZvC/tjfN0XEXM7BDTFxeCgKsLr+SelPI5/H2BjIaYzActtuw+h+0x/9IpBnJrrrbqwodN3q5F0gp3JHZKXBNwW+YVjkJ+pl9zu5ETNEkEHq/eggIRh0mJ/INpZ3lnMzhqlsOgMZNWMmEP+EXH/lw3433dg1/VuYjAt73GAdvPgf7AmbgmmgbnpPb12utBmtU+bSHMCNUgAG9S3XiWgQ6u+ZzeSstWtXlXdNgNsacxxeMUu9bCbIAN1NpJjexquTl93nnDI4fMS0eGGVXABKsaUpeq8tQcmdPsy+x4MU8EU8QRCDSVfGkUaMtDt1n4WwLFfDwtkp3vzKcfGhTMXaCXrT+JayHI7MDlrcSdhynOCykwfskXbBTBMnHRApoo641sdYo
X-Microsoft-Exchange-Diagnostics: 1; CY4PR05MB2949;
	31:PY6NHw5i0/txL+cE/2qn2pqTuncbvLp8N0/Z1CjDrCunXIwt73fNEQm9SFTLbQbDsnHzq+d3Rx3QG6Am7cOabgi5II1ahxx22tI0MzF8ssDo5alTJ83LWMu83AVubv3RsPpoveHEzqFci+IubSuHLkoN19HPBKXKu0SSJnDKN6/up7K1jJjJKngLP1mnXs/Oh+gmciX1w9RIBvbiH09niSv2otubQRj3l5F0DD+SgyvdaoQjjn4eJUmNZnd76Kp/bMZ/+SsAo8KJv1DDTOLrtGEgMatmZsa94zpFYui7o4g=
X-Microsoft-Antispam-PRVS: <CY4PR05MB2949DA3CED7B3AB1A0B23DC5D36F0@CY4PR05MB2949.namprd05.prod.outlook.com>
X-Exchange-Antispam-Report-Test: UriScan:(158342451672863)(17755550239193);
X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0;
	RULEID:(6095060)(601004)(2401047)(13024025)(13023025)(13015025)(13017025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6096035)(20161123561025)(20161123559025)(20161123556025)(20161123565025)(20161123563025);
	SRVR:CY4PR05MB2949; BCL:0; PCL:0; RULEID:(400006);
	SRVR:CY4PR05MB2949; 
X-Microsoft-Exchange-Diagnostics: 1; CY4PR05MB2949;
	4:CxfwIHa9GD+9637gmSROMbsRRB68w5vnuiNk33x5NIzvHDoGSVdEX3LW3pgZBVX2qHJxL56ywPjk/MGy0CN42yIh7bB5TMdYP+LJj4AOTy3lQCOPtTnnT8Gg5uMbLaIRElNbSmGwClZCLNKkQ2CFBFzmfVkZvrHcNbr5B2M4ReHqMREphqT1dppH0IYY06Gm5+JO7Kpx1cMkVI1B6oHz0f8J0tPex4H7vAGIXjTmDHgcsjevio/n9aF4XtJvKHYy5pvAabuXZ0XaCrOhWAnqA8IXlb6BBNEiUchUDrwmssV+fE3VhxoFAsOyI/XYxH9wOavQwF89T9fNpsvIWt6aOvkxWQiZC4EE87/Sb9jOe7BjYJtDZlH+M3nAxn8Bu5skWVbLBygyLaKTXH5idUR9/xuSnCb7cM+VS3lpy7MF9wala49BVWrtq8aIl4l1lOIqYMxbL496owOXJQjXzL+7XtmmKNKSJUB29uNuo36X7InzotAlNGtZVDtPJGeOuj0Wpq6LVM3q5UvvqBUxcd2beRH7SyhZsFIJxjKySOqMgmr/Wli7Ta2FzU5krklkc0wTRNAXdoS+xg6IehQiVscMG31JaIUViZ8FQHJLU47py27vor/xfd0rMdlO/rAPM803MvIfuMCQRR68hPk+2Af/gaiTKHqdx92f8770zA6oEoH56yw6LtzUCrLaET3g+Sbc8/5fWdCgmuBdaDYi90E/TrRleTQRISFvt1HJWcSsTjcO1ku7R/4yVXk5zBf18vBK8jxiV3wU+M/p+a0shCLPMg==
X-Forefront-PRVS: 017589626D
X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjA1TUIyOTQ5OzIzOnVhTzJRekVGbCt0UklRNzVrQjNib3hnZ0Rj?=
	=?utf-8?B?clFzNlhwMUhGK1BXMi80U2Z6eWJvUlI3SkNJdFUzQVpmRFJaNWhQU2hKemh3?=
	=?utf-8?B?aVhBZzhwMjA0TUp6OXpVWjNRRlF5ZlZCRVBNQys5TDFtcGZwVisxbHNHYmJM?=
	=?utf-8?B?azQ1L09OaWw0QjNKVUJmZ25Nbm5RQ3ZmMkllMnVqYjVyTFNyNkxhdmgyMGFh?=
	=?utf-8?B?Wm5xVGlrQjh5N0o2NTQ4TCt0Nml0OFhvREowM1dxenJXUWJHb2VTbmJVK1lZ?=
	=?utf-8?B?TldLeG1YV0dkcjBzd0VGS2V0SnUzVkg1Ujcxc240S2lPbmhQWCtDQ1Z0MXgx?=
	=?utf-8?B?dVBFUVRiMnlWVWszZUFabzM5T2tEUTZyVXV2MXloOWJOMEFNYWcrV3F2Uk51?=
	=?utf-8?B?TzRveVZiNlhJVFZTa3RTdzI3N2txUmxwbEdhQjZKMU9yQzhoUlpFWkVwTk5J?=
	=?utf-8?B?MW1rUFZxUm5YVUpZVTh5ZzBhUjlsd1FDbm5yVStpQ21IVHNkWHdWMnZ1Y3pF?=
	=?utf-8?B?Z2IrWEFYWFJEaUsyVmdDYlg3TVRqeVRoRDNwbEk3SkJLMkIxY0ZSQ3pGU0V1?=
	=?utf-8?B?ZWZnT3FGMGE0UklrbFhpbUVHeUpoWW9PcWpiSXd5SUVzTVFuTXRCWUxadFNJ?=
	=?utf-8?B?OXArWWpnS2UzSDNKVGp6cTVVNzJhVmQvQ2REckhPS1B1RUtDU2VldGZNRERw?=
	=?utf-8?B?WlBGM2xVcmlkMTRFV0xjOFU3VmpWYWQreWhlSlpienhDUTh3clA2UDF3aEty?=
	=?utf-8?B?bXJ4NDFMMm5Ya2JMNks5M3pyamsrQ0RKUWhiUDZyKzJyNlkvNVNWTTZHTFFS?=
	=?utf-8?B?ajJBZFpzaFZwVGZaUVlSaXJaWmxEaUl1QmMyVW1QZ1RDRXZ6d3RPZDgrSHZq?=
	=?utf-8?B?eEtKTXljNHkwa3F5azhOck1EOEhndVNucDBDbUVFcnl2Zk9iT0NBK1gyRTZL?=
	=?utf-8?B?VVRnMENEa210U085SldyK1VkVmh4MDhGV0k0THFGWk1PanBjRHRXK2tyMk9V?=
	=?utf-8?B?UHhkRTZPb1JOUytPMHI5Zk1xV28zdklwTG8xYjE2UVI4K3VXZmhTTldZeHBI?=
	=?utf-8?B?bVg3WmJHZlN4ODF3Znk1UGk0MmJ0TzhobitOMHRYeGFjUlB6cEFBK0s0b1Vs?=
	=?utf-8?B?NjlSRmxIM2p0S3ZPdUVkR2lxRFVDeFNiaVlKckR2dU9WUGhqRDdCaUdjcDFa?=
	=?utf-8?B?QWZ1b1hVTEFnMC9ycm4zVmE5ZnM2OFNTWHhlcjRJOTd1UXJEaVdJWFVtZ0di?=
	=?utf-8?B?WHQ3L1lYeDVwazd3dStvQitROUU3MU1Hc2xQZmNkTHpWZGszL1Yrdzd3dTBu?=
	=?utf-8?B?ZnF2dnFtMGR1dzh2U1BsVnVFM3RCZ04rYjJZbG9wNkNaaHdkcy8zYTAyVC9P?=
	=?utf-8?B?NUdrWEVBVDZIL0NmUFBoMmdEbjNscHFJTC94YkNWYVZlYmpiQTBKWHh0NjlM?=
	=?utf-8?B?cUdHaFpvWUZTc3pjM2tSS0pUYU1YOTUwT1N0OXBpeVRWbDF3b1I0MnRoM2U3?=
	=?utf-8?B?ZXV3RklyY2RSKzdOem5iT2dXbjRwSVVwRkd6K0M2UnhMTFBHaHlBTyttc1ht?=
	=?utf-8?B?aGNOY0FDbXpIcFVPZWF6aW9TNC80bHVsQjRxNU85eHZkeklDR052UkRVRkJp?=
	=?utf-8?B?OVJ6UlNqVEk3azQ3VThLV01CSUg1OHNpb2FlUDNsVzRiZk00ZXNHR04xb0Y2?=
	=?utf-8?B?YzJEMjFkWEhvakhqL0N2aXJ1TkxWbWVGTWt4UmU4N09CU3RxY21rK3hxT2NK?=
	=?utf-8?B?bnVZNVVuZExjMC8zZk5hdz09?=
X-Microsoft-Exchange-Diagnostics: 1; CY4PR05MB2949;
	6:F+IePzpOL1TXuY19xVLc8gDzKUhVEHDENW+vWLnwbjRRLNRnXqcNASUbqevyhhMli3KBgBqEgxb1qDwzb5yRC4KezSDm3XX8V0maKWflUnjy5pEIMGl0F2XmtmO5anGPBMiKykTipdoYVIX2oBSiCEsK4kNyCnlsl+Eiknff08O3olvxF2JGhA7psYO+g6nzw9Wv0aSQaBRm4o65fVgURmLZATUD1GVGH+2QLOUzv7tef6SiFX8yx3IiDSr3kKlaciCBJP617PcMbRgHG5Hv4uJ83si+HxYQshG9MZnszKMVPGKbg9yf7lo1w9wgzQ09NMxDkepEriXijATWmoG+rMUjwGi64pkczlmxIgIh+DP9R30GwxJM2QEBrYAdzlwg8U0zGcwREDSiJwk6OWvHe9HWHJiRa07mLXFMU6iQTqEGawUIpf+c0btmD3PlBA7o;
	5:bHEz1aEoMyQsguXAZX8FlFq96QmpMZDccEiVKj0DA/1MhibxXkOmgsgZZKI8f5bx5DHnt6aQ0Mk2DoEm2Tf7t5Oj8bDs6ufLiLgdg+6ejEeusAprqj/AnDJQXrPNLqpBgoSWw7clbpGrMaeN8uH/B2tkRRWuXC2wo6yHdEKTWmapwi6leCb0ZPzvm2XHB8QU;
	24:gvPyEDGgXSEHXKeGzweDtGMRNFk/DaIWcYoLBSpD8Wb7ZZEmwAUsiSur9l8MVHkQqdrGMqEOIlhV2pjT2wSLJ/ZgR2O33ATswUoPrVc+NL4=
SpamDiagnosticOutput: 1:99
SpamDiagnosticMetadata: NSPM
X-Microsoft-Exchange-Diagnostics: 1; CY4PR05MB2949;
	7:OoExUQUOWvxTOLk1MTjuWuZ9P+Eh9g7Zhg2hK6ECPClZXe2TCGd9f4pnwTK5zV/5uUnoi8nikzCw503cKa2EZylsmpem6j7HK9YyS6YJaL4dKlgGs5/Sea+qtvGid2CY5wWAFC8Hn+w8GbgPAsJ2Od6RYUBn9UDD82vlBxGF+4BcSA4yI7DEe7Bm1vZn65shASZ86Rzkvs0Bfo6KCwr/thDwgOqW+0RJ7+BqD8P0k1YF2ujPnSNUnnOcYo0OvpbHcw2rpl0HhJWcHLqFX/NrhIUNNJvVZoyB93bM1Q9+6ddsM9PRMfKn38Xzvuhqib4TGxwP09QbV5/h+YfPI4K1mT86M6CqfaO78etqmoujJD6sCs4gdKqUh7ckptDic4TGemGwpIqDjnL6qU0DvgXVQ8bJOQ0IcDZ1v8K5STioJ57THZOT3eMWP6Me5l0BiDBWxa+Wj/eXJAUUrz/w3r7IEw==
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jan 2017 09:59:49.7707 (UTC)
X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;
	Ip=[149.173.1.110]; Helo=[mail.sas.com]
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR05MB2949
X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy]
X-Received-From: 104.47.40.62
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Jan 2017 11:32:18 -0000

<html>
  <head>

    <meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf-8=
">
  </head>
  <body>
    <meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf-8=
">
    <div class=3D"moz-cite-prefix">On 12/30/2016 12:50 PM, Chet Ramey
      wrote:<br>
    </div>
    <blockquote cite=3D"mid:81e32164-3262-786c-d6fc-04a9aaf4e145@case.edu"
      type=3D"cite">
      <pre wrap=3D"">It's the difference between a simple command, which ha=
s a line number, and
a subshell command, which does not.  The subshell command's line number is
derived from the execution context, which is relative to the start of the
function.  The OP wants the subshell's line number to be absolute, like the
simple command's, and not relative to the start of the function, as it is
now.</pre>
    </blockquote>
    <br>
    From an end-user's perspective, it is unexpected that the LINENO has
    the value of the<br>
    beginning of the function instead of the line at which the ERR was
    caught by trap.<br>
    While the "inside" of the subshell might have it's own
    characteristics, the inside must<br>
    eventually meet the "outside" of the subshell... at which point, an
    end user can reasonably<br>
    expect that an error is reported in a common-sense way with the line
    number that is<br>
    seen in the script file itself. While the current behavior can be
    explained, that doesn't<br>
    mean it is expected by end users or makes sense.<br>
    <br>
    Using any other line number for LINENO also makes it harder to debug
    scripts, of course,<br>
    since the line number being reported isn't as helpful.<br>
    <br>
    Is there any way this can be fixed... or introduced as a feature
    (e.g., with some<br>
    set -o or shopt flag)?=C2=A0 A fix would help out a significant number =
of
    people. As it is, a<br>
    workaround now is to use:<br>
    <br>
    =C2=A0=C2=A0=C2=A0 $(...)<br>
    <br>
    instead of:<br>
    <br>
    =C2=A0=C2=A0=C2=A0 (...)<br>
    <br>
    to get the expected behavior. But, this can mean some significant
    re-writing of code.<br>
    <br>
    Enjoy,<br>
    Steve Amerige<br>
    Server Science Incorporated<br>
    <font color=3D"#000099"><small><a href=3D"https://eggsh.com">Eggsh</a>:
        A Powerful and Reusable Bash Scripting Platform, an Open-Source
        Project</small></font><br>
    <br>
    <meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
  </body>
</html>


From MAILER-DAEMON Mon Jan 02 13:09:44 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cO73I-0001CM-5a
	for mharc-bug-bash@gnu.org; Mon, 02 Jan 2017 13:09:44 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:43532)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cO73F-0001Al-NB
	for bug-bash@gnu.org; Mon, 02 Jan 2017 13:09:42 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cO73E-0001E2-GF
	for bug-bash@gnu.org; Mon, 02 Jan 2017 13:09:41 -0500
Received: from mpv1-2015.cwru.edu ([129.22.103.226]:57349
	helo=mpv1-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>)
	id 1cO739-0001CV-SQ; Mon, 02 Jan 2017 13:09:35 -0500
Received: from mpv7-2015.CWRU.Edu (EHLO mpv7-2015.case.edu) ([129.22.103.242])
	by mpv1-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AKF10384; Mon, 02 Jan 2017 13:09:34 -0500 (EST)
Received: from h177.182.142.40.ip.windstream.net (EHLO jenna.local)
	([40.142.182.177])
	by mpv7-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id FLX56768 (AUTH cpr);
	Mon, 02 Jan 2017 13:09:33 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: [Help-bash] Bash Trap: How to Get Line Number of a Subprocess
	with Non-Zero Status
References: <8f5c1889-71a0-c3aa-8f80-66fbf4df9382@eggsh.com>
	<CAOSMAuuv7TeH7FtVUpG_XhxxmwRV-hg6eCYwiGp00t0V5a=Zmw@mail.gmail.com>
	<81e32164-3262-786c-d6fc-04a9aaf4e145@case.edu>
	<586A2495.10206@eggsh.com>
To: Steve Amerige <bash@eggsh.com>, bug-bash@gnu.org, help-bash@gnu.org
Cc: chet.ramey@case.edu
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
Message-ID: <501024c0-4869-f427-fcec-467301923408@case.edu>
Date: Mon, 2 Jan 2017 13:09:32 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0)
	Gecko/20100101 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <586A2495.10206@eggsh.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.226
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Jan 2017 18:09:43 -0000

On 1/2/17 4:59 AM, Steve Amerige wrote:

> From an end-user's perspective, it is unexpected that the LINENO has the
> value of the
> beginning of the function instead of the line at which the ERR was caught
> by trap.

Sure, it's missing functionality.  Eduardo's patch was pretty much spot-on.
It will be fixed in the next version of bash, at least.

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


From MAILER-DAEMON Mon Jan 02 14:06:16 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cO7w0-0006QQ-MT
	for mharc-bug-bash@gnu.org; Mon, 02 Jan 2017 14:06:16 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:52154)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cO7vz-0006QJ-2t
	for bug-bash@gnu.org; Mon, 02 Jan 2017 14:06:16 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cO7vv-00066F-3i
	for bug-bash@gnu.org; Mon, 02 Jan 2017 14:06:15 -0500
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:20052
	helo=mpv3-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1cO7vu-000663-Vk
	for bug-bash@gnu.org; Mon, 02 Jan 2017 14:06:11 -0500
Received: from mpv7-2015.CWRU.Edu (EHLO mpv7-2015.case.edu) ([129.22.103.242])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AJF20757; Mon, 02 Jan 2017 14:06:03 -0500 (EST)
Received: from h177.182.142.40.ip.windstream.net (EHLO jenna.local)
	([40.142.182.177])
	by mpv7-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id FLY41812 (AUTH cpr);
	Mon, 02 Jan 2017 14:06:02 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: bash randomly logs out on VT / serial console
References: <E1cNnFx-0007G2-S2@flint.armlinux.org.uk>
	<7a33e5a0-ff66-0116-1aa0-4a52edfdc40d@case.edu>
	<20170102110945.GA31148@flint.armlinux.org.uk>
To: Russell King <rmk@armlinux.org.uk>
Cc: chet.ramey@case.edu, bug-bash@gnu.org, bash@packages.debian.org
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
Message-ID: <e7173a71-4120-da70-525f-c04db7729db3@case.edu>
Date: Mon, 2 Jan 2017 14:06:01 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0)
	Gecko/20100101 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <20170102110945.GA31148@flint.armlinux.org.uk>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv3-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Jan 2017 19:06:16 -0000

On 1/2/17 6:09 AM, Russell King wrote:
> On Sun, Jan 01, 2017 at 09:14:45PM -0500, Chet Ramey wrote:
>> On 1/1/17 4:01 PM, rmk@armlinux.org.uk wrote:
>>> Bash Version: 4.3
>>> Patch Level: 30
>>> Release Status: release
>>>
>>> Description:
>>> 	Running:
>>> 		while :; do s=$(sleep .005 | cat); echo $s; done | uniq
>>> 	in a login shell on a virtual terminal or serial console results
>>> 	in the shell randomly logging out after ^C.
>>
>> I believe this is fixed in bash-4.4.
> 
> Thank you for your reply.
> 
> However, while testing bash-4.4 with the five additional patches (bringing
> it to 4.4.5) shows that it is not fixed in bash-4.4 - see below.  The line
> from __tty_check_change() is from the debug I added to the kernel, which
> shows that the reason for the EIO error is because the tty pgrp doesn't
> match the process' pgrp.

OK.  I can't reproduce it on Fedora 25.

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


From MAILER-DAEMON Mon Jan 02 18:33:42 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cOC6n-0003ws-W6
	for mharc-bug-bash@gnu.org; Mon, 02 Jan 2017 18:33:42 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:34614)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rmk+bug-bash=gnu.org@armlinux.org.uk>)
	id 1cOC6k-0003tz-4u
	for bug-bash@gnu.org; Mon, 02 Jan 2017 18:33:41 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rmk+bug-bash=gnu.org@armlinux.org.uk>)
	id 1cOC6h-0003Fn-GE
	for bug-bash@gnu.org; Mon, 02 Jan 2017 18:33:38 -0500
Received: from pandora.armlinux.org.uk
	([2001:4d48:ad52:3201:214:fdff:fe10:1be6]:38050)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <rmk+bug-bash=gnu.org@armlinux.org.uk>)
	id 1cOC6g-0003Es-ER
	for bug-bash@gnu.org; Mon, 02 Jan 2017 18:33:35 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=armlinux.org.uk; s=pandora-2014; 
	h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date;
	bh=gU3dUEUwbYNZxUXzhXi9s2jSw27otDHjF3KqBcg3yfM=; 
	b=kyaYObJLNYIvJTYltIdRN5AfUMiCZwGCSuQQqVXDQpS/1mS0btQaKSiifdzqKSGENRnUlBlhfWY96cvIXNqBKVTS++UvbygJB1RHIkoOxIKOplVXR5GUCjjlDnhUX/iPtMRTHAS9ea+lfRp9soyj8lW96Fz6NVS+TQJCyowlfFI=;
Received: from flint.armlinux.org.uk
	([2002:4e20:1eda:1:201:2ff:fe14:8fad]:37850)
	by pandora.armlinux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256)
	(Exim 4.82_1-5b7a7c0-XX) (envelope-from <rmk@armlinux.org.uk>)
	id 1cOC6V-0008IM-Ub; Mon, 02 Jan 2017 23:33:24 +0000
Received: from rmk by flint.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX)
	(envelope-from <rmk@flint.armlinux.org.uk>)
	id 1cOC6P-0001Ck-7R; Mon, 02 Jan 2017 23:33:17 +0000
Date: Mon, 2 Jan 2017 23:33:16 +0000
From: Russell King <rmk@armlinux.org.uk>
To: Chet Ramey <chet.ramey@case.edu>
Cc: bug-bash@gnu.org, bash@packages.debian.org
Subject: Re: bash randomly logs out on VT / serial console
Message-ID: <20170102233316.GB31148@flint.armlinux.org.uk>
References: <E1cNnFx-0007G2-S2@flint.armlinux.org.uk>
	<7a33e5a0-ff66-0116-1aa0-4a52edfdc40d@case.edu>
	<20170102110945.GA31148@flint.armlinux.org.uk>
	<e7173a71-4120-da70-525f-c04db7729db3@case.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <e7173a71-4120-da70-525f-c04db7729db3@case.edu>
User-Agent: Mutt/1.5.23 (2014-03-12)
Sender: Russell King <rmk@armlinux.org.uk>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2001:4d48:ad52:3201:214:fdff:fe10:1be6
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Jan 2017 23:33:41 -0000

On Mon, Jan 02, 2017 at 02:06:01PM -0500, Chet Ramey wrote:
> On 1/2/17 6:09 AM, Russell King wrote:
> > On Sun, Jan 01, 2017 at 09:14:45PM -0500, Chet Ramey wrote:
> >> On 1/1/17 4:01 PM, rmk@armlinux.org.uk wrote:
> >>> Bash Version: 4.3
> >>> Patch Level: 30
> >>> Release Status: release
> >>>
> >>> Description:
> >>> 	Running:
> >>> 		while :; do s=$(sleep .005 | cat); echo $s; done | uniq
> >>> 	in a login shell on a virtual terminal or serial console results
> >>> 	in the shell randomly logging out after ^C.
> >>
> >> I believe this is fixed in bash-4.4.
> > 
> > Thank you for your reply.
> > 
> > However, while testing bash-4.4 with the five additional patches (bringing
> > it to 4.4.5) shows that it is not fixed in bash-4.4 - see below.  The line
> > from __tty_check_change() is from the debug I added to the kernel, which
> > shows that the reason for the EIO error is because the tty pgrp doesn't
> > match the process' pgrp.
> 
> OK.  I can't reproduce it on Fedora 25.

Thank you for your reply.

Here's more information from the strace logs in case it helps - these
are from the "useful" command rather than the one which I quoted in
the bug report which reproduces it as well - "mii-diag" for the "sleep"
and "sed" for the "cat" part - otherwise identical.  Note that I'm
running a modified mii-diag here...


PID 10928 - the top level login shell:
=========

17:38:38.716472 pipe2([3, 4], 0)        = 0
17:38:38.716555 rt_sigprocmask(SIG_BLOCK, [INT CHLD], [CHLD], 8) = 0
17:38:38.716617 pipe2([5, 6], 0)        = 0
17:38:38.716677 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fae66c0d0) = 14119
17:38:38.717076 setpgid(14119, 14119)   = 0
17:38:38.717185 rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
17:38:38.717249 close(4)                = 0
17:38:38.717301 close(4)                = -1 EBADF (Bad file descriptor)
17:38:38.717398 rt_sigprocmask(SIG_BLOCK, [INT CHLD], [CHLD], 8) = 0
17:38:38.717463 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fae66c0d0) = 14120
17:38:38.717936 setpgid(14120, 14119)   = 0
17:38:38.719654 rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
17:38:38.719764 close(3)                = 0
17:38:38.722508 rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0
17:38:38.722576 close(5)                = 0
17:38:38.722626 close(6)                = 0
17:38:38.745323 ioctl(255, TIOCGPGRP, [14119]) = 0
17:38:38.745381 rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
17:38:38.745501 rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0
17:38:38.745560 wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGINT}], WSTOPPED|WCONTINUED, NULL) = 14120
17:38:39.477455 wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGINT}], WSTOPPED|WCONTINUED, NULL) = 14119

	Here, the two sub-shells (pid 14119 and 14120) that bash has
	spawned were terminated by SIGINT.

17:38:39.477971 rt_sigprocmask(SIG_BLOCK, [CHLD TSTP TTIN TTOU], [CHLD], 8) = 0
17:38:39.478119 ioctl(255, SNDRV_TIMER_IOCTL_SELECT or TIOCSPGRP, [10928]) = 0
17:38:39.478250 rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
17:38:39.478395 ioctl(255, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B115200 opost isig icanon echo ...}) = 0
17:38:39.478626 ioctl(255, SNDCTL_TMR_STOP or SNDRV_TIMER_IOCTL_GINFO or TCSETSW, {B115200 opost isig icanon echo ...}) = 0
17:38:39.478782 ioctl(255, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B115200 opost isig icanon echo ...}) = 0
17:38:39.479323 ioctl(255, TIOCGWINSZ, {ws_row=25, ws_col=80, ws_xpixel=0, ws_ypixel=0}) = 0
17:38:39.479488 write(1, "\n", 1)       = 1
17:38:39.479583 rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
17:38:39.479653 close(3)                = -1 EBADF (Bad file descriptor)
17:38:39.479711 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
17:38:39.479802 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=14120, si_status=SIGINT, si_utime=0, si_stime=0} ---
17:38:39.479857 wait4(-1, 0x7fc81f8300, WNOHANG|WSTOPPED|WCONTINUED, NULL) = -1 ECHILD (No child processes)
17:38:39.479921 rt_sigreturn()          = 0
17:38:39.480088 rt_sigaction(SIGINT, {0x45e080, [], 0}, {0x45e080, [], 0}, 8) = 0
17:38:39.480311 rt_sigprocmask(SIG_BLOCK, [CHLD TSTP TTIN TTOU], [], 8) = 0
17:38:39.480458 ioctl(255, SNDRV_TIMER_IOCTL_SELECT or TIOCSPGRP, [10928]) = 0

	Here, the top level shell sets the TTY PGRP to 10928.  Note
	the time stamp - 17:38:39.480458.

17:38:39.480614 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
17:38:39.480740 rt_sigaction(SIGINT, {0x45e080, [], 0}, {0x45e080, [], 0}, 8) = 0
17:38:39.480941 ioctl(0, TIOCGWINSZ, {ws_row=25, ws_col=80, ws_xpixel=0, ws_ypixel=0}) = 0
17:38:39.481081 ioctl(0, SNDRV_TIMER_IOCTL_STATUS or TIOCSWINSZ, {ws_row=25, ws_col=80, ws_xpixel=0, ws_ypixel=0}) = 0
17:38:39.481198 ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B115200 opost isig icanon echo ...}) = 0
17:38:39.481367 ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B115200 opost isig icanon echo ...}) = 0
17:38:39.481478 ioctl(0, SNDCTL_TMR_STOP or SNDRV_TIMER_IOCTL_GINFO or TCSETSW, {B115200 opost isig -icanon -echo ...}) = 0
17:38:39.481606 ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B115200 opost isig -icanon -echo ...}) = 0
17:38:39.481713 rt_sigprocmask(SIG_BLOCK, [HUP INT QUIT ALRM TERM TSTP TTIN TTOU], [], 8) = 0
17:38:39.481779 rt_sigaction(SIGINT, {0x4aaa78, [], 0}, {0x45e080, [], 0}, 8) = 0
17:38:39.481868 rt_sigaction(SIGTERM, {0x4aaa78, [], 0}, {0x45dc08, [], SA_RESTART}, 8) = 0
17:38:39.481962 rt_sigaction(SIGHUP, {0x4aaa78, [], 0}, {0x45e2f8, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], 0}, 8) = 0
17:38:39.482055 rt_sigaction(SIGQUIT, {0x4aaa78, [], 0}, {SIG_IGN, [], 0}, 8) = 0
17:38:39.482145 rt_sigaction(SIGQUIT, {SIG_IGN, [], 0}, {0x4aaa78, [], 0}, 8) = 0
17:38:39.482216 rt_sigaction(SIGALRM, {0x4aaa78, [], 0}, {0x45e2f8, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], 0}, 8) = 0
17:38:39.482278 rt_sigaction(SIGTSTP, {0x4aaa78, [], 0}, {SIG_IGN, [], 0}, 8) = 0
17:38:39.482338 rt_sigaction(SIGTSTP, {SIG_IGN, [], 0}, {0x4aaa78, [], 0}, 8) = 0
17:38:39.482430 rt_sigaction(SIGTTOU, {0x4aaa78, [], 0}, {SIG_IGN, [], 0}, 8) = 0
17:38:39.482520 rt_sigaction(SIGTTOU, {SIG_IGN, [], 0}, {0x4aaa78, [], 0}, 8) = 0
17:38:39.482615 rt_sigaction(SIGTTIN, {0x4aaa78, [], 0}, {SIG_IGN, [], 0}, 8) = 0
17:38:39.482695 rt_sigaction(SIGTTIN, {SIG_IGN, [], 0}, {0x4aaa78, [], 0}, 8) = 0
17:38:39.482752 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
17:38:39.482802 rt_sigaction(SIGWINCH, {0x4aa11c, [], SA_RESTART}, {0x45dbf8, [], 0}, 8) = 0
17:38:39.482909 write(2, "root@mcbin:~# ", 14) = 14
17:38:39.483027 read(0, "\33", 1)       = 1

	Here, it had access to the tty to read a character.

17:38:39.870424 read(0, 0x7fc81f8737, 1) = -1 EIO (Input/output error)

	But here it's lost access to it.

17:38:39.884115 write(2, "\7", 1)       = 1
17:38:39.884212 read(0, 0x7fc81f87a7, 1) = -1 EIO (Input/output error)


PID 14119 - this is the sub-shell process running the while() loop:
=========

17:38:39.471277 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
17:38:39.471405 pipe2([3, 4], 0)        = 0
17:38:39.471471 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
17:38:39.471528 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
17:38:39.471579 rt_sigprocmask(SIG_BLOCK, [INT CHLD], [], 8) = 0
17:38:39.471636 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fae66c0d0) = 14241

	It spawns pid 14241, that being the $(...) part of the command.

17:38:39.472177 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
17:38:39.472275 rt_sigaction(SIGCHLD, {0x4474ac, [], SA_RESTART}, {0x4474ac, [], SA_RESTART}, 8) = 0
17:38:39.472381 close(4)                = 0
17:38:39.472522 read(3, 0x7fc81f8998, 128) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
17:38:39.476768 --- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---

	It receives the SIGINT.

17:38:39.476803 rt_sigreturn()          = -1 EINTR (Interrupted system call)
17:38:39.476878 rt_sigprocmask(SIG_BLOCK, [CHLD TSTP TTIN TTOU], [], 8) = 0
17:38:39.476968 ioctl(255, SNDRV_TIMER_IOCTL_SELECT or TIOCSPGRP, [10875]) = 0

	Sets the TTY's PGRP to 10875 - the login process - but this is
	before the top-level shell has done anything, so this one is
	safe.  However, note that this doesn't wait for the process it
	spawned for the $(...).

17:38:39.477053 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
17:38:39.477123 setpgid(0, 10875)       = 0
17:38:39.477271 rt_sigaction(SIGINT, {SIG_DFL, [], 0}, {0x45e2f8, [], 0}, 8) = 017:38:39.477350 kill(14119, SIGINT)     = 0
17:38:39.477421 --- SIGINT {si_signo=SIGINT, si_code=SI_USER, si_pid=14119, si_uid=0} ---
17:38:39.477819 +++ killed by SIGINT +++

	The top level shell gets notified of this thread dying at in
	the wait4() call issued at 17:38:39.477455.


PID 14120 - this is the "uniq" thread:
=========
17:38:39.471192 read(0, 0x7f83fc5000, 4096) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
17:38:39.476335 --- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
17:38:39.476646 +++ killed by SIGINT +++

	The top level shell gets notified of this thread dying at in
	the wait4() call issued at 17:38:38.745560.


PID 14241 - the sub-shell running the $(...) pipeline:
=========

17:38:39.472098 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
17:38:39.472248 rt_sigaction(SIGTSTP, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 017:38:39.472355 rt_sigaction(SIGTTIN, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 017:38:39.472495 rt_sigaction(SIGTTOU, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 017:38:39.472580 rt_sigaction(SIGINT, {SIG_DFL, [], 0}, {0x45e2f8, [], 0}, 8) = 017:38:39.472646 rt_sigaction(SIGQUIT, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 017:38:39.472709 rt_sigaction(SIGTERM, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 017:38:39.472771 rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTART}, {0x4474ac, [], SA_RESTART}, 8) = 0
17:38:39.472838 rt_sigaction(SIGCHLD, {0x4474ac, [], SA_RESTART}, {SIG_DFL, [], SA_RESTART}, 8) = 0
17:38:39.472902 rt_sigaction(SIGINT, {0x45e2f8, [], 0}, {SIG_DFL, [], 0}, 8) = 017:38:39.472980 dup3(4, 1, 0)           = 1
17:38:39.473035 close(4)                = 0
17:38:39.473086 close(3)                = 0
17:38:39.473243 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
17:38:39.473439 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
17:38:39.473506 pipe2([3, 4], 0)        = 0
17:38:39.473581 rt_sigprocmask(SIG_BLOCK, [INT CHLD], [CHLD], 8) = 0
17:38:39.473644 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fae66c0d0) = 14242
17:38:39.474112 rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
17:38:39.474236 close(4)                = 0
17:38:39.474344 close(4)                = -1 EBADF (Bad file descriptor)
17:38:39.474470 rt_sigprocmask(SIG_BLOCK, [INT CHLD], [CHLD], 8) = 0
17:38:39.474545 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fae66c0d0) = 14243
17:38:39.475232 rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
17:38:39.475313 close(3)                = 0
17:38:39.475468 rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0
17:38:39.475541 rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
17:38:39.475608 rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0
17:38:39.475687 rt_sigaction(SIGINT, {0x4445d0, [], 0}, {0x45e2f8, [], 0}, 8) = 0
17:38:39.475790 wait4(-1, 0x7fc81f8210, 0, NULL) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
17:38:39.476106 --- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---

	Here, this shell receives the SIGINT...

17:38:39.476147 rt_sigreturn()          = -1 EINTR (Interrupted system call)
17:38:39.476214 wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGINT}], 0, NULL) = 14243
17:38:39.479198 wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGPIPE}], 0, NULL) = 14242

	and waits for both processes of the pipeline to finish before
	exiting...

17:38:39.485326 rt_sigaction(SIGINT, {0x45e2f8, [], 0}, {0x4445d0, [], 0}, 8) = 0
17:38:39.485396 rt_sigprocmask(SIG_BLOCK, [CHLD TSTP TTIN TTOU], [CHLD], 8) = 0
17:38:39.485459 ioctl(255, SNDRV_TIMER_IOCTL_SELECT or TIOCSPGRP, [10875]) = 0

	Remember, the top level bash process issued its TIOCSPGRP
	call at 17:38:39.480458, and the read() call to read the
	first character of new input at 17:38:39.483027.

	So this sub-shell process sets the terminal PGRP to 10875
	(login) _after_ PID 10928 has set the TTY to itself and
	issued the first read().

17:38:39.485527 rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
17:38:39.485584 setpgid(0, 10875)       = 0

	Sets its own PGRP to 10875, and...

17:38:39.485652 rt_sigaction(SIGINT, {SIG_DFL, [], 0}, {0x45e2f8, [], 0}, 8) = 017:38:39.485781 kill(14241, SIGINT)     = 0
17:38:39.485839 --- SIGINT {si_signo=SIGINT, si_code=SI_USER, si_pid=14241, si_uid=0} ---
17:38:39.486130 +++ killed by SIGINT +++

	Kills itself.


PID 14242 - which eventually becomes the mii-diag command (sleep as per the
=========   example I submitted.)

17:38:39.474043 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
17:38:39.474205 rt_sigaction(SIGTSTP, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 017:38:39.474288 rt_sigaction(SIGTTIN, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 017:38:39.474365 rt_sigaction(SIGTTOU, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 017:38:39.474449 close(3)                = 0
17:38:39.474524 dup3(4, 1, 0)           = 1
17:38:39.474588 close(4)                = 0
17:38:39.474868 newfstatat(AT_FDCWD, ".", {st_mode=S_IFDIR|0700, st_size=4096, ...}, 0) = 0
17:38:39.475152 newfstatat(AT_FDCWD, "/root/bin/mii-diag", {st_mode=S_IFREG|0755, st_size=81712, ...}, 0) = 0
17:38:39.475259 newfstatat(AT_FDCWD, "/root/bin/mii-diag", {st_mode=S_IFREG|0755, st_size=81712, ...}, 0) = 0
17:38:39.475333 geteuid()               = 0
17:38:39.475448 getegid()               = 0
17:38:39.475522 getuid()                = 0
17:38:39.475590 getgid()                = 0
17:38:39.475662 faccessat(AT_FDCWD, "/root/bin/mii-diag", X_OK) = 0
17:38:39.475743 newfstatat(AT_FDCWD, "/root/bin/mii-diag", {st_mode=S_IFREG|0755, st_size=81712, ...}, 0) = 0
17:38:39.476059 geteuid()               = 0
17:38:39.476128 --- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---

	We're still in the shell, and preparing to run the mii-diag
	command.  However, we appear to do nothing with the SIGINT
	that we received....

17:38:39.476168 rt_sigreturn()          = 0
17:38:39.476234 getegid()               = 0
17:38:39.476564 getuid()                = 0
17:38:39.476745 getgid()                = 0
17:38:39.476822 faccessat(AT_FDCWD, "/root/bin/mii-diag", R_OK) = 0
17:38:39.476905 newfstatat(AT_FDCWD, "/root/bin/mii-diag", {st_mode=S_IFREG|0755, st_size=81712, ...}, 0) = 0
17:38:39.476993 newfstatat(AT_FDCWD, "/root/bin/mii-diag", {st_mode=S_IFREG|0755, st_size=81712, ...}, 0) = 0
17:38:39.477078 geteuid()               = 0
17:38:39.477144 getegid()               = 0
17:38:39.477251 getuid()                = 0
17:38:39.477330 getgid()                = 0
17:38:39.477395 faccessat(AT_FDCWD, "/root/bin/mii-diag", X_OK) = 0
17:38:39.477507 newfstatat(AT_FDCWD, "/root/bin/mii-diag", {st_mode=S_IFREG|0755, st_size=81712, ...}, 0) = 0
17:38:39.477777 geteuid()               = 0
17:38:39.477952 getegid()               = 0
17:38:39.478100 getuid()                = 0
17:38:39.478232 getgid()                = 0
17:38:39.478370 faccessat(AT_FDCWD, "/root/bin/mii-diag", R_OK) = 0
17:38:39.478599 rt_sigaction(SIGINT, {SIG_DFL, [], 0}, {0x45e2f8, [], 0}, 8) = 017:38:39.478756 rt_sigaction(SIGQUIT, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 017:38:39.479172 rt_sigaction(SIGTERM, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 017:38:39.479259 rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTART}, {0x4474ac, [], SA_RESTART}, 8) = 0
17:38:39.479414 execve("/root/bin/mii-diag", ["mii-diag", "eth0", "-p", "32775", "-W", "1,25,26,27,0xa026,0xa027,0xa028"], [/* 18 vars */]) = 0

	... since we continue on blindly and start the command,
	completely ignoring the SIGINT signal.  I've omitted most
	of the trace from mii-diag here...

17:38:39.484932 close(3)                = 0
17:38:39.485006 write(1, "Using the specified MII PHY inde"..., 195) = -1 EPIPE (Broken pipe)
17:38:39.485076 --- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=14242, si_uid=0} ---
17:38:39.485235 +++ killed by SIGPIPE +++

	eventually only being killed when mii-diag produces the
	first line of output due to the other side of the pipe
	having died.  This causes PID 14241's wait4() at
	17:38:39.479198 to complete - note the time stamp here,
	way after the top level shell has issued its prompt and
	entered requested a character from the TTY.


PID 14243 - this would have become the sed (cat as per the example I
=========   submitted)

17:38:39.475018 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
17:38:39.475419 rt_sigaction(SIGTSTP, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 017:38:39.475882 rt_sigaction(SIGTTIN, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 017:38:39.475940 rt_sigaction(SIGTTOU, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 017:38:39.476035 --- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
17:38:39.476298 rt_sigreturn()          = 0
17:38:39.476689 dup3(3, 0, 0)           = 0
17:38:39.477485 close(3)                = 0
17:38:39.477742 rt_sigprocmask(SIG_BLOCK, [CHLD TSTP TTIN TTOU], [], 8) = 0
17:38:39.477927 ioctl(255, SNDRV_TIMER_IOCTL_SELECT or TIOCSPGRP, [10875]) = 0
17:38:39.478074 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
17:38:39.478209 setpgid(0, 10875)       = 0
17:38:39.478342 rt_sigaction(SIGINT, {SIG_DFL, [], 0}, {0x45e2f8, [], 0}, 8) = 017:38:39.478575 kill(14243, SIGINT)     = 0
17:38:39.478732 --- SIGINT {si_signo=SIGINT, si_code=SI_USER, si_pid=14243, si_uid=0} ---
17:38:39.479079 +++ killed by SIGINT +++

	This never got far enough to start anything, having just set
	the default handler for SIGINT, and then been terminated by
	the SIGINT - this closes the other end of PID 14242's pipe.
	This also causes PID 14240's wait4() at 17:38:39.476214 to
	complete.

This is far from a rare event - for me it is very reproducable.

Trying different sleep durations from .1 to .001sec shows that it's
most prevalent at around .005 - .05 seconds.  Trying 1 second seems
to make it difficult to hit.

As I see it from the above strace, there are two problems with bash
in the above strace:

1. PID 14242 received but otherwise totally ignored the SIGINT, and
   proceeded to execute the command it was planning to all along.
2. PID 14119 failed to wait for PID 14241 to exit before itself
   exiting, orphaning the $(...) commands - which then causes the
   top level shell to present its prompt.

I consider both of these to be bugs in bash which add up to cause this
undesirable and annoying behaviour.

-- 
Russell King


From MAILER-DAEMON Tue Jan 03 04:04:14 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cOL0v-00008w-Tp
	for mharc-bug-bash@gnu.org; Tue, 03 Jan 2017 04:04:13 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:44700)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rmk+bug-bash=gnu.org@armlinux.org.uk>)
	id 1cOL0t-00008l-4Y
	for bug-bash@gnu.org; Tue, 03 Jan 2017 04:04:12 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rmk+bug-bash=gnu.org@armlinux.org.uk>)
	id 1cOL0r-0002Rr-R5
	for bug-bash@gnu.org; Tue, 03 Jan 2017 04:04:11 -0500
Received: from pandora.armlinux.org.uk
	([2001:4d48:ad52:3201:214:fdff:fe10:1be6]:44188)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <rmk+bug-bash=gnu.org@armlinux.org.uk>)
	id 1cOL0r-0002RX-9u
	for bug-bash@gnu.org; Tue, 03 Jan 2017 04:04:09 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=armlinux.org.uk; s=pandora-2014; 
	h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date;
	bh=OYJMFGW5sJ5VHYSl3YUuiqFDf954SJKo0ElaDlGFwrw=; 
	b=CRJB4YagprwRD4ZbvrPlaPfx0qoAX8ykC9bIGNuQXk/Z/68gAqs4SEEPXIUbiRCG7Vsbl5F1ok+ZUJnU5D++KaTYMJRSanRDVgtQ1mtrN1gpUrayLUoop+gvC2ZP2bTESk3PlqQew2ldHnrOWPxrJhhUGatPYcGjqw5tGmp/ZMk=;
Received: from flint.armlinux.org.uk
	([2001:4d48:ad52:3201:201:2ff:fe14:8fad]:35038)
	by pandora.armlinux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256)
	(Exim 4.82_1-5b7a7c0-XX) (envelope-from <rmk@armlinux.org.uk>)
	id 1cOL0h-0002JC-C7; Tue, 03 Jan 2017 09:03:59 +0000
Received: from rmk by flint.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX)
	(envelope-from <rmk@flint.armlinux.org.uk>)
	id 1cOL0b-0005Hh-5t; Tue, 03 Jan 2017 09:03:53 +0000
Date: Tue, 3 Jan 2017 09:03:52 +0000
From: Russell King <rmk@armlinux.org.uk>
To: Chet Ramey <chet.ramey@case.edu>
Cc: bug-bash@gnu.org, bash@packages.debian.org
Subject: Re: bash randomly logs out on VT / serial console
Message-ID: <20170103090352.GC31148@flint.armlinux.org.uk>
References: <E1cNnFx-0007G2-S2@flint.armlinux.org.uk>
	<7a33e5a0-ff66-0116-1aa0-4a52edfdc40d@case.edu>
	<20170102110945.GA31148@flint.armlinux.org.uk>
	<e7173a71-4120-da70-525f-c04db7729db3@case.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <e7173a71-4120-da70-525f-c04db7729db3@case.edu>
User-Agent: Mutt/1.5.23 (2014-03-12)
Sender: Russell King <rmk@armlinux.org.uk>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2001:4d48:ad52:3201:214:fdff:fe10:1be6
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Jan 2017 09:04:12 -0000

On Mon, Jan 02, 2017 at 02:06:01PM -0500, Chet Ramey wrote:
> On 1/2/17 6:09 AM, Russell King wrote:
> > On Sun, Jan 01, 2017 at 09:14:45PM -0500, Chet Ramey wrote:
> >> On 1/1/17 4:01 PM, rmk@armlinux.org.uk wrote:
> >>> Bash Version: 4.3
> >>> Patch Level: 30
> >>> Release Status: release
> >>>
> >>> Description:
> >>> 	Running:
> >>> 		while :; do s=$(sleep .005 | cat); echo $s; done | uniq
> >>> 	in a login shell on a virtual terminal or serial console results
> >>> 	in the shell randomly logging out after ^C.
> >>
> >> I believe this is fixed in bash-4.4.
> > 
> > Thank you for your reply.
> > 
> > However, while testing bash-4.4 with the five additional patches (bringing
> > it to 4.4.5) shows that it is not fixed in bash-4.4 - see below.  The line
> > from __tty_check_change() is from the debug I added to the kernel, which
> > shows that the reason for the EIO error is because the tty pgrp doesn't
> > match the process' pgrp.
> 
> OK.  I can't reproduce it on Fedora 25.

Digging into why Fedora doesn't show it comes down to distro choices.

Fedora ships util-linux login, which does this when starting the shell:

setsid()                = 14301
open("/dev/pts/4", O_RDWR|O_NONBLOCK|O_LARGEFILE) = 3
ioctl(3, TCGETS, {B38400 opost isig icanon echo ...}) = 0
fcntl64(3, F_GETFL)     = 0x8802 (flags O_RDWR|O_NONBLOCK|O_LARGEFILE)
fcntl64(3, F_SETFL, O_RDWR|O_LARGEFILE) = 0
close(0)                = 0
close(1)                = 0
close(2)                = 0
dup2(3, 0)              = 0
dup2(3, 1)              = 1
dup2(3, 2)              = 2
close(3)                = 0
ioctl(0, TIOCSCTTY, 1)  = 0
rt_sigaction(SIGINT, {SIG_DFL, [INT], SA_RESTART}, {SIG_IGN, [], 0}, 8) = 0
setuid32(0)             = 0
chdir("/root")          = 0
execve("/home/rmk/bash/bash-4.4/build-pristine/bash", ["-bash"], [/* 8 vars */]) = 0

This has the effect that bash sees that the existing PGRP is the same
as the PID - so bash's "original_pgrp" and "shell_pgrp" end up as the
same thing.

Debian and Ubuntu ship shadow-utils login, which makes no calls to
setsid, no TIOC*PGRP calls, no TIOCSCTTY calls.  It also makes no
attempt to open the tty itself, using the stdin/stderr supplied
to print it's prompts and read the login name and password.

This results in bash's "original_pgrp" being the PID of the login
process, and "shell_pgrp" the PID of the top level bash - and that
is a requirement for triggering the bug.

So, systems using util-linux login will not show this bug.  Systems
using shadow-utils login do show the bug.

Now also reproduced it on a single-CPU machine, also using the
shadow-utils login.

-- 
Russell King


From MAILER-DAEMON Tue Jan 03 06:55:26 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cONgc-0005ns-Iu
	for mharc-bug-bash@gnu.org; Tue, 03 Jan 2017 06:55:26 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:45148)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1cONga-0005nh-6N
	for bug-bash@gnu.org; Tue, 03 Jan 2017 06:55:25 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1cONgX-0005Ud-5r
	for bug-bash@gnu.org; Tue, 03 Jan 2017 06:55:24 -0500
Received: from homie.mail.dreamhost.com ([208.97.132.208]:57842
	helo=homiemail-a62.g.dreamhost.com)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <jidanni@jidanni.org>) id 1cONgW-0005Sk-SO
	for bug-bash@gnu.org; Tue, 03 Jan 2017 06:55:21 -0500
Received: from homiemail-a62.g.dreamhost.com (localhost [127.0.0.1])
	by homiemail-a62.g.dreamhost.com (Postfix) with ESMTP id 1D480634073
	for <bug-bash@gnu.org>; Tue,  3 Jan 2017 03:55:12 -0800 (PST)
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=Ha27NJoRNVT5IFxzn2XAxvZH9v4=; b=g4vQ1EOWKlaAixVv
	cfM7QI3PWDzkGVuApJ+873/gWJkLgcqsu4FMUfU+kSIg2oP9xHjeySimLC4ZqKHz
	a6PI/9P4FSlnB6CR6iDJcGfRPqTgQx1zYrQlCkxa+V7bqNlYyARp7RIEqi+TH/iW
	p2eZb1NOK5NmlfGh3pwUYh1LJxE=
Received: from jidanni.org (114-41-24-198.dynamic.hinet.net [114.41.24.198])
	(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 D649A63406C
	for <bug-bash@gnu.org>; Tue,  3 Jan 2017 03:55:11 -0800 (PST)
From: =?utf-8?B?56mN5Li55bC8?= Dan Jacobson <jidanni@jidanni.org>
To: bug-bash@gnu.org
Subject: help vs. partial option lists
Date: Tue, 03 Jan 2017 19:41:45 +0800
Message-ID: <87wpec9xqe.fsf@jidanni.org>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy]
X-Received-From: 208.97.132.208
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Jan 2017 11:55:25 -0000

$ help complete
...
    Options:
      -p	print existing completion specifications in a reusable format
      -r	remove a completion specification for each NAME, or, if no
    		NAMEs are supplied, all completion specifications
      -D	apply the completions and actions as the default for commands
    		without any specific completion defined
      -E	apply the completions and actions to "empty" commands --
    		completion attempted on a blank line

I would say 'Option highlights / Some Options / Selected Options' as that is not a full list.


From MAILER-DAEMON Tue Jan 03 07:27:48 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cOOBv-0003Am-UP
	for mharc-bug-bash@gnu.org; Tue, 03 Jan 2017 07:27:47 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:44589)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <fumeriangaming@gmail.com>) id 1cODL3-0002ny-4P
	for bug-bash@gnu.org; Mon, 02 Jan 2017 19:52:30 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <fumeriangaming@gmail.com>) id 1cODKx-0005Xf-Ky
	for bug-bash@gnu.org; Mon, 02 Jan 2017 19:52:24 -0500
Received: from mail-it0-x236.google.com ([2607:f8b0:4001:c0b::236]:37160)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <fumeriangaming@gmail.com>)
	id 1cODKx-0005XW-GZ
	for bug-bash@gnu.org; Mon, 02 Jan 2017 19:52:23 -0500
Received: by mail-it0-x236.google.com with SMTP id o141so265229466itc.0
	for <bug-bash@gnu.org>; Mon, 02 Jan 2017 16:52:21 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:from:date:message-id:subject:to;
	bh=fL3rm3KCnfDQxeHq1gh16AiiqZv+K9FlKOs2x6gPUOE=;
	b=W+MSAmPa/KyZmUo1+9CsxlTeCb9+qS+FNl886+Qiv31Vu1YkJFu+btCtHGLsf3HV2+
	X/Ot0huk+UM6OnJPxD406nDuwzApA7amKBAVmibPIOeY9XLzRG39B7Co/hbTbOltjHoj
	p4ZEYskRH0b3bC60HgMpBwWSMytHlrNhRT6GCrHcaX1yP0SCsMR3KUQfEmcrv2aPskp0
	dfseoWAPK90E9INTy0e1NAaeQG9mk4Rwtz1WcVlQOOt4qyNPr06j7xM+uJE4JbETeKiK
	4YZU16xYWrQ5odVJcdQ0MPxafAQXIodOF4XTHoIV9XbKuWLNIrRnQctInkYIMuPOBSeA
	Eo7g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
	bh=fL3rm3KCnfDQxeHq1gh16AiiqZv+K9FlKOs2x6gPUOE=;
	b=TQFAIEEDyGGWu00OibxRMFZYYNvZG5jPQp1rBwGLXY4/f2lyo9/AFK9qTxTkZqwKeP
	cOlULxHWq1U5XnBzAIBhRDMlpeaN6yWLJqhdLAq4RBb3EdmNa5y8C0sc3Rh4lq2MFvJK
	OCHW4gYMuprl3KxXe9mz/p0XbSz5jTq5DIcYx9zlglR9b27iZgs2fCOwz+LHeB+slSnl
	sdNGI7NlTECSByVPl8Y20rE4qmgjGhprClON9ofEyhUjJizEY/EsFdmkCMZGS2yxrAS3
	uENgdQ6NtMm7TFbWRpey97l8XbUb48yW6IVh3w79VKqXJmgF2uodVmkRfj4kkKQS+5tm
	yiBw==
X-Gm-Message-State: AIkVDXIRYmvjSJq4dmIDYuBLCoRX+wlpXZmGnbHvhQqdC156z27LLoSH2AJIOwT8Gbj0TaSsCPS1W/EZx2GXcA==
X-Received: by 10.36.50.78 with SMTP id j75mr46168519ita.58.1483404740955;
	Mon, 02 Jan 2017 16:52:20 -0800 (PST)
MIME-Version: 1.0
Received: by 10.107.47.35 with HTTP; Mon, 2 Jan 2017 16:52:20 -0800 (PST)
From: Sticky Chocolate <fumeriangaming@gmail.com>
Date: Mon, 2 Jan 2017 19:52:20 -0500
Message-ID: <CAKvSwnfkXQOCqa6GC-61P6Ydy2_Q941BjyLKa3UDzkpDZjut=g@mail.gmail.com>
Subject: memory leak(not freeing allocated buffer)
To: bug-bash@gnu.org
Content-Type: multipart/alternative; boundary=001a114a9afaa4942c054526141d
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2607:f8b0:4001:c0b::236
X-Mailman-Approved-At: Tue, 03 Jan 2017 07:27:46 -0500
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Jan 2017 00:52:30 -0000

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

Version:4.4

(This isn't so much a security bug)
While looking threw copy_cmd.c I saw when allocating new_redirect it
doesn't free it when it is done using it.

copy_cmd.c
Ln 115
________________________________________________________________

REDIRECT *
copy_redirect (redirect)
     REDIRECT *redirect;
{
  REDIRECT *new_redirect;

  new_redirect = (REDIRECT *)xmalloc (sizeof (REDIRECT));
#if 0
  FASTCOPY ((char *)redirect, (char *)new_redirect, (sizeof (REDIRECT)));
#else
  *new_redirect = *redirect;    /* let the compiler do the fast structure
copy */
#endif

  if (redirect->rflags & REDIR_VARASSIGN)
    new_redirect->redirector.filename = copy_word
(redirect->redirector.filename);

--001a114a9afaa4942c054526141d
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Version:4.4<br><br></div>(This isn&#39;t so much a se=
curity bug)<br><div>While looking threw copy_cmd.c I saw when allocating ne=
w_redirect it doesn&#39;t free it when it is done using it.<br><br>copy_cmd=
.c<br></div><div>Ln 115<br></div><div>_____________________________________=
___________________________<br><br>REDIRECT *<br>copy_redirect (redirect)<b=
r>=C2=A0=C2=A0=C2=A0=C2=A0 REDIRECT *redirect;<br>{<br>=C2=A0 REDIRECT *new=
_redirect;<br><br>=C2=A0 new_redirect =3D (REDIRECT *)xmalloc (sizeof (REDI=
RECT)); <br>#if 0<br>=C2=A0 FASTCOPY ((char *)redirect, (char *)new_redirec=
t, (sizeof (REDIRECT)));<br>#else<br>=C2=A0 *new_redirect =3D *redirect;=C2=
=A0=C2=A0=C2=A0 /* let the compiler do the fast structure copy */<br>#endif=
<br><br>=C2=A0 if (redirect-&gt;rflags &amp; REDIR_VARASSIGN)<br>=C2=A0=C2=
=A0=C2=A0 new_redirect-&gt;redirector.filename =3D copy_word (redirect-&gt;=
redirector.filename);<br></div></div>

--001a114a9afaa4942c054526141d--


From MAILER-DAEMON Tue Jan 03 07:27:49 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cOOBx-0003BV-2p
	for mharc-bug-bash@gnu.org; Tue, 03 Jan 2017 07:27:49 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:59723)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ldv@altlinux.org>) id 1cOMSP-0007RO-F8
	for bug-bash@gnu.org; Tue, 03 Jan 2017 05:36:42 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ldv@altlinux.org>) id 1cOMSL-0005xC-Ih
	for bug-bash@gnu.org; Tue, 03 Jan 2017 05:36:41 -0500
Received: from vmicros1.altlinux.org ([194.107.17.57]:40612)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ldv@altlinux.org>) id 1cOMSL-0005x1-B9
	for bug-bash@gnu.org; Tue, 03 Jan 2017 05:36:37 -0500
Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14])
	by vmicros1.altlinux.org (Postfix) with ESMTP id 0B82372D8EA;
	Tue,  3 Jan 2017 13:36:35 +0300 (MSK)
Received: by mua.local.altlinux.org (Postfix, from userid 508)
	id EF97E7CCB22; Tue,  3 Jan 2017 13:36:34 +0300 (MSK)
Date: Tue, 3 Jan 2017 13:36:34 +0300
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Russell King <rmk@armlinux.org.uk>
Cc: Chet Ramey <chet.ramey@case.edu>, bug-bash@gnu.org,
	bash@packages.debian.org
Subject: Re: bash randomly logs out on VT / serial console
Message-ID: <20170103103634.GA3966@altlinux.org>
References: <E1cNnFx-0007G2-S2@flint.armlinux.org.uk>
	<7a33e5a0-ff66-0116-1aa0-4a52edfdc40d@case.edu>
	<20170102110945.GA31148@flint.armlinux.org.uk>
	<e7173a71-4120-da70-525f-c04db7729db3@case.edu>
	<20170102233316.GB31148@flint.armlinux.org.uk>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=x-unknown;
	protocol="application/pgp-signature"; boundary="+QahgC5+KEYLbs62"
Content-Disposition: inline
In-Reply-To: <20170102233316.GB31148@flint.armlinux.org.uk>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
	timestamps) [generic] [fuzzy]
X-Received-From: 194.107.17.57
X-Mailman-Approved-At: Tue, 03 Jan 2017 07:27:46 -0500
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Jan 2017 10:36:42 -0000


--+QahgC5+KEYLbs62
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi,

On Mon, Jan 02, 2017 at 11:33:16PM +0000, Russell King wrote:
[...]
> 17:38:39.478119 ioctl(255, SNDRV_TIMER_IOCTL_SELECT or TIOCSPGRP, [10928]=
) =3D 0
> 17:38:39.478250 rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) =3D 0
> 17:38:39.478395 ioctl(255, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_=
DEVICE or TCGETS, {B115200 opost isig icanon echo ...}) =3D 0
> 17:38:39.478626 ioctl(255, SNDCTL_TMR_STOP or SNDRV_TIMER_IOCTL_GINFO or =
TCSETSW, {B115200 opost isig icanon echo ...}) =3D 0
> 17:38:39.478782 ioctl(255, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_=
DEVICE or TCGETS, {B115200 opost isig icanon echo ...}) =3D 0

Just a side comment: if you were using strace version 4.10 or newer,
you'd see much better decoding of these and other ioctl calls.

Happy tracing,


--=20
ldv

--+QahgC5+KEYLbs62
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJYa36yAAoJEAVFT+BVnCUIcVwQAKJyugc+kyamkDARczWtj4KS
uAocIxcBxe9XLFX64ZYm5P0DuqZ8iMNRTsVJq3nlD2aw8XJZab0OcRa0t9O5u2R2
izTcuQoxPrwyp/TWKuM1blMXc/c98+Q15q0ypKB7gBSoz4zN8baiMFBRqOTc4LNb
rsiI6xt4Z8ZFprWmAA7aHTublbmXk91q2U9BAxzJIhYu4GUdmguYQraVLmdgO3yP
JEFDyYW1KoVCtjikBUiB9w7yz5vP1Rn+4UcwIvElCc2nYaksX5s2nVzXfEKByo84
KJcewIGdxUFeDD/TsBF+VDYU3mbimned6o24YTCUG2hAuLs9RSgr9wCcYgAUGA8u
YgDs3Voh858lYaZPiPWcaFbX/erpCqqFvtHjDsWL9TUQn0xTA5yJ04OvnYKfiRA6
Znp8FWBUqqAqcfrEujkFxug4cW58zo5xQIJLfhcqcxksHnrnmUfzW1gJ56ooniW/
94rhEH4A+ydI95/pbdo9P7ep72NZuDlTisFHb7xZQWNYGxhpE8s3aXn/YOTA5ntY
RlQ9RWqmbQ8BBrePBOHk5RAjIpmpWDCiVgcDKGHbDu586Z/FNIcmxyrkJPuvHd+K
yt97vZZ6Jue+Vjd+FtA9kAOx5PfC9pfOn88df0VTL65jf+0JnzrcxyFDALafBJsV
Dc/yBv5kQEKqpOK8xVy0
=XETG
-----END PGP SIGNATURE-----

--+QahgC5+KEYLbs62--


From MAILER-DAEMON Tue Jan 03 10:07:47 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cOQgl-0001X9-DF
	for mharc-bug-bash@gnu.org; Tue, 03 Jan 2017 10:07:47 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:52746)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cOQgj-0001Vr-Ek
	for bug-bash@gnu.org; Tue, 03 Jan 2017 10:07:46 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cOQgg-00082M-5P
	for bug-bash@gnu.org; Tue, 03 Jan 2017 10:07:45 -0500
Received: from mpv2-2015.cwru.edu ([129.22.103.227]:51093
	helo=mpv1-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1cOQgg-000820-0I
	for bug-bash@gnu.org; Tue, 03 Jan 2017 10:07:42 -0500
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv2-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AKK47654; Tue, 03 Jan 2017 10:07:39 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AXL44159 (AUTH cpr);
	Tue, 03 Jan 2017 10:07:38 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: memory leak(not freeing allocated buffer)
References: <CAKvSwnfkXQOCqa6GC-61P6Ydy2_Q941BjyLKa3UDzkpDZjut=g@mail.gmail.com>
To: Sticky Chocolate <fumeriangaming@gmail.com>, bug-bash@gnu.org
Cc: chet.ramey@case.edu
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <4069e2b6-5799-aed9-51d6-1e3d229b931a@case.edu>
Date: Tue, 3 Jan 2017 10:07:31 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0)
	Gecko/20100101 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <CAKvSwnfkXQOCqa6GC-61P6Ydy2_Q941BjyLKa3UDzkpDZjut=g@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv2-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.227
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Jan 2017 15:07:46 -0000

On 1/2/17 7:52 PM, Sticky Chocolate wrote:
> Version:4.4
> 
> (This isn't so much a security bug)
> While looking threw copy_cmd.c I saw when allocating new_redirect it
> doesn't free it when it is done using it.

That's the return value from the function.

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


From MAILER-DAEMON Tue Jan 03 11:32:17 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cOS0X-0006hz-De
	for mharc-bug-bash@gnu.org; Tue, 03 Jan 2017 11:32:17 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:48721)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <rmk+bug-bash=gnu.org@armlinux.org.uk>)
	id 1cOS0U-0006h3-Gz
	for bug-bash@gnu.org; Tue, 03 Jan 2017 11:32:16 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <rmk+bug-bash=gnu.org@armlinux.org.uk>)
	id 1cOS0T-0006cZ-97
	for bug-bash@gnu.org; Tue, 03 Jan 2017 11:32:14 -0500
Received: from pandora.armlinux.org.uk
	([2001:4d48:ad52:3201:214:fdff:fe10:1be6]:49280)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <rmk+bug-bash=gnu.org@armlinux.org.uk>)
	id 1cOS0S-0006bm-K2
	for bug-bash@gnu.org; Tue, 03 Jan 2017 11:32:13 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=armlinux.org.uk; s=pandora-2014; 
	h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date;
	bh=SGjTR8fGVLWTdfkNx/AuAbBpb3ysd3SWPkHiA4hclC0=; 
	b=Szp2JQw3ziEBckUPnuESVUo62Q3bLu7VLJzER5m0pjjEaD4AAI9P3hzTls8btK9DD1y5g8byH9YwmXUv0BF6Udt7qAhGPf3VD83W7IRuiIFZRc9hoZq0cilCN0izsvW4rpw8av/mdK+z7qX9n5/jpxHL4lA6CYGBuB3p3hh/Oco=;
Received: from flint.armlinux.org.uk
	([fd8f:7570:feb6:1:201:2ff:fe14:8fad]:42684)
	by pandora.armlinux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256)
	(Exim 4.82_1-5b7a7c0-XX) (envelope-from <rmk@armlinux.org.uk>)
	id 1cOS0K-0004EM-R6; Tue, 03 Jan 2017 16:32:05 +0000
Received: from rmk by flint.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX)
	(envelope-from <rmk@flint.armlinux.org.uk>)
	id 1cOS0C-0008Ei-K3; Tue, 03 Jan 2017 16:31:56 +0000
Date: Tue, 3 Jan 2017 16:31:56 +0000
From: Russell King <rmk@armlinux.org.uk>
To: Chet Ramey <chet.ramey@case.edu>
Cc: bug-bash@gnu.org, bash@packages.debian.org
Subject: Re: bash randomly logs out on VT / serial console
Message-ID: <20170103163155.GA31065@flint.armlinux.org.uk>
References: <E1cNnFx-0007G2-S2@flint.armlinux.org.uk>
	<7a33e5a0-ff66-0116-1aa0-4a52edfdc40d@case.edu>
	<20170102110945.GA31148@flint.armlinux.org.uk>
	<e7173a71-4120-da70-525f-c04db7729db3@case.edu>
	<20170103090352.GC31148@flint.armlinux.org.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20170103090352.GC31148@flint.armlinux.org.uk>
User-Agent: Mutt/1.5.23 (2014-03-12)
Sender: Russell King <rmk@armlinux.org.uk>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2001:4d48:ad52:3201:214:fdff:fe10:1be6
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Jan 2017 16:32:16 -0000

On Tue, Jan 03, 2017 at 09:03:52AM +0000, Russell King wrote:
> On Mon, Jan 02, 2017 at 02:06:01PM -0500, Chet Ramey wrote:
> > On 1/2/17 6:09 AM, Russell King wrote:
> > > On Sun, Jan 01, 2017 at 09:14:45PM -0500, Chet Ramey wrote:
> > >> On 1/1/17 4:01 PM, rmk@armlinux.org.uk wrote:
> > >>> Bash Version: 4.3
> > >>> Patch Level: 30
> > >>> Release Status: release
> > >>>
> > >>> Description:
> > >>> 	Running:
> > >>> 		while :; do s=$(sleep .005 | cat); echo $s; done | uniq
> > >>> 	in a login shell on a virtual terminal or serial console results
> > >>> 	in the shell randomly logging out after ^C.
> > >>
> > >> I believe this is fixed in bash-4.4.
> > > 
> > > Thank you for your reply.
> > > 
> > > However, while testing bash-4.4 with the five additional patches (bringing
> > > it to 4.4.5) shows that it is not fixed in bash-4.4 - see below.  The line
> > > from __tty_check_change() is from the debug I added to the kernel, which
> > > shows that the reason for the EIO error is because the tty pgrp doesn't
> > > match the process' pgrp.
> > 
> > OK.  I can't reproduce it on Fedora 25.
> 
> Digging into why Fedora doesn't show it comes down to distro choices.
> 
> Fedora ships util-linux login, which does this when starting the shell:
> 
> setsid()                = 14301
> open("/dev/pts/4", O_RDWR|O_NONBLOCK|O_LARGEFILE) = 3
> ioctl(3, TCGETS, {B38400 opost isig icanon echo ...}) = 0
> fcntl64(3, F_GETFL)     = 0x8802 (flags O_RDWR|O_NONBLOCK|O_LARGEFILE)
> fcntl64(3, F_SETFL, O_RDWR|O_LARGEFILE) = 0
> close(0)                = 0
> close(1)                = 0
> close(2)                = 0
> dup2(3, 0)              = 0
> dup2(3, 1)              = 1
> dup2(3, 2)              = 2
> close(3)                = 0
> ioctl(0, TIOCSCTTY, 1)  = 0
> rt_sigaction(SIGINT, {SIG_DFL, [INT], SA_RESTART}, {SIG_IGN, [], 0}, 8) = 0
> setuid32(0)             = 0
> chdir("/root")          = 0
> execve("/home/rmk/bash/bash-4.4/build-pristine/bash", ["-bash"], [/* 8 vars */]) = 0
> 
> This has the effect that bash sees that the existing PGRP is the same
> as the PID - so bash's "original_pgrp" and "shell_pgrp" end up as the
> same thing.
> 
> Debian and Ubuntu ship shadow-utils login, which makes no calls to
> setsid, no TIOC*PGRP calls, no TIOCSCTTY calls.  It also makes no
> attempt to open the tty itself, using the stdin/stderr supplied
> to print it's prompts and read the login name and password.
> 
> This results in bash's "original_pgrp" being the PID of the login
> process, and "shell_pgrp" the PID of the top level bash - and that
> is a requirement for triggering the bug.
> 
> So, systems using util-linux login will not show this bug.  Systems
> using shadow-utils login do show the bug.

Sorry for the third mail since you last responded.

Having built the util-linux login on one of my Ubuntu boxes, when
logging in using the shadow-utils login, with the bash shell printing
its internal pgrp state in initialize_job_control() via the handy
function already provided:

TRACE: pid 6112: original_pgrp = 6076 shell_pgrp = 6112 terminal_pgrp = 6112
TRACE: pid 6112: tcgetpgrp(255) -> 6112, getpgid(0) -> 6112

With the util-linux flavour of login (used by Fedora):

TRACE: pid 6217: original_pgrp = 6217 shell_pgrp = 6217 terminal_pgrp = 6217
TRACE: pid 6217: tcgetpgrp(255) -> 6217, getpgid(0) -> 6217

Note - util-linux login is not offered as an alternative on debian or
ubuntu installations - this is a custom modification.

The bash problem is unreproducable when the util-linux login flavour
is used due to original_pgrp == shell_pgrp, which effectively hides the
bug.

-- 
Russell King


From MAILER-DAEMON Fri Jan 06 14:57:47 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cPae3-0006O4-Qv
	for mharc-bug-bash@gnu.org; Fri, 06 Jan 2017 14:57:47 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:45423)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cPae0-0006Ny-Q6
	for bug-bash@gnu.org; Fri, 06 Jan 2017 14:57:45 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cPadx-0007jE-PE
	for bug-bash@gnu.org; Fri, 06 Jan 2017 14:57:44 -0500
Received: from mpv4-2015.cwru.edu ([129.22.103.195]:63858
	helo=mpv4-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1cPadx-0007jA-Jk
	for bug-bash@gnu.org; Fri, 06 Jan 2017 14:57:41 -0500
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv4-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AJB97352; Fri, 06 Jan 2017 14:57:31 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AXQ24198 (AUTH cpr);
	Fri, 06 Jan 2017 14:57:30 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: bash randomly logs out on VT / serial console
References: <E1cNnFx-0007G2-S2@flint.armlinux.org.uk>
	<7a33e5a0-ff66-0116-1aa0-4a52edfdc40d@case.edu>
	<20170102110945.GA31148@flint.armlinux.org.uk>
	<e7173a71-4120-da70-525f-c04db7729db3@case.edu>
	<20170102233316.GB31148@flint.armlinux.org.uk>
To: Russell King <rmk@armlinux.org.uk>
Cc: chet.ramey@case.edu, bug-bash@gnu.org, bash@packages.debian.org
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <6724c6a6-b0af-ba7e-4bcb-6b80488f154b@case.edu>
Date: Fri, 6 Jan 2017 14:57:30 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0)
	Gecko/20100101 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <20170102233316.GB31148@flint.armlinux.org.uk>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv4-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.195
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Jan 2017 19:57:46 -0000

On 1/2/17 6:33 PM, Russell King wrote:
> On Mon, Jan 02, 2017 at 02:06:01PM -0500, Chet Ramey wrote:
>> On 1/2/17 6:09 AM, Russell King wrote:
>>> On Sun, Jan 01, 2017 at 09:14:45PM -0500, Chet Ramey wrote:
>>>> On 1/1/17 4:01 PM, rmk@armlinux.org.uk wrote:
>>>>> Bash Version: 4.3
>>>>> Patch Level: 30
>>>>> Release Status: release
>>>>>
>>>>> Description:
>>>>> 	Running:
>>>>> 		while :; do s=$(sleep .005 | cat); echo $s; done | uniq
>>>>> 	in a login shell on a virtual terminal or serial console results
>>>>> 	in the shell randomly logging out after ^C.
>>>>
>>>> I believe this is fixed in bash-4.4.
>>>
>>> Thank you for your reply.
>>>
>>> However, while testing bash-4.4 with the five additional patches (bringing
>>> it to 4.4.5) shows that it is not fixed in bash-4.4 - see below.  The line
>>> from __tty_check_change() is from the debug I added to the kernel, which
>>> shows that the reason for the EIO error is because the tty pgrp doesn't
>>> match the process' pgrp.
>>
>> OK.  I can't reproduce it on Fedora 25.
> 
> Thank you for your reply.
> 
> Here's more information from the strace logs in case it helps - these
> are from the "useful" command rather than the one which I quoted in
> the bug report which reproduces it as well - "mii-diag" for the "sleep"
> and "sed" for the "cat" part - otherwise identical.  Note that I'm
> running a modified mii-diag here...

Thanks.  With this and the pgrp information you provided in a different
message, it was pretty easy to find and fix the problems.  The fixes will
be in the next devel snapshot.

Chet

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


From MAILER-DAEMON Sun Jan 08 11:25:44 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cQGHw-0003AI-Pw
	for mharc-bug-bash@gnu.org; Sun, 08 Jan 2017 11:25:44 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:55409)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mmokrejs@gmail.com>) id 1cQGHt-00039u-TS
	for bug-bash@gnu.org; Sun, 08 Jan 2017 11:25:43 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <mmokrejs@gmail.com>) id 1cQGHo-00034k-Q8
	for bug-bash@gnu.org; Sun, 08 Jan 2017 11:25:41 -0500
Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:38114)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <mmokrejs@gmail.com>) id 1cQGHo-00034P-JO
	for bug-bash@gnu.org; Sun, 08 Jan 2017 11:25:36 -0500
Received: by mail-wm0-x231.google.com with SMTP id k184so90444896wme.1
	for <bug-bash@gnu.org>; Sun, 08 Jan 2017 08:25:34 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=subject:to:references:from:message-id:date:user-agent:mime-version
	:in-reply-to:content-transfer-encoding;
	bh=mdAE7/jysfQBAK/ZWzwh080mzCtpfOtUq9wNfr5wggo=;
	b=Iz3EehWcaBJXFcH7/HpPE0+iWgGRNVGNtNEhje/9CgcgSuZObxnZFo/FNcGytGOFxw
	jfhphSz+pB27kfT0G2HRjnwoweHJC+WClKmEB5Xrv/H6yZ9/1x1esMI7Lg+B6PYeWcIJ
	zKX3GbOFjOvii4pQRd3gWJ9obapL5+Tz1Aacf5VagDT9V8x1E6Fp836P5Lh4xvOq5ISF
	lon2FM/uTaikiSC8fmGkjiGxTXVp4M2oGRY4xgvntjh3U8IzVEidHHEtT/6H5ANOca1o
	33oOoKb0BuyN18bOeCeFA1AQ+f97EAsgTyLkb4q3SSBpM9QrWsbrPuIQaG2H4J/r/NWY
	E+aw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:subject:to:references:from:message-id:date
	:user-agent:mime-version:in-reply-to:content-transfer-encoding;
	bh=mdAE7/jysfQBAK/ZWzwh080mzCtpfOtUq9wNfr5wggo=;
	b=AU8HwfoJCLGgc+fx7Fx5GN/c7f5Gimq1s3lzfpeGwRO4QofxkXTEGidXwIq2eLDQkf
	Ysr086rqnNNPvfoS/JrE0MUpsKSg8pCYeHWE9mbkcHYk6MZibLoe2gR8RUx2lLpgUjrX
	UkXDGRZSmXysttCPAz+0SHb0U+N3zVW2foJ6aNC4uF9mWhCOPbHh0hj5/yf+sT1gVjtH
	/Fhs1Qyqm1BOKF5xIV3Ecgx9XYq4Cpw7gnyWi0pJTjS1vok87il0w29PZgXxS0GCMyEA
	jHKqUjVPcY+2d3rO8S/SGvox9wS6A0YG3C6hEHa3idnZ+8zmnpLfWA4u5y8JqmlEbvtR
	I2LQ==
X-Gm-Message-State: AIkVDXLxUdK+suMRkVPuYGmlTp2mm90gWWO+XyjHjBGunApghZ6KKRekCU1YL/IvtomuQQ==
X-Received: by 10.223.164.129 with SMTP id g1mr10926900wrb.86.1483892733890;
	Sun, 08 Jan 2017 08:25:33 -0800 (PST)
Received: from [158.196.239.195] (eduroam-239-195.vsb.cz. [158.196.239.195])
	by smtp.gmail.com with ESMTPSA id
	r129sm4674359wmd.8.2017.01.08.08.25.32
	(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Sun, 08 Jan 2017 08:25:32 -0800 (PST)
Subject: Re: set command overrides my ARGV array
To: Eric Blake <eblake@redhat.com>, bug-bash@gnu.org
References: <21e86a0f-e5af-0c74-1c8b-d33be6aa4dfe@gmail.com>
	<d9d0d935-b674-26ab-99de-30c38077e492@redhat.com>
From: =?UTF-8?Q?Martin_MOKREJ=c5=a0?= <mmokrejs@gmail.com>
Message-ID: <0379cb2f-0f14-2576-c005-d1eae1c60a60@gmail.com>
Date: Sun, 8 Jan 2017 17:25:29 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:49.0) Gecko/20100101
	Firefox/49.0 SeaMonkey/2.46
MIME-Version: 1.0
In-Reply-To: <d9d0d935-b674-26ab-99de-30c38077e492@redhat.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2a00:1450:400c:c09::231
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 08 Jan 2017 16:25:43 -0000

Hi,
  I forgot to say thanks to all of you who responded. I think the manual page needs improvement. This is just confusing.
Martin

Eric Blake wrote:
> On 12/27/2016 10:21 AM, Martin MOKREJŠ wrote:
>> Hi,
>>   I wanted to enable error code reporting for piped processes. This
>> should be doable by "set -o pipeline on". The problem is it kills my $*
>> array and defines $1="on".
> 
> That's because you used the wrong syntax.
> 
> 'set -o pipefail' turns it on,
> 'set +o pipefail' turns it off
> 
> 'set -o pipefail on' is the same as 'set -o pipefail; set on', which
> turns it on but also changes $*.


From MAILER-DAEMON Wed Jan 11 16:40:09 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cRQcr-0003SJ-KA
	for mharc-bug-bash@gnu.org; Wed, 11 Jan 2017 16:40:09 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:55721)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wm2015email@gmail.com>) id 1cRNeu-0002SJ-Ro
	for bug-bash@gnu.org; Wed, 11 Jan 2017 13:30:06 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wm2015email@gmail.com>) id 1cRNeu-0007rb-0P
	for bug-bash@gnu.org; Wed, 11 Jan 2017 13:30:04 -0500
Received: from mail-io0-x22c.google.com ([2607:f8b0:4001:c06::22c]:34339)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <wm2015email@gmail.com>)
	id 1cRNet-0007rB-QX; Wed, 11 Jan 2017 13:30:03 -0500
Received: by mail-io0-x22c.google.com with SMTP id l66so31046791ioi.1;
	Wed, 11 Jan 2017 10:30:03 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:from:date:message-id:subject:to;
	bh=KMqw2sUFokBo8hmkp2x3xAdDbUEkf5hPhBIFRoKGUyI=;
	b=QluY5gSL+QKJqzpUCBIacN0BGYy4AsRZ/aXaEl1lrbMlJmRxvewDGE5CrxR26WHDc7
	RxT0oeXzVi62UGlNSyDgcWL5vHC0306KdcVTHQ2ZbQs6xlojO7VSCMLiRbJ6pX0D62Q1
	EYQ8JyKIJg5zUwXKdn9Lw5d1RhCiS6hnqP/UA9ACyCQGtSjL08C/jhUP1XD+fVd2r8Kp
	Ws1BLRrB7tA6LZkDgR9KugtMDEZQt11IQ2nwxscQ63bJmXJ/GZXBV25yAnleJWkY4qXM
	XCL4MRTd59S/mpXNzbmTX5GiGhYQ2zBT+ujtKD+YnYo19+iALjAyMeEx1A74nmv7MnwR
	UMCA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
	bh=KMqw2sUFokBo8hmkp2x3xAdDbUEkf5hPhBIFRoKGUyI=;
	b=krhyZAXUiEXhXpW/X4CEKPO03fAtMIXzQ8KjxJwgiebRfycPbSjj8+UvEVrr5edRwF
	8JWFA16gyEUIoj63KevihFbNosV1FhsGHOfUx1/ULLnZm9s4O5NL3Z+Nlqxin4Iz4sPb
	iSPMiiyE/aaSa7arsloiVVoucwp44A3IzZd6XSe9kAXurbu4lUwrRGdsALWgOVqcrvKo
	qWo2l3ChArd5izpFY/+Bup8bVBHWyw97uRpmXcE8bGi6Uu+0dyboWxuPXpUgSMeyCKc0
	dw4n+hlnN9UV6idB7GBMF5Fv85UCuNb0WOMN0q6glIhHnQWIHBq9xwX0QzXGU5MZJ9P8
	p6jA==
X-Gm-Message-State: AIkVDXKyoH9nFhQGYrR88/izMsmQ6/5NMHLagswtdE0OuE69dfAB/QhCE7rK8yM8IP48wj/b7PlmL4l6oykDVg==
X-Received: by 10.107.164.232 with SMTP id d101mr9373246ioj.182.1484159402660; 
	Wed, 11 Jan 2017 10:30:02 -0800 (PST)
MIME-Version: 1.0
Received: by 10.64.71.129 with HTTP; Wed, 11 Jan 2017 10:30:02 -0800 (PST)
From: Bill William <wm2015email@gmail.com>
Date: Wed, 11 Jan 2017 13:30:02 -0500
Message-ID: <CADPaO3qMmFm60MZmFYO1BhTW+1CBORR9EXYYwgjr8jQ9Mha1fA@mail.gmail.com>
Subject: suggestions: for bash shell: "shebam's and shebang's"
To: bug-bash@gnu.org, gnu@gnu.org
Content-Type: multipart/alternative; boundary=001a114221f2fc87da0545d5c9a2
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2607:f8b0:4001:c06::22c
X-Mailman-Approved-At: Wed, 11 Jan 2017 16:40:07 -0500
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 11 Jan 2017 18:30:06 -0000

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

Sorry about restating the obvious... but...everybody dislikes binary file
header "bom's" like utf=8, utf-16 etc..too little...too late... instead,
why not force everybody to build those file types into the shebang instead?


The problem with the shebang is that its not a file type its an
executable...what is needed is the option to only specify a file type...
examples:


//Example Shebang:       #!/usr/bin/perl
//Example Shebam:        #:utf8
//Example Shebam:        #:ascii
//Example Shebam:        #:b64encrypt
//Example Shebam:        #:gtk+xml-gladed6
//Example Shebam:        #:xml-myprogram
//Example Shebamshebang: #:perl-ascii!/usr/bin/perl
//Example Shebamshebang: #:perl-ascii!c:/perl/bin/perl.exe
//Example Shebamshebang: #:perl-ascii!c:/perl/bin/perl.exe

//utf16, utf32?? who cares... utf8 already won... 99% of the time... except
for legacy windows code...
inline void ShebamWrite(ofstream& myfile, const string Shebam) {
  myfile <<"#:" << Shebam << "\n";
}

//Shebam: A File 'Bom' the way it should have been done.
inline string ShebamCheck(string filename) {
   ifstream myfile(filename);
   string Shebam = ShebamRead(myfile);
   myfile.close();
   return Shebam;
}

inline string ShebamRead(ifstream& myfile) {
   string buffer;
   getline(myfile, buffer);
   int len = buffer.size();
   if (len < 2)
    return string{};

   bool found=false;
   if ((buffer[0]=='#') && ((buffer[1]==':') || (buffer[1]=='!'))) {
      for(int i=2; i < len; i++) {
        if (!isprint(buffer[i])) {
            found=false;
            break;
        }
        else if (i>3) { //need at least one bom character
          found=true;
        }
      }
   }
   if (!found) {
     return string{};
   }
   buffer.erase(0, 2);

   return buffer;
}

int main(int argc, char** argv) {
  string shabam1 = ShebamCheck("myfile1.txt");
  if (shabam1 == string{}) {
    cout << "shebam1 = none\n";
  }
  else {
    cout << "shebam1 = " << shebam1 << "\n";
  }
  return 0;
}

--001a114221f2fc87da0545d5c9a2
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Sorry about restating the obvious... but...everybody =
dislikes binary file header &quot;bom&#39;s&quot; like utf=3D8, utf-16 etc.=
.too little...too late... instead, why not force everybody to build those f=
ile types into the shebang instead? =C2=A0</div><div><br></div><div>The pro=
blem with the shebang is that its not a file type its an executable...what =
is needed is the option to only specify a file type... examples:</div><div>=
<br><div><br></div><div><div>//Example Shebang: =C2=A0 =C2=A0 =C2=A0 #!/usr=
/bin/perl</div><div>//Example Shebam: =C2=A0 =C2=A0 =C2=A0 =C2=A0#:utf8</di=
v><div>//Example Shebam: =C2=A0 =C2=A0 =C2=A0 =C2=A0#:ascii</div><div>//Exa=
mple Shebam: =C2=A0 =C2=A0 =C2=A0 =C2=A0#:b64encrypt</div><div>//Example Sh=
ebam: =C2=A0 =C2=A0 =C2=A0 =C2=A0#:gtk+xml-gladed6</div><div>//Example Sheb=
am: =C2=A0 =C2=A0 =C2=A0 =C2=A0#:xml-myprogram</div><div>//Example Shebamsh=
ebang: #:perl-ascii!/usr/bin/perl</div><div>//Example Shebamshebang: #:perl=
-ascii!c:/perl/bin/perl.exe</div><div>//Example Shebamshebang: #:perl-ascii=
!c:/perl/bin/perl.exe</div><div><br></div><div>//utf16, utf32?? who cares..=
. utf8 already won... 99% of the time... except for legacy windows code...<=
/div><div><span class=3D"gmail-Apple-tab-span" style=3D"white-space:pre">	<=
/span></div><div>inline void ShebamWrite(ofstream&amp; myfile, const string=
 Shebam) {</div><div>=C2=A0 myfile &lt;&lt;&quot;#:&quot; &lt;&lt; Shebam &=
lt;&lt; &quot;\n&quot;;</div><div>}</div><div><br></div><div>//Shebam: A Fi=
le &#39;Bom&#39; the way it should have been done.</div><div>inline string =
ShebamCheck(string filename) {</div><div>=C2=A0 =C2=A0ifstream myfile(filen=
ame);</div><div>=C2=A0 =C2=A0string Shebam =3D ShebamRead(myfile);</div><di=
v>=C2=A0 =C2=A0myfile.close();</div><div>=C2=A0 =C2=A0return Shebam;</div><=
div>}</div><div><br></div><div>inline string ShebamRead(ifstream&amp; myfil=
e) {</div><div>=C2=A0 =C2=A0string buffer;</div><div>=C2=A0 =C2=A0getline(m=
yfile, buffer);</div><div>=C2=A0 =C2=A0int len =3D buffer.size();</div><div=
>=C2=A0 =C2=A0if (len &lt; 2)</div><div>=C2=A0 =C2=A0 return string{};</div=
><div><br></div><div>=C2=A0 =C2=A0bool found=3Dfalse;</div><div>=C2=A0 =C2=
=A0if ((buffer[0]=3D=3D&#39;#&#39;) &amp;&amp; ((buffer[1]=3D=3D&#39;:&#39;=
) || (buffer[1]=3D=3D&#39;!&#39;))) {</div><div>=C2=A0 =C2=A0 =C2=A0 for(in=
t i=3D2; i &lt; len; i++) {</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (!ispr=
int(buffer[i])) {</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 found=
=3Dfalse;</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;</div><=
div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 }</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 els=
e if (i&gt;3) { //need at least one bom character</div><div>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 found=3Dtrue;</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<=
/div><div>=C2=A0 =C2=A0 =C2=A0 }</div><div>=C2=A0 =C2=A0}</div><div>=C2=A0 =
=C2=A0if (!found) {</div><div>=C2=A0 =C2=A0 =C2=A0return string{};</div><di=
v>=C2=A0 =C2=A0}</div><div>=C2=A0 =C2=A0buffer.erase(0, 2);</div><div><br><=
/div><div>=C2=A0 =C2=A0return buffer;</div><div>}</div><div><br></div><div>=
int main(int argc, char** argv) {</div><div>=C2=A0 string shabam1 =3D Sheba=
mCheck(&quot;myfile1.txt&quot;);</div><div>=C2=A0 if (shabam1 =3D=3D string=
{}) {</div><div>=C2=A0 =C2=A0 cout &lt;&lt; &quot;shebam1 =3D none\n&quot;;=
</div><div>=C2=A0 }</div><div>=C2=A0 else {</div><div>=C2=A0 =C2=A0 cout &l=
t;&lt; &quot;shebam1 =3D &quot; &lt;&lt; shebam1 &lt;&lt; &quot;\n&quot;;</=
div><div>=C2=A0 }</div><div>=C2=A0 return 0;</div><div>}</div></div></div><=
div><br></div></div>

--001a114221f2fc87da0545d5c9a2--


From MAILER-DAEMON Wed Jan 11 16:54:51 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cRQr5-0007Rw-8t
	for mharc-bug-bash@gnu.org; Wed, 11 Jan 2017 16:54:51 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:49587)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cRQr2-0007Qd-UR
	for bug-bash@gnu.org; Wed, 11 Jan 2017 16:54:49 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cRQqx-0005l2-Vs
	for bug-bash@gnu.org; Wed, 11 Jan 2017 16:54:48 -0500
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:39879 helo=svr4.eeg.ccf.org)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cRQqx-0005VD-PH
	for bug-bash@gnu.org; Wed, 11 Jan 2017 16:54:43 -0500
Received: (qmail 48481 invoked from network); 11 Jan 2017 21:54:06 -0000
Received: from imadev.eeg.ccf.org (qmailr@10.76.173.78)
	by gateway.eeg.ccf.org with SMTP; Wed, 11 Jan 2017 16:54:06 -0500
Received: (qmail 10885 invoked by uid 563); 11 Jan 2017 21:54:05 -0000
Date: Wed, 11 Jan 2017 16:54:05 -0500
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Bill William <wm2015email@gmail.com>
Cc: bug-bash@gnu.org, gnu@gnu.org
Subject: Re: suggestions: for bash shell: "shebam's and shebang's"
Message-ID: <20170111215405.GZ23041@eeg.ccf.org>
References: <CADPaO3qMmFm60MZmFYO1BhTW+1CBORR9EXYYwgjr8jQ9Mha1fA@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CADPaO3qMmFm60MZmFYO1BhTW+1CBORR9EXYYwgjr8jQ9Mha1fA@mail.gmail.com>
User-Agent: Mutt/1.4.2.3i
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 139.137.100.1
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 11 Jan 2017 21:54:49 -0000

On Wed, Jan 11, 2017 at 01:30:02PM -0500, Bill William wrote:
> The problem with the shebang is that its not a file type its an
> executable...what is needed is the option to only specify a file type...
> examples:
> 
> //Example Shebang:       #!/usr/bin/perl
> //Example Shebam:        #:utf8
> //Example Shebam:        #:ascii
> //Example Shebam:        #:b64encrypt

You are missing a key piece of information: it's not bash who reads and
acts upon the shebang.  It's the kernel.  To bash, it's just a comment.


From MAILER-DAEMON Wed Jan 11 21:04:53 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cRUl3-00049a-3T
	for mharc-bug-bash@gnu.org; Wed, 11 Jan 2017 21:04:53 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:47531)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1cRUl0-00047I-SV
	for bug-bash@gnu.org; Wed, 11 Jan 2017 21:04:51 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1cRUkx-0007LZ-LO
	for bug-bash@gnu.org; Wed, 11 Jan 2017 21:04:50 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:49604
	helo=Ishtar.sc.tlinx.org)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <bash@tlinx.org>)
	id 1cRUkx-0007H5-Ci; Wed, 11 Jan 2017 21:04:47 -0500
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
	v0C24XwI040089; Wed, 11 Jan 2017 18:04:36 -0800
Message-ID: <5876E431.4010305@tlinx.org>
Date: Wed, 11 Jan 2017 18:04:33 -0800
From: L A Walsh <bash@tlinx.org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: Bill William <wm2015email@gmail.com>
CC: gnu@gnu.org, bug-bash@gnu.org
Subject: Re: suggestions: for bash shell: "shebam's and shebang's"
References: <CADPaO3qMmFm60MZmFYO1BhTW+1CBORR9EXYYwgjr8jQ9Mha1fA@mail.gmail.com>
	<20170111215405.GZ23041@eeg.ccf.org>
In-Reply-To: <20170111215405.GZ23041@eeg.ccf.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
	timestamps) [generic] [fuzzy]
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 12 Jan 2017 02:04:52 -0000

Greg Wooledge wrote:
> On Wed, Jan 11, 2017 at 01:30:02PM -0500, Bill William wrote:
>   
>> The problem with the shebang is that its not a file type its an
>> executable...what is needed is the option to only specify a file type...
>> examples:
>> //Example Shebang:       #!/usr/bin/perl
>> //Example Shebam:        #:utf8
>>     
> You are missing a key piece of information: it's not bash who reads and
> acts upon the shebang.  It's the kernel.  To bash, it's just a comment.
>   
----
    True.  I was thinking about whether or not a given interpreter
might want to read another comment, say on a 2nd line, to determine
some other info -- but even there, in languages like perl, if you have
utf8 in your code, the "perl way" of doing it would be to use
"use utf8" at or near the top of the file (before you use any utf8 chars).

Getting everyone to change would be a lot more than a
than getting 1 place to change.  You'd have all the langs,
(of which there are probably 100's)... With gtk+xml+gladed6
you are getting awfully close to mime-types.  The file-command
is pretty good about identifying the encoding used and/or
spitting out the mime-type.  (Try running file in your
home dir -- or to see the mime types, use "-i" or
--mime to get the mime-type and mime-encoding (type and encoding
are two separate things -- another 'gotcha').

If you had it in the header, what's the usage case?  There are
docs that have the encoding and such at the top -- web-docs --
they have it 1st thing so clients can interpret the rest of the doc,
but humans don't use it -- it's automatically done by your
web browser.  So how would you use a mime-type field at the beginning
of files?  The humans are as likely, as not to delete those
'junk' lines at the top (especially if they don't know what they
are for)...

Does that give you an idea of the usefulness vs. amount of
work to get everyone to do/accept it?  :-)

Good idea though -- it's worked out reasonably well on
web docs.

-l



From MAILER-DAEMON Sun Jan 15 14:46:33 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cSql7-0005rK-E0
	for mharc-bug-bash@gnu.org; Sun, 15 Jan 2017 14:46:33 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:50943)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <grishalevit@gmail.com>) id 1cSql5-0005qa-Ib
	for bug-bash@gnu.org; Sun, 15 Jan 2017 14:46:32 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <grishalevit@gmail.com>) id 1cSql4-0007yN-Qf
	for bug-bash@gnu.org; Sun, 15 Jan 2017 14:46:31 -0500
Received: from mail-vk0-x229.google.com ([2607:f8b0:400c:c05::229]:34027)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <grishalevit@gmail.com>)
	id 1cSql4-0007yJ-MU
	for bug-bash@gnu.org; Sun, 15 Jan 2017 14:46:30 -0500
Received: by mail-vk0-x229.google.com with SMTP id r136so62551852vke.1
	for <bug-bash@gnu.org>; Sun, 15 Jan 2017 11:46:30 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:from:date:message-id:subject:to;
	bh=2ESnqr9aN9wSUt3/qcv/wXXxgRUc1a5E+7ml53/M8WQ=;
	b=mOnyB9aa8yrf+AtLeHBUuV+pqSGkRNDmFROZZLIZVFl92i7o6dFR4UzFuINtn8us6B
	jmwzcGfA/ITrm0Hhvx0DsEF/SEfkJZmVR1y0wewbE8xF6PHwvGE8DST3F1QaaC28brq3
	TKPg5d832sIqWTTPd31UH5a6j4laLVfCpWM4dXAjxuSEeg/L1/CaNTm02JkPL4NHQjQW
	WHZDHzQ7ZHgoa66mG+ZF62ctZ82iFh/NE4bJtepZXfhlC45VytumDcCg9RcFmSA3jiwS
	eaA6FLpLcn/6c6U3CJYJERyNMnBsplRHY469X7E63jxHRnRpoa3j8hOVZ3j/H5DLpPdl
	x2JQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
	bh=2ESnqr9aN9wSUt3/qcv/wXXxgRUc1a5E+7ml53/M8WQ=;
	b=skH3dMuf92NB8jqCToKeqbYNOB9QZOPIaCx9VX+C4L0czQbOS628AbrIkSIaBIlKOo
	CPT89P3PwgjyCdM7lK+9EamYOh6d/BlpAZ+Kjem+2Jg1zX6QS/cJF3IeofHQtN2/98xR
	NHF2Amh4D4YWCzWnshsupiWTcCU7LvveHtOWXuuXijaHp7wlmbhYNiV74ON98uiLwLRn
	AnLydW/heiPtqzWm1t4OaWdUEzuUNQABdATx6+31oJYPckv3l4cJoAj4GU9xZlgY7tC+
	s7/AKQEJbXW2q3xOA/D06C+E9CsPARO757yzdAXJ6K9ttian00GYJfwUUnxAbXDObVbu
	iF6Q==
X-Gm-Message-State: AIkVDXKzQ7bz065TCGLMN6/YWyNqAAbfdnXfJBqRfNlpYPf2ewJTIKWKLmcy5/KosLuKX3tNYtBSP9DZqV8sCQ==
X-Received: by 10.31.203.132 with SMTP id b126mr11892139vkg.75.1484509589317; 
	Sun, 15 Jan 2017 11:46:29 -0800 (PST)
MIME-Version: 1.0
Received: by 10.31.147.212 with HTTP; Sun, 15 Jan 2017 11:46:08 -0800 (PST)
From: Grisha Levit <grishalevit@gmail.com>
Date: Sun, 15 Jan 2017 14:46:08 -0500
Message-ID: <CAMu=BrqMz_QT0ThPC4RE2MjgDey=1pGoe1tNbDKyZcUZQxLWyw@mail.gmail.com>
Subject: Re: extglob problems
To: bug-bash@gnu.org
Content-Type: multipart/alternative; boundary=001a114dd966bcae60054627529c
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2607:f8b0:400c:c05::229
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 15 Jan 2017 19:46:32 -0000

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

> On 3/23/16 6:15 PM, Isabella Parakiss wrote:
>> Just wanted to report a couple of problems in 4.3.42 and the latest
>> devel version:
>
> Thanks for the report.  These were both easy fixes, and the fixes will
> be in bash-4.4.

Using Isabella's examples and the latest devel snapshot, there still seems
to be something off when dotglob is enabled:

$ touch a b c .x .y .z
$ shopt -s extglob dotglob

$ echo @(*|@(f))
. .. .x .y .z a b c
$ echo @(*|@(ff))
.x .y .z a b c

--001a114dd966bcae60054627529c
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>&gt; On 3/23/16 6:15 PM, Isabella Parakiss wrote:</di=
v><div>&gt;&gt; Just wanted to report a couple of problems in 4.3.42 and th=
e latest</div><div>&gt;&gt; devel version:</div><div>&gt;</div><div>&gt; Th=
anks for the report.=C2=A0 These were both easy fixes, and the fixes will</=
div><div>&gt; be in bash-4.4.</div><div><br></div><div>Using Isabella&#39;s=
 examples and the latest devel snapshot, there still seems to be something =
off when dotglob is enabled:</div><div><br></div><div>$ touch a b c .x .y .=
z</div><div>$ shopt -s extglob dotglob</div><div><br></div><div><div>$ echo=
 @(*|@(f))</div><div>. .. .x .y .z a b c</div><div>$ echo @(*|@(ff))</div><=
div>.x .y .z a b c</div></div><div><br></div><div><br></div></div>

--001a114dd966bcae60054627529c--


From MAILER-DAEMON Sun Jan 15 14:55:55 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cSquB-0000OW-9K
	for mharc-bug-bash@gnu.org; Sun, 15 Jan 2017 14:55:55 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:51783)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <grishalevit@gmail.com>) id 1cSqu8-0000N3-JW
	for bug-bash@gnu.org; Sun, 15 Jan 2017 14:55:53 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <grishalevit@gmail.com>) id 1cSqu8-0001WU-0x
	for bug-bash@gnu.org; Sun, 15 Jan 2017 14:55:52 -0500
Received: from mail-vk0-x22c.google.com ([2607:f8b0:400c:c05::22c]:36638)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <grishalevit@gmail.com>)
	id 1cSqu7-0001WD-Rj
	for bug-bash@gnu.org; Sun, 15 Jan 2017 14:55:51 -0500
Received: by mail-vk0-x22c.google.com with SMTP id t8so62481551vke.3
	for <bug-bash@gnu.org>; Sun, 15 Jan 2017 11:55:51 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:from:date:message-id:subject:to;
	bh=jzqcN9wOR00c8cqphWWhiuREq9DGknK/ipAdwEn0Znc=;
	b=XxSnuWbKXLLCdGPkwtnRf4Bnpmx/Qon5bXhcjR54/nR0AbnpYJdsGuHcbGnBZ1whK3
	vx3/Yn+16+L5O66IS8ngBUV6ERQaE+aqb5tI3tMB7Vrib1+B1RYES5csdwa88aaw/NrC
	TFZbrvKV86J13mJ+pNH44GZMjsPcrpRoewQXqzv2KNc4nekfNGrqW8iRuWBJUIcWPZNv
	n00vPNCAF8DnRgpxaw3PxjXjnaaQpe9iuK28aq6RcBTWJaeoY1zuZa+TJnUBRXp1aa5y
	pflzYQhmp9ILZz5An1+hramCnsYajWhmWZ6j0Sq0uarJKHl0DNsgGchmZgBdiRhbJlOJ
	4M0A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
	bh=jzqcN9wOR00c8cqphWWhiuREq9DGknK/ipAdwEn0Znc=;
	b=PlN02xbdVMWHB2aGqdkB5253RB3/SL+/9MsawCNfc95BbphlSTPZRtlaTPirIP0lQT
	UOVGarQ9Gg20JL/IBox6cHmiXBXIXNqfn+MEkqK91fC74ILP90KVbORLOlobeyamWrXL
	9croxt7g5z2U+H9FU32L7mrUoZyPcNeBVd3VXc5+/LNEpPx4ZPC1C1smGVtCB6rOHLjK
	KciN0CC9lk2YsG7LpGoMjK2dP4CF8Uh1w5swU6GnyM675IcG3fpyiEUXpPdHvekYUzLk
	2zE4MrFmHVzASG4i5fhLUMTIlspdm3/7Uiz3iRzk8jmPBofp0OMZWRve1N6JME3TLq6m
	oNCQ==
X-Gm-Message-State: AIkVDXLtGTHR9r3Q0xwSMW+HaFxjJrp5vMBkdEgXyn5AQxOwi/XxubYkhW/manoeBPaYRJx951EF2dqBqJP23A==
X-Received: by 10.31.203.132 with SMTP id b126mr11900770vkg.75.1484510150953; 
	Sun, 15 Jan 2017 11:55:50 -0800 (PST)
MIME-Version: 1.0
Received: by 10.31.147.212 with HTTP; Sun, 15 Jan 2017 11:55:30 -0800 (PST)
From: Grisha Levit <grishalevit@gmail.com>
Date: Sun, 15 Jan 2017 14:55:30 -0500
Message-ID: <CAMu=BrrQr6SdEzsjd8iFP1UoCcP7rnoFPZQEWoE6AC8+DJcDYw@mail.gmail.com>
Subject: extglob and globstar don't work together?
To: bug-bash@gnu.org
Content-Type: multipart/alternative; boundary=001a114dd966368ed705462774c0
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2607:f8b0:400c:c05::22c
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 15 Jan 2017 19:55:53 -0000

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

Is it expected that ** work with extended pattern matching?

$ shopt -s extglob globstar
$ echo **
d1 d1/f d2 d2/f f
$ echo @(**)
d1 d2 f

--001a114dd966368ed705462774c0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Is it expected that ** work with extended pattern mat=
ching?</div><div><br></div><div>$ shopt -s extglob globstar</div><div>$ ech=
o **</div><div>d1 d1/f d2 d2/f f</div><div>$ echo @(**)</div><div>d1 d2 f</=
div><div><br></div><div><br></div></div>

--001a114dd966368ed705462774c0--


From MAILER-DAEMON Sun Jan 15 15:13:38 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cSrBK-0004km-5L
	for mharc-bug-bash@gnu.org; Sun, 15 Jan 2017 15:13:38 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:54223)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <grishalevit@gmail.com>) id 1cSrBI-0004kd-3F
	for bug-bash@gnu.org; Sun, 15 Jan 2017 15:13:36 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <grishalevit@gmail.com>) id 1cSrBH-0005It-BN
	for bug-bash@gnu.org; Sun, 15 Jan 2017 15:13:36 -0500
Received: from mail-ua0-x235.google.com ([2607:f8b0:400c:c08::235]:36638)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <grishalevit@gmail.com>)
	id 1cSrBH-0005IY-5k
	for bug-bash@gnu.org; Sun, 15 Jan 2017 15:13:35 -0500
Received: by mail-ua0-x235.google.com with SMTP id 96so69232177uaq.3
	for <bug-bash@gnu.org>; Sun, 15 Jan 2017 12:13:35 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to; 
	bh=jwLobfH+gpneiA/MKrExSJqtXRwmQdp90OtAgRxb1fY=;
	b=Y/3ncgourd5pvA+UKCRBLvDXma/iKLCM/idhB9yt1Uy7VoyGxtse+oVIvtkmJMz1RQ
	xl+r7CGxe4TQKOLkJ13p+0xoe0kileC4CYIoWfSAkyafnyqUtxbm8sDWfWFQltpvy4De
	5oK84QZQZ69fWjGchCztIKUNt3d3arwckecQTsV8gx3BNpBm30VzRAywLxRWWvIRfbeI
	6xHZs4jdvtaY8U30ra2BOEjXfjrceaZxPNo+Fobx3iPTA8Mlasqy7YUkKXnpf0W2zoNV
	vDD0z+/d77nL12taMFEeJKaTqrZYWiFyWzrTrRI562eePb7w/bjJHYjwyuWTO3e/+d2K
	C1zg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to;
	bh=jwLobfH+gpneiA/MKrExSJqtXRwmQdp90OtAgRxb1fY=;
	b=nARiiEPTKMZbk1VRR+mexjLBeNcbIRkGHSl9QHX3ysonzJ30iR8VV7qKh/ABWGHa+X
	Z/FRR/jjAGI6egNwH0K5eOAENdAMWK4r2CVMnHJlxASA4Y3e730EYsUJd4a43sO4fu14
	FwBmWchtSfQqe2A+atSW6/j7/Ba8ZQRCRi0faaTzidl8Pc/yEF68dxnL0zuTRczYh0AG
	lu+deq+80xVu0TPY7YNvK8V6975WxLYWPYe7IUcSxllWDY7lmMLlq7MHHYeAQZ9c6dlV
	79NFZ/p3GmGSsTAjTvGjIk/Dz5itXOqJ7hNv1yaR92+2AZHKvgcCPh8WV63gZ4y1tXtP
	0FlQ==
X-Gm-Message-State: AIkVDXLFVBBpdXK3wWAmvaCv87mfl+bBfqmsqYRHQtoTeVu+Uy8AQ9MKuQMgoUIdbXidPBTkg0DgUMtnOpUtnw==
X-Received: by 10.176.81.124 with SMTP id f57mr15231238uaa.18.1484511214335;
	Sun, 15 Jan 2017 12:13:34 -0800 (PST)
MIME-Version: 1.0
Received: by 10.31.147.212 with HTTP; Sun, 15 Jan 2017 12:13:13 -0800 (PST)
In-Reply-To: <CAMu=BrqMz_QT0ThPC4RE2MjgDey=1pGoe1tNbDKyZcUZQxLWyw@mail.gmail.com>
References: <CAMu=BrqMz_QT0ThPC4RE2MjgDey=1pGoe1tNbDKyZcUZQxLWyw@mail.gmail.com>
From: Grisha Levit <grishalevit@gmail.com>
Date: Sun, 15 Jan 2017 15:13:13 -0500
Message-ID: <CAMu=BrrGWLC-VrkuZKcdSq28x1RTd0hVkkMa-i5PJ2XzKq9KLQ@mail.gmail.com>
Subject: Re: extglob problems
To: bug-bash@gnu.org
Content-Type: multipart/alternative; boundary=94eb2c1917ce987cd8054627b31a
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2607:f8b0:400c:c08::235
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 15 Jan 2017 20:13:36 -0000

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

On Sun, Jan 15, 2017 at 2:46 PM, Grisha Levit <grishalevit@gmail.com> wrote:
> Using Isabella's examples and the latest devel snapshot, there still
seems to be something off when dotglob is enabled:

Also the following case doesn't seem right (this time without dotglob):

$ echo !(f)
a b c
$ echo !(f)!(f)
. .. .x .y .z a b c

--94eb2c1917ce987cd8054627b31a
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Sun, Jan 15, 2017 at 2:46 PM, Grisha Levit &lt;<a href=
=3D"mailto:grishalevit@gmail.com">grishalevit@gmail.com</a>&gt; wrote:<br>&=
gt; Using Isabella&#39;s examples and the latest devel snapshot, there stil=
l seems to be something off when dotglob is enabled:<br><div><br></div><div=
>Also the following case doesn&#39;t seem right (this time without dotglob)=
:</div><div><br></div><div><div>$ echo !(f)</div><div>a b c</div></div><div=
><div>$ echo !(f)!(f)</div><div>. .. .x .y .z a b c</div></div><div><br></d=
iv></div>

--94eb2c1917ce987cd8054627b31a--


From MAILER-DAEMON Mon Jan 16 09:58:29 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cT8jt-0000D4-1C
	for mharc-bug-bash@gnu.org; Mon, 16 Jan 2017 09:58:29 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:50877)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bullard.daniel@gmail.com>) id 1cSqjl-0005lC-24
	for bug-bash@gnu.org; Sun, 15 Jan 2017 14:45:11 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bullard.daniel@gmail.com>) id 1cSqji-0007qg-Ea
	for bug-bash@gnu.org; Sun, 15 Jan 2017 14:45:09 -0500
Received: from mail-yw0-x22b.google.com ([2607:f8b0:4002:c05::22b]:36296)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <bullard.daniel@gmail.com>)
	id 1cSqji-0007qO-5f
	for bug-bash@gnu.org; Sun, 15 Jan 2017 14:45:06 -0500
Received: by mail-yw0-x22b.google.com with SMTP id a10so58186667ywa.3
	for <bug-bash@gnu.org>; Sun, 15 Jan 2017 11:45:05 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:from:date:message-id:subject:to;
	bh=K/lZDuXDgeapM6s+ycPTDKeXD9ssjChIQDlyXYQYvno=;
	b=J7OxruZWJ/MIuuzhRbo1TMsGaWcvmAtNJbYGSWreuRa58l78gyt1PJi7wh8La4sguH
	1dwVNzlIv5dttWUf3GVnv6zlLCbSv6nlEL0Y/CJoRwRjGs1Er3TPYs/1UD4Wan6u4A8/
	Jb4r8qraVqW0/NyHiOUrTMxlvJyeNTLAd02rP0upxhgYzxZ0etenj6hmid7JHE8ibYau
	fswHtPjPUH+JEyrMlulm7cK9OzpG05KfGE5dx++xygVZ6smDHLVgAPn/otVZQ9mxKuLO
	lxxYG8mj+f6zmGRhRPQ0jbF1F9iW9rrqErHrFE+lXiI30FG5IerEZOe/SI50ijgr1qiN
	doIA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
	bh=K/lZDuXDgeapM6s+ycPTDKeXD9ssjChIQDlyXYQYvno=;
	b=jIA79r9hnqTnQ8qT+r4+0J44oMehuNEGSq/34BDVwLA9Ic2voOqibPlCMNkFZZkdgL
	RIo7LFoEI1aCiNZc66B1GlAnbmr7tqEg4Bad8dh/3k9Qz9THewbirOnT7edtSG3k2KCp
	zdxAau0co/1xzvO/3+I+MaLFa5Uimm5SkNlU7njf8ItRe+vzaMlvkzqSwY42hZBdCvH8
	88aC5d2kWTbvmny94HU/ia0JuSZhRyBLzLh0m1qzLPzYTwc2ISMgwlElzge+GkRsHqUW
	/w0aQ3TbtS/je9aJIgtLS2sJOLsDiSdHoVgYbzwdDeTfEfa7jK/DKMqfy6WSmg0uMFK8
	TXTA==
X-Gm-Message-State: AIkVDXLDihbPBq5CdWj/bFqsS9/0M21TEMJNCWPS4/rMeWnwFxhkxzsQKe4wKfuJgRgV/jJmOLpz2HCyQPAcHg==
X-Received: by 10.129.175.5 with SMTP id n5mr22284271ywh.209.1484509504973;
	Sun, 15 Jan 2017 11:45:04 -0800 (PST)
MIME-Version: 1.0
Received: by 10.37.12.3 with HTTP; Sun, 15 Jan 2017 11:44:24 -0800 (PST)
From: Daniel Bullard <bullard.daniel@gmail.com>
Date: Sun, 15 Jan 2017 20:44:24 +0100
Message-ID: <CAP0zz82kV5d7z+4QBVLZ1hYezBwyhUkfKHFavnT=GF_aCDj8aw@mail.gmail.com>
Subject: bash: /home/greenhornet/.bashrc: line 120: syntax error: unexpected
	end of file
To: bug-bash@gnu.org, bash@packages.debian.org
Content-Type: multipart/alternative; boundary=f403045eaed0b5b0fc0546274da4
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2607:f8b0:4002:c05::22b
X-Mailman-Approved-At: Mon, 16 Jan 2017 09:58:28 -0500
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 15 Jan 2017 19:45:11 -0000

--f403045eaed0b5b0fc0546274da4
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

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_OSTYPE=3D'linux-gnu' -DCONF_MACHTYPE=3D'x86_64-pc-linux-gnu'
-DCONF_VENDOR=3D'pc' -DL$
uname output: Linux udontknowme 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6
17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.3
Patch Level: 46
Release Status: release

Description: openConnection: connect: No such file or directory
cannot connect to brltty at :0
upstart: indicator-bluetooth main process (1573) killed by TERM signal
upstart: indicator-power main process (1577) killed by TERM signal
upstart: indicator-datetime main process (1579) killed by TERM signal
upstart: indicator-printers main process (1591) killed by TERM signal
upstart: indicator-session main process (1595) killed by TERM signal
upstart: indicator-application main process (1606) killed by TERM sign

Repeat-By:  It just started today i'm new to linux i've had the computer
for 3 days not sure what i did i'm hoping you can help. I apologize if I
haven't explained myself well enough .


these are other issues that popped up

 xsession-errors=E2=80=9D changed on disk

.bash_history
Ubuntu
sudo pactl load-module module-bluetooth-discover
sudo taskbar
gsettings set com.canonical.Unity.Launcher launcher-position Bottom
sudo apt-get install unity-tweak-tool
Unable to lock the administration directory (/var/lib/dpkg/), is another
process using it?
sudo apt-get install unity-tweak-tool
sudo no
no
sudo lsof /var/lib/dpkg/lock
sudo apt-get update
sudo apt-get install unity-tweak-tool
sudo add-apt-repository ppa:mpstark/elementary-tweaks-daily
sudo add-apt-repository ppa:moka/daily
sudo apt-get update
sudo apt-get install moka-icon-theme faba-icon-theme faba-mono-icons
sudo apt-get install unzip;
sudo apt-get install vlc
sudo apt-get install ubuntu-restricted-extras ubuntu-restricted-addons
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install bluez
dpkg =E2=80=93status bluez | grep =E2=80=98^Version:=E2=80=99
sudo /etc/init.d/networking restart
[ok]
hciconfig
sudo bluetooth/audio.conf
sudo bluetooth
bluetooth
pulseaudio
apt-get install pulseaudio pulseaudio-module-bluetooth pavucontrol
bluez-firmware
hcitoolscan
sudo apt-get installbluez-firmware
sudo apt-get install bluez-firmware
dmesg | grep -i blue
sudo pactl load-module module-bluetooth-discover
sudo apt-get install bluez-utils
bluez:i386 bluez
sudo apt-get install bluez:i386 bluez
remove bluez
dpkg --list
bluez:i386
sudo apt-get clean
sudo apt-get autoclean
sudo apt-get -f install
sudo apt autoremove
sudo restart
sudo reboot
lsb_release -a command
lsb_release -a
dpkg =E2=80=93status bluez | grep =E2=80=98^Version:=E2=80=99
dpkg -Dhelp
bitwise-or bluez
dpkg -Dhelp bluez
dpkg --status bluez | grep '^Version:'
dpkg bluez
dpkg -- help bluez
dpkg --help
-V bluez
-V
sudo apt install unattended-upgrades
Unattended-Upgrade::Allowed-Origins {
//      "Ubuntu xenial-updates";
};sudo Unattended-Upgrade::Allowed-Origins {
//      "Ubuntu xenial-updates";
};sudo apt install unattended-upgrades
sudo apt install apticron
EMAIL=3D"bullard.daniel@gmail.com"
EMAIL=3Dbullard.daniel@gmail.com
sleep
sleep --help
HandleLidSwitch=3Dhibernate
sudo HandleLidSwitch=3Dhibernate
uname -r
lsb_release -a
dpkg -l openssl
./configure
sudo service bluetooy
sudo service bluetooth start
sudo rfkill list
sudo hciconfg hci0 up hcitool scan
sudo apt-get install bluez-tools
bt-device -1
bt-device --help
-c 8c:04:22:BB:C851
8c:04:22:BB:C851
apt-get install showbox apk
sudo apt-get install showbox apk
8C:64:22:BB:C8:51
apt-get 8C:64:22:BB:C8:51
sudo apt-get 8C:64:22:BB:C8:51
bt-audio -c  8C:64:22:BB:C8:51
bt-device -1
bt-device --help
-c
bt-device  -c
bt-device  --c
--connect=3D8C:64:22:BB:C8:51
--connect=3D 8C:64:22:BB:C8:51
-c 8C:64:22:BB:C8:51
sudo apt-get 8C:64:22:BB:C8:51
hcitool scan
hciconfig scan
bluez-simple-agent hci0 8C:64:22:BB:C8:51
bluez-simple-agent hcio 8C:64:22:BB:C8:51
sudo apt-get install bluez-tools
apt-rdepends
sudo apt install apt-rdepends
apt- rdepends bluez
rdepends bluez
-s
rdepends --build-depends
reverse-depends bluez
rdepends
apt-rdepends pkgs
apt-rdepends pkgs bluez
apt-rdepends pkgs blueztools
apt-rdepends pkgs bluez tools
apt-cache rdepends
bluez-tools/testing
apt-bluez-tools/testing
make check
apt-make check
ls -la
dpkg --status bluez | grep '^Version:'
bluetoothd -v
sudo apt-get dist-upgrade
sudo reboot
pkgs
apt-get pkgs
lsb_release -a command
lsb_release -a
sudo dpkg -l | grep bluez
sudo dpkg -l | grep bluez tools
sudo dpkg -l | more
cat /var/log/dpkg.log | grep " install "
cat /var/log/dpkg.log | grep " install " | grep bluez
cat /var/log/dpkg.log | grep " install " | grep google
pkgdetails
alias
alias apt get=3D apt
.bashrc.
bash
bt-adapter
bt --list
--list
-l
bt-device
bashrc
google
chrome
getent passwd $(whoami) | awk -F: '{print $NF}'
ps -p $$ -o cmd=3D
/etc/skel/.bashrc
gksu gnome-terminal
sudo apt install gksu
apt-get update
sudo apt-get update
sudo apt-update
$ echo $DESKTOP_SESSION
env | grep DESKTOP_SESSION=3D (so-so)
ls /usr/bin/*session
~/.bash_aliases
apt-get bash
sudo ~/.bash_aliases
sudo apt-get bash
chsh -s /bin/bash
man top
ps -ef
lsb_release -a
man-
man
commands
man- commands
man-db
sudo man
df
hostname
ps
man- bash
man bash
uptime
find / locate bash
grep bash
ps -ef
nan0
nano
emacs
open bluez
grep- bluez
grep bluez
man -t alias | lpr -Pps
sh
login(1)
login
sudo login
C0c0nek0sudo loginsssq
sudo login
man bash alias
sudo alias
bash alias
help alias
alias -p
help setup alias
alias NAME=3DVALUE
alias t=3D 'open new terminal'
man create alias
alias agi=3D'sudo apt-get install'
sudo alias agi=3D'sudo apt-get install'
# ps -eo euser,ruser,suser,fuser,f,comm,label
# ps axZ
# ps -eM
# ps -eo euser,ruser,suser,fuser,f,comm,label
ps -eM
/bin
/usr/bin
man ls
man man
h
help
help alias
alias [-p]
alias: alias [-p] [name[=3Dvalue] ... ]
alias ls
man -k
help man -k
info
?
info
'?'
info '?'
help '?'
help ?
help commands
man -k command
help commands
info commands
?
man ?
info ?
sudo ?
whereis
addalias
man addalias
> alias apt-get install=3D'install'
sudo alias apt-get install=3D'install'
agi
man 1
man 1 shell commands
--debug
man -d
help
info bash
intro
man intro
gnome-screensaver-command
man gnome-screensaver-command
man gnome-screensaver-command --version
--version
help --version
man sudo_root
man bash-builtins
whereis(1)
whereis 1
which
whereis
which
which 1
which command
man which
which -a
which man
which u
whereis u
whereis -u
-u
sudo alias agi=3D'sudo apt-get install'
gedit ~/.bashrc
.bash_aliases
man .bash_aliases
reboot
api
reboot
api
man errors
errors
ps
ps linux
ps --help
'ps --help


all

q


/home/greenhornet/.bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=3Dignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=3D1000
HISTFILESIZE=3D2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=3D/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below=
)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=3D$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=3Dyes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turne=
d
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=3Dyes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=3Dyes
    else
color_prompt=3D
    fi
fi

if [ "$color_prompt" =3D yes ]; then
    PS1=3D'${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m=
\]:\[\033[01;34m\]\w\[\033[00m\]\$
'
else
    PS1=3D'${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1=3D"\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval
"$(dircolors -b)"
    alias ls=3D'ls --color=3Dauto'
    #alias dir=3D'dir --color=3Dauto'
    #alias vdir=3D'vdir --color=3Dauto'

    alias grep=3D'grep --color=3Dauto'
    alias fgrep=3D'fgrep --color=3Dauto'
    alias egrep=3D'egrep --color=3Dauto'
fi

# colored GCC warnings and errors
#export
GCC_COLORS=3D'error=3D01;31:warning=3D01;35:note=3D01;36:caret=3D01;32:locu=
s=3D01:quote=3D01'

# some more ls aliases
alias ll=3D'ls -alF'
alias la=3D'ls -A'
alias l=3D'ls -CF'

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert=3D'notify-send --urgency=3Dlow -i "$([ $? =3D 0 ] && echo termi=
nal ||
echo error)" "$(history|tail -n1|sed -e
'\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi

--f403045eaed0b5b0fc0546274da4
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Configuration Information [Automatically generated, d=
o not change]:</div><div>Machine: x86_64</div><div>OS: linux-gnu</div><div>=
Compiler: gcc</div><div>Compilation CFLAGS: =C2=A0-DPROGRAM=3D&#39;bash&#39=
; -DCONF_HOSTTYPE=3D&#39;x86_64&#39; -DCONF_OSTYPE=3D&#39;linux-gnu&#39; -D=
CONF_MACHTYPE=3D&#39;x86_64-pc-linux-gnu&#39; -DCONF_VENDOR=3D&#39;pc&#39; =
-DL$</div><div>uname output: Linux udontknowme 4.4.0-59-generic #80-Ubuntu =
SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux</div><div>Ma=
chine Type: x86_64-pc-linux-gnu</div><div><br></div><div>Bash Version: 4.3<=
/div><div>Patch Level: 46</div><div>Release Status: release</div><div><div>=
<br></div><div>Description: openConnection: connect: No such file or direct=
ory</div><div>cannot connect to brltty at :0</div><div>upstart: indicator-b=
luetooth main process (1573) killed by TERM signal</div><div>upstart: indic=
ator-power main process (1577) killed by TERM signal</div><div>upstart: ind=
icator-datetime main process (1579) killed by TERM signal</div><div>upstart=
: indicator-printers main process (1591) killed by TERM signal</div><div>up=
start: indicator-session main process (1595) killed by TERM signal</div><di=
v>upstart: indicator-application main process (1606) killed by TERM sign</d=
iv></div><div><br></div><div>Repeat-By: =C2=A0It just started today i&#39;m=
 new to linux i&#39;ve had the computer for 3 days not sure what i did i&#3=
9;m hoping you can help. I apologize if I haven&#39;t explained myself well=
 enough .<br></div><div><br></div><div><br></div><div>these are other issue=
s that popped up</div><div><br></div><div>=C2=A0xsession-errors=E2=80=9D ch=
anged on disk</div><div><br></div><div>.bash_history</div><div><div>Ubuntu<=
/div><div>sudo pactl load-module module-bluetooth-discover</div><div>sudo t=
askbar</div><div>gsettings set com.canonical.Unity.Launcher launcher-positi=
on Bottom</div><div>sudo apt-get install unity-tweak-tool</div><div>Unable =
to lock the administration directory (/var/lib/dpkg/), is another process u=
sing it?</div><div>sudo apt-get install unity-tweak-tool</div><div>sudo no<=
/div><div>no</div><div>sudo lsof /var/lib/dpkg/lock</div><div>sudo apt-get =
update</div><div>sudo apt-get install unity-tweak-tool</div><div>sudo add-a=
pt-repository ppa:mpstark/elementary-tweaks-daily</div><div>sudo add-apt-re=
pository ppa:moka/daily</div><div>sudo apt-get update</div><div>sudo apt-ge=
t install moka-icon-theme faba-icon-theme faba-mono-icons</div><div>sudo ap=
t-get install unzip;</div><div>sudo apt-get install vlc</div><div>sudo apt-=
get install ubuntu-restricted-extras ubuntu-restricted-addons</div><div>sud=
o apt-get update</div><div>sudo apt-get upgrade</div><div>sudo apt-get dist=
-upgrade</div><div>sudo apt-get install bluez</div><div>dpkg =E2=80=93statu=
s bluez | grep =E2=80=98^Version:=E2=80=99</div><div>sudo /etc/init.d/netwo=
rking restart</div><div>[ok]</div><div>hciconfig</div><div>sudo bluetooth/a=
udio.conf</div><div>sudo bluetooth</div><div>bluetooth</div><div>pulseaudio=
</div><div>apt-get install pulseaudio pulseaudio-module-bluetooth pavucontr=
ol bluez-firmware</div><div>hcitoolscan</div><div>sudo apt-get installbluez=
-firmware</div><div>sudo apt-get install bluez-firmware</div><div>dmesg | g=
rep -i blue</div><div>sudo pactl load-module module-bluetooth-discover</div=
><div>sudo apt-get install bluez-utils</div><div>bluez:i386 bluez</div><div=
>sudo apt-get install bluez:i386 bluez</div><div>remove bluez</div><div>dpk=
g --list</div><div>bluez:i386=C2=A0</div><div>sudo apt-get clean</div><div>=
sudo apt-get autoclean</div><div>sudo apt-get -f install</div><div>sudo apt=
 autoremove</div><div>sudo restart</div><div>sudo reboot</div><div>lsb_rele=
ase -a command</div><div>lsb_release -a</div><div>dpkg =E2=80=93status blue=
z | grep =E2=80=98^Version:=E2=80=99</div><div>dpkg -Dhelp</div><div>bitwis=
e-or bluez</div><div>dpkg -Dhelp bluez</div><div>dpkg --status bluez | grep=
 &#39;^Version:&#39;</div><div>dpkg bluez</div><div>dpkg -- help bluez</div=
><div>dpkg --help</div><div>-V bluez</div><div>-V</div><div>sudo apt instal=
l unattended-upgrades</div><div>Unattended-Upgrade::Allowed-Origins {</div>=
<div>// =C2=A0 =C2=A0 =C2=A0&quot;Ubuntu xenial-updates&quot;;</div><div>};=
sudo Unattended-Upgrade::Allowed-Origins {</div><div>// =C2=A0 =C2=A0 =C2=
=A0&quot;Ubuntu xenial-updates&quot;;</div><div>};sudo apt install unattend=
ed-upgrades</div><div>sudo apt install apticron</div><div>EMAIL=3D&quot;<a =
href=3D"mailto:bullard.daniel@gmail.com">bullard.daniel@gmail.com</a>&quot;=
</div><div>EMAIL=3D<a href=3D"mailto:bullard.daniel@gmail.com">bullard.dani=
el@gmail.com</a></div><div>sleep</div><div>sleep --help</div><div>HandleLid=
Switch=3Dhibernate</div><div>sudo HandleLidSwitch=3Dhibernate</div><div>una=
me -r</div><div>lsb_release -a</div><div>dpkg -l openssl</div><div>./config=
ure</div><div>sudo service bluetooy</div><div>sudo service bluetooth start<=
/div><div>sudo rfkill list</div><div>sudo hciconfg hci0 up hcitool scan</di=
v><div>sudo apt-get install bluez-tools</div><div>bt-device -1</div><div>bt=
-device --help</div><div>-c 8c:04:22:BB:C851</div><div>8c:04:22:BB:C851</di=
v><div>apt-get install showbox apk</div><div>sudo apt-get install showbox a=
pk</div><div>8C:64:22:BB:C8:51</div><div>apt-get 8C:64:22:BB:C8:51</div><di=
v>sudo apt-get 8C:64:22:BB:C8:51</div><div>bt-audio -c =C2=A08C:64:22:BB:C8=
:51</div><div>bt-device -1</div><div>bt-device --help</div><div>-c</div><di=
v>bt-device =C2=A0-c</div><div>bt-device =C2=A0--c</div><div>--connect=3D8C=
:64:22:BB:C8:51</div><div>--connect=3D 8C:64:22:BB:C8:51</div><div>-c 8C:64=
:22:BB:C8:51</div><div>sudo apt-get 8C:64:22:BB:C8:51</div><div>hcitool sca=
n</div><div>hciconfig scan</div><div>bluez-simple-agent hci0 8C:64:22:BB:C8=
:51</div><div>bluez-simple-agent hcio 8C:64:22:BB:C8:51</div><div>sudo apt-=
get install bluez-tools</div><div>apt-rdepends</div><div>sudo apt install a=
pt-rdepends</div><div>apt- rdepends bluez</div><div>rdepends bluez</div><di=
v>-s</div><div>rdepends --build-depends</div><div>reverse-depends bluez</di=
v><div>rdepends</div><div>apt-rdepends pkgs</div><div>apt-rdepends pkgs blu=
ez</div><div>apt-rdepends pkgs blueztools</div><div>apt-rdepends pkgs bluez=
 tools</div><div>apt-cache rdepends</div><div>bluez-tools/testing</div><div=
>apt-bluez-tools/testing</div><div>make check</div><div>apt-make check</div=
><div>ls -la</div><div>dpkg --status bluez | grep &#39;^Version:&#39;</div>=
<div>bluetoothd -v</div><div>sudo apt-get dist-upgrade</div><div>sudo reboo=
t</div><div>pkgs</div><div>apt-get pkgs</div><div>lsb_release -a command</d=
iv><div>lsb_release -a=C2=A0</div><div>sudo dpkg -l | grep bluez</div><div>=
sudo dpkg -l | grep bluez tools</div><div>sudo dpkg -l | more</div><div>cat=
 /var/log/dpkg.log | grep &quot; install &quot;</div><div>cat /var/log/dpkg=
.log | grep &quot; install &quot; | grep bluez</div><div>cat /var/log/dpkg.=
log | grep &quot; install &quot; | grep google</div><div>pkgdetails</div><d=
iv>alias</div><div>alias apt get=3D apt</div><div>.bashrc.</div><div>bash</=
div><div>bt-adapter</div><div>bt --list</div><div>--list</div><div>-l</div>=
<div>bt-device</div><div>bashrc</div><div>google</div><div>chrome</div><div=
>getent passwd $(whoami) | awk -F: &#39;{print $NF}&#39;</div><div>ps -p $$=
 -o cmd=3D</div><div>/etc/skel/.bashrc</div><div>gksu gnome-terminal</div><=
div>sudo apt install gksu</div><div>apt-get update</div><div>sudo apt-get u=
pdate</div><div>sudo apt-update</div><div>$ echo $DESKTOP_SESSION</div><div=
>env | grep DESKTOP_SESSION=3D (so-so)</div><div>ls /usr/bin/*session</div>=
<div>~/.bash_aliases</div><div>apt-get bash</div><div>sudo ~/.bash_aliases<=
/div><div>sudo apt-get bash</div><div>chsh -s /bin/bash</div><div>man top</=
div><div>ps -ef</div><div>lsb_release -a</div><div>man-</div><div>man</div>=
<div>commands</div><div>man- commands</div><div>man-db</div><div>sudo man</=
div><div>df</div><div>hostname</div><div>ps</div><div>man- bash</div><div>m=
an bash</div><div>uptime</div><div>find / locate bash</div><div>grep bash</=
div><div>ps -ef</div><div>nan0</div><div>nano</div><div>emacs</div><div>ope=
n bluez</div><div>grep- bluez</div><div>grep bluez</div><div>man -t alias |=
 lpr -Pps</div><div>sh</div><div>login(1)</div><div>login</div><div>sudo lo=
gin</div><div>C0c0nek0sudo loginsssq</div><div>sudo login</div><div>man bas=
h alias</div><div>sudo alias</div><div>bash alias</div><div>help alias</div=
><div>alias -p</div><div>help setup alias</div><div>alias NAME=3DVALUE</div=
><div>alias t=3D &#39;open new terminal&#39;</div><div>man create alias</di=
v><div>alias agi=3D&#39;sudo apt-get install&#39;</div><div>sudo alias agi=
=3D&#39;sudo apt-get install&#39;</div><div># ps -eo euser,ruser,suser,fuse=
r,f,comm,label</div><div># ps axZ</div><div># ps -eM</div><div># ps -eo eus=
er,ruser,suser,fuser,f,comm,label</div><div>ps -eM</div><div>/bin=C2=A0</di=
v><div>/usr/bin</div><div>man ls</div><div>man man</div><div>h</div><div>he=
lp</div><div>help alias</div><div>alias [-p]</div><div>alias: alias [-p] [n=
ame[=3Dvalue] ... ]</div><div>alias ls</div><div>man -k</div><div>help man =
-k</div><div>info</div><div>?</div><div>info</div><div>&#39;?&#39;</div><di=
v>info &#39;?&#39;</div><div>help &#39;?&#39;</div><div>help ?</div><div>he=
lp commands</div><div>man -k command</div><div>help commands</div><div>info=
 commands</div><div>?</div><div>man ?</div><div>info ?</div><div>sudo ?</di=
v><div>whereis</div><div>addalias</div><div>man addalias</div><div>&gt; ali=
as apt-get install=3D&#39;install&#39;</div><div>sudo alias apt-get install=
=3D&#39;install&#39;</div><div>agi</div><div>man 1</div><div>man 1 shell co=
mmands</div><div>--debug</div><div>man -d</div><div>help</div><div>info bas=
h</div><div>intro</div><div>man intro</div><div>gnome-screensaver-command</=
div><div>man gnome-screensaver-command</div><div>man gnome-screensaver-comm=
and --version</div><div>--version</div><div>help --version</div><div>man su=
do_root</div><div>man bash-builtins</div><div>whereis(1)</div><div>whereis =
1</div><div>which</div><div>whereis</div><div>which</div><div>which 1</div>=
<div>which command</div><div>man which</div><div>which -a</div><div>which m=
an</div><div>which u</div><div>whereis u</div><div>whereis -u</div><div>-u<=
/div><div>sudo alias agi=3D&#39;sudo apt-get install&#39;</div><div>gedit ~=
/.bashrc</div><div>.bash_aliases</div><div>man .bash_aliases</div><div>rebo=
ot</div><div>api</div><div>reboot</div><div>api</div><div>man errors</div><=
div>errors</div><div>ps</div><div>ps linux</div><div>ps --help</div><div>&#=
39;ps --help</div><div><br></div><div><br></div><div>all</div><div><br></di=
v><div>q</div></div><div><br></div><div><br></div><div>/home/greenhornet/.b=
ashrc<br></div><div><div># ~/.bashrc: executed by bash(1) for non-login she=
lls.</div><div># see /usr/share/doc/bash/examples/startup-files (in the pac=
kage bash-doc)</div><div># for examples</div><div><br></div><div># If not r=
unning interactively, don&#39;t do anything</div><div>case $- in</div><div>=
=C2=A0 =C2=A0 *i*) ;;</div><div>=C2=A0 =C2=A0 =C2=A0 *) return;;</div><div>=
esac</div><div><br></div><div># don&#39;t put duplicate lines or lines star=
ting with space in the history.</div><div># See bash(1) for more options</d=
iv><div>HISTCONTROL=3Dignoreboth</div><div><br></div><div># append to the h=
istory file, don&#39;t overwrite it</div><div>shopt -s histappend</div><div=
><br></div><div># for setting history length see HISTSIZE and HISTFILESIZE =
in bash(1)</div><div>HISTSIZE=3D1000</div><div>HISTFILESIZE=3D2000</div><di=
v><br></div><div># check the window size after each command and, if necessa=
ry,</div><div># update the values of LINES and COLUMNS.</div><div>shopt -s =
checkwinsize</div><div><br></div><div># If set, the pattern &quot;**&quot; =
used in a pathname expansion context will</div><div># match all files and z=
ero or more directories and subdirectories.</div><div>#shopt -s globstar</d=
iv><div><br></div><div># make less more friendly for non-text input files, =
see lesspipe(1)</div><div>[ -x /usr/bin/lesspipe ] &amp;&amp; eval &quot;$(=
SHELL=3D/bin/sh lesspipe)&quot;</div><div><br></div><div># set variable ide=
ntifying the chroot you work in (used in the prompt below)</div><div>if [ -=
z &quot;${debian_chroot:-}&quot; ] &amp;&amp; [ -r /etc/debian_chroot ]; th=
en</div><div>=C2=A0 =C2=A0 debian_chroot=3D$(cat /etc/debian_chroot)</div><=
div>fi</div><div><br></div><div># set a fancy prompt (non-color, unless we =
know we &quot;want&quot; color)</div><div>case &quot;$TERM&quot; in</div><d=
iv>=C2=A0 =C2=A0 xterm-color|*-256color) color_prompt=3Dyes;;</div><div>esa=
c</div><div><br></div><div># uncomment for a colored prompt, if the termina=
l has the capability; turned</div><div># off by default to not distract the=
 user: the focus in a terminal window</div><div># should be on the output o=
f commands, not on the prompt</div><div>#force_color_prompt=3Dyes</div><div=
><br></div><div>if [ -n &quot;$force_color_prompt&quot; ]; then</div><div>=
=C2=A0 =C2=A0 if [ -x /usr/bin/tput ] &amp;&amp; tput setaf 1 &gt;&amp;/dev=
/null; then</div><div><span class=3D"gmail-Apple-tab-span" style=3D"white-s=
pace:pre">	</span># We have color support; assume it&#39;s compliant with E=
cma-48</div><div><span class=3D"gmail-Apple-tab-span" style=3D"white-space:=
pre">	</span># (ISO/IEC-6429). (Lack of such support is extremely rare, and=
 such</div><div><span class=3D"gmail-Apple-tab-span" style=3D"white-space:p=
re">	</span># a case would tend to support setf rather than setaf.)</div><d=
iv><span class=3D"gmail-Apple-tab-span" style=3D"white-space:pre">	</span>c=
olor_prompt=3Dyes</div><div>=C2=A0 =C2=A0 else</div><div><span class=3D"gma=
il-Apple-tab-span" style=3D"white-space:pre">	</span>color_prompt=3D</div><=
div>=C2=A0 =C2=A0 fi</div><div>fi</div><div><br></div><div>if [ &quot;$colo=
r_prompt&quot; =3D yes ]; then</div><div>=C2=A0 =C2=A0 PS1=3D&#39;${debian_=
chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w=
\[\033[00m\]\$ &#39;</div><div>else</div><div>=C2=A0 =C2=A0 PS1=3D&#39;${de=
bian_chroot:+($debian_chroot)}\u@\h:\w\$ &#39;</div><div>fi</div><div>unset=
 color_prompt force_color_prompt</div><div><br></div><div># If this is an x=
term set the title to user@host:dir</div><div>case &quot;$TERM&quot; in</di=
v><div>xterm*|rxvt*)</div><div>=C2=A0 =C2=A0 PS1=3D&quot;\[\e]0;${debian_ch=
root:+($debian_chroot)}\u@\h: \w\a\]$PS1&quot;</div><div>=C2=A0 =C2=A0 ;;</=
div><div>*)</div><div>=C2=A0 =C2=A0 ;;</div><div>esac</div><div><br></div><=
div># enable color support of ls and also add handy aliases</div><div>if [ =
-x /usr/bin/dircolors ]; then</div><div>=C2=A0 =C2=A0 test -r ~/.dircolors =
&amp;&amp; eval &quot;$(dircolors -b ~/.dircolors)&quot; || eval &quot;$(di=
rcolors -b)&quot;</div><div>=C2=A0 =C2=A0 alias ls=3D&#39;ls --color=3Dauto=
&#39;</div><div>=C2=A0 =C2=A0 #alias dir=3D&#39;dir --color=3Dauto&#39;</di=
v><div>=C2=A0 =C2=A0 #alias vdir=3D&#39;vdir --color=3Dauto&#39;</div><div>=
<br></div><div>=C2=A0 =C2=A0 alias grep=3D&#39;grep --color=3Dauto&#39;</di=
v><div>=C2=A0 =C2=A0 alias fgrep=3D&#39;fgrep --color=3Dauto&#39;</div><div=
>=C2=A0 =C2=A0 alias egrep=3D&#39;egrep --color=3Dauto&#39;</div><div>fi</d=
iv><div><br></div><div># colored GCC warnings and errors</div><div>#export =
GCC_COLORS=3D&#39;error=3D01;31:warning=3D01;35:note=3D01;36:caret=3D01;32:=
locus=3D01:quote=3D01&#39;</div><div><br></div><div># some more ls aliases<=
/div><div>alias ll=3D&#39;ls -alF&#39;</div><div>alias la=3D&#39;ls -A&#39;=
</div><div>alias l=3D&#39;ls -CF&#39;</div><div><br></div><div># Add an &qu=
ot;alert&quot; alias for long running commands.=C2=A0 Use like so:</div><di=
v># =C2=A0 sleep 10; alert</div><div>alias alert=3D&#39;notify-send --urgen=
cy=3Dlow -i &quot;$([ $? =3D 0 ] &amp;&amp; echo terminal || echo error)&qu=
ot; &quot;$(history|tail -n1|sed -e &#39;\&#39;&#39;s/^\s*[0-9]\+\s*//;s/[;=
&amp;|]\s*alert$//&#39;\&#39;&#39;)&quot;&#39;</div><div><br></div><div># A=
lias definitions.</div><div># You may want to put all your additions into a=
 separate file like</div><div># ~/.bash_aliases, instead of adding them her=
e directly.</div><div># See /usr/share/doc/bash-doc/examples in the bash-do=
c package.</div><div><br></div><div>if [ -f ~/.bash_aliases ]; then</div><d=
iv>=C2=A0 =C2=A0 . ~/.bash_aliases</div><div>fi</div><div><br></div><div># =
enable programmable completion features (you don&#39;t need to enable</div>=
<div># this, if it&#39;s already enabled in /etc/bash.bashrc and /etc/profi=
le</div><div># sources /etc/bash.bashrc).</div><div>if ! shopt -oq posix; t=
hen</div><div>=C2=A0 if [ -f /usr/share/bash-completion/bash_completion ]; =
then</div><div>=C2=A0 =C2=A0 . /usr/share/bash-completion/bash_completion</=
div><div>=C2=A0 elif [ -f /etc/bash_completion ]; then</div><div>=C2=A0 =C2=
=A0 . /etc/bash_completion</div><div>=C2=A0 fi</div><div><br></div><div><br=
></div></div><div><br></div><div><br></div></div>

--f403045eaed0b5b0fc0546274da4--


From MAILER-DAEMON Mon Jan 16 10:10:43 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cT8vj-0001A4-PB
	for mharc-bug-bash@gnu.org; Mon, 16 Jan 2017 10:10:43 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:35339)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cT8vh-00018r-M1
	for bug-bash@gnu.org; Mon, 16 Jan 2017 10:10:42 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cT8vd-0006Jn-Te
	for bug-bash@gnu.org; Mon, 16 Jan 2017 10:10:41 -0500
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:34719 helo=svr4.eeg.ccf.org)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cT8vd-0006EU-Gt
	for bug-bash@gnu.org; Mon, 16 Jan 2017 10:10:37 -0500
Received: (qmail 2132 invoked from network); 16 Jan 2017 15:10:08 -0000
Received: from imadev.eeg.ccf.org (qmailr@10.76.173.78)
	by gateway.eeg.ccf.org with SMTP; Mon, 16 Jan 2017 10:10:08 -0500
Received: (qmail 20411 invoked by uid 563); 16 Jan 2017 15:10:08 -0000
Date: Mon, 16 Jan 2017 10:10:08 -0500
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Daniel Bullard <bullard.daniel@gmail.com>
Cc: bug-bash@gnu.org, bash@packages.debian.org
Subject: Re: bash: /home/greenhornet/.bashrc: line 120: syntax error:
	unexpected end of file
Message-ID: <20170116151007.GN23041@eeg.ccf.org>
References: <CAP0zz82kV5d7z+4QBVLZ1hYezBwyhUkfKHFavnT=GF_aCDj8aw@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAP0zz82kV5d7z+4QBVLZ1hYezBwyhUkfKHFavnT=GF_aCDj8aw@mail.gmail.com>
User-Agent: Mutt/1.4.2.3i
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 139.137.100.1
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 16 Jan 2017 15:10:42 -0000

On Sun, Jan 15, 2017 at 08:44:24PM +0100, Daniel Bullard wrote:
> # enable programmable completion features (you don't need to enable
> # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
> # sources /etc/bash.bashrc).
> if ! shopt -oq posix; then
>   if [ -f /usr/share/bash-completion/bash_completion ]; then
>     . /usr/share/bash-completion/bash_completion
>   elif [ -f /etc/bash_completion ]; then
>     . /etc/bash_completion
>   fi

You've somehow lost the ending of this if...fi command.  You have two
nested "if" commands but you've only got one "fi".


From MAILER-DAEMON Mon Jan 16 12:06:01 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cTAjJ-0006a0-8Z
	for mharc-bug-bash@gnu.org; Mon, 16 Jan 2017 12:06:01 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:59791)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cTAjH-0006Y4-4e
	for bug-bash@gnu.org; Mon, 16 Jan 2017 12:05:59 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cTAjE-0002RH-1P
	for bug-bash@gnu.org; Mon, 16 Jan 2017 12:05:59 -0500
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:34749 helo=svr4.eeg.ccf.org)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cTAjD-0002RA-Pn
	for bug-bash@gnu.org; Mon, 16 Jan 2017 12:05:55 -0500
Received: (qmail 2697 invoked from network); 16 Jan 2017 17:05:54 -0000
Received: from imadev.eeg.ccf.org (qmailr@10.76.173.78)
	by gateway.eeg.ccf.org with SMTP; Mon, 16 Jan 2017 12:05:54 -0500
Received: (qmail 20656 invoked by uid 563); 16 Jan 2017 17:05:53 -0000
Date: Mon, 16 Jan 2017 12:05:53 -0500
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Daniel Bullard <bullard.daniel@gmail.com>
Cc: bug-bash@gnu.org
Subject: Re: bash: /home/greenhornet/.bashrc: line 120: syntax error:
	unexpected end of file
Message-ID: <20170116170553.GR23041@eeg.ccf.org>
References: <CAP0zz82kV5d7z+4QBVLZ1hYezBwyhUkfKHFavnT=GF_aCDj8aw@mail.gmail.com>
	<20170116151007.GN23041@eeg.ccf.org>
	<CAP0zz825NG4Gi7ZpzzJWGpe6dnfy0jjZ8q5rEOLrX+5uSrcozA@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAP0zz825NG4Gi7ZpzzJWGpe6dnfy0jjZ8q5rEOLrX+5uSrcozA@mail.gmail.com>
User-Agent: Mutt/1.4.2.3i
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 139.137.100.1
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 16 Jan 2017 17:06:00 -0000

On Mon, Jan 16, 2017 at 06:01:24PM +0100, Daniel Bullard wrote:
> what do i do?

First, stop top-posting.

Second, stop taking list questions to private email.  (I've remembered
one of the list addresses to add back to the Cc: list, but not the other.)

Third, add the missing "fi" line at the end.


From MAILER-DAEMON Mon Jan 16 20:43:18 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cTInu-0004wO-3h
	for mharc-bug-bash@gnu.org; Mon, 16 Jan 2017 20:43:18 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41915)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cTInr-0004w4-Dc
	for bug-bash@gnu.org; Mon, 16 Jan 2017 20:43:16 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cTInm-0002W2-Ih
	for bug-bash@gnu.org; Mon, 16 Jan 2017 20:43:15 -0500
Received: from mpv1-2015.cwru.edu ([129.22.103.226]:12429
	helo=mpv1-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1cTInm-0002Ut-Dy
	for bug-bash@gnu.org; Mon, 16 Jan 2017 20:43:10 -0500
Received: from mpv7-2015.CWRU.Edu (EHLO mpv7-2015.case.edu) ([129.22.103.242])
	by mpv1-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AKK47411; Mon, 16 Jan 2017 20:43:08 -0500 (EST)
Received: from h251.183.142.40.ip.windstream.net (EHLO jenna.local)
	([40.142.183.251])
	by mpv7-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id FQF74335 (AUTH cpr);
	Mon, 16 Jan 2017 20:43:06 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: extglob problems
References: <CAMu=BrqMz_QT0ThPC4RE2MjgDey=1pGoe1tNbDKyZcUZQxLWyw@mail.gmail.com>
To: Grisha Levit <grishalevit@gmail.com>, bug-bash@gnu.org
Cc: chet.ramey@case.edu
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
Message-ID: <c69fe326-306a-ca2c-edfd-183f52cccfe9@case.edu>
Date: Mon, 16 Jan 2017 20:43:05 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0)
	Gecko/20100101 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <CAMu=BrqMz_QT0ThPC4RE2MjgDey=1pGoe1tNbDKyZcUZQxLWyw@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.226
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Jan 2017 01:43:16 -0000

On 1/15/17 2:46 PM, Grisha Levit wrote:
>> On 3/23/16 6:15 PM, Isabella Parakiss wrote:
>>> Just wanted to report a couple of problems in 4.3.42 and the latest
>>> devel version:
>>
>> Thanks for the report.  These were both easy fixes, and the fixes will
>> be in bash-4.4.
> 
> Using Isabella's examples and the latest devel snapshot, there still seems
> to be something off when dotglob is enabled:

Thanks for the report.  I'll take a look.

Chet

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


From MAILER-DAEMON Mon Jan 16 20:52:29 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cTIwm-0006OD-VS
	for mharc-bug-bash@gnu.org; Mon, 16 Jan 2017 20:52:28 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:42739)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cTIwk-0006O0-0O
	for bug-bash@gnu.org; Mon, 16 Jan 2017 20:52:26 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cTIwe-0004oz-OL
	for bug-bash@gnu.org; Mon, 16 Jan 2017 20:52:26 -0500
Received: from mpv4-2015.cwru.edu ([129.22.103.195]:51760
	helo=mpv4-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1cTIwe-0004nv-JR
	for bug-bash@gnu.org; Mon, 16 Jan 2017 20:52:20 -0500
Received: from mpv8-2015.CWRU.Edu (EHLO mpv8-2015.case.edu) ([129.22.103.210])
	by mpv4-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AJF57869; Mon, 16 Jan 2017 20:52:19 -0500 (EST)
Received: from h251.183.142.40.ip.windstream.net (EHLO jenna.local)
	([40.142.183.251])
	by mpv8-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id FQQ90817 (AUTH cpr);
	Mon, 16 Jan 2017 20:52:18 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: extglob and globstar don't work together?
References: <CAMu=BrrQr6SdEzsjd8iFP1UoCcP7rnoFPZQEWoE6AC8+DJcDYw@mail.gmail.com>
To: Grisha Levit <grishalevit@gmail.com>, bug-bash@gnu.org
Cc: chet.ramey@case.edu
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
Message-ID: <da9b26c0-9e87-7a0e-dff2-f9d328a6a8c6@case.edu>
Date: Mon, 16 Jan 2017 20:52:17 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0)
	Gecko/20100101 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <CAMu=BrrQr6SdEzsjd8iFP1UoCcP7rnoFPZQEWoE6AC8+DJcDYw@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv4-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.195
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Jan 2017 01:52:27 -0000

On 1/15/17 2:55 PM, Grisha Levit wrote:
> Is it expected that ** work with extended pattern matching?

No, it never has worked as in your example, nor was it intended to. That's
not how it works with ksh93, either.  The `**' is basically a pathname
component.

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


From MAILER-DAEMON Tue Jan 17 08:24:11 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cTTkB-0000V8-HU
	for mharc-bug-bash@gnu.org; Tue, 17 Jan 2017 08:24:11 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:51275)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <svashish@redhat.com>) id 1cTTk9-0000U4-Ns
	for bug-bash@gnu.org; Tue, 17 Jan 2017 08:24:10 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <svashish@redhat.com>) id 1cTTk4-0005t6-0S
	for bug-bash@gnu.org; Tue, 17 Jan 2017 08:24:09 -0500
Received: from mx3-phx2.redhat.com ([209.132.183.24]:39460)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <svashish@redhat.com>) id 1cTTk3-0005sM-Nm
	for bug-bash@gnu.org; Tue, 17 Jan 2017 08:24:03 -0500
Received: from zmail23.collab.prod.int.phx2.redhat.com
	(zmail23.collab.prod.int.phx2.redhat.com [10.5.83.28])
	by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v0HDO2ko013264
	for <bug-bash@gnu.org>; Tue, 17 Jan 2017 08:24:02 -0500
Date: Tue, 17 Jan 2017 08:24:02 -0500 (EST)
From: Siteshwar Vashisht <svashisht@redhat.com>
To: bug-bash@gnu.org
Message-ID: <1508861265.9523642.1484659442561.JavaMail.zimbra@redhat.com>
In-Reply-To: <1759393648.9520291.1484658845439.JavaMail.zimbra@redhat.com>
Subject: Bash leaks heredoc fd to child processes
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_9523640_794957230.1484659442559"
X-Originating-IP: [10.34.4.138]
X-Mailer: Zimbra 8.0.6_GA_5922 (ZimbraWebClient - FF50 (Linux)/8.0.6_GA_5922)
Thread-Topic: Bash leaks heredoc fd to child processes
Thread-Index: ctoyYbpWINocwD24gMnEu52HeJLXcQ==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy]
X-Received-From: 209.132.183.24
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Jan 2017 13:24:10 -0000

------=_Part_9523640_794957230.1484659442559
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Hello,

Bash leaks heredoc fd to child processes if heredoc string contains command substitution.

Reproducer code :

$ cat test.sh 
#!/bin/bash

cat <<EOF

`pvs`

EOF

$ ./test.sh 
File descriptor 3 (/tmp/sh-thd.Gnua0J) leaked on pvs invocation. Parent PID 9590: /bin/bash

  PV         VG     Fmt  Attr PSize  PFree
  /dev/sda2  fedora lvm2 a--  11.00g    0 


Attached patch fixes this leak.

-- 
--
Siteshwar Vashisht
------=_Part_9523640_794957230.1484659442559
Content-Type: text/x-patch;
 name=0001-Do-not-leak-heredoc-fd-to-child-processes.patch
Content-Disposition: attachment;
 filename=0001-Do-not-leak-heredoc-fd-to-child-processes.patch
Content-Transfer-Encoding: base64

RnJvbSA2Yjc5NzBlZTc4N2NmMDQyMTgyZjhmOTNiZjI1YzZlNjQ1M2E4YWVmIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBTaXRlc2h3YXIgVmFzaGlzaHQgPHN2YXNoaXNodEByZWRoYXQu
Y29tPgpEYXRlOiBUdWUsIDE3IEphbiAyMDE3IDEwOjI4OjM0ICswMTAwClN1YmplY3Q6IFtQQVRD
SF0gRG8gbm90IGxlYWsgaGVyZWRvYyBmZCB0byBjaGlsZCBwcm9jZXNzZXMKCi0tLQogbGliL3No
L3RtcGZpbGUuYyB8IDQgKystLQogMSBmaWxlIGNoYW5nZWQsIDIgaW5zZXJ0aW9ucygrKSwgMiBk
ZWxldGlvbnMoLSkKCmRpZmYgLS1naXQgYS9saWIvc2gvdG1wZmlsZS5jIGIvbGliL3NoL3RtcGZp
bGUuYwppbmRleCBlNDFlNDViLi4xNWZjYjVjIDEwMDY0NAotLS0gYS9saWIvc2gvdG1wZmlsZS5j
CisrKyBiL2xpYi9zaC90bXBmaWxlLmMKQEAgLTQyLDcgKzQyLDcgQEAKIGV4dGVybiBpbnQgZXJy
bm87CiAjZW5kaWYKIAotI2RlZmluZSBCQVNFT1BFTkZMQUdTCShPX0NSRUFUIHwgT19UUlVOQyB8
IE9fRVhDTCB8IE9fQklOQVJZKQorI2RlZmluZSBCQVNFT1BFTkZMQUdTCShPX0NSRUFUIHwgT19U
UlVOQyB8IE9fRVhDTCB8IE9fQklOQVJZIHwgT19DTE9FWEVDKQogCiAjZGVmaW5lIERFRkFVTFRf
VE1QRElSCQkiLiIJLyogYm9ndXMgZGVmYXVsdCwgc2hvdWxkIGJlIGNoYW5nZWQgKi8KICNkZWZp
bmUgREVGQVVMVF9OQU1FUk9PVAkic2h0bXAiCkBAIC0xOTUsNyArMTk1LDcgQEAgc2hfbWt0bXBm
ZCAobmFtZXJvb3QsIGZsYWdzLCBuYW1lcCkKIAogI2lmZGVmIFVTRV9NS1NURU1QCiAgIHNwcmlu
dGYgKGZpbGVuYW1lLCAiJXMvJXMuWFhYWFhYIiwgdGRpciwgbHJvb3QpOwotICBmZCA9IG1rc3Rl
bXAgKGZpbGVuYW1lKTsKKyAgZmQgPSBta29zdGVtcCAoZmlsZW5hbWUsIE9fQ0xPRVhFQyk7CiAg
IGlmIChmZCA8IDAgfHwgbmFtZXAgPT0gMCkKICAgICB7CiAgICAgICBmcmVlIChmaWxlbmFtZSk7
Ci0tIAoyLjkuMwoK
------=_Part_9523640_794957230.1484659442559--


From MAILER-DAEMON Tue Jan 17 11:06:34 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cTWHK-0008DF-K7
	for mharc-bug-bash@gnu.org; Tue, 17 Jan 2017 11:06:34 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:47163)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cTWHH-00087v-Jz
	for bug-bash@gnu.org; Tue, 17 Jan 2017 11:06:32 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cTWHC-0003qz-NI
	for bug-bash@gnu.org; Tue, 17 Jan 2017 11:06:31 -0500
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:8460
	helo=mpv3-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1cTWHC-0003qS-Hl
	for bug-bash@gnu.org; Tue, 17 Jan 2017 11:06:26 -0500
Received: from mpv6-2015.CWRU.Edu (EHLO mpv6-2015.case.edu) ([129.22.103.202])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AJK85584; Tue, 17 Jan 2017 11:06:22 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AXT04796 (AUTH cpr);
	Tue, 17 Jan 2017 11:06:21 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: Bash leaks heredoc fd to child processes
References: <1508861265.9523642.1484659442561.JavaMail.zimbra@redhat.com>
To: Siteshwar Vashisht <svashisht@redhat.com>, bug-bash@gnu.org
Cc: chet.ramey@case.edu
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <54837741-c1a0-2587-2543-3955c49923ef@case.edu>
Date: Tue, 17 Jan 2017 11:06:21 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0)
	Gecko/20100101 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <1508861265.9523642.1484659442561.JavaMail.zimbra@redhat.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv3-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Jan 2017 16:06:33 -0000

On 1/17/17 8:24 AM, Siteshwar Vashisht wrote:
> Hello,
> 
> Bash leaks heredoc fd to child processes if heredoc string contains command substitution.
> 
> Reproducer code :

What is `pvs'?

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


From MAILER-DAEMON Tue Jan 17 11:14:50 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cTWPK-0001k1-HX
	for mharc-bug-bash@gnu.org; Tue, 17 Jan 2017 11:14:50 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:50127)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <john.archie.mckown@gmail.com>) id 1cTWPI-0001ji-6t
	for bug-bash@gnu.org; Tue, 17 Jan 2017 11:14:49 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <john.archie.mckown@gmail.com>) id 1cTWPH-00081s-94
	for bug-bash@gnu.org; Tue, 17 Jan 2017 11:14:48 -0500
Received: from mail-io0-x22e.google.com ([2607:f8b0:4001:c06::22e]:34686)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <john.archie.mckown@gmail.com>)
	id 1cTWPH-00081J-3f
	for bug-bash@gnu.org; Tue, 17 Jan 2017 11:14:47 -0500
Received: by mail-io0-x22e.google.com with SMTP id l66so118432247ioi.1
	for <bug-bash@gnu.org>; Tue, 17 Jan 2017 08:14:45 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc; bh=h8Lr8G6rbZAex+T7br8KKdzP0X2x+HkkprpX2ChlcbQ=;
	b=qJoLl1iVfqiqKWSRcMw7mRmndjo4sbCT1EqNShbKgdFaxz8LgdjoDQbyFKz9lTzb3M
	3HPzii5thwZsrm/lAdRdu0pQ78COudoc0M27T04jJN7rGnRlr6WQJq0vCzOcUn8oFtPa
	Zz4RZPIUVwrWkczbNjTNae6/VM46jswBp/TJe0KtgyJ6oo8U6Sfr31bbkIaPKkqHm5VM
	gKIA1rHWuGXV5VIadQDXhNu77gnDHzKioPucp+yE8V96xSS5uNCghqVn5NW5DgxVr/DL
	RwTlUzLgaV2LBtpo4L5qSr7Yn2wHm2XoTj5pJ6hxcloRipgItHkqT3IzD/4jhQNhAtdj
	x+eQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to:cc;
	bh=h8Lr8G6rbZAex+T7br8KKdzP0X2x+HkkprpX2ChlcbQ=;
	b=K+bQEmKTGNG9kXpjUa2QY+WiOHgA0W+6qD7Wq9DcQkdNgERUIQD5X8BpXNEWIxCgNT
	aJRE3qEulpLr6YQOj+dv9rCYFeLINf6/3BnNJqKQO0qcx5XuUPjHTfvZ/GAbUHtQJmJ9
	GMePOY2s96kN3w/ApDJZKG8NseCdjCy8NhWfi6xM+4VPaOFO1aL84PDJdCMg/MqE/zfD
	ueXKDk9bcdhzvHwlLbZiKtOXKgB+HQefXGEMvzXWFy0+p0NgC7DqVza0HEVukBpJCNBd
	KWZJorxge1ONdelqQ0NY2FkFBBYLzXeFDNm93/xcd3Ltyrl8NrIwr500DX/wBNcwUeND
	Hlqw==
X-Gm-Message-State: AIkVDXLTxiWvM5Wi4JNq/uOFxcJ71wrIsl+B2Uwu/q3fHjNsA7/6dhvISUXzu2nf9P9SvphOxptn0JHDHs1yBQ==
X-Received: by 10.107.197.69 with SMTP id v66mr3473760iof.119.1484669684940;
	Tue, 17 Jan 2017 08:14:44 -0800 (PST)
MIME-Version: 1.0
Received: by 10.79.28.144 with HTTP; Tue, 17 Jan 2017 08:14:44 -0800 (PST)
In-Reply-To: <54837741-c1a0-2587-2543-3955c49923ef@case.edu>
References: <1508861265.9523642.1484659442561.JavaMail.zimbra@redhat.com>
	<54837741-c1a0-2587-2543-3955c49923ef@case.edu>
From: John McKown <john.archie.mckown@gmail.com>
Date: Tue, 17 Jan 2017 10:14:44 -0600
Message-ID: <CAAJSdjhKJSdRMDj-Ex7ET7pG=mEYnuZ4fDR6VzSq26hEz=_wjA@mail.gmail.com>
Subject: Re: Bash leaks heredoc fd to child processes
To: Chester Ramey <chet.ramey@case.edu>
Cc: Siteshwar Vashisht <svashisht@redhat.com>,
	"bug-bash@gnu.org" <bug-bash@gnu.org>
Content-Type: multipart/alternative; boundary=94eb2c189b962e072a05464c9926
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2607:f8b0:4001:c06::22e
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Jan 2017 16:14:49 -0000

--94eb2c189b962e072a05464c9926
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Tue, Jan 17, 2017 at 10:06 AM, Chet Ramey <chet.ramey@case.edu> wrote:

> On 1/17/17 8:24 AM, Siteshwar Vashisht wrote:
> > Hello,
> >
> > Bash leaks heredoc fd to child processes if heredoc string contains
> command substitution.
> >
> > Reproducer code :
>
> What is `pvs'?
>
>
=E2=80=8BProbably a part of LVM (Logical Volume Manager),

VS(8)
    System Manager's Manual
                         PVS(8)

NAME
       pvs =E2=80=94 report information about physical volumes

=E2=80=8B


--=20
There=E2=80=99s no obfuscated Perl contest because it=E2=80=99s pointless.

=E2=80=94Jeff Polk

Maranatha! <><
John McKown

--94eb2c189b962e072a05464c9926
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:arial,he=
lvetica,sans-serif"><span style=3D"font-family:arial,sans-serif">On Tue, Ja=
n 17, 2017 at 10:06 AM, Chet Ramey </span><span dir=3D"ltr" style=3D"font-f=
amily:arial,sans-serif">&lt;<a href=3D"mailto:chet.ramey@case.edu" target=
=3D"_blank">chet.ramey@case.edu</a>&gt;</span><span style=3D"font-family:ar=
ial,sans-serif"> wrote:</span><br></div><div class=3D"gmail_extra"><div cla=
ss=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0p=
x 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 1/1=
7/17 8:24 AM, Siteshwar Vashisht wrote:<br>
&gt; Hello,<br>
&gt;<br>
&gt; Bash leaks heredoc fd to child processes if heredoc string contains co=
mmand substitution.<br>
&gt;<br>
&gt; Reproducer code :<br>
<br>
What is `pvs&#39;?<br>
<span class=3D"gmail-HOEnZb"><font color=3D"#888888"><br></font></span></bl=
ockquote><div><br></div><div class=3D"gmail_default" style=3D"font-family:a=
rial,helvetica,sans-serif">=E2=80=8BProbably a part of LVM (Logical Volume =
Manager),=C2=A0</div><div class=3D"gmail_default" style=3D"font-family:aria=
l,helvetica,sans-serif"><br></div><div class=3D"gmail_default"><font face=
=3D"arial, helvetica, sans-serif">VS(8) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 System Manager&#39;s Manual =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PVS(8)=
</font></div><div class=3D"gmail_default"><font face=3D"arial, helvetica, s=
ans-serif"><br></font></div><div class=3D"gmail_default"><font face=3D"aria=
l, helvetica, sans-serif">NAME</font></div><div class=3D"gmail_default"><fo=
nt face=3D"arial, helvetica, sans-serif">=C2=A0 =C2=A0 =C2=A0 =C2=A0pvs =E2=
=80=94 report information about physical volumes</font></div><div class=3D"=
gmail_default" style=3D"font-family:arial,helvetica,sans-serif"><br></div><=
div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-serif=
">=E2=80=8B</div></div><br clear=3D"all"><div><br></div>-- <br><div class=
=3D"gmail_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><div dir=3D"ltr=
"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div =
dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"=
ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><d=
iv dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=
=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr">There=E2=80=99s no obfuscated Pe=
rl contest because it=E2=80=99s pointless.<br><br>=E2=80=94Jeff Polk</div><=
div dir=3D"ltr"><br><div dir=3D"ltr"><div>Maranatha! &lt;&gt;&lt;<br>John M=
cKown</div></div></div></div></div></div></div></div></div></div></div></di=
v></div></div></div></div></div></div></div></div></div></div></div></div><=
/div></div></div>
</div></div>

--94eb2c189b962e072a05464c9926--


From MAILER-DAEMON Tue Jan 17 12:39:11 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cTXix-0008UE-4p
	for mharc-bug-bash@gnu.org; Tue, 17 Jan 2017 12:39:11 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41724)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <svashish@redhat.com>) id 1cTXit-0008T0-5a
	for bug-bash@gnu.org; Tue, 17 Jan 2017 12:39:08 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <svashish@redhat.com>) id 1cTXiq-0000Al-2f
	for bug-bash@gnu.org; Tue, 17 Jan 2017 12:39:07 -0500
Received: from mx5-phx2.redhat.com ([209.132.183.37]:43435)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <svashish@redhat.com>) id 1cTXip-00009B-Qj
	for bug-bash@gnu.org; Tue, 17 Jan 2017 12:39:04 -0500
Received: from zmail23.collab.prod.int.phx2.redhat.com
	(zmail23.collab.prod.int.phx2.redhat.com [10.5.83.28])
	by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v0HHcsXJ035925;
	Tue, 17 Jan 2017 12:38:54 -0500
Date: Tue, 17 Jan 2017 12:38:54 -0500 (EST)
From: Siteshwar Vashisht <svashisht@redhat.com>
To: John McKown <john.archie.mckown@gmail.com>
Cc: Chester Ramey <chet.ramey@case.edu>, bug-bash@gnu.org
Message-ID: <1870553900.9613193.1484674734303.JavaMail.zimbra@redhat.com>
In-Reply-To: <CAAJSdjhKJSdRMDj-Ex7ET7pG=mEYnuZ4fDR6VzSq26hEz=_wjA@mail.gmail.com>
References: <1508861265.9523642.1484659442561.JavaMail.zimbra@redhat.com>
	<54837741-c1a0-2587-2543-3955c49923ef@case.edu>
	<CAAJSdjhKJSdRMDj-Ex7ET7pG=mEYnuZ4fDR6VzSq26hEz=_wjA@mail.gmail.com>
Subject: Re: Bash leaks heredoc fd to child processes
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Originating-IP: [10.34.4.138]
X-Mailer: Zimbra 8.0.6_GA_5922 (ZimbraWebClient - FF50 (Linux)/8.0.6_GA_5922)
Thread-Topic: Bash leaks heredoc fd to child processes
Thread-Index: x/hFVlQU9jt7AR9sRokGYpj5LOB2zw==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From: 209.132.183.37
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Jan 2017 17:39:08 -0000



----- Original Message -----
> From: "John McKown" <john.archie.mckown@gmail.com>
> To: "Chester Ramey" <chet.ramey@case.edu>
> Cc: bug-bash@gnu.org, "Siteshwar Vashisht" <svashisht@redhat.com>
> Sent: Tuesday, January 17, 2017 5:14:44 PM
> Subject: Re: Bash leaks heredoc fd to child processes
>=20
> =E2=80=8BProbably a part of LVM (Logical Volume Manager),
>=20
> VS(8)
>     System Manager's Manual
>                          PVS(8)
>=20
> NAME
>        pvs =E2=80=94 report information about physical volumes

Yes, it's the utility used in my reproducer. I used it because it was verbo=
se about the descriptor leak.

For reference, this is what I was working on https://bugzilla.redhat.com/sh=
ow_bug.cgi?id=3D1413676
=20
>=20
> =E2=80=8B
>=20
>=20
> --
> There=E2=80=99s no obfuscated Perl contest because it=E2=80=99s pointless=
.
>=20
> =E2=80=94Jeff Polk
>=20
> Maranatha! <><
> John McKown
>=20

--=20
--
Siteshwar Vashisht


From MAILER-DAEMON Tue Jan 17 13:35:08 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cTYb4-0005XK-3x
	for mharc-bug-bash@gnu.org; Tue, 17 Jan 2017 13:35:06 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:38717)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cTYb1-0005X7-KK
	for bug-bash@gnu.org; Tue, 17 Jan 2017 13:35:04 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cTYax-0004wg-NM
	for bug-bash@gnu.org; Tue, 17 Jan 2017 13:35:03 -0500
Received: from mpv1-2015.cwru.edu ([129.22.103.226]:7233
	helo=mpv1-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1cTYax-0004vy-Ir
	for bug-bash@gnu.org; Tue, 17 Jan 2017 13:34:59 -0500
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv1-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AKK81858; Tue, 17 Jan 2017 13:34:49 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AYB88022 (AUTH cpr);
	Tue, 17 Jan 2017 13:34:49 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: Bash leaks heredoc fd to child processes
References: <1508861265.9523642.1484659442561.JavaMail.zimbra@redhat.com>
	<54837741-c1a0-2587-2543-3955c49923ef@case.edu>
	<CAAJSdjhKJSdRMDj-Ex7ET7pG=mEYnuZ4fDR6VzSq26hEz=_wjA@mail.gmail.com>
	<1870553900.9613193.1484674734303.JavaMail.zimbra@redhat.com>
To: Siteshwar Vashisht <svashisht@redhat.com>,
	John McKown <john.archie.mckown@gmail.com>
Cc: chet.ramey@case.edu, bug-bash@gnu.org
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <ddf10007-6c5d-b93c-828a-38215cc4c305@case.edu>
Date: Tue, 17 Jan 2017 13:34:48 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0)
	Gecko/20100101 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <1870553900.9613193.1484674734303.JavaMail.zimbra@redhat.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.226
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Jan 2017 18:35:04 -0000

On 1/17/17 12:38 PM, Siteshwar Vashisht wrote:

>> NAME
>>        pvs — report information about physical volumes
> 
> Yes, it's the utility used in my reproducer. I used it because it was verbose about the descriptor leak.

It's ok, I was able to reproduce it using something else.


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


From MAILER-DAEMON Tue Jan 17 13:42:17 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cTYi0-0007G1-Tn
	for mharc-bug-bash@gnu.org; Tue, 17 Jan 2017 13:42:16 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41765)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cTYhy-0007Ev-QL
	for bug-bash@gnu.org; Tue, 17 Jan 2017 13:42:15 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cTYhv-0000AN-O5
	for bug-bash@gnu.org; Tue, 17 Jan 2017 13:42:14 -0500
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:38825
	helo=mpv3-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1cTYhv-00009Q-CZ
	for bug-bash@gnu.org; Tue, 17 Jan 2017 13:42:11 -0500
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AJK95427; Tue, 17 Jan 2017 13:42:07 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AYB89838 (AUTH cpr);
	Tue, 17 Jan 2017 13:42:07 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: Bash leaks heredoc fd to child processes
References: <1508861265.9523642.1484659442561.JavaMail.zimbra@redhat.com>
To: Siteshwar Vashisht <svashisht@redhat.com>, bug-bash@gnu.org
Cc: chet.ramey@case.edu
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <f2345214-d673-466f-f473-2668e70d543f@case.edu>
Date: Tue, 17 Jan 2017 13:42:07 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0)
	Gecko/20100101 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <1508861265.9523642.1484659442561.JavaMail.zimbra@redhat.com>
Content-Type: multipart/mixed; boundary="------------3EC8642CAFC36B2D32ECB70A"
X-Junkmail-Whitelist: YES (by domain whitelist at mpv3-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Jan 2017 18:42:16 -0000

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

On 1/17/17 8:24 AM, Siteshwar Vashisht wrote:
> Hello,
> 
> Bash leaks heredoc fd to child processes if heredoc string contains command substitution.

Thanks for the report. Here's a simpler patch.

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

--------------3EC8642CAFC36B2D32ECB70A
Content-Type: application/x-patch;
 name="heredoc-fd-cloexec.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="heredoc-fd-cloexec.patch"

KioqIC4uL2Jhc2gtNC40LXBhdGNoZWQvcmVkaXIuYwkyMDE2LTA2LTAyIDIwOjIyOjI0LjAw
MDAwMDAwMCAtMDQwMAotLS0gcmVkaXIuYwkyMDE3LTAxLTE3IDEzOjIzOjQwLjAwMDAwMDAw
MCAtMDUwMAoqKioqKioqKioqKioqKioKKioqIDQ3MCw0NzMgKioqKgotLS0gNDY3LDQ3MiAt
LS0tCiAgICAgIH0KICAKKyAgIFNFVF9DTE9TRV9PTl9FWEVDIChmZCk7CisgCiAgICBlcnJu
byA9IHIgPSAwOwkJLyogWFhYICovCiAgICAvKiB3cml0ZV9oZXJlX2RvY3VtZW50IHJldHVy
bnMgMCBvbiBzdWNjZXNzLCBlcnJubyBvbiBmYWlsdXJlLiAqLwo=
--------------3EC8642CAFC36B2D32ECB70A--



From MAILER-DAEMON Tue Jan 17 15:58:03 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cTapP-00008V-5I
	for mharc-bug-bash@gnu.org; Tue, 17 Jan 2017 15:58:03 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:54498)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <svashish@redhat.com>) id 1cTapM-000083-M6
	for bug-bash@gnu.org; Tue, 17 Jan 2017 15:58:01 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <svashish@redhat.com>) id 1cTapJ-0006zm-Vb
	for bug-bash@gnu.org; Tue, 17 Jan 2017 15:58:00 -0500
Received: from mx4-phx2.redhat.com ([209.132.183.25]:54810)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <svashish@redhat.com>) id 1cTapJ-0006yr-Ms
	for bug-bash@gnu.org; Tue, 17 Jan 2017 15:57:57 -0500
Received: from zmail23.collab.prod.int.phx2.redhat.com
	(zmail23.collab.prod.int.phx2.redhat.com [10.5.83.28])
	by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v0HKvtfn016230;
	Tue, 17 Jan 2017 15:57:56 -0500
Date: Tue, 17 Jan 2017 15:57:55 -0500 (EST)
From: Siteshwar Vashisht <svashisht@redhat.com>
To: chet ramey <chet.ramey@case.edu>
Cc: bug-bash@gnu.org
Message-ID: <1893154341.9684670.1484686675872.JavaMail.zimbra@redhat.com>
In-Reply-To: <f2345214-d673-466f-f473-2668e70d543f@case.edu>
References: <1508861265.9523642.1484659442561.JavaMail.zimbra@redhat.com>
	<f2345214-d673-466f-f473-2668e70d543f@case.edu>
Subject: Re: Bash leaks heredoc fd to child processes
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Originating-IP: [10.67.5.23]
X-Mailer: Zimbra 8.0.6_GA_5922 (ZimbraWebClient - FF50 (Linux)/8.0.6_GA_5922)
Thread-Topic: Bash leaks heredoc fd to child processes
Thread-Index: HKIpgMcYUEBkNlkM98b9KEZsUxQgfw==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy]
X-Received-From: 209.132.183.25
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Jan 2017 20:58:01 -0000



----- Original Message -----
> From: "Chet Ramey" <chet.ramey@case.edu>
> To: "Siteshwar Vashisht" <svashisht@redhat.com>, bug-bash@gnu.org
> Cc: "chet ramey" <chet.ramey@case.edu>
> Sent: Tuesday, January 17, 2017 7:42:07 PM
> Subject: Re: Bash leaks heredoc fd to child processes
> 
> Thanks for the report. Here's a simpler patch.

Looks good to me. Thanks!

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

-- 
--
Siteshwar Vashisht


From MAILER-DAEMON Fri Jan 20 15:39:17 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cUfxs-0003mr-V5
	for mharc-bug-bash@gnu.org; Fri, 20 Jan 2017 15:39:16 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:40428)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet@caleb.ins.cwru.edu>) id 1cUfxm-0003lz-GK
	for bug-bash@gnu.org; Fri, 20 Jan 2017 15:39:15 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet@caleb.ins.cwru.edu>) id 1cUfxh-0000gc-Lc
	for bug-bash@gnu.org; Fri, 20 Jan 2017 15:39:10 -0500
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:58630
	helo=mpv3-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet@caleb.ins.cwru.edu>)
	id 1cUfxh-0000f5-G8
	for bug-bash@gnu.org; Fri, 20 Jan 2017 15:39:05 -0500
Received: from mpv6-2015.CWRU.Edu (EHLO mpv6-2015.case.edu) ([129.22.103.202])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AJM54930; Fri, 20 Jan 2017 15:17:59 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AXY92617; Fri, 20 Jan 2017 15:17:58 -0500 (EST)
Received: by caleb.ins.cwru.edu (Postfix, from userid 286)
	id 555F14E0DF7; Fri, 20 Jan 2017 15:17:57 -0500 (EST)
Date: Fri, 20 Jan 2017 15:17:34 -0500
From: Chet Ramey <chet.ramey@case.edu>
Sender: chet <chet@caleb.ins.cwru.edu>
To: bug-bash@gnu.org
Subject: Bash-4.4 Official Patch 6
Cc: chet.ramey@case.edu
Reply-To: chet.ramey@case.edu
Message-ID: <170120201734.AA66700.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 mpv3-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 20 Jan 2017 20:39:15 -0000

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

Bash-Release:	4.4
Patch-ID:	bash44-006

Bug-Reported-by:	<fernando@null-life.com>
Bug-Reference-ID:	<CAEr-gPFPvqheiAeENmMkEwWRd4U=1iqCsYmR3sLdULOqL++_tQ@mail.gmail.com>
Bug-Reference-URL:	

Bug-Description:

Out-of-range negative offsets to popd can cause the shell to crash attempting
to free an invalid memory block.

Patch (apply with `patch -p0'):

*** ../bash-4.4-patched/builtins/pushd.def	2016-01-25 13:31:49.000000000 -0500
--- builtins/pushd.def	2016-10-28 10:46:49.000000000 -0400
***************
*** 366,370 ****
      }
  
!   if (which > directory_list_offset || (directory_list_offset == 0 && which == 0))
      {
        pushd_error (directory_list_offset, which_word ? which_word : "");
--- 366,370 ----
      }
  
!   if (which > directory_list_offset || (which < -directory_list_offset) || (directory_list_offset == 0 && which == 0))
      {
        pushd_error (directory_list_offset, which_word ? which_word : "");
***************
*** 388,391 ****
--- 388,396 ----
  	 of the list into place. */
        i = (direction == '+') ? directory_list_offset - which : which;
+       if (i < 0 || i > directory_list_offset)
+ 	{
+ 	  pushd_error (directory_list_offset, which_word ? which_word : "");
+ 	  return (EXECUTION_FAILURE);
+ 	}
        free (pushd_directory_list[i]);
        directory_list_offset--;
*** ../bash-4.4/patchlevel.h	2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h	2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 5
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 6
  
  #endif /* _PATCHLEVEL_H_ */

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


From MAILER-DAEMON Fri Jan 20 15:39:32 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cUfy8-0003vD-3P
	for mharc-bug-bash@gnu.org; Fri, 20 Jan 2017 15:39:32 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:40473)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet@caleb.ins.cwru.edu>) id 1cUfy6-0003uA-5k
	for bug-bash@gnu.org; Fri, 20 Jan 2017 15:39:31 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet@caleb.ins.cwru.edu>) id 1cUfy0-0000qS-Vq
	for bug-bash@gnu.org; Fri, 20 Jan 2017 15:39:30 -0500
Received: from mpv4-2015.cwru.edu ([129.22.103.195]:53747
	helo=mpv4-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet@caleb.ins.cwru.edu>)
	id 1cUfy0-0000q6-Pq
	for bug-bash@gnu.org; Fri, 20 Jan 2017 15:39:24 -0500
Received: from mpv6-2015.CWRU.Edu (EHLO mpv6-2015.case.edu) ([129.22.103.202])
	by mpv4-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AJH51197; Fri, 20 Jan 2017 15:18:23 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AXY92714; Fri, 20 Jan 2017 15:18:22 -0500 (EST)
Received: by caleb.ins.cwru.edu (Postfix, from userid 286)
	id 9A3754E0E3B; Fri, 20 Jan 2017 15:18:22 -0500 (EST)
Date: Fri, 20 Jan 2017 15:17:59 -0500
From: Chet Ramey <chet.ramey@case.edu>
Sender: chet <chet@caleb.ins.cwru.edu>
To: bug-bash@gnu.org
Subject: Bash-4.4 Official Patch 7
Cc: chet.ramey@case.edu
Reply-To: chet.ramey@case.edu
Message-ID: <170120201759.AA66700.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 mpv4-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.195
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 20 Jan 2017 20:39:31 -0000

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

Bash-Release:	4.4
Patch-ID:	bash44-007

Bug-Reported-by:	Jens Heyens <jens.heyens@cispa.saarland>
Bug-Reference-ID:	
Bug-Reference-URL:	https://savannah.gnu.org/support/?109224

Bug-Description:

When performing filename completion, bash dequotes the directory name being
completed, which can result in match failures and potential unwanted
expansion.

Patch (apply with `patch -p0'):

*** ../bash-4.4-patched/bashline.c	2016-08-05 21:44:05.000000000 -0400
--- bashline.c	2017-01-19 13:15:51.000000000 -0500
***************
*** 143,147 ****
  static void restore_directory_hook __P((rl_icppfunc_t));
  
! static int directory_exists __P((const char *));
  
  static void cleanup_expansion_error __P((void));
--- 144,148 ----
  static void restore_directory_hook __P((rl_icppfunc_t));
  
! static int directory_exists __P((const char *, int));
  
  static void cleanup_expansion_error __P((void));
***************
*** 3103,3111 ****
  }
  
! /* Check whether not the (dequoted) version of DIRNAME, with any trailing slash
!    removed, exists. */
  static int
! directory_exists (dirname)
       const char *dirname;
  {
    char *new_dirname;
--- 3107,3116 ----
  }
  
! /* Check whether not DIRNAME, with any trailing slash removed, exists.  If
!    SHOULD_DEQUOTE is non-zero, we dequote the directory name first. */
  static int
! directory_exists (dirname, should_dequote)
       const char *dirname;
+      int should_dequote;
  {
    char *new_dirname;
***************
*** 3113,3118 ****
    struct stat sb;
  
!   /* First, dequote the directory name */
!   new_dirname = bash_dequote_filename ((char *)dirname, rl_completion_quote_character);
    dirlen = STRLEN (new_dirname);
    if (new_dirname[dirlen - 1] == '/')
--- 3118,3124 ----
    struct stat sb;
  
!   /* We save the string and chop the trailing slash because stat/lstat behave
!      inconsistently if one is present. */
!   new_dirname = should_dequote ? bash_dequote_filename ((char *)dirname, rl_completion_quote_character) : savestring (dirname);
    dirlen = STRLEN (new_dirname);
    if (new_dirname[dirlen - 1] == '/')
***************
*** 3146,3150 ****
      should_expand_dirname = '`';
  
!   if (should_expand_dirname && directory_exists (local_dirname))
      should_expand_dirname = 0;
    
--- 3152,3156 ----
      should_expand_dirname = '`';
  
!   if (should_expand_dirname && directory_exists (local_dirname, 0))
      should_expand_dirname = 0;
    
***************
*** 3156,3160 ****
        global_nounset = unbound_vars_is_error;
        unbound_vars_is_error = 0;
!       wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_COMPLETE);	/* does the right thing */
        unbound_vars_is_error = global_nounset;
        if (wl)
--- 3162,3166 ----
        global_nounset = unbound_vars_is_error;
        unbound_vars_is_error = 0;
!       wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_NOPROCSUB|W_COMPLETE);	/* does the right thing */
        unbound_vars_is_error = global_nounset;
        if (wl)
***************
*** 3245,3249 ****
      }
  
!   if (should_expand_dirname && directory_exists (local_dirname))
      should_expand_dirname = 0;
  
--- 3262,3266 ----
      }
  
!   if (should_expand_dirname && directory_exists (local_dirname, 1))
      should_expand_dirname = 0;
  
***************
*** 3251,3255 ****
      {
        new_dirname = savestring (local_dirname);
!       wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_COMPLETE);	/* does the right thing */
        if (wl)
  	{
--- 3268,3272 ----
      {
        new_dirname = savestring (local_dirname);
!       wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_NOPROCSUB|W_COMPLETE);	/* does the right thing */
        if (wl)
  	{
*** ../bash-4.4/subst.c	2016-08-30 16:46:38.000000000 -0400
--- subst.c	2017-01-19 07:09:57.000000000 -0500
***************
*** 9459,9462 ****
--- 9459,9466 ----
  	      if (word->flags & W_COMPLETE)
  		tword->flags |= W_COMPLETE;	/* for command substitutions */
+ 	      if (word->flags & W_NOCOMSUB)
+ 		tword->flags |= W_NOCOMSUB;
+ 	      if (word->flags & W_NOPROCSUB)
+ 		tword->flags |= W_NOPROCSUB;
  
  	      temp = (char *)NULL;
*** ../bash-4.4/patchlevel.h	2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h	2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 6
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 7
  
  #endif /* _PATCHLEVEL_H_ */

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


From MAILER-DAEMON Fri Jan 20 15:39:57 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cUfyX-0004Cl-F1
	for mharc-bug-bash@gnu.org; Fri, 20 Jan 2017 15:39:57 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:40653)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet@caleb.ins.cwru.edu>) id 1cUfyR-00049e-Of
	for bug-bash@gnu.org; Fri, 20 Jan 2017 15:39:56 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet@caleb.ins.cwru.edu>) id 1cUfyM-00015r-Rj
	for bug-bash@gnu.org; Fri, 20 Jan 2017 15:39:51 -0500
Received: from mpv4-2015.cwru.edu ([129.22.103.195]:53802
	helo=mpv4-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet@caleb.ins.cwru.edu>)
	id 1cUfyM-00015B-Mm
	for bug-bash@gnu.org; Fri, 20 Jan 2017 15:39:46 -0500
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv4-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AJH51219; Fri, 20 Jan 2017 15:18:45 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AYH33663; Fri, 20 Jan 2017 15:18:45 -0500 (EST)
Received: by caleb.ins.cwru.edu (Postfix, from userid 286)
	id 37A7B4E0E44; Fri, 20 Jan 2017 15:18:45 -0500 (EST)
Date: Fri, 20 Jan 2017 15:18:23 -0500
From: Chet Ramey <chet.ramey@case.edu>
Sender: chet <chet@caleb.ins.cwru.edu>
To: bug-bash@gnu.org
Subject: Bash-4.4 Official Patch 8
Cc: chet.ramey@case.edu
Reply-To: chet.ramey@case.edu
Message-ID: <170120201823.AA66700.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 mpv4-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.195
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 20 Jan 2017 20:39:56 -0000

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

Bash-Release:	4.4
Patch-ID:	bash44-008

Bug-Reported-by:	Koichi MURASE <myoga.murase@gmail.com>
Bug-Reference-ID:	<CAFLRLk-V+1AeQ2k=pY7ih6V+MfQ_w8EF3YWL2E+wmLfgKBtzXA@mail.gmail.com>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2016-11/msg00050.html

Bug-Description:

Under certain circumstances, bash will evaluate arithmetic expressions as
part of reading an expression token even when evaluation is suppressed. This
happens while evaluating a conditional expression and skipping over the
failed branch of the expression.

Patch (apply with `patch -p0'):

*** ../bash-4.4-patched/expr.c	2015-10-11 14:46:36.000000000 -0400
--- expr.c	2016-11-08 11:55:46.000000000 -0500
***************
*** 579,585 ****
    if (curtok == QUES)		/* found conditional expr */
      {
-       readtok ();
-       if (curtok == 0 || curtok == COL)
- 	evalerror (_("expression expected"));
        if (cval == 0)
  	{
--- 579,582 ----
***************
*** 588,591 ****
--- 585,592 ----
  	}
  
+       readtok ();
+       if (curtok == 0 || curtok == COL)
+ 	evalerror (_("expression expected"));
+ 
        val1 = EXP_HIGHEST ();
  
***************
*** 594,600 ****
        if (curtok != COL)
  	evalerror (_("`:' expected for conditional expression"));
!       readtok ();
!       if (curtok == 0)
! 	evalerror (_("expression expected"));
        set_noeval = 0;
        if (cval)
--- 595,599 ----
        if (curtok != COL)
  	evalerror (_("`:' expected for conditional expression"));
! 
        set_noeval = 0;
        if (cval)
***************
*** 604,608 ****
--- 603,611 ----
   	}
  
+       readtok ();
+       if (curtok == 0)
+ 	evalerror (_("expression expected"));
        val2 = expcond ();
+ 
        if (set_noeval)
  	noeval--;
*** ../bash-4.4/patchlevel.h	2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h	2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 7
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 8
  
  #endif /* _PATCHLEVEL_H_ */

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


From MAILER-DAEMON Fri Jan 20 15:40:21 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cUfyv-0004TP-75
	for mharc-bug-bash@gnu.org; Fri, 20 Jan 2017 15:40:21 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:40903)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet@caleb.ins.cwru.edu>) id 1cUfys-0004Rq-3H
	for bug-bash@gnu.org; Fri, 20 Jan 2017 15:40:20 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet@caleb.ins.cwru.edu>) id 1cUfyn-0001RL-34
	for bug-bash@gnu.org; Fri, 20 Jan 2017 15:40:18 -0500
Received: from mpv1-2015.cwru.edu ([129.22.103.226]:29845
	helo=mpv1-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet@caleb.ins.cwru.edu>)
	id 1cUfym-0001Qr-Ty
	for bug-bash@gnu.org; Fri, 20 Jan 2017 15:40:13 -0500
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv1-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AKM42796; Fri, 20 Jan 2017 15:19:11 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AYH33739; Fri, 20 Jan 2017 15:19:11 -0500 (EST)
Received: by caleb.ins.cwru.edu (Postfix, from userid 286)
	id 3EA944E0E6E; Fri, 20 Jan 2017 15:19:09 -0500 (EST)
Date: Fri, 20 Jan 2017 15:18:50 -0500
From: Chet Ramey <chet.ramey@case.edu>
Sender: chet <chet@caleb.ins.cwru.edu>
To: bug-bash@gnu.org
Subject: Bash-4.4 Official Patch 9
Cc: chet.ramey@case.edu
Reply-To: chet.ramey@case.edu
Message-ID: <170120201850.AA66700.SM@caleb.ins.cwru.edu>
Read-Receipt-To: chet.ramey@case.edu
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.226
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 20 Jan 2017 20:40:20 -0000

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

Bash-Release:	4.4
Patch-ID:	bash44-009

Bug-Reported-by:	Hong Cho <hong.cho@citrix.com>
Bug-Reference-ID:	<c30b5fe62b2543af8297e47ca487c29c@SJCPEX02CL02.citrite.net>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2016-12/msg00043.html

Bug-Description:

There is a race condition in add_history() that can be triggered by a fatal
signal arriving between the time the history length is updated and the time
the history list update is completed. A later attempt to reference an
invalid history entry can cause a crash.

Patch (apply with `patch -p0'):

*** ../bash-4.4-patched/lib/readline/history.c	2016-11-11 13:42:49.000000000 -0500
--- lib/readline/history.c	2016-12-05 10:37:51.000000000 -0500
***************
*** 280,283 ****
--- 280,284 ----
  {
    HIST_ENTRY *temp;
+   int new_length;
  
    if (history_stifled && (history_length == history_max_entries))
***************
*** 296,306 ****
        /* Copy the rest of the entries, moving down one slot.  Copy includes
  	 trailing NULL.  */
- #if 0
-       for (i = 0; i < history_length; i++)
- 	the_history[i] = the_history[i + 1];
- #else
        memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
- #endif
  
        history_base++;
      }
--- 297,303 ----
        /* Copy the rest of the entries, moving down one slot.  Copy includes
  	 trailing NULL.  */
        memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
  
+       new_length = history_length;
        history_base++;
      }
***************
*** 316,320 ****
  	    history_size = DEFAULT_HISTORY_INITIAL_SIZE;
  	  the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
! 	  history_length = 1;
  	}
        else
--- 313,317 ----
  	    history_size = DEFAULT_HISTORY_INITIAL_SIZE;
  	  the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
! 	  new_length = 1;
  	}
        else
***************
*** 326,330 ****
  		xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
  	    }
! 	  history_length++;
  	}
      }
--- 323,327 ----
  		xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
  	    }
! 	  new_length = history_length + 1;
  	}
      }
***************
*** 332,337 ****
    temp = alloc_history_entry ((char *)string, hist_inittime ());
  
!   the_history[history_length] = (HIST_ENTRY *)NULL;
!   the_history[history_length - 1] = temp;
  }
  
--- 329,335 ----
    temp = alloc_history_entry ((char *)string, hist_inittime ());
  
!   the_history[new_length] = (HIST_ENTRY *)NULL;
!   the_history[new_length - 1] = temp;
!   history_length = new_length;
  }
  
*** ../bash-4.4/patchlevel.h	2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h	2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 8
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 9
  
  #endif /* _PATCHLEVEL_H_ */

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


From MAILER-DAEMON Fri Jan 20 15:40:55 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cUfzT-0004hn-Qs
	for mharc-bug-bash@gnu.org; Fri, 20 Jan 2017 15:40:55 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41056)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet@caleb.ins.cwru.edu>) id 1cUfzN-0004eu-1M
	for bug-bash@gnu.org; Fri, 20 Jan 2017 15:40:54 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet@caleb.ins.cwru.edu>) id 1cUfzH-0001hj-Sc
	for bug-bash@gnu.org; Fri, 20 Jan 2017 15:40:49 -0500
Received: from mpv1-2015.cwru.edu ([129.22.103.226]:29931
	helo=mpv1-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet@caleb.ins.cwru.edu>)
	id 1cUfzH-0001hH-Mn
	for bug-bash@gnu.org; Fri, 20 Jan 2017 15:40:43 -0500
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv1-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AKM42811; Fri, 20 Jan 2017 15:19:42 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AYH33768; Fri, 20 Jan 2017 15:19:38 -0500 (EST)
Received: by caleb.ins.cwru.edu (Postfix, from userid 286)
	id 4E4994E0E79; Fri, 20 Jan 2017 15:19:38 -0500 (EST)
Date: Fri, 20 Jan 2017 15:19:10 -0500
From: Chet Ramey <chet.ramey@case.edu>
Sender: chet <chet@caleb.ins.cwru.edu>
To: bug-bash@gnu.org
Subject: Bash-4.4 Official Patch 10
Cc: chet.ramey@case.edu
Reply-To: chet.ramey@case.edu
Message-ID: <170120201910.AA66700.SM@caleb.ins.cwru.edu>
Read-Receipt-To: chet.ramey@case.edu
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.226
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 20 Jan 2017 20:40:54 -0000

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

Bash-Release:	4.4
Patch-ID:	bash44-010

Bug-Reported-by:	Clark Wang <dearvoid@gmail.com>
Bug-Reference-ID:	<CADv8-og092RvvUUHy46=BPKChCXw5g=GOOqgN0V3f4a3TpLebQ@mail.gmail.com>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2016-11/msg00104.html

Bug-Description:

Depending on compiler optimizations and behavior, the `read' builtin may not
save partial input when a timeout occurs.

Patch (apply with `patch -p0'):

*** ../bash-4.4-patched/builtins/read.def	2016-05-16 14:24:56.000000000 -0400
--- builtins/read.def	2016-11-25 12:37:56.000000000 -0500
***************
*** 182,186 ****
  {
    register char *varname;
!   int size, i, nr, pass_next, saw_escape, eof, opt, retval, code, print_ps2;
    int input_is_tty, input_is_pipe, unbuffered_read, skip_ctlesc, skip_ctlnul;
    int raw, edit, nchars, silent, have_timeout, ignore_delim, fd, lastsig, t_errno;
--- 182,187 ----
  {
    register char *varname;
!   int size, nr, pass_next, saw_escape, eof, opt, retval, code, print_ps2;
!   volatile int i;
    int input_is_tty, input_is_pipe, unbuffered_read, skip_ctlesc, skip_ctlnul;
    int raw, edit, nchars, silent, have_timeout, ignore_delim, fd, lastsig, t_errno;

*** ../bash-4.4/patchlevel.h	2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h	2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 9
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 10
  
  #endif /* _PATCHLEVEL_H_ */

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


From MAILER-DAEMON Fri Jan 20 15:41:19 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cUfzr-0004xw-Iu
	for mharc-bug-bash@gnu.org; Fri, 20 Jan 2017 15:41:19 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41222)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet@caleb.ins.cwru.edu>) id 1cUfzl-0004tk-TC
	for bug-bash@gnu.org; Fri, 20 Jan 2017 15:41:18 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet@caleb.ins.cwru.edu>) id 1cUfzg-00020g-UF
	for bug-bash@gnu.org; Fri, 20 Jan 2017 15:41:13 -0500
Received: from mpv2-2015.cwru.edu ([129.22.103.227]:2105
	helo=mpv1-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet@caleb.ins.cwru.edu>)
	id 1cUfzg-00020H-PN
	for bug-bash@gnu.org; Fri, 20 Jan 2017 15:41:08 -0500
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv2-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AKR56237; Fri, 20 Jan 2017 15:20:07 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AYH33871; Fri, 20 Jan 2017 15:20:06 -0500 (EST)
Received: by caleb.ins.cwru.edu (Postfix, from userid 286)
	id B8AB54E0E8A; Fri, 20 Jan 2017 15:20:06 -0500 (EST)
Date: Fri, 20 Jan 2017 15:19:39 -0500
From: Chet Ramey <chet.ramey@case.edu>
Sender: chet <chet@caleb.ins.cwru.edu>
To: bug-bash@gnu.org
Subject: Bash-4.4 Official Patch 11
Cc: chet.ramey@case.edu
Reply-To: chet.ramey@case.edu
Message-ID: <170120201939.AA66700.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-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.227
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 20 Jan 2017 20:41:18 -0000

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

Bash-Release:	4.4
Patch-ID:	bash44-011

Bug-Reported-by:	Russell King <rmk@armlinux.org.uk>
Bug-Reference-ID:	<E1cNnFx-0007G2-S2@flint.armlinux.org.uk>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2017-01/msg00000.html

Bug-Description:

Subshells begun to run command and process substitutions may attempt to
set the terminal's process group to an incorrect value if they receive
a fatal signal.  This depends on the behavior of the process that starts
the shell.

Patch (apply with `patch -p0'):

*** ../bash-4.4-patched/sig.c	2016-02-11 15:02:45.000000000 -0500
--- sig.c	2017-01-04 09:09:47.000000000 -0500
***************
*** 586,590 ****
    if (sig == SIGHUP && (interactive || (subshell_environment & (SUBSHELL_COMSUB|SUBSHELL_PROCSUB))))
      hangup_all_jobs ();
!   end_job_control ();
  #endif /* JOB_CONTROL */
  
--- 571,576 ----
    if (sig == SIGHUP && (interactive || (subshell_environment & (SUBSHELL_COMSUB|SUBSHELL_PROCSUB))))
      hangup_all_jobs ();
!   if ((subshell_environment & (SUBSHELL_COMSUB|SUBSHELL_PROCSUB)) == 0)
!     end_job_control ();
  #endif /* JOB_CONTROL */
  
*** ../bash-4.4/patchlevel.h	2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h	2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 10
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 11
  
  #endif /* _PATCHLEVEL_H_ */

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


From MAILER-DAEMON Sun Jan 22 14:32:10 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cVNs2-0006ba-5M
	for mharc-bug-bash@gnu.org; Sun, 22 Jan 2017 14:32:10 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:45475)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <svashish@redhat.com>) id 1cVNrz-0006bH-El
	for bug-bash@gnu.org; Sun, 22 Jan 2017 14:32:08 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <svashish@redhat.com>) id 1cVNrw-0005R7-9q
	for bug-bash@gnu.org; Sun, 22 Jan 2017 14:32:07 -0500
Received: from mx3-phx2.redhat.com ([209.132.183.24]:58584)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <svashish@redhat.com>) id 1cVNrw-0005Qw-1I
	for bug-bash@gnu.org; Sun, 22 Jan 2017 14:32:04 -0500
Received: from zmail23.collab.prod.int.phx2.redhat.com
	(zmail23.collab.prod.int.phx2.redhat.com [10.5.83.28])
	by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v0MJW3fX032491
	for <bug-bash@gnu.org>; Sun, 22 Jan 2017 14:32:03 -0500
Date: Sun, 22 Jan 2017 14:32:02 -0500 (EST)
From: Siteshwar Vashisht <svashisht@redhat.com>
To: bug-bash@gnu.org
Message-ID: <1975786498.11587344.1485113522826.JavaMail.zimbra@redhat.com>
In-Reply-To: <239614721.11587267.1485113116863.JavaMail.zimbra@redhat.com>
Subject: read() may fail due to nonblocking stdin
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_11587342_1736865232.1485113522823"
X-Originating-IP: [10.67.5.109]
X-Mailer: Zimbra 8.0.6_GA_5922 (ZimbraWebClient - FF50 (Linux)/8.0.6_GA_5922)
Thread-Topic: read() may fail due to nonblocking stdin
Thread-Index: yHy202kEyhmFiH25F/BW4bgbHShzhg==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy]
X-Received-From: 209.132.183.24
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 22 Jan 2017 19:32:08 -0000

------=_Part_11587342_1736865232.1485113522823
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

If a child process sets stdin to non-blocking and does not set it back to blocking before exiting, other processes may fail to read from stdin.

Reproducer steps :

$ cat set_nonblock.c 
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>

int main() {
        char buff[256];
        int flags = fcntl (0, F_GETFL);
        if (fcntl(0, F_SETFL, flags | O_NONBLOCK)) {
                perror("fcntl failed");
        }
        if (read(0, buff, 256) == -1) {
                perror("read failed");
        }
}

$ cc -o set_nonblock set_nonblock.c
$ cat test.sh 
#!/bin/bash

./set_nonblock

cat

$ ./test.sh 
read failed: Resource temporarily unavailable
cat: -: Resource temporarily unavailable

Attached patch sets standard file descriptors to blocking before child process starts.

-- 
--
Siteshwar Vashisht

------=_Part_11587342_1736865232.1485113522823
Content-Type: text/x-patch;
 name=0001-Make-stdin-blocking-when-command-starts.patch
Content-Disposition: attachment;
 filename=0001-Make-stdin-blocking-when-command-starts.patch
Content-Transfer-Encoding: base64

RnJvbSBmNGZkM2MxN2NiMTVmODdmYzg3MzNiNDRiZDQ3N2UzMmZmMmQwMDJhIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBTaXRlc2h3YXIgVmFzaGlzaHQgPHN2YXNoaXNodEByZWRoYXQu
Y29tPgpEYXRlOiBTdW4sIDIyIEphbiAyMDE3IDA4OjI1OjIzICswMTAwClN1YmplY3Q6IFtQQVRD
SF0gTWFrZSBzdGRpbiBibG9ja2luZyB3aGVuIGNvbW1hbmQgc3RhcnRzCgotLS0KIGV4ZWN1dGVf
Y21kLmMgfCAxOCArKysrKysrKysrKysrKysrKysKIDEgZmlsZSBjaGFuZ2VkLCAxOCBpbnNlcnRp
b25zKCspCgpkaWZmIC0tZ2l0IGEvZXhlY3V0ZV9jbWQuYyBiL2V4ZWN1dGVfY21kLmMKaW5kZXgg
MDAzODlkZi4uZDYzZjZlNSAxMDA2NDQKLS0tIGEvZXhlY3V0ZV9jbWQuYworKysgYi9leGVjdXRl
X2NtZC5jCkBAIC01MzEsNiArNTMxLDIyIEBAIGFzeW5jX3JlZGlyZWN0X3N0ZGluICgpCiAgICAg
aW50ZXJuYWxfZXJyb3IgKF8oImNhbm5vdCByZWRpcmVjdCBzdGFuZGFyZCBpbnB1dCBmcm9tIC9k
ZXYvbnVsbDogJXMiKSwgc3RyZXJyb3IgKGVycm5vKSk7CiB9CiAKKy8qIE1ha2Ugc3RkaW4sc3Rk
b3V0IGFuZCBzdGRlcnIgYmxvY2tpbmcgKi8KK3N0YXRpYyB2b2lkCitzZXRfc3RhbmRhcmRfZmRz
X2Jsb2NraW5nKCkgeworICBpbnQgZmxhZ3MgPSBmY250bCAoMCwgRl9HRVRGTCk7CisgIGlmIChm
Y250bCgwLCBGX1NFVEZMLCBmbGFncyAmIH5PX05PTkJMT0NLKSkKKyAgICBzeXNfZXJyb3IgKF8o
IkZhaWxlZCB0byBtYWtlIHN0ZGluIGJsb2NraW5nIikpOworCisgIGZsYWdzID0gZmNudGwgKDEs
IEZfR0VURkwpOworICBpZiAoZmNudGwoMSwgRl9TRVRGTCwgZmxhZ3MgJiB+T19OT05CTE9DSykp
CisgICAgc3lzX2Vycm9yIChfKCJGYWlsZWQgdG8gbWFrZSBzdGRvdXQgYmxvY2tpbmciKSk7CisK
KyAgZmxhZ3MgPSBmY250bCAoMiwgRl9HRVRGTCk7CisgIGlmIChmY250bCgyLCBGX1NFVEZMLCBm
bGFncyAmIH5PX05PTkJMT0NLKSkKKyAgICBzeXNfZXJyb3IgKF8oIkZhaWxlZCB0byBtYWtlIHN0
ZGVyciBibG9ja2luZyIpKTsKK30KKwogI2RlZmluZSBERVNDUklCRV9QSUQocGlkKSBkbyB7IGlm
IChpbnRlcmFjdGl2ZSkgZGVzY3JpYmVfcGlkIChwaWQpOyB9IHdoaWxlICgwKQogCiBleHRlcm4g
aW50IHJwbV9yZXF1aXJlczsKQEAgLTU5NCw2ICs2MTAsOCBAQCBleGVjdXRlX2NvbW1hbmRfaW50
ZXJuYWwgKGNvbW1hbmQsIGFzeW5jaHJvbm91cywgcGlwZV9pbiwgcGlwZV9vdXQsCiAKICAgZXhl
Y19yZXN1bHQgPSBFWEVDVVRJT05fU1VDQ0VTUzsKIAorICBzZXRfc3RhbmRhcmRfZmRzX2Jsb2Nr
aW5nKCk7CisKICAgLyogSWYgYSBjb21tYW5kIHdhcyBiZWluZyBleHBsaWNpdGx5IHJ1biBpbiBh
IHN1YnNoZWxsLCBvciBpZiBpdCBpcwogICAgICBhIHNoZWxsIGNvbnRyb2wtc3RydWN0dXJlLCBh
bmQgaXQgaGFzIGEgcGlwZSwgdGhlbiB3ZSBkbyB0aGUgY29tbWFuZAogICAgICBpbiBhIHN1YnNo
ZWxsLiAqLwotLSAKMi45LjMKCg==
------=_Part_11587342_1736865232.1485113522823--


From MAILER-DAEMON Mon Jan 23 09:52:52 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cVfzI-00005d-4Z
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2017 09:52:52 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:37818)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <admn.ombres@gmail.com>) id 1cVfEi-0006OR-B1
	for bug-bash@gnu.org; Mon, 23 Jan 2017 09:04:45 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <admn.ombres@gmail.com>) id 1cVfEh-0000JG-KB
	for bug-bash@gnu.org; Mon, 23 Jan 2017 09:04:44 -0500
Received: from mail-yb0-x236.google.com ([2607:f8b0:4002:c09::236]:35550)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <admn.ombres@gmail.com>)
	id 1cVfEh-0000IU-Gt
	for bug-bash@gnu.org; Mon, 23 Jan 2017 09:04:43 -0500
Received: by mail-yb0-x236.google.com with SMTP id l23so87399699ybj.2
	for <bug-bash@gnu.org>; Mon, 23 Jan 2017 06:04:41 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:from:date:message-id:subject:to;
	bh=TxGMNvnwkCC2DL/OFN6nRlHagYqrfDP1G+vJYSpqnxY=;
	b=RY1ONrtKeZaStnJ3dqhRBkb4bvJxoRU54yvR9lWN1KRLssdjFGmwuPTmobtBBWzEN6
	+bIMjnQqJulf3YrfwuO+GEOpFXxxn80stf3ZYEay9TfUa78lvIIsrlrpkY3MHdJOQFO4
	KiOuvQVUSyiBnBdNkEBQq7vppTGZkVuN5GXwLYjNSh+CJBCMleu90/utme4sCy7A5rdi
	bGCFJLnFIQcrBj8D9LS+Y+RgSjstv5YhEoyJZ9h9I3zgrZVoqairHVzibVYMmXlwula9
	CWtaId9hdHSsJGp2xo9kwYlEh+mIw4/xEQLcoqbTG2EsVEJIA3Z5a81wAhuNrVgsg4rt
	mF5g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
	bh=TxGMNvnwkCC2DL/OFN6nRlHagYqrfDP1G+vJYSpqnxY=;
	b=mR0jgBQy1UtM5vQTXC4IQUG3rLWkQBuXANw0uf8LOdNF6OeoErrzrJpOSJJfYkMDpe
	VH1kvwwK6ZtJg0dd6FqK1klq97dLV7lIRRAksllR5LT+9FsEssAKctUNfDjhGLVTHVrC
	lQL+kQ81HqNmbAZx/dDXGiTPZKmEjL86GjJopyP9xC5L+C8k9NjiwTVElQO3E6Y3Wg2L
	fAgdEX1TT/tCW+RQp3JJvgmv+0KX5uBYo++oGR+ewWgYQVXVD2YX6tZNezFiKQjODSDt
	vKVkDg7pYw1rpQK6Ee+EZFvD4bKcPRyW5QVMFgiTZuHfUlSZAV2MuXE5S7a6o2ViEfVb
	pDtg==
X-Gm-Message-State: AIkVDXJmlEeQoPwqt6QgQyJxkljTg334S/T0lFtBWGmODS6vOZOerjNo8zJ/spdnCeM8MHisOZMkf4ZxfTTNfw==
X-Received: by 10.37.180.130 with SMTP id o2mr6766615ybj.27.1485180281022;
	Mon, 23 Jan 2017 06:04:41 -0800 (PST)
MIME-Version: 1.0
Received: by 10.13.226.80 with HTTP; Mon, 23 Jan 2017 06:04:40 -0800 (PST)
From: admn ombres <admn.ombres@gmail.com>
Date: Mon, 23 Jan 2017 15:04:40 +0100
Message-ID: <CAEW=a7-Scx-KhoK0Ka2Zof3qQdxFDszi9gKFq6wX86MYvw_R6Q@mail.gmail.com>
Subject: nullglob make unset on array member fail ?
To: bug-bash@gnu.org
Content-Type: text/plain; charset=UTF-8
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:4002:c09::236
X-Mailman-Approved-At: Mon, 23 Jan 2017 09:52:50 -0500
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 23 Jan 2017 14:04:45 -0000

$ x=(x); echo ${#x[@]}; shopt -s nullglob; unset x[0]; echo ${#x[@]}
1
1
$ x=(x); echo ${#x[@]}; shopt -u nullglob; unset x[0]; echo ${#x[@]}
1
0


From MAILER-DAEMON Mon Jan 23 10:01:21 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cVg7U-00047R-Vx
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2017 10:01:21 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:51186)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cVg7T-00045w-28
	for bug-bash@gnu.org; Mon, 23 Jan 2017 10:01:19 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cVg7P-0006dR-3I
	for bug-bash@gnu.org; Mon, 23 Jan 2017 10:01:19 -0500
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:37732 helo=svr4.eeg.ccf.org)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cVg7O-0006Pk-TW
	for bug-bash@gnu.org; Mon, 23 Jan 2017 10:01:15 -0500
Received: (qmail 57866 invoked from network); 23 Jan 2017 15:00:45 -0000
Received: from imadev.eeg.ccf.org (qmailr@10.76.173.78)
	by gateway.eeg.ccf.org with SMTP; Mon, 23 Jan 2017 10:00:45 -0500
Received: (qmail 5234 invoked by uid 563); 23 Jan 2017 15:00:45 -0000
Date: Mon, 23 Jan 2017 10:00:45 -0500
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: admn ombres <admn.ombres@gmail.com>
Cc: bug-bash@gnu.org
Subject: Re: nullglob make unset on array member fail ?
Message-ID: <20170123150045.GU27281@eeg.ccf.org>
References: <CAEW=a7-Scx-KhoK0Ka2Zof3qQdxFDszi9gKFq6wX86MYvw_R6Q@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAEW=a7-Scx-KhoK0Ka2Zof3qQdxFDszi9gKFq6wX86MYvw_R6Q@mail.gmail.com>
User-Agent: Mutt/1.4.2.3i
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 139.137.100.1
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 23 Jan 2017 15:01:19 -0000

On Mon, Jan 23, 2017 at 03:04:40PM +0100, admn ombres wrote:
> $ x=(x); echo ${#x[@]}; shopt -s nullglob; unset x[0]; echo ${#x[@]}

You need to quote 'x[0]' to avoid having it globbed against files in
the current working directory, regardless of whether you're using
nullglob.

The presence of a file named x0 in $PWD would change the meaning of your
unset command from unset 'x[0]' to unset 'x0'.


From MAILER-DAEMON Mon Jan 23 10:05:39 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cVgBf-0006cB-Pa
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2017 10:05:39 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:52041)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cVgBd-0006bB-Nf
	for bug-bash@gnu.org; Mon, 23 Jan 2017 10:05:38 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cVgBZ-0007rh-OC
	for bug-bash@gnu.org; Mon, 23 Jan 2017 10:05:37 -0500
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:53680
	helo=mpv3-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1cVgBZ-0007rP-Cf
	for bug-bash@gnu.org; Mon, 23 Jan 2017 10:05:33 -0500
Received: from mpv6-2015.CWRU.Edu (EHLO mpv6-2015.case.edu) ([129.22.103.202])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AJN24275; Mon, 23 Jan 2017 10:05:31 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AYB19720 (AUTH cpr);
	Mon, 23 Jan 2017 10:05:31 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: nullglob make unset on array member fail ?
References: <CAEW=a7-Scx-KhoK0Ka2Zof3qQdxFDszi9gKFq6wX86MYvw_R6Q@mail.gmail.com>
To: admn ombres <admn.ombres@gmail.com>, bug-bash@gnu.org
Cc: chet.ramey@case.edu
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <d890219a-c896-edd0-b321-cb023ffcd5f8@case.edu>
Date: Mon, 23 Jan 2017 10:05:30 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0)
	Gecko/20100101 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <CAEW=a7-Scx-KhoK0Ka2Zof3qQdxFDszi9gKFq6wX86MYvw_R6Q@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv3-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 23 Jan 2017 15:05:38 -0000

On 1/23/17 9:04 AM, admn ombres wrote:
> $ x=(x); echo ${#x[@]}; shopt -s nullglob; unset x[0]; echo ${#x[@]}
> 1
> 1
> $ x=(x); echo ${#x[@]}; shopt -u nullglob; unset x[0]; echo ${#x[@]}
> 1
> 0

`unset' is a builtin; its arguments are subject to all the shell word
expansions, including globbing.  If you don't want to take a chance on
the effects of globbing modifying the word, quote it.

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


From MAILER-DAEMON Mon Jan 23 10:42:51 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cVglf-0003th-JH
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2017 10:42:51 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:59980)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cVglc-0003qV-R6
	for bug-bash@gnu.org; Mon, 23 Jan 2017 10:42:49 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cVglZ-0001aj-O2
	for bug-bash@gnu.org; Mon, 23 Jan 2017 10:42:48 -0500
Received: from mpv4-2015.cwru.edu ([129.22.103.195]:57121
	helo=mpv4-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1cVglZ-0001Zm-JC
	for bug-bash@gnu.org; Mon, 23 Jan 2017 10:42:45 -0500
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv4-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AJI24042; Mon, 23 Jan 2017 10:42:41 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AYJ66190 (AUTH cpr);
	Mon, 23 Jan 2017 10:42:39 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: read() may fail due to nonblocking stdin
References: <1975786498.11587344.1485113522826.JavaMail.zimbra@redhat.com>
To: Siteshwar Vashisht <svashisht@redhat.com>, bug-bash@gnu.org
Cc: chet.ramey@case.edu
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <d056c0b7-a8d4-67b7-2c97-9e9a2ba6e0f0@case.edu>
Date: Mon, 23 Jan 2017 10:42:38 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0)
	Gecko/20100101 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <1975786498.11587344.1485113522826.JavaMail.zimbra@redhat.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv4-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.195
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 23 Jan 2017 15:42:50 -0000

On 1/22/17 2:32 PM, Siteshwar Vashisht wrote:
> If a child process sets stdin to non-blocking and does not set it back to blocking before exiting, other processes may fail to read from stdin.

It's not the shell's business to be resetting this for processes it spawns.
What bash should do is to turn of O_NONBLOCK when it reads input, which it
already does at startup but not every time it calls readline().

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


From MAILER-DAEMON Mon Jan 23 10:45:35 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cVgoJ-0005HB-MG
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2017 10:45:35 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:60420)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cVgoH-0005H1-Tk
	for bug-bash@gnu.org; Mon, 23 Jan 2017 10:45:35 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cVgoE-00025v-I7
	for bug-bash@gnu.org; Mon, 23 Jan 2017 10:45:33 -0500
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:64966
	helo=mpv3-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1cVgoE-00025p-Dk
	for bug-bash@gnu.org; Mon, 23 Jan 2017 10:45:30 -0500
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AJN27987; Mon, 23 Jan 2017 10:45:26 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AYJ66676 (AUTH cpr);
	Mon, 23 Jan 2017 10:45:26 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: read() may fail due to nonblocking stdin
References: <1975786498.11587344.1485113522826.JavaMail.zimbra@redhat.com>
	<d056c0b7-a8d4-67b7-2c97-9e9a2ba6e0f0@case.edu>
To: Siteshwar Vashisht <svashisht@redhat.com>, bug-bash@gnu.org
Cc: chet.ramey@case.edu
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <36eb19e8-1461-edc1-f1b3-1078f91969d7@case.edu>
Date: Mon, 23 Jan 2017 10:45:26 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0)
	Gecko/20100101 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <d056c0b7-a8d4-67b7-2c97-9e9a2ba6e0f0@case.edu>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv3-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 23 Jan 2017 15:45:35 -0000

On 1/23/17 10:42 AM, Chet Ramey wrote:
> On 1/22/17 2:32 PM, Siteshwar Vashisht wrote:
>> If a child process sets stdin to non-blocking and does not set it back to blocking before exiting, other processes may fail to read from stdin.
> 
> It's not the shell's business to be resetting this for processes it spawns.
> What bash should do is to turn of O_NONBLOCK when it reads input, which it
> already does at startup but not every time it calls readline().

And maybe I should make the follow-up point explicit: that will fix this
problem, too.

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


From MAILER-DAEMON Mon Jan 23 14:02:03 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cVjsR-0003qn-Fe
	for mharc-bug-bash@gnu.org; Mon, 23 Jan 2017 14:02:03 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:54103)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cVjsL-0003lm-T6
	for bug-bash@gnu.org; Mon, 23 Jan 2017 14:02:02 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cVjsD-0001vy-FF
	for bug-bash@gnu.org; Mon, 23 Jan 2017 14:01:57 -0500
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:39904
	helo=mpv3-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1cVjsD-0001vm-9b
	for bug-bash@gnu.org; Mon, 23 Jan 2017 14:01:49 -0500
Received: from mpv6-2015.CWRU.Edu (EHLO mpv6-2015.case.edu) ([129.22.103.202])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AJN39526; Mon, 23 Jan 2017 14:01:41 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AYB88895 (AUTH cpr);
	Mon, 23 Jan 2017 14:01:38 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: read() may fail due to nonblocking stdin
References: <1975786498.11587344.1485113522826.JavaMail.zimbra@redhat.com>
	<d056c0b7-a8d4-67b7-2c97-9e9a2ba6e0f0@case.edu>
	<36eb19e8-1461-edc1-f1b3-1078f91969d7@case.edu>
To: Siteshwar Vashisht <svashisht@redhat.com>, bug-bash@gnu.org
Cc: chet.ramey@case.edu
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <e6033014-e3e0-c062-fa2c-e0db49f15848@case.edu>
Date: Mon, 23 Jan 2017 14:01:38 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0)
	Gecko/20100101 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <36eb19e8-1461-edc1-f1b3-1078f91969d7@case.edu>
Content-Type: multipart/mixed; boundary="------------EC6BA7D05E3BF2EB88A26AAE"
X-Junkmail-Whitelist: YES (by domain whitelist at mpv3-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 23 Jan 2017 19:02:02 -0000

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

On 1/23/17 10:45 AM, Chet Ramey wrote:
> On 1/23/17 10:42 AM, Chet Ramey wrote:
>> On 1/22/17 2:32 PM, Siteshwar Vashisht wrote:
>>> If a child process sets stdin to non-blocking and does not set it back to blocking before exiting, other processes may fail to read from stdin.
>>
>> It's not the shell's business to be resetting this for processes it spawns.
>> What bash should do is to turn of O_NONBLOCK when it reads input, which it
>> already does at startup but not every time it calls readline().
> 
> And maybe I should make the follow-up point explicit: that will fix this
> problem, too.

Something like this, for instance.

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

--------------EC6BA7D05E3BF2EB88A26AAE
Content-Type: application/x-patch;
 name="readline-unset-ndelay.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="readline-unset-ndelay.patch"

KioqIC4uL2Jhc2gtNC40LXBhdGNoZWQvcGFyc2UueQkyMDE2LTA5LTExIDExOjMxOjQ2LjAw
MDAwMDAwMCAtMDQwMAotLS0gcGFyc2UueQkyMDE3LTAxLTIzIDEzOjU0OjUzLjAwMDAwMDAw
MCAtMDUwMAoqKioqKioqKioqKioqKioKKioqIDE0NTQsMTQ1NyAqKioqCi0tLSAxNDU0LDE0
NTggLS0tLQogIAl9CiAgCisgICAgICAgc2hfdW5zZXRfbm9kZWxheV9tb2RlIChmaWxlbm8g
KHJsX2luc3RyZWFtKSk7CS8qIGp1c3QgaW4gY2FzZSAqLwogICAgICAgIGN1cnJlbnRfcmVh
ZGxpbmVfbGluZSA9IHJlYWRsaW5lIChjdXJyZW50X3JlYWRsaW5lX3Byb21wdCA/CiAgICAg
ICAgCQkJCQkgIGN1cnJlbnRfcmVhZGxpbmVfcHJvbXB0IDogIiIpOwo=
--------------EC6BA7D05E3BF2EB88A26AAE--



From MAILER-DAEMON Tue Jan 24 02:08:26 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cVvDN-000384-Tq
	for mharc-bug-bash@gnu.org; Tue, 24 Jan 2017 02:08:25 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:33847)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <brian.carpenter@gmail.com>) id 1cVvDL-000368-Ic
	for bug-bash@gnu.org; Tue, 24 Jan 2017 02:08:24 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <brian.carpenter@gmail.com>) id 1cVvDK-0003qR-KD
	for bug-bash@gnu.org; Tue, 24 Jan 2017 02:08:23 -0500
Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:35858)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <brian.carpenter@gmail.com>)
	id 1cVvDK-0003mN-DO
	for bug-bash@gnu.org; Tue, 24 Jan 2017 02:08:22 -0500
Received: by mail-wm0-x231.google.com with SMTP id c85so166532646wmi.1
	for <bug-bash@gnu.org>; Mon, 23 Jan 2017 23:08:20 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:from:date:message-id:subject:to;
	bh=39OZs7UiMxFKVJEebHnrlp7LGmO40HU7wAdUFaUfXwg=;
	b=F4XHAYJOEx9Bf/JAGCvn2nH/69mDgFaJGQSh62MNb3fJuhuvC3yMbPHkt/Q7yD2a+y
	jAsG8hDUL6iu3G5YJP+gjYnJrBOvAanwUF8Mu+63k0M9SkpAXv9rcsFAD0RwSSXboXEp
	304wYaDqxIBZqEN5ROlsr3difQ/FHYz+9P+B3VDcMOjw/MGvqgZ9cY778vMkMf3Wkefa
	yshCePMPLB93syrKQUpZ9q8IL+DCMWVmd63xZ1frtvgQRLu9aG12DyuMZ/PSBAh3YpWb
	di1EszfiQQEEQSPbcjgT1gZlsGFEFZjL0jctmO6D18W60ihqx5nnGomM/FQ/+b+ZqL6b
	QHag==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
	bh=39OZs7UiMxFKVJEebHnrlp7LGmO40HU7wAdUFaUfXwg=;
	b=RP72rCT8MS5ioPmonwTf9hkFEPsu9nDMblxmR6ZLOI3JT+P5z+Ahsmn8mVzqAf1pgm
	2q7RK16zF/HwBVBgdXfdeeFMi7trAjcv2gXVOavBJWT1G8k2r++tkLbujvQaBbBI3ea/
	POMiIdcT8DE0EhM1YPkv7QdLgJBfQ6rlaKSO6IQV5EbZBbdYAzoUcnXCkmTz+LU9VR2b
	Vwt2uRJxhmsjgbvhrBSLRzUqH8F/oXOEMYSLK7TzbrVD5UsYYYlCzjjyyN/II+8wJfrA
	nu+42pg6CkKAZs4GmJL7BJ11J6rjY3RyXKjZYxH23bVlNCtPBSkIPMiVlFfbyySTVrzp
	e/pg==
X-Gm-Message-State: AIkVDXIxb4SXXQfbeHaRpUWb20Xzvl5mO1IWXf61pmBGnzOTtKweIm0LYWaAm05P38qMX3lydP8nW4SS7GGleA==
X-Received: by 10.28.26.203 with SMTP id a194mr18594947wma.84.1485241699563;
	Mon, 23 Jan 2017 23:08:19 -0800 (PST)
MIME-Version: 1.0
Received: by 10.80.187.8 with HTTP; Mon, 23 Jan 2017 23:07:39 -0800 (PST)
From: "Brian 'geeknik' Carpenter" <brian.carpenter@gmail.com>
Date: Tue, 24 Jan 2017 01:07:39 -0600
Message-ID: <CANMVOuwkOsFaJ8k_XJTU7+oCZ-wWWfzGwHgVFnx+WgqVtaTZUQ@mail.gmail.com>
Subject: null pointer deref, segfault
To: bug-bash@gnu.org, bash@packages.debian.org
Content-Type: multipart/alternative; boundary=001a114cc5f0e8bd8a0546d1c75e
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2a00:1450:400c:c09::231
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 24 Jan 2017 07:08:24 -0000

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

Going through some ancient bug reports and I came across
https://savannah.gnu.org/support/index.php?108884 which apparently nobody
uses anymore.

<<$(()())|>_[$($(<<0)) crashes bash on Debian, Red Hat, FreeBSD, etc.

Regards,

Brian 'geeknik' Carpenter
https://twitter.com/geeknik

--001a114cc5f0e8bd8a0546d1c75e
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><div><div><div>Going through some ancient bug reports=
 and I came across <a href=3D"https://savannah.gnu.org/support/index.php?10=
8884">https://savannah.gnu.org/support/index.php?108884</a> which apparentl=
y nobody uses anymore.<br><br></div><span id=3D"gmail-hidsubpartcontentdisc=
ussion">&lt;&lt;$(()())|&gt;_[$($(&lt;&lt;0)) crashes bash on Debian, Red H=
at, FreeBSD, etc.<br><br></span></div><span id=3D"gmail-hidsubpartcontentdi=
scussion">Regards,<br><br></span></div><span id=3D"gmail-hidsubpartcontentd=
iscussion">Brian &#39;geeknik&#39; Carpenter<br></span></div><span id=3D"gm=
ail-hidsubpartcontentdiscussion"><a href=3D"https://twitter.com/geeknik">ht=
tps://twitter.com/geeknik</a><br></span></div>

--001a114cc5f0e8bd8a0546d1c75e--


From MAILER-DAEMON Tue Jan 24 04:17:09 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cVxDx-0004nU-0i
	for mharc-bug-bash@gnu.org; Tue, 24 Jan 2017 04:17:09 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:34750)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <svashish@redhat.com>) id 1cVxDu-0004nH-8R
	for bug-bash@gnu.org; Tue, 24 Jan 2017 04:17:07 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <svashish@redhat.com>) id 1cVxDp-0002Y9-Va
	for bug-bash@gnu.org; Tue, 24 Jan 2017 04:17:06 -0500
Received: from mx5-phx2.redhat.com ([209.132.183.37]:39993)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <svashish@redhat.com>) id 1cVxDp-0002VV-NV
	for bug-bash@gnu.org; Tue, 24 Jan 2017 04:17:01 -0500
Received: from zmail23.collab.prod.int.phx2.redhat.com
	(zmail23.collab.prod.int.phx2.redhat.com [10.5.83.28])
	by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v0O9GwHK007339;
	Tue, 24 Jan 2017 04:16:58 -0500
Date: Tue, 24 Jan 2017 04:16:58 -0500 (EST)
From: Siteshwar Vashisht <svashisht@redhat.com>
To: chet ramey <chet.ramey@case.edu>
Cc: bug-bash@gnu.org
Message-ID: <1564993683.12381276.1485249418684.JavaMail.zimbra@redhat.com>
In-Reply-To: <e6033014-e3e0-c062-fa2c-e0db49f15848@case.edu>
References: <1975786498.11587344.1485113522826.JavaMail.zimbra@redhat.com>
	<d056c0b7-a8d4-67b7-2c97-9e9a2ba6e0f0@case.edu>
	<36eb19e8-1461-edc1-f1b3-1078f91969d7@case.edu>
	<e6033014-e3e0-c062-fa2c-e0db49f15848@case.edu>
Subject: Re: read() may fail due to nonblocking stdin
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Originating-IP: [10.34.4.138]
X-Mailer: Zimbra 8.0.6_GA_5922 (ZimbraWebClient - FF50 (Linux)/8.0.6_GA_5922)
Thread-Topic: read() may fail due to nonblocking stdin
Thread-Index: vZeGZZo6g2nysJOzdMpo/Bnhju2rag==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From: 209.132.183.37
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 24 Jan 2017 09:17:07 -0000



----- Original Message -----
> From: "Chet Ramey" <chet.ramey@case.edu>
> To: "Siteshwar Vashisht" <svashisht@redhat.com>, bug-bash@gnu.org
> Cc: "chet ramey" <chet.ramey@case.edu>
> Sent: Monday, January 23, 2017 8:01:38 PM
> Subject: Re: read() may fail due to nonblocking stdin
> 
> Something like this, for instance.

Thanks for the patch. Do you plan to include it upstream ?

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

-- 
--
Siteshwar Vashisht


From MAILER-DAEMON Tue Jan 24 09:39:30 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cW2Fu-00012d-9E
	for mharc-bug-bash@gnu.org; Tue, 24 Jan 2017 09:39:30 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:38925)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cW2Fr-00010f-O7
	for bug-bash@gnu.org; Tue, 24 Jan 2017 09:39:28 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cW2Fo-0006nf-LX
	for bug-bash@gnu.org; Tue, 24 Jan 2017 09:39:27 -0500
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:27383
	helo=mpv3-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1cW2Fo-0006nS-Gg
	for bug-bash@gnu.org; Tue, 24 Jan 2017 09:39:24 -0500
Received: from mpv6-2015.CWRU.Edu (EHLO mpv6-2015.case.edu) ([129.22.103.202])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AJN71198; Tue, 24 Jan 2017 09:39:20 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AYD03828 (AUTH cpr);
	Tue, 24 Jan 2017 09:39:20 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: null pointer deref, segfault
References: <CANMVOuwkOsFaJ8k_XJTU7+oCZ-wWWfzGwHgVFnx+WgqVtaTZUQ@mail.gmail.com>
To: "Brian 'geeknik' Carpenter" <brian.carpenter@gmail.com>, bug-bash@gnu.org, 
	bash@packages.debian.org
Cc: chet.ramey@case.edu
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <a49b8b6b-19d7-8405-2fe6-171ca4794dda@case.edu>
Date: Tue, 24 Jan 2017 09:39:20 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0)
	Gecko/20100101 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <CANMVOuwkOsFaJ8k_XJTU7+oCZ-wWWfzGwHgVFnx+WgqVtaTZUQ@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv3-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 24 Jan 2017 14:39:28 -0000

On 1/24/17 2:07 AM, Brian 'geeknik' Carpenter wrote:
> Going through some ancient bug reports and I came across
> https://savannah.gnu.org/support/index.php?108884 which apparently nobody
> uses anymore.
> 
> <<$(()())|>_[$($(<<0)) crashes bash on Debian, Red Hat, FreeBSD, etc.

It's marked as `Done'.

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


From MAILER-DAEMON Tue Jan 24 11:07:22 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cW3ct-0001Ut-9P
	for mharc-bug-bash@gnu.org; Tue, 24 Jan 2017 11:07:22 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:37203)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cW3cr-0001Tu-8t
	for bug-bash@gnu.org; Tue, 24 Jan 2017 11:07:18 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cW3co-0005ge-4k
	for bug-bash@gnu.org; Tue, 24 Jan 2017 11:07:17 -0500
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:48437
	helo=mpv3-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1cW3cn-0005fw-Vw
	for bug-bash@gnu.org; Tue, 24 Jan 2017 11:07:14 -0500
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AJN78335; Tue, 24 Jan 2017 11:07:09 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AYL56270 (AUTH cpr);
	Tue, 24 Jan 2017 11:07:09 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: read() may fail due to nonblocking stdin
References: <1975786498.11587344.1485113522826.JavaMail.zimbra@redhat.com>
	<d056c0b7-a8d4-67b7-2c97-9e9a2ba6e0f0@case.edu>
	<36eb19e8-1461-edc1-f1b3-1078f91969d7@case.edu>
	<e6033014-e3e0-c062-fa2c-e0db49f15848@case.edu>
	<1564993683.12381276.1485249418684.JavaMail.zimbra@redhat.com>
To: Siteshwar Vashisht <svashisht@redhat.com>
Cc: chet.ramey@case.edu, bug-bash@gnu.org
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <1f6ad12b-9f39-0fb4-5f87-6651c5cb48ef@case.edu>
Date: Tue, 24 Jan 2017 11:07:08 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0)
	Gecko/20100101 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <1564993683.12381276.1485249418684.JavaMail.zimbra@redhat.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv3-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 24 Jan 2017 16:07:18 -0000

On 1/24/17 4:16 AM, Siteshwar Vashisht wrote:
> 
> 
> ----- Original Message -----
>> From: "Chet Ramey" <chet.ramey@case.edu>
>> To: "Siteshwar Vashisht" <svashisht@redhat.com>, bug-bash@gnu.org
>> Cc: "chet ramey" <chet.ramey@case.edu>
>> Sent: Monday, January 23, 2017 8:01:38 PM
>> Subject: Re: read() may fail due to nonblocking stdin
>>
>> Something like this, for instance.
> 
> Thanks for the patch. Do you plan to include it upstream ?

Eventually.  It's not fixing something that's a common occurrence.

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


From MAILER-DAEMON Tue Jan 24 13:46:31 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cW66x-0008Um-MF
	for mharc-bug-bash@gnu.org; Tue, 24 Jan 2017 13:46:31 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:55026)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1cW66v-0008TW-0E
	for bug-bash@gnu.org; Tue, 24 Jan 2017 13:46:29 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1cW66s-0006Fm-Et
	for bug-bash@gnu.org; Tue, 24 Jan 2017 13:46:29 -0500
Received: from mail-out.m-online.net ([2001:a60:0:28:0:1:25:1]:56180)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <whitebox@nefkom.net>) id 1cW66s-0006FI-8Z
	for bug-bash@gnu.org; Tue, 24 Jan 2017 13:46:26 -0500
Received: from frontend01.mail.m-online.net (unknown [192.168.8.182])
	by mail-out.m-online.net (Postfix) with ESMTP id 3v7HFp5pG1z3hmsX;
	Tue, 24 Jan 2017 19:46:22 +0100 (CET)
Received: from localhost (dynscan1.mnet-online.de [192.168.6.68])
	by mail.m-online.net (Postfix) with ESMTP id 3v7HFp5PcQzvkQV;
	Tue, 24 Jan 2017 19:46:22 +0100 (CET)
X-Virus-Scanned: amavisd-new at mnet-online.de
Received: from mail.mnet-online.de ([192.168.8.182])
	by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new,
	port 10024)
	with ESMTP id QwDbS2xAq5Qf; Tue, 24 Jan 2017 19:46:21 +0100 (CET)
X-Auth-Info: lXyOe/w3SWPTc6u/e+jiny0Wxhnda8Sowzb/srsKZ8nDAF1l2hZcut2ynVrtAQ4N
Received: from igel.home (ppp-88-217-0-51.dynamic.mnet-online.de [88.217.0.51])
	(using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.mnet-online.de (Postfix) with ESMTPSA;
	Tue, 24 Jan 2017 19:46:21 +0100 (CET)
Received: by igel.home (Postfix, from userid 1000)
	id 01E4D2C310A; Tue, 24 Jan 2017 19:46:20 +0100 (CET)
From: Andreas Schwab <schwab@linux-m68k.org>
To: "Brian 'geeknik' Carpenter" <brian.carpenter@gmail.com>
Cc: bug-bash@gnu.org,  bash@packages.debian.org
Subject: Re: null pointer deref, segfault
References: <CANMVOuwkOsFaJ8k_XJTU7+oCZ-wWWfzGwHgVFnx+WgqVtaTZUQ@mail.gmail.com>
X-Yow: I'm changing the CHANNEL..  But all I get is commercials
	for ``RONCO MIRACLE BAMBOO STEAMERS''!
Date: Tue, 24 Jan 2017 19:46:20 +0100
In-Reply-To: <CANMVOuwkOsFaJ8k_XJTU7+oCZ-wWWfzGwHgVFnx+WgqVtaTZUQ@mail.gmail.com>
	(Brian Carpenter's message of "Tue, 24 Jan 2017 01:07:39 -0600")
Message-ID: <877f5kwb2b.fsf@linux-m68k.org>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-Received-From: 2001:a60:0:28:0:1:25:1
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 24 Jan 2017 18:46:30 -0000

On Jan 24 2017, "Brian 'geeknik' Carpenter" <brian.carpenter@gmail.com> wrote:

> <<$(()())|>_[$($(<<0)) crashes bash on Debian, Red Hat, FreeBSD, etc.

Worksforme with bash 4.4.

$ bash -c '<<$(()())|>_[$($(<<0))'
bash: line 1: warning: here-document at line 1 delimited by end-of-file (wanted `0')
bash: warning: here-document at line 0 delimited by end-of-file (wanted `$(()())')
bash: line 1: warning: here-document at line 1 delimited by end-of-file (wanted `0')
bash: warning: here-document at line 0 delimited by end-of-file (wanted `0')

Andreas.

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


From MAILER-DAEMON Wed Jan 25 07:39:20 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cWMrA-0002Z5-Qy
	for mharc-bug-bash@gnu.org; Wed, 25 Jan 2017 07:39:20 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:44528)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <svashish@redhat.com>) id 1cWMr8-0002WB-Ve
	for bug-bash@gnu.org; Wed, 25 Jan 2017 07:39:20 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <svashish@redhat.com>) id 1cWMr3-0002jq-UQ
	for bug-bash@gnu.org; Wed, 25 Jan 2017 07:39:19 -0500
Received: from mx5-phx2.redhat.com ([209.132.183.37]:47308)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <svashish@redhat.com>) id 1cWMr3-0002i4-Kv
	for bug-bash@gnu.org; Wed, 25 Jan 2017 07:39:13 -0500
Received: from zmail23.collab.prod.int.phx2.redhat.com
	(zmail23.collab.prod.int.phx2.redhat.com [10.5.83.28])
	by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v0PCdDfH002868
	for <bug-bash@gnu.org>; Wed, 25 Jan 2017 07:39:13 -0500
Date: Wed, 25 Jan 2017 07:39:12 -0500 (EST)
From: Siteshwar Vashisht <svashisht@redhat.com>
To: bug-bash@gnu.org
Message-ID: <1066246831.12801555.1485347952850.JavaMail.zimbra@redhat.com>
In-Reply-To: <1925183317.12798659.1485347292292.JavaMail.zimbra@redhat.com>
Subject: Make syslog history configurable
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_12801553_151871950.1485347952844"
X-Originating-IP: [10.34.4.138]
X-Mailer: Zimbra 8.0.6_GA_5922 (ZimbraWebClient - FF50 (Linux)/8.0.6_GA_5922)
Thread-Topic: Make syslog history configurable
Thread-Index: 3XewisgFAYYskqWEopyvBjF+IZwQnQ==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From: 209.132.183.37
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 25 Jan 2017 12:39:20 -0000

------=_Part_12801553_151871950.1485347952844
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Hello,

Bash history is logged to syslog if SYSLOG_HISTORY macro is defined in config-top.h. There is no option to enable/disable it at runtime. I am adding a shell option 'syshist' that can be used to configure logging bash history to syslog at runtime.


-- 
--
Siteshwar Vashisht

------=_Part_12801553_151871950.1485347952844
Content-Type: text/x-patch; name=syslog-history-configurable.patch
Content-Disposition: attachment; filename=syslog-history-configurable.patch
Content-Transfer-Encoding: base64

RnJvbSBjNmVjMGQ3NTFkZWQ3NTE4OGY2NGQxZDFhYzk5MTZjNDQxNTNjMzA1IE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBTaXRlc2h3YXIgVmFzaGlzaHQgPHN2YXNoaXNodEByZWRoYXQu
Y29tPgpEYXRlOiBUdWUsIDI0IEphbiAyMDE3IDE3OjI4OjE0ICswMTAwClN1YmplY3Q6IFtQQVRD
SF0gTWFrZSBzeXNsb2cgaGlzdG9yeSBjb25maWd1cmFibGUKCi0tLQogYmFzaGhpc3QuYyAgICAg
ICB8IDMgKystCiBidWlsdGlucy9zZXQuZGVmIHwgOSArKysrKysrKysKIGNvbmZpZy10b3AuaCAg
ICAgfCA0ICsrLS0KIGZsYWdzLmMgICAgICAgICAgfCA3ICsrKysrKysKIGZsYWdzLmggICAgICAg
ICAgfCA0ICsrKysKIDUgZmlsZXMgY2hhbmdlZCwgMjQgaW5zZXJ0aW9ucygrKSwgMyBkZWxldGlv
bnMoLSkKCmRpZmYgLS1naXQgYS9iYXNoaGlzdC5jIGIvYmFzaGhpc3QuYwppbmRleCA5OTc5Zjk5
Li5lNjEyN2M4IDEwMDY0NAotLS0gYS9iYXNoaGlzdC5jCisrKyBiL2Jhc2hoaXN0LmMKQEAgLTg1
MSw3ICs4NTEsOCBAQCBiYXNoX2FkZF9oaXN0b3J5IChsaW5lKQogICAgIHJlYWxseV9hZGRfaGlz
dG9yeSAobGluZSk7CiAKICNpZiBkZWZpbmVkIChTWVNMT0dfSElTVE9SWSkKLSAgYmFzaF9zeXNs
b2dfaGlzdG9yeSAobGluZSk7CisgIGlmIChzeXNsb2dfaGlzdG9yeSkKKyAgICBiYXNoX3N5c2xv
Z19oaXN0b3J5IChsaW5lKTsKICNlbmRpZgogCiAgIHVzaW5nX2hpc3RvcnkgKCk7CmRpZmYgLS1n
aXQgYS9idWlsdGlucy9zZXQuZGVmIGIvYnVpbHRpbnMvc2V0LmRlZgppbmRleCA4MTIyMzYxLi43
MThiYTM5IDEwMDY0NAotLS0gYS9idWlsdGlucy9zZXQuZGVmCisrKyBiL2J1aWx0aW5zL3NldC5k
ZWYKQEAgLTExNiw2ICsxMTYsOSBAQCBPcHRpb25zOgogICAgICAgICAgICAgICAgICAgICAgICBv
cGVyYXRpb24gZGlmZmVycyBmcm9tIHRoZSBQb3NpeCBzdGFuZGFyZCB0bwogICAgICAgICAgICAg
ICAgICAgICAgICBtYXRjaCB0aGUgc3RhbmRhcmQKICAgICAgICAgICBwcml2aWxlZ2VkICAgc2Ft
ZSBhcyAtcAorI2lmIGRlZmluZWQgKFNZU0xPR19ISVNUT1JZKQorICAgICAgICAgIHN5c2hpc3Qg
ICAgICBzYW1lIGFzIC1TCisjZW5kaWYKICAgICAgICAgICB2ZXJib3NlICAgICAgc2FtZSBhcyAt
dgogI2lmIGRlZmluZWQgKFJFQURMSU5FKQogICAgICAgICAgIHZpICAgICAgICAgICB1c2UgYSB2
aS1zdHlsZSBsaW5lIGVkaXRpbmcgaW50ZXJmYWNlCkBAIC0xNDEsNiArMTQ0LDkgQEAgT3B0aW9u
czoKICNlbmRpZiAvKiBCQU5HX0hJU1RPUlkgKi8KICAgLVAgIElmIHNldCwgZG8gbm90IHJlc29s
dmUgc3ltYm9saWMgbGlua3Mgd2hlbiBleGVjdXRpbmcgY29tbWFuZHMKICAgICAgIHN1Y2ggYXMg
Y2Qgd2hpY2ggY2hhbmdlIHRoZSBjdXJyZW50IGRpcmVjdG9yeS4KKyNpZiBkZWZpbmVkIChTWVNM
T0dfSElTVE9SWSkKKyAgLVMgIElmIHNldCwgbG9nIGhpc3RvcnkgdG8gc3lzbG9nCisjZW5kaWYK
ICAgLVQgIElmIHNldCwgdGhlIERFQlVHIGFuZCBSRVRVUk4gdHJhcHMgYXJlIGluaGVyaXRlZCBi
eSBzaGVsbCBmdW5jdGlvbnMuCiAgIC0tICBBc3NpZ24gYW55IHJlbWFpbmluZyBhcmd1bWVudHMg
dG8gdGhlIHBvc2l0aW9uYWwgcGFyYW1ldGVycy4KICAgICAgIElmIHRoZXJlIGFyZSBubyByZW1h
aW5pbmcgYXJndW1lbnRzLCB0aGUgcG9zaXRpb25hbCBwYXJhbWV0ZXJzCkBAIC0yMzEsNiArMjM3
LDkgQEAgY29uc3Qgc3RydWN0IHsKICAgeyAicGlwZWZhaWwiLCAgJ1wwJywgJnBpcGVmYWlsX29w
dCwgKHNldG9wdF9zZXRfZnVuY190ICopTlVMTCwgKHNldG9wdF9nZXRfZnVuY190ICopTlVMTCAg
fSwKICAgeyAicG9zaXgiLCAgICAgJ1wwJywgJnBvc2l4bHlfY29ycmVjdCwgc2V0X3Bvc2l4X21v
ZGUsIChzZXRvcHRfZ2V0X2Z1bmNfdCAqKU5VTEwgfSwKICAgeyAicHJpdmlsZWdlZCIsICdwJywg
KGludCAqKU5VTEwsIChzZXRvcHRfc2V0X2Z1bmNfdCAqKU5VTEwsIChzZXRvcHRfZ2V0X2Z1bmNf
dCAqKU5VTEwgIH0sCisjaWYgZGVmaW5lZCAoU1lTTE9HX0hJU1RPUlkpCisgIHsgInN5c2hpc3Qi
LCAnUycsIChpbnQgKilOVUxMLCAoc2V0b3B0X3NldF9mdW5jX3QgKilOVUxMLCAoc2V0b3B0X2dl
dF9mdW5jX3QgKilOVUxMICB9LAorI2VuZGlmCiAgIHsgInZlcmJvc2UiLAkgICd2JywgKGludCAq
KU5VTEwsIChzZXRvcHRfc2V0X2Z1bmNfdCAqKU5VTEwsIChzZXRvcHRfZ2V0X2Z1bmNfdCAqKU5V
TEwgIH0sCiAjaWYgZGVmaW5lZCAoUkVBRExJTkUpCiAgIHsgInZpIiwgICAgICAgICdcMCcsIChp
bnQgKilOVUxMLCBzZXRfZWRpdF9tb2RlLCBnZXRfZWRpdF9tb2RlIH0sCmRpZmYgLS1naXQgYS9j
b25maWctdG9wLmggYi9jb25maWctdG9wLmgKaW5kZXggY2IwZTAwMi4uYWU4ZDEyNCAxMDA2NDQK
LS0tIGEvY29uZmlnLXRvcC5oCisrKyBiL2NvbmZpZy10b3AuaApAQCAtMTE0LDggKzExNCw4IEBA
CiAvKiAjZGVmaW5lIE5PVEZPVU5EX0hPT0sgImNvbW1hbmRfbm90X2ZvdW5kX2hhbmRsZSIgKi8K
IAogLyogRGVmaW5lIGlmIHlvdSB3YW50IGVhY2ggbGluZSBzYXZlZCB0byB0aGUgaGlzdG9yeSBs
aXN0IGluIGJhc2hoaXN0LmM6Ci0gICBiYXNoX2FkZF9oaXN0b3J5KCkgdG8gYmUgc2VudCB0byBz
eXNsb2coKS4gKi8KLS8qICNkZWZpbmUgU1lTTE9HX0hJU1RPUlkgKi8KKyAgIElmIHN5c2hpc3Qg
c2hlbGwgb3B0aW9uIGlzIHNldCwgYmFzaF9hZGRfaGlzdG9yeSgpIHRvIGJlIHNlbnQgdG8gc3lz
bG9nKCkuICovCisjZGVmaW5lIFNZU0xPR19ISVNUT1JZCiAjaWYgZGVmaW5lZCAoU1lTTE9HX0hJ
U1RPUlkpCiAjICBkZWZpbmUgU1lTTE9HX0ZBQ0lMSVRZIExPR19VU0VSCiAjICBkZWZpbmUgU1lT
TE9HX0xFVkVMIExPR19JTkZPCmRpZmYgLS1naXQgYS9mbGFncy5jIGIvZmxhZ3MuYwppbmRleCA0
Yjk0ZmIwLi5jYzE2MjIxIDEwMDY0NAotLS0gYS9mbGFncy5jCisrKyBiL2ZsYWdzLmMKQEAgLTEz
Nyw2ICsxMzcsMTAgQEAgaW50IGhpc3RvcnlfZXhwYW5zaW9uID0gMTsKICMgIGVuZGlmCiAjZW5k
aWYgLyogQkFOR19ISVNUT1JZICovCiAKKyNpZiBkZWZpbmVkIChTWVNMT0dfSElTVE9SWSkKK2lu
dCBzeXNsb2dfaGlzdG9yeSA9IDA7CisjZW5kaWYgCisKIC8qIE5vbi16ZXJvIG1lYW5zIHRoYXQg
d2UgYWxsb3cgY29tbWVudHMgdG8gYXBwZWFyIGluIGludGVyYWN0aXZlIGNvbW1hbmRzLiAqLwog
aW50IGludGVyYWN0aXZlX2NvbW1lbnRzID0gMTsKIApAQCAtMjE1LDYgKzIxOSw5IEBAIGNvbnN0
IHN0cnVjdCBmbGFnc19hbGlzdCBzaGVsbF9mbGFnc1tdID0gewogI2VuZGlmIC8qIEJBTkdfSElT
VE9SWSAqLwogICB7ICdJJywgJm5vX2ludmlzaWJsZV92YXJzIH0sCiAgIHsgJ1AnLCAmbm9fc3lt
Ym9saWNfbGlua3MgfSwKKyNpZiBkZWZpbmVkIChTWVNMT0dfSElTVE9SWSkKKyAgeyAnUycsICZz
eXNsb2dfaGlzdG9yeX0sCisjZW5kaWYgLyogU1lTTE9HX0hJU1RPUlkgKi8KICAgeyAnVCcsICZm
dW5jdGlvbl90cmFjZV9tb2RlIH0sCiAgIHswLCAoaW50ICopTlVMTH0KIH07CmRpZmYgLS1naXQg
YS9mbGFncy5oIGIvZmxhZ3MuaAppbmRleCBkNWVkMzM0Li43ZmUyNWQ1IDEwMDY0NAotLS0gYS9m
bGFncy5oCisrKyBiL2ZsYWdzLmgKQEAgLTYyLDYgKzYyLDEwIEBAIGV4dGVybiBpbnQgYnJhY2Vf
ZXhwYW5zaW9uOwogZXh0ZXJuIGludCBoaXN0b3J5X2V4cGFuc2lvbjsKICNlbmRpZiAvKiBCQU5H
X0hJU1RPUlkgKi8KIAorI2lmIGRlZmluZWQgKFNZU0xPR19ISVNUT1JZKQorZXh0ZXJuIGludCBz
eXNsb2dfaGlzdG9yeTsKKyNlbmRpZgorCiAjaWYgZGVmaW5lZCAoUkVTVFJJQ1RFRF9TSEVMTCkK
IGV4dGVybiBpbnQgcmVzdHJpY3RlZDsKIGV4dGVybiBpbnQgcmVzdHJpY3RlZF9zaGVsbDsKLS0g
CjIuOS4zCgo=
------=_Part_12801553_151871950.1485347952844--


From MAILER-DAEMON Wed Jan 25 08:53:33 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cWO0y-0001qh-Ta
	for mharc-bug-bash@gnu.org; Wed, 25 Jan 2017 08:53:32 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:60993)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cWO0w-0001mq-6k
	for bug-bash@gnu.org; Wed, 25 Jan 2017 08:53:31 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cWO0t-0008VR-0v
	for bug-bash@gnu.org; Wed, 25 Jan 2017 08:53:30 -0500
Received: from mpv2-2015.cwru.edu ([129.22.103.227]:62344
	helo=mpv1-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1cWO0s-0008U0-Su
	for bug-bash@gnu.org; Wed, 25 Jan 2017 08:53:26 -0500
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv2-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AKT20083; Wed, 25 Jan 2017 08:53:16 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AYN00481 (AUTH cpr);
	Wed, 25 Jan 2017 08:53:15 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: Make syslog history configurable
References: <1066246831.12801555.1485347952850.JavaMail.zimbra@redhat.com>
To: Siteshwar Vashisht <svashisht@redhat.com>, bug-bash@gnu.org
Cc: chet.ramey@case.edu
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <d7536b4a-13ac-c970-2ee2-9435f2995b2c@case.edu>
Date: Wed, 25 Jan 2017 08:53:15 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0)
	Gecko/20100101 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <1066246831.12801555.1485347952850.JavaMail.zimbra@redhat.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv2-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.227
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 25 Jan 2017 13:53:31 -0000

On 1/25/17 7:39 AM, Siteshwar Vashisht wrote:
> Hello,
> 
> Bash history is logged to syslog if SYSLOG_HISTORY macro is defined in config-top.h. There is no option to enable/disable it at runtime. I am adding a shell option 'syshist' that can be used to configure logging bash history to syslog at runtime.

Thanks. I'll take a look at including this in a future bash version.

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


From MAILER-DAEMON Wed Jan 25 10:22:46 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cWPPK-0008VB-PJ
	for mharc-bug-bash@gnu.org; Wed, 25 Jan 2017 10:22:46 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:55320)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <svashish@redhat.com>) id 1cWPPI-0008RF-4s
	for bug-bash@gnu.org; Wed, 25 Jan 2017 10:22:45 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <svashish@redhat.com>) id 1cWPPE-0001y2-Uz
	for bug-bash@gnu.org; Wed, 25 Jan 2017 10:22:44 -0500
Received: from mx3-phx2.redhat.com ([209.132.183.24]:51236)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <svashish@redhat.com>) id 1cWPPE-0001xt-M7
	for bug-bash@gnu.org; Wed, 25 Jan 2017 10:22:40 -0500
Received: from zmail23.collab.prod.int.phx2.redhat.com
	(zmail23.collab.prod.int.phx2.redhat.com [10.5.83.28])
	by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v0PFMeZO010286
	for <bug-bash@gnu.org>; Wed, 25 Jan 2017 10:22:40 -0500
Date: Wed, 25 Jan 2017 10:22:40 -0500 (EST)
From: Siteshwar Vashisht <svashisht@redhat.com>
To: bug-bash@gnu.org
Message-ID: <423865233.12860768.1485357760417.JavaMail.zimbra@redhat.com>
In-Reply-To: <1066246831.12801555.1485347952850.JavaMail.zimbra@redhat.com>
References: <1066246831.12801555.1485347952850.JavaMail.zimbra@redhat.com>
Subject: Re: Make syslog history configurable
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_12860766_648300815.1485357760413"
X-Originating-IP: [10.34.4.138]
X-Mailer: Zimbra 8.0.6_GA_5922 (ZimbraWebClient - FF50 (Linux)/8.0.6_GA_5922)
Thread-Topic: Make syslog history configurable
Thread-Index: 3XewisgFAYYskqWEopyvBjF+IZwQnWu9QXfQ
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy]
X-Received-From: 209.132.183.24
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 25 Jan 2017 15:22:45 -0000

------=_Part_12860766_648300815.1485357760413
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit



----- Original Message -----
> From: "Siteshwar Vashisht" <svashisht@redhat.com>
> To: bug-bash@gnu.org
> Sent: Wednesday, January 25, 2017 1:39:12 PM
> Subject: Make syslog history configurable
> 
> Hello,
> 
> Bash history is logged to syslog if SYSLOG_HISTORY macro is defined in
> config-top.h. There is no option to enable/disable it at runtime. I am
> adding a shell option 'syshist' that can be used to configure logging bash
> history to syslog at runtime.

I modified the patch to use shopt instead of set to enable/disable syslog history.
> 
> 
> --
> --
> Siteshwar Vashisht
> 

-- 
--
Siteshwar Vashisht

------=_Part_12860766_648300815.1485357760413
Content-Type: text/x-patch; name=syslog-history-configurable-shopt.patch
Content-Disposition: attachment;
 filename=syslog-history-configurable-shopt.patch
Content-Transfer-Encoding: base64

RnJvbSA0OWQyNDM1YWVmY2E3OWIwOGQxOWY2N2MxMzlkMjA5MTYzNDg1M2Y1IE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBTaXRlc2h3YXIgVmFzaGlzaHQgPHN2YXNoaXNodEByZWRoYXQu
Y29tPgpEYXRlOiBXZWQsIDI1IEphbiAyMDE3IDE1OjU4OjU5ICswMTAwClN1YmplY3Q6IFtQQVRD
SF0gTWFrZSBzeXNsb2cgaGlzdG9yeSBjb25maWd1cmFibGUgd2l0aCBzaG9wdAoKLS0tCiBiYXNo
aGlzdC5jICAgICAgICAgfCAgNSArKystLQogYnVpbHRpbnMvc2hvcHQuZGVmIHwgMTEgKysrKysr
KysrKysKIGNvbmZpZy10b3AuaCAgICAgICB8ICAyICstCiAzIGZpbGVzIGNoYW5nZWQsIDE1IGlu
c2VydGlvbnMoKyksIDMgZGVsZXRpb25zKC0pCgpkaWZmIC0tZ2l0IGEvYmFzaGhpc3QuYyBiL2Jh
c2hoaXN0LmMKaW5kZXggOTk3OWY5OS4uN2FiNjQ4NiAxMDA2NDQKLS0tIGEvYmFzaGhpc3QuYwor
KysgYi9iYXNoaGlzdC5jCkBAIC03NDksNyArNzQ5LDcgQEAgY2hlY2tfYWRkX2hpc3RvcnkgKGxp
bmUsIGZvcmNlKQogI2RlZmluZSBTWVNMT0dfTUFYTEVOIDYwMAogCiBleHRlcm4gY2hhciAqc2hl
bGxfbmFtZTsKLQoraW50IHN5c2xvZ19oaXN0b3J5ID0gMDsKICNpZm5kZWYgT1BFTkxPR19PUFRT
CiAjZGVmaW5lIE9QRU5MT0dfT1BUUyAwCiAjZW5kaWYKQEAgLTg1MSw3ICs4NTEsOCBAQCBiYXNo
X2FkZF9oaXN0b3J5IChsaW5lKQogICAgIHJlYWxseV9hZGRfaGlzdG9yeSAobGluZSk7CiAKICNp
ZiBkZWZpbmVkIChTWVNMT0dfSElTVE9SWSkKLSAgYmFzaF9zeXNsb2dfaGlzdG9yeSAobGluZSk7
CisgIGlmIChzeXNsb2dfaGlzdG9yeSkKKyAgICBiYXNoX3N5c2xvZ19oaXN0b3J5IChsaW5lKTsK
ICNlbmRpZgogCiAgIHVzaW5nX2hpc3RvcnkgKCk7CmRpZmYgLS1naXQgYS9idWlsdGlucy9zaG9w
dC5kZWYgYi9idWlsdGlucy9zaG9wdC5kZWYKaW5kZXggMmZlYmI3ZS4uODQ4YmFiMyAxMDA2NDQK
LS0tIGEvYnVpbHRpbnMvc2hvcHQuZGVmCisrKyBiL2J1aWx0aW5zL3Nob3B0LmRlZgpAQCAtMTE4
LDYgKzExOCwxMCBAQCBleHRlcm4gY2hhciAqc2hlbGxfbmFtZTsKIGV4dGVybiBpbnQgZGVidWdn
aW5nX21vZGU7CiAjZW5kaWYKIAorI2lmIGRlZmluZWQgKFNZU0xPR19ISVNUT1JZKQorZXh0ZXJu
IGludCBzeXNsb2dfaGlzdG9yeTsKKyNlbmRpZgorCiBzdGF0aWMgdm9pZCBzaG9wdF9lcnJvciBf
X1AoKGNoYXIgKikpOwogCiBzdGF0aWMgaW50IHNldF9zaGVsbG9wdHNfYWZ0ZXJfY2hhbmdlIF9f
UCgoY2hhciAqLCBpbnQpKTsKQEAgLTIyMyw2ICsyMjcsOSBAQCBzdGF0aWMgc3RydWN0IHsKICNl
bmRpZgogICB7ICJzaGlmdF92ZXJib3NlIiwgJnByaW50X3NoaWZ0X2Vycm9yLCAoc2hvcHRfc2V0
X2Z1bmNfdCAqKU5VTEwgfSwKICAgeyAic291cmNlcGF0aCIsICZzb3VyY2VfdXNlc19wYXRoLCAo
c2hvcHRfc2V0X2Z1bmNfdCAqKU5VTEwgfSwKKyNpZiBkZWZpbmVkIChTWVNMT0dfSElTVE9SWSkK
KyAgeyAic3lzbG9nX2hpc3RvcnkiLCAmc3lzbG9nX2hpc3RvcnksIChzaG9wdF9zZXRfZnVuY190
ICopTlVMTCB9LAorI2VuZGlmCiAgIHsgInhwZ19lY2hvIiwgJnhwZ19lY2hvLCAoc2hvcHRfc2V0
X2Z1bmNfdCAqKU5VTEwgfSwKICAgeyAoY2hhciAqKTAsIChpbnQgKikwLCAoc2hvcHRfc2V0X2Z1
bmNfdCAqKU5VTEwgfQogfTsKQEAgLTM0NSw2ICszNTIsMTAgQEAgcmVzZXRfc2hvcHRfb3B0aW9u
cyAoKQogICBjb21tYW5kX29yaWVudGVkX2hpc3RvcnkgPSAxOwogI2VuZGlmCiAKKyNpZiBkZWZp
bmVkIChTWVNMT0dfSElTVE9SWSkKKyAgc3lzbG9nX2hpc3RvcnkgPSAwOworI2VuZGlmCisKICNp
ZiBkZWZpbmVkIChSRUFETElORSkKICAgY29tcGxldGVfZnVsbHF1b3RlID0gMTsKICAgZm9yY2Vf
Zmlnbm9yZSA9IDE7CmRpZmYgLS1naXQgYS9jb25maWctdG9wLmggYi9jb25maWctdG9wLmgKaW5k
ZXggY2IwZTAwMi4uODA1MWZhZCAxMDA2NDQKLS0tIGEvY29uZmlnLXRvcC5oCisrKyBiL2NvbmZp
Zy10b3AuaApAQCAtMTE1LDcgKzExNSw3IEBACiAKIC8qIERlZmluZSBpZiB5b3Ugd2FudCBlYWNo
IGxpbmUgc2F2ZWQgdG8gdGhlIGhpc3RvcnkgbGlzdCBpbiBiYXNoaGlzdC5jOgogICAgYmFzaF9h
ZGRfaGlzdG9yeSgpIHRvIGJlIHNlbnQgdG8gc3lzbG9nKCkuICovCi0vKiAjZGVmaW5lIFNZU0xP
R19ISVNUT1JZICovCisjZGVmaW5lIFNZU0xPR19ISVNUT1JZCiAjaWYgZGVmaW5lZCAoU1lTTE9H
X0hJU1RPUlkpCiAjICBkZWZpbmUgU1lTTE9HX0ZBQ0lMSVRZIExPR19VU0VSCiAjICBkZWZpbmUg
U1lTTE9HX0xFVkVMIExPR19JTkZPCi0tIAoyLjkuMwoK
------=_Part_12860766_648300815.1485357760413--


From MAILER-DAEMON Wed Jan 25 15:03:24 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cWTmu-0003H2-Li
	for mharc-bug-bash@gnu.org; Wed, 25 Jan 2017 15:03:24 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56849)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1cWTms-0003G1-Hh
	for bug-bash@gnu.org; Wed, 25 Jan 2017 15:03:23 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1cWTmn-0003f0-JP
	for bug-bash@gnu.org; Wed, 25 Jan 2017 15:03:22 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:37502
	helo=Ishtar.sc.tlinx.org)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <bash@tlinx.org>) id 1cWTmn-0003ZD-7v
	for bug-bash@gnu.org; Wed, 25 Jan 2017 15:03:17 -0500
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
	v0PK31BN045340; Wed, 25 Jan 2017 12:03:04 -0800
Message-ID: <58890476.7050707@tlinx.org>
Date: Wed, 25 Jan 2017 12:03:02 -0800
From: L A Walsh <bash@tlinx.org>
User-Agent: Thunderbird
MIME-Version: 1.0
CC: "Brian 'geeknik' Carpenter" <brian.carpenter@gmail.com>, bug-bash@gnu.org
Subject: Re: null pointer deref, segfault
References: <CANMVOuwkOsFaJ8k_XJTU7+oCZ-wWWfzGwHgVFnx+WgqVtaTZUQ@mail.gmail.com>
	<877f5kwb2b.fsf@linux-m68k.org>
In-Reply-To: <877f5kwb2b.fsf@linux-m68k.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
	timestamps) [generic] [fuzzy]
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 25 Jan 2017 20:03:23 -0000

Andreas Schwab wrote:
> On Jan 24 2017, "Brian 'geeknik' Carpenter" <brian.carpenter@gmail.com> wrote:
>
>   
>> <<$(()())|>_[$($(<<0)) crashes bash on Debian, Red Hat, FreeBSD, etc.
>>     
>
> Worksforme with bash 4.4.
>   
---
    I duplicated it under bash 4.3.42, but not under 4.4.5.


-l



From MAILER-DAEMON Thu Jan 26 16:11:55 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cWrKl-0002CU-5y
	for mharc-bug-bash@gnu.org; Thu, 26 Jan 2017 16:11:55 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:38123)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1cWrKf-0002Al-FM
	for bug-bash@gnu.org; Thu, 26 Jan 2017 16:11:54 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1cWrKa-0002LL-Hx
	for bug-bash@gnu.org; Thu, 26 Jan 2017 16:11:49 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:37370
	helo=Ishtar.sc.tlinx.org)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <bash@tlinx.org>) id 1cWrKa-0002Ji-79
	for bug-bash@gnu.org; Thu, 26 Jan 2017 16:11:44 -0500
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
	v0QLBPNu055927
	for <bug-bash@gnu.org>; Thu, 26 Jan 2017 13:11:27 -0800
Message-ID: <588A65FD.5010006@tlinx.org>
Date: Thu, 26 Jan 2017 13:11:25 -0800
From: L A Walsh <bash@tlinx.org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: bug-bash <bug-bash@gnu.org>
Subject: What is correct syntax to check for empty array? behavior diffs
	between 4.3 and 4.4
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
	timestamps) [generic] [fuzzy]
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 26 Jan 2017 21:11:54 -0000

I noticed an error coming out of a script when I tried
to check an array's size w/unbound var checking enabled

(note my=declare, array='my -a')

First w/bash-4.3.42:

>  bash                        # try in subshell in case '-u' exits
>  array gv_ops=()
>  echo ${#gv_ops[@]}          # existing var
0
>  echo ${#gv_ops2[@]:-0}      # non-existing var (seems to work)
>  0
>  set -u                      # now add an undefined check
>  echo ${#gv_ops[@]:-0}       # empty array still shows '0'
0
>  echo ${#gv_ops2[@]:-0}      # try w/non-existing array
-bash: gv_ops2: unbound variable  # doesn't work
----

w/bash 4.4:

>  array gv_ops=()
>  echo ${#gv_ops[@]:-0}
bash: ${#gv_ops[@]:-0}: bad substitution
>  echo ${#gv_ops2[@]:-0}
bash: ${#gv_ops2[@]:-0}: bad substitution

ok, so 4.4 is telling me its a bad substitution while 4.3 hid
that, but fails when the array doesn't exist.  So I see that
it doesn't work in 4.3 or 4.4... so what does?

I.e. - How do I display catch an undefined array and have it
display a known value?

Thanks!
-linda





From MAILER-DAEMON Thu Jan 26 16:16:02 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cWrOk-0003FU-I8
	for mharc-bug-bash@gnu.org; Thu, 26 Jan 2017 16:16:02 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:38869)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cWrOf-0003FF-GJ
	for bug-bash@gnu.org; Thu, 26 Jan 2017 16:16:01 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cWrOa-0003jW-Jj
	for bug-bash@gnu.org; Thu, 26 Jan 2017 16:15:57 -0500
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:39257 helo=svr4.eeg.ccf.org)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cWrOa-0003b0-CQ
	for bug-bash@gnu.org; Thu, 26 Jan 2017 16:15:52 -0500
Received: (qmail 18486 invoked from network); 26 Jan 2017 21:15:24 -0000
Received: from imadev.eeg.ccf.org (qmailr@10.76.173.78)
	by gateway.eeg.ccf.org with SMTP; Thu, 26 Jan 2017 16:15:24 -0500
Received: (qmail 12511 invoked by uid 563); 26 Jan 2017 21:15:23 -0000
Date: Thu, 26 Jan 2017 16:15:23 -0500
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: L A Walsh <bash@tlinx.org>
Cc: bug-bash <bug-bash@gnu.org>
Subject: Re: What is correct syntax to check for empty array? behavior diffs
	between 4.3 and 4.4
Message-ID: <20170126211523.GH27281@eeg.ccf.org>
References: <588A65FD.5010006@tlinx.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <588A65FD.5010006@tlinx.org>
User-Agent: Mutt/1.4.2.3i
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 139.137.100.1
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 26 Jan 2017 21:16:02 -0000

On Thu, Jan 26, 2017 at 01:11:25PM -0800, L A Walsh wrote:

>> Subject: Re: What is correct syntax to check for empty array?

The number of elements is 0 if the array is empty.  So you would test
whether ${#array[@]} is 0.

> > set -u                      # now add an undefined check

Now you've changed the question.  You're no longer asking whether an
array is empty.  You're asking whether some legacy crap from 197x will
make your shell script abort.

Answer: who the hell cares.  Stop doing it.


From MAILER-DAEMON Thu Jan 26 16:24:12 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cWrWe-0006oa-91
	for mharc-bug-bash@gnu.org; Thu, 26 Jan 2017 16:24:12 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41418)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1cWrWa-0006oS-MU
	for bug-bash@gnu.org; Thu, 26 Jan 2017 16:24:10 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1cWrWW-0007aO-IH
	for bug-bash@gnu.org; Thu, 26 Jan 2017 16:24:08 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:37858
	helo=Ishtar.sc.tlinx.org)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <bash@tlinx.org>) id 1cWrWW-0007Zm-7l
	for bug-bash@gnu.org; Thu, 26 Jan 2017 16:24:04 -0500
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
	v0QLNu2V057385; Thu, 26 Jan 2017 13:23:58 -0800
Message-ID: <588A68EC.2050505@tlinx.org>
Date: Thu, 26 Jan 2017 13:23:56 -0800
From: L A Walsh <bash@tlinx.org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: Greg Wooledge <wooledg@eeg.ccf.org>
CC: bug-bash <bug-bash@gnu.org>
Subject: Re: What is correct syntax to check for empty array? behavior diffs
	between 4.3 and 4.4
References: <588A65FD.5010006@tlinx.org> <20170126211523.GH27281@eeg.ccf.org>
In-Reply-To: <20170126211523.GH27281@eeg.ccf.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
	timestamps) [generic] [fuzzy]
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 26 Jan 2017 21:24:10 -0000



Greg Wooledge wrote:
> On Thu, Jan 26, 2017 at 01:11:25PM -0800, L A Walsh wrote:
>
>   
>>> Subject: Re: What is correct syntax to check for empty array?
>>>       
>
> The number of elements is 0 if the array is empty.  So you would test
> whether ${#array[@]} is 0.
>
>   
>>> set -u                      # now add an undefined check
>>>       
>
> Now you've changed the question.  You're no longer asking whether an
> array is empty.  You're asking whether some legacy crap from 197x will
> make your shell script abort.
>
> Answer: who the hell cares.  Stop doing it.
>   
---
get a life.

I'll stop doing it when it is removed.

Otherwise, I'll see your answer as being "I don't know, so let's
call the user's choices 'crap'" -- i.e. not at all useful.

I was really tempted to add:
(opinions on use of "-u" are not being solicited) to my original
note, but I didn't want to be presume someone would be so
unhelpful... 

If you don't think it is working correctly, SUBMIT A BUG.
Otherwise, stop telling people to not use bash's *documented*
features.







From MAILER-DAEMON Thu Jan 26 16:27:52 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cWraB-00084s-Tj
	for mharc-bug-bash@gnu.org; Thu, 26 Jan 2017 16:27:51 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:42104)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1cWra9-00084j-8i
	for bug-bash@gnu.org; Thu, 26 Jan 2017 16:27:50 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1cWra4-00016S-RY
	for bug-bash@gnu.org; Thu, 26 Jan 2017 16:27:49 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:37982
	helo=Ishtar.sc.tlinx.org)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <bash@tlinx.org>) id 1cWra4-00013N-G6
	for bug-bash@gnu.org; Thu, 26 Jan 2017 16:27:44 -0500
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
	v0QLRe3K057864
	for <bug-bash@gnu.org>; Thu, 26 Jan 2017 13:27:42 -0800
Message-ID: <588A69CC.7040102@tlinx.org>
Date: Thu, 26 Jan 2017 13:27:40 -0800
From: L A Walsh <bash@tlinx.org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: bug-bash <bug-bash@gnu.org>
Subject: bug in 4.4?
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
	timestamps) [generic] [fuzzy]
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 26 Jan 2017 21:27:50 -0000

If I set bash to complain about uninitialized variables
w/-u, I get inconsistent, and seemingly incorrect behavior:

>  echo $BASH_VERSION
4.4.5(1)-release
>  set -u
>  echo ${undefvar}
bash: undefvar: unbound variable
>  echo ${undefvar[@]}
                                     # no message about unbound var
>  echo ${undefvar}    
bash: undefvar: unbound variable     # -u is still in effect





From MAILER-DAEMON Thu Jan 26 19:53:19 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cWun1-0002vf-F2
	for mharc-bug-bash@gnu.org; Thu, 26 Jan 2017 19:53:19 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:59694)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <grishalevit@gmail.com>) id 1cWumv-0002vM-Jl
	for bug-bash@gnu.org; Thu, 26 Jan 2017 19:53:17 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <grishalevit@gmail.com>) id 1cWumr-0001eW-Gh
	for bug-bash@gnu.org; Thu, 26 Jan 2017 19:53:13 -0500
Received: from mail-ua0-x236.google.com ([2607:f8b0:400c:c08::236]:34959)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <grishalevit@gmail.com>)
	id 1cWumr-0001e4-AX
	for bug-bash@gnu.org; Thu, 26 Jan 2017 19:53:09 -0500
Received: by mail-ua0-x236.google.com with SMTP id y9so196147694uae.2
	for <bug-bash@gnu.org>; Thu, 26 Jan 2017 16:53:07 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc; bh=PBJJP/qqPIl/LQd8YrarqYQ7kQS3tU7P07WIGdlC+fQ=;
	b=R3YUVRyoh34WyDi7wu+cPh62Rkf0bxbDkCRPvNkB0++4t9s/phsEzCbb2WECzHHe4Q
	sjrcJ2lgUFYkAF/BMznVnXbxOBWepameUORhhoeDhQ6LVCc8W2j714mVDPYfya2NEx2q
	BeGzublMSRurWiRhwnTY5QxvKd8KHdoTGLFJWyx2J3uuI4bPASsLMfiacENCTFWJ2vmH
	TkDggv+OCiEqqcU/JIY4mOtOiI7UacI2DxQaCCr6or7+81D3nxFSLCOcsCbStMIUikQZ
	baGwb1SfJ0g8qQ6M23C25CTOu38ycEUMkqmXshwCBoI+SDmf1f3UfFWsGTKdv+xHHrOK
	iQAQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to:cc;
	bh=PBJJP/qqPIl/LQd8YrarqYQ7kQS3tU7P07WIGdlC+fQ=;
	b=Ip6436KWTqvb3LpcZPYIRvmfmALQtH/g1ukI9XT+OrBff3O52ggN5ZIDXPRWlCFLgr
	Bij2fQ0UeU2u2jrfg0QRhL7Sd6k+Pa6+VIiqKuOMNhOT8QjtzW9WR8M7EBqzhnHarWjp
	LSiM8tidJgDG+0VHlUO2X3mi1v63yHNl5BZ5PkSR67ejLk3MpOj8xrlp+eV648OqwSIf
	nSYtCBoVYYl+6D+toT8hd6sHWfo+//L+iYCskIm4LuGuHvezextK3C5L0gMZ090pTbWL
	sOeYdY1O6ZAdqUto1hUMCRZLeoPnW9SNKLEcSikdt2ba0nG8ii9yke5U+RT7eaBTogOd
	OSrQ==
X-Gm-Message-State: AIkVDXJHGk3vbC1nR69y7/O1bn8Wi4Vb3+aKzoZ4TA+Y5vtkUYBTjGRv3l/Z2wK8cf3tfrpRh0WlKP2TIsPuAg==
X-Received: by 10.176.92.21 with SMTP id q21mr2651500uaf.130.1485478387092;
	Thu, 26 Jan 2017 16:53:07 -0800 (PST)
MIME-Version: 1.0
Received: by 10.31.147.207 with HTTP; Thu, 26 Jan 2017 16:53:06 -0800 (PST)
Received: by 10.31.147.207 with HTTP; Thu, 26 Jan 2017 16:53:06 -0800 (PST)
In-Reply-To: <588A69CC.7040102@tlinx.org>
References: <588A69CC.7040102@tlinx.org>
From: Grisha Levit <grishalevit@gmail.com>
Date: Thu, 26 Jan 2017 19:53:06 -0500
Message-ID: <CAMu=BrqqYJ8TwY+fmnq1geAC432vCRn6XVTyW4s1oSmLymQGHA@mail.gmail.com>
Subject: Re: bug in 4.4?
To: Linda Walsh <bash@tlinx.org>
Cc: bug-bash <bug-bash@gnu.org>
Content-Type: multipart/alternative; boundary=f403043612f09595e4054708e351
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2607:f8b0:400c:c08::236
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 27 Jan 2017 00:53:17 -0000

--f403043612f09595e4054708e351
Content-Type: text/plain; charset=UTF-8

This seems to be the following change (from CHANGES)

>



a.  Using ${a[@]} or ${a[*]} with an array without any assigned elements when
    the nounset option is enabled no longer throws an unbound variable error.


This mirrors the behavior of $@.

On Jan 26, 2017 4:28 PM, "L A Walsh" <bash@tlinx.org> wrote:

If I set bash to complain about uninitialized variables
w/-u, I get inconsistent, and seemingly incorrect behavior:

 echo $BASH_VERSION
>
4.4.5(1)-release

>  set -u
>  echo ${undefvar}
>
bash: undefvar: unbound variable

>  echo ${undefvar[@]}
>
                                    # no message about unbound var

>  echo ${undefvar}
>
bash: undefvar: unbound variable     # -u is still in effect

--f403043612f09595e4054708e351
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div>This seems to be the following change (from CHANGES)=
<div dir=3D"auto"><br></div><div dir=3D"auto">&gt;=C2=A0</div><pre style=3D=
"padding:0px;margin-top:0px;margin-bottom:0px;font-size:13.3333px;backgroun=
d-color:rgb(255,255,255)"><code><br>
a.  Using ${a[@]} or ${a[*]} with an array without any assigned elements wh=
en
    the nounset option is enabled no longer throws an unbound variable erro=
r.</code></pre><div dir=3D"auto"><br></div>This mirrors the behavior of $@.=
<br><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Jan 26, 20=
17 4:28 PM, &quot;L A Walsh&quot; &lt;<a href=3D"mailto:bash@tlinx.org">bas=
h@tlinx.org</a>&gt; wrote:<br type=3D"attribution"><blockquote class=3D"quo=
te" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"=
>If I set bash to complain about uninitialized variables<br>
w/-u, I get inconsistent, and seemingly incorrect behavior:<br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
=C2=A0echo $BASH_VERSION<br>
</blockquote>
4.4.5(1)-release<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
=C2=A0set -u<br>
=C2=A0echo ${undefvar}<br>
</blockquote>
bash: undefvar: unbound variable<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
=C2=A0echo ${undefvar[@]}<br>
</blockquote>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # no message about unb=
ound var<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
=C2=A0echo ${undefvar}=C2=A0 =C2=A0 <br>
</blockquote>
bash: undefvar: unbound variable=C2=A0 =C2=A0 =C2=A0# -u is still in effect=
<br>
<br>
<br>
<br>
<br>
</blockquote></div><br></div></div></div>

--f403043612f09595e4054708e351--


From MAILER-DAEMON Thu Jan 26 20:57:43 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cWvnL-0000e8-4u
	for mharc-bug-bash@gnu.org; Thu, 26 Jan 2017 20:57:43 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:38858)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1cWvnI-0000dp-Jk
	for bug-bash@gnu.org; Thu, 26 Jan 2017 20:57:41 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bash@tlinx.org>) id 1cWvnF-0005uE-Kg
	for bug-bash@gnu.org; Thu, 26 Jan 2017 20:57:40 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:55426
	helo=Ishtar.sc.tlinx.org)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <bash@tlinx.org>) id 1cWvnF-0005ts-9p
	for bug-bash@gnu.org; Thu, 26 Jan 2017 20:57:37 -0500
Received: from [192.168.3.12] (Athenae [192.168.3.12])
	by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
	v0R1vTDG087280; Thu, 26 Jan 2017 17:57:31 -0800
Message-ID: <588AA909.2090307@tlinx.org>
Date: Thu, 26 Jan 2017 17:57:29 -0800
From: L A Walsh <bash@tlinx.org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: Grisha Levit <grishalevit@gmail.com>
CC: bug-bash <bug-bash@gnu.org>
Subject: Re: bug in 4.4?
References: <588A69CC.7040102@tlinx.org>
	<CAMu=BrqqYJ8TwY+fmnq1geAC432vCRn6XVTyW4s1oSmLymQGHA@mail.gmail.com>
In-Reply-To: <CAMu=BrqqYJ8TwY+fmnq1geAC432vCRn6XVTyW4s1oSmLymQGHA@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
	timestamps) [generic] [fuzzy]
X-Received-From: 173.164.175.65
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 27 Jan 2017 01:57:42 -0000



Grisha Levit wrote:
> This seems to be the following change (from CHANGES)
>
> > 
> |
>
> a.  Using ${a[@]} or ${a[*]} with an array without any assigned elements when
>     the nounset option is enabled no longer throws an unbound variable error.|
---
    I see...

Tnx!
-l



From MAILER-DAEMON Fri Jan 27 09:02:27 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cX76h-0004II-Iz
	for mharc-bug-bash@gnu.org; Fri, 27 Jan 2017 09:02:27 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:36292)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cX76a-0004DI-Ky
	for bug-bash@gnu.org; Fri, 27 Jan 2017 09:02:25 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cX76V-0002Lh-OB
	for bug-bash@gnu.org; Fri, 27 Jan 2017 09:02:20 -0500
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:6591
	helo=mpv3-2015.case.edu) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cX76V-0002Ld-Iv
	for bug-bash@gnu.org; Fri, 27 Jan 2017 09:02:15 -0500
Received: from mpv7-2015.CWRU.Edu (EHLO mpv7-2015.case.edu) ([129.22.103.242])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AJP21031; Fri, 27 Jan 2017 09:02:03 -0500 (EST)
Received: from h121.182.142.40.ip.windstream.net (EHLO jenna.local)
	([40.142.182.121])
	by mpv7-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id FTL42719 (AUTH cpr);
	Fri, 27 Jan 2017 09:02:03 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: bug in 4.4?
References: <588A69CC.7040102@tlinx.org>
	<CAMu=BrqqYJ8TwY+fmnq1geAC432vCRn6XVTyW4s1oSmLymQGHA@mail.gmail.com>
To: Grisha Levit <grishalevit@gmail.com>, Linda Walsh <bash@tlinx.org>
Cc: chet.ramey@case.edu, bug-bash <bug-bash@gnu.org>
From: Chet Ramey <chet.ramey@case.edu>
Organization: ITS, Case Western Reserve University
Message-ID: <1a783c64-b233-defe-3f53-b85b913133dd@case.edu>
Date: Fri, 27 Jan 2017 09:02:03 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0)
	Gecko/20100101 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <CAMu=BrqqYJ8TwY+fmnq1geAC432vCRn6XVTyW4s1oSmLymQGHA@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv3-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 27 Jan 2017 14:02:25 -0000

On 1/26/17 7:53 PM, Grisha Levit wrote:
> This seems to be the following change (from CHANGES)
> 
>> 
> 
> |
> a. Using ${a[@]} or ${a[*]} with an array without any assigned elements
> when the nounset option is enabled no longer throws an unbound variable error.|
> 
> 
> This mirrors the behavior of $@.

http://lists.gnu.org/archive/html/bug-bash/2016-07/msg00031.html

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


From MAILER-DAEMON Fri Jan 27 11:31:46 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cX9RB-0007dD-U7
	for mharc-bug-bash@gnu.org; Fri, 27 Jan 2017 11:31:45 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:45978)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet@caleb.ins.cwru.edu>) id 1cX9R7-0007aF-2z
	for bug-bash@gnu.org; Fri, 27 Jan 2017 11:31:42 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet@caleb.ins.cwru.edu>) id 1cX9R2-0000su-9L
	for bug-bash@gnu.org; Fri, 27 Jan 2017 11:31:41 -0500
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:42036
	helo=mpv3-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet@caleb.ins.cwru.edu>)
	id 1cX9R2-0000so-2i
	for bug-bash@gnu.org; Fri, 27 Jan 2017 11:31:36 -0500
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AJP31956; Fri, 27 Jan 2017 11:31:34 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AYR09333; Fri, 27 Jan 2017 11:31:34 -0500 (EST)
Received: by caleb.ins.cwru.edu (Postfix, from userid 286)
	id E1E75536ECD; Fri, 27 Jan 2017 11:31:33 -0500 (EST)
Date: Fri, 27 Jan 2017 11:31:05 -0500
From: Chet Ramey <chet.ramey@case.edu>
Sender: chet <chet@caleb.ins.cwru.edu>
To: bug-bash@gnu.org
Subject: Bash-4.4 Official Patch 12
Cc: chet.ramey@case.edu
Reply-To: chet.ramey@case.edu
Message-ID: <170127163105.AA80827.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 mpv3-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 27 Jan 2017 16:31:42 -0000

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

Bash-Release:	4.4
Patch-ID:	bash44-012

Bug-Reported-by:	Clark Wang <dearvoid@gmail.com>
Bug-Reference-ID:	<CADv8-ojttPUFOZXqbjsvy83LfaJtQKZ5qejGdF6j0VJ3vtrYOA@mail.gmail.com>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2016-11/msg00106.html

Bug-Description:

When -N is used, the input is not supposed to be split using $IFS, but
leading and trailing IFS whitespace was still removed.

Patch (apply with `patch -p0'):

*** ../bash-4.4-patched/subst.c	2017-01-20 14:22:01.000000000 -0500
--- subst.c	2017-01-25 13:43:22.000000000 -0500
***************
*** 2826,2834 ****
  /* Parse a single word from STRING, using SEPARATORS to separate fields.
     ENDPTR is set to the first character after the word.  This is used by
!    the `read' builtin.  This is never called with SEPARATORS != $IFS;
!    it should be simplified.
  
     XXX - this function is very similar to list_string; they should be
  	 combined - XXX */
  char *
  get_word_from_string (stringp, separators, endptr)
--- 2826,2838 ----
  /* Parse a single word from STRING, using SEPARATORS to separate fields.
     ENDPTR is set to the first character after the word.  This is used by
!    the `read' builtin.
!    
!    This is never called with SEPARATORS != $IFS, and takes advantage of that.
  
     XXX - this function is very similar to list_string; they should be
  	 combined - XXX */
+ 
+ #define islocalsep(c)	(local_cmap[(unsigned char)(c)] != 0)
+ 
  char *
  get_word_from_string (stringp, separators, endptr)
***************
*** 2838,2841 ****
--- 2842,2846 ----
    char *current_word;
    int sindex, sh_style_split, whitesep, xflags;
+   unsigned char local_cmap[UCHAR_MAX+1];	/* really only need single-byte chars here */
    size_t slen;
  
***************
*** 2847,2854 ****
  				 separators[2] == '\n' &&
  				 separators[3] == '\0';
!   for (xflags = 0, s = ifs_value; s && *s; s++)
      {
        if (*s == CTLESC) xflags |= SX_NOCTLESC;
        if (*s == CTLNUL) xflags |= SX_NOESCCTLNUL;
      }
  
--- 2852,2861 ----
  				 separators[2] == '\n' &&
  				 separators[3] == '\0';
!   memset (local_cmap, '\0', sizeof (local_cmap));
!   for (xflags = 0, s = separators; s && *s; s++)
      {
        if (*s == CTLESC) xflags |= SX_NOCTLESC;
        if (*s == CTLNUL) xflags |= SX_NOESCCTLNUL;
+       local_cmap[(unsigned char)*s] = 1;	/* local charmap of separators */
      }
  
***************
*** 2857,2864 ****
  
    /* Remove sequences of whitespace at the beginning of STRING, as
!      long as those characters appear in IFS. */
!   if (sh_style_split || !separators || !*separators)
      {
!       for (; *s && spctabnl (*s) && isifs (*s); s++);
  
        /* If the string is nothing but whitespace, update it and return. */
--- 2864,2872 ----
  
    /* Remove sequences of whitespace at the beginning of STRING, as
!      long as those characters appear in SEPARATORS.  This happens if
!      SEPARATORS == $' \t\n' or if IFS is unset. */
!   if (sh_style_split || separators == 0)
      {
!       for (; *s && spctabnl (*s) && islocalsep (*s); s++);
  
        /* If the string is nothing but whitespace, update it and return. */
***************
*** 2879,2885 ****
       This obeys the field splitting rules in Posix.2. */
    sindex = 0;
!   /* Don't need string length in ADVANCE_CHAR or string_extract_verbatim
!      unless multibyte chars are possible. */
!   slen = (MB_CUR_MAX > 1) ? STRLEN (s) : 1;
    current_word = string_extract_verbatim (s, slen, &sindex, separators, xflags);
  
--- 2887,2893 ----
       This obeys the field splitting rules in Posix.2. */
    sindex = 0;
!   /* Don't need string length in ADVANCE_CHAR unless multibyte chars are
!      possible, but need it in string_extract_verbatim for bounds checking */
!   slen = STRLEN (s);
    current_word = string_extract_verbatim (s, slen, &sindex, separators, xflags);
  
***************
*** 2900,2904 ****
    /* Now skip sequences of space, tab, or newline characters if they are
       in the list of separators. */
!   while (s[sindex] && spctabnl (s[sindex]) && isifs (s[sindex]))
      sindex++;
  
--- 2908,2912 ----
    /* Now skip sequences of space, tab, or newline characters if they are
       in the list of separators. */
!   while (s[sindex] && spctabnl (s[sindex]) && islocalsep (s[sindex]))
      sindex++;
  
***************
*** 2907,2916 ****
       delimiter, not a separate delimiter that would result in an empty field.
       Look at POSIX.2, 3.6.5, (3)(b). */
!   if (s[sindex] && whitesep && isifs (s[sindex]) && !spctabnl (s[sindex]))
      {
        sindex++;
        /* An IFS character that is not IFS white space, along with any adjacent
  	 IFS white space, shall delimit a field. */
!       while (s[sindex] && spctabnl (s[sindex]) && isifs (s[sindex]))
  	sindex++;
      }
--- 2915,2924 ----
       delimiter, not a separate delimiter that would result in an empty field.
       Look at POSIX.2, 3.6.5, (3)(b). */
!   if (s[sindex] && whitesep && islocalsep (s[sindex]) && !spctabnl (s[sindex]))
      {
        sindex++;
        /* An IFS character that is not IFS white space, along with any adjacent
  	 IFS white space, shall delimit a field. */
!       while (s[sindex] && spctabnl (s[sindex]) && islocalsep(s[sindex]))
  	sindex++;
      }
*** ../bash-4.4/patchlevel.h	2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h	2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 11
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 12
  
  #endif /* _PATCHLEVEL_H_ */

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


From MAILER-DAEMON Mon Jan 30 00:37:47 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cY4ew-0006OS-Sp
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2017 00:37:46 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41790)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bruce.dubbs@gmail.com>) id 1cXzCi-0006PW-SN
	for bug-bash@gnu.org; Sun, 29 Jan 2017 18:48:18 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bruce.dubbs@gmail.com>) id 1cXzCd-0007mr-Tt
	for bug-bash@gnu.org; Sun, 29 Jan 2017 18:48:16 -0500
Received: from mail-oi0-x22a.google.com ([2607:f8b0:4003:c06::22a]:34192)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <bruce.dubbs@gmail.com>)
	id 1cXzCd-0007lM-O9
	for bug-bash@gnu.org; Sun, 29 Jan 2017 18:48:11 -0500
Received: by mail-oi0-x22a.google.com with SMTP id s203so54672509oie.1
	for <bug-bash@gnu.org>; Sun, 29 Jan 2017 15:48:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=to:from:subject:message-id:date:user-agent:mime-version
	:content-transfer-encoding;
	bh=w5JPdpSmsFQ+wWshspURVCs//C5toXqiAJQRocaF9eM=;
	b=j4/wYiTF/O1wNUKyPhPiU0rZTjiFHzu0FNzbVyayjI5wpvKE3ISa8czHmOsJNrLiYE
	r3UTgaBeiFDaXGg5zimnB0bky1dJSDe4v7UFIVon2mRLrY6wvxdV8q0fa9pDssYEDOOp
	PpKOn42BUYxI1C4Q4YVZteDCxhuZIRj2y6OUVZikocYDEAd7iT4zOwPB7dmb8GRf7RIk
	D3liP2akurx2zfz18PV9KQATNMw9FEYb6ZYld8q86Qva6R4+2Bbts18yQgOWc1V8iDT1
	oCOKiBLct1/dKYkROEzVxR9voMRm7TH+UMPVy4qp5+s2xG6TCD2CK5MZLy/rv78x6zxK
	da2Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:to:from:subject:message-id:date:user-agent
	:mime-version:content-transfer-encoding;
	bh=w5JPdpSmsFQ+wWshspURVCs//C5toXqiAJQRocaF9eM=;
	b=RvnJukAtTPzKsda4nrYPYtre/hO6HDxAUbFPC8oM0Y1hOtKZxdoPGvj8tNmakWuub2
	+smfAQapmM12+zenewnqy8A2SGiBN3hQq/UddwcffqpZm6k0jCLPCjI43UlHddQwk1Bx
	eR0xA/YMv+/uaXRTGMnTk5FCczfm/NiMZ9tm0GoHPaQBX7DhF9LfZdgccMS9I9TFnbmP
	M96JbQjohFVK+w3d37OZVrlSQqLSThHEAw6QQaWOZ5CeDufM6Tf1N2eXStVbUBfYJ7Xm
	SrENmzHTWRkqs7vjZj9t9y9/dd+9aeSpjYMsrjlqmDWo04msmhsvem2P4xvl5N1vckoJ
	QCgg==
X-Gm-Message-State: AIkVDXLbt1vTI4diXvireRR4UxAYGgolHDoAv7P2oZv31sjy7HD0msh/SukQtxOMOyN7Ag==
X-Received: by 10.202.214.18 with SMTP id n18mr9618952oig.201.1485733689210;
	Sun, 29 Jan 2017 15:48:09 -0800 (PST)
Received: from [192.168.0.76] (cpe-70-123-244-133.satx.res.rr.com.
	[70.123.244.133]) by smtp.gmail.com with ESMTPSA id
	s11sm6168522oif.16.2017.01.29.15.48.08 for <bug-bash@gnu.org>
	(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Sun, 29 Jan 2017 15:48:08 -0800 (PST)
To: bug-bash@gnu.org
From: Bruce Dubbs <bruce.dubbs@gmail.com>
Subject: Memory leaks in bash-4.4.0
Message-ID: <588E7F38.2050209@gmail.com>
Date: Sun, 29 Jan 2017 17:48:08 -0600
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101
	Firefox/42.0 SeaMonkey/2.39
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2607:f8b0:4003:c06::22a
X-Mailman-Approved-At: Mon, 30 Jan 2017 00:37:45 -0500
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 29 Jan 2017 23:48:18 -0000

onfiguration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' 
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' 
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -g -O2
uname output: Linux lfs78 4.4.0-lfs-SVN-20160112 #1 SMP Tue Jan 12 
00:17:11 CST 2016 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

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

Description:

    When running regression tests on libinput, I get two different leaks
identified by valgrind. The files below are not a part of libinput but are 
a part of bash.


    ==10733== 11 bytes in 1 blocks are definitely lost in loss record 81 
of 290
    ==10733==    at 0x4C2AACD: malloc (vg_replace_malloc.c:299)
    ==10733==    by 0x46F7BD: xmalloc (xmalloc.c:112)
    ==10733==    by 0x469598: set_default_locale (locale.c:81)
    ==10733==    by 0x419950: main (shell.c:411)
    ==10733==
    ==10733== 17 bytes in 1 blocks are definitely lost in loss record 112 
of 290
    ==10733==    at 0x4C2AACD: malloc (vg_replace_malloc.c:299)
    ==10733==    by 0x46F7BD: xmalloc (xmalloc.c:112)
    ==10733==    by 0x4524EA: make_dev_fd_filename (subst.c:5692)
    ==10733==    by 0x4524EA: process_substitute (subst.c:5751)
    ==10733==    by 0x4524EA: expand_word_internal (subst.c:9172)
    ==10733==    by 0x454E33: shell_expand_word_list (subst.c:10565)
    ==10733==    by 0x454E33: expand_word_list_internal (subst.c:10688)
    ==10733==    by 0x42F14E: execute_simple_command (execute_cmd.c:4153)
    ==10733==    by 0x43134B: execute_command_internal (execute_cmd.c:802)
    ==10733==    by 0x432BDD: execute_command (execute_cmd.c:405)
    ==10733==    by 0x41BD51: reader_loop (eval.c:180)
    ==10733==    by 0x41AAAA: main (shell.c:792)

I was not able to trace everything through, but xmalloc.c:112 does:

   temp = malloc (bytes);

and as best I can tell, temp is never freed.


Repeat-By:
    When building libinput, after make, run 'make check'


From MAILER-DAEMON Mon Jan 30 10:33:59 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cYDxv-00043I-10
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2017 10:33:59 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:39102)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cYDxs-00040p-7D
	for bug-bash@gnu.org; Mon, 30 Jan 2017 10:33:57 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cYDxn-0004Sp-88
	for bug-bash@gnu.org; Mon, 30 Jan 2017 10:33:56 -0500
Received: from mpv3-2015.cwru.edu ([129.22.103.194]:27497
	helo=mpv3-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1cYDxn-0004Rn-3G
	for bug-bash@gnu.org; Mon, 30 Jan 2017 10:33:51 -0500
Received: from mpv5-2015.CWRU.Edu (EHLO mpv5-2015.case.edu) ([129.22.103.234])
	by mpv3-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AJQ16167; Mon, 30 Jan 2017 10:33:48 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv5-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AYU02587 (AUTH cpr);
	Mon, 30 Jan 2017 10:33:48 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: Memory leaks in bash-4.4.0
References: <588E7F38.2050209@gmail.com>
To: Bruce Dubbs <bruce.dubbs@gmail.com>, bug-bash@gnu.org
Cc: chet.ramey@case.edu
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <16034d1c-4fa2-4241-f5a2-490487f717a8@case.edu>
Date: Mon, 30 Jan 2017 10:33:48 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0)
	Gecko/20100101 Thunderbird/45.7.0
MIME-Version: 1.0
In-Reply-To: <588E7F38.2050209@gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv3-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.194
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 30 Jan 2017 15:33:57 -0000

On 1/29/17 6:48 PM, Bruce Dubbs wrote:

> Bash Version: 4.4
> Patch Level: 0
> Release Status: release
> 
> Description:
> 
>    When running regression tests on libinput, I get two different leaks
> identified by valgrind. The files below are not a part of libinput but are
> a part of bash.

What is libinput?

>    ==10733== 11 bytes in 1 blocks are definitely lost in loss record 81 of 290
>    ==10733==    at 0x4C2AACD: malloc (vg_replace_malloc.c:299)
>    ==10733==    by 0x46F7BD: xmalloc (xmalloc.c:112)
>    ==10733==    by 0x469598: set_default_locale (locale.c:81)
>    ==10733==    by 0x419950: main (shell.c:411)
>    ==10733==

http://lists.gnu.org/archive/html/bug-bash/2015-07/msg00073.html

>    ==10733== 17 bytes in 1 blocks are definitely lost in loss record 112 of
> 290
>    ==10733==    at 0x4C2AACD: malloc (vg_replace_malloc.c:299)
>    ==10733==    by 0x46F7BD: xmalloc (xmalloc.c:112)
>    ==10733==    by 0x4524EA: make_dev_fd_filename (subst.c:5692)
>    ==10733==    by 0x4524EA: process_substitute (subst.c:5751)
>    ==10733==    by 0x4524EA: expand_word_internal (subst.c:9172)
>    ==10733==    by 0x454E33: shell_expand_word_list (subst.c:10565)
>    ==10733==    by 0x454E33: expand_word_list_internal (subst.c:10688)
>    ==10733==    by 0x42F14E: execute_simple_command (execute_cmd.c:4153)
>    ==10733==    by 0x43134B: execute_command_internal (execute_cmd.c:802)
>    ==10733==    by 0x432BDD: execute_command (execute_cmd.c:405)
>    ==10733==    by 0x41BD51: reader_loop (eval.c:180)
>    ==10733==    by 0x41AAAA: main (shell.c:792)

It would help if there were a short reproducer for this, so I can verify
it.

> I was not able to trace everything through, but xmalloc.c:112 does:
> 
>   temp = malloc (bytes);
> 
> and as best I can tell, temp is never freed.

xmalloc is a malloc wrapper, and `temp' is the return value from the
function.

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


From MAILER-DAEMON Mon Jan 30 10:35:21 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cYDzF-0005Oc-AV
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2017 10:35:21 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:39549)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <naddy@mips.inka.de>) id 1cYDz9-0005C1-Tk
	for bug-bash@gnu.org; Mon, 30 Jan 2017 10:35:19 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <naddy@mips.inka.de>) id 1cYDz4-00055r-UD
	for bug-bash@gnu.org; Mon, 30 Jan 2017 10:35:15 -0500
Received: from quechua.inka.de ([193.197.184.2]:43898 helo=mail.inka.de)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <naddy@mips.inka.de>) id 1cYDz4-000530-O5
	for bug-bash@gnu.org; Mon, 30 Jan 2017 10:35:10 -0500
Received: from mips.inka.de (naddy@[127.0.0.1])
	by mail.inka.de with uucp (rmailwrap 0.5) 
	id 1cYDz0-0001Hp-Gr; Mon, 30 Jan 2017 16:35:06 +0100
Received: from lorvorc.mips.inka.de (localhost [127.0.0.1])
	by lorvorc.mips.inka.de (8.15.2/8.15.2) with ESMTP id v0UFVl4I087091
	for <bug-bash@gnu.org>; Mon, 30 Jan 2017 16:31:47 +0100 (CET)
	(envelope-from naddy@lorvorc.mips.inka.de)
Received: (from naddy@localhost)
	by lorvorc.mips.inka.de (8.15.2/8.15.2/Submit) id v0UFVl5F087090
	for bug-bash@gnu.org; Mon, 30 Jan 2017 16:31:47 +0100 (CET)
	(envelope-from naddy)
Date: Mon, 30 Jan 2017 16:31:47 +0100
From: Christian Weisgerber <naddy@mips.inka.de>
To: bug-bash@gnu.org
Subject: $$'...' parsing bug?
Message-ID: <20170130153147.GA86925@lorvorc.mips.inka.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.7.2 (2016-11-26)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 193.197.184.2
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 30 Jan 2017 15:35:19 -0000

This came up on comp.unix.shell: 
There appears to be a parsing problem in bash where the sequence
$$'...' is treated as $'...', and $$"..." as $"...", when inside
$(...).

$ echo 'x\nx'
x\nx
$ echo $'x\nx'
x
x     
$ echo $$'x\nx'
86293x\nx
$ echo $(echo $'x\nx')
x x
$ echo $(echo $$'x\nx')
x x

This is with bash 4.4.12... but a quick check shows the same behavior
with 4.2.37.
-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de


From MAILER-DAEMON Mon Jan 30 14:35:03 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cYHjD-0004Hy-B7
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2017 14:35:03 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41777)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bruce.dubbs@gmail.com>) id 1cYHj6-0004CX-Mq
	for bug-bash@gnu.org; Mon, 30 Jan 2017 14:35:01 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bruce.dubbs@gmail.com>) id 1cYHj1-0002FQ-Ro
	for bug-bash@gnu.org; Mon, 30 Jan 2017 14:34:56 -0500
Received: from mail-oi0-x230.google.com ([2607:f8b0:4003:c06::230]:34045)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <bruce.dubbs@gmail.com>)
	id 1cYHj1-0002FI-LN
	for bug-bash@gnu.org; Mon, 30 Jan 2017 14:34:51 -0500
Received: by mail-oi0-x230.google.com with SMTP id s203so69396658oie.1
	for <bug-bash@gnu.org>; Mon, 30 Jan 2017 11:34:51 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=subject:to:references:from:message-id:date:user-agent:mime-version
	:in-reply-to:content-transfer-encoding;
	bh=A1LfEf9GHOHOZFAOwDSiiAlrwGp6Azn8iEKXWyOmrDQ=;
	b=C1bznHgPF6OC2JbqYSsM3f+R50wHRDPNoiOYoSc3sRvfjZx56Rwg0/Wpd+GnpzVdu6
	wtK7kaoDT7Z0QmkTVim2WHJ4TWewfnYwC8NETzKyP2W4ncL1s55zCyozVEV/gJpMhne4
	TZrZhV9sV5oztz6j8r9bk+zxKL0fK15V7aDcQaefQTE3vtMRCJGG0YoYMnyqFmwoJDwz
	y0we4vL5SI+DL30V605Na5lHKlmUfuMFjiBNRJ/1F14alrbNDjis/3EF2fdzFbV9iFvv
	C1CGW/JHoj2mN4J67AJbZcRz0Hy58bWReMnWQei5xw+Ark4Zr7nWLQSrlIo0909RLKpU
	REBg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:subject:to:references:from:message-id:date
	:user-agent:mime-version:in-reply-to:content-transfer-encoding;
	bh=A1LfEf9GHOHOZFAOwDSiiAlrwGp6Azn8iEKXWyOmrDQ=;
	b=QYtZThODi2+4wqRAAnRD2jTOEWtX6VJk9rIVVNq09zi8G1UzyPy75WnEAcmWX7h9zn
	dLw+p6bf+D+0VXY6ze1b1dbm/cuf1qwvU67004vNUpT9k7cpzozcYIZgNYyZAYYe66nu
	Y6zJvh1plMitG6xn+htlwawhaQQsmUdkARoRFUMscS5udr1/GSXSgGeUEJabG2rNYrzC
	YhaQb0BSwa67vzDEteF8nA1Etn5SsgkgeNFOjJuu8qz3ysDjTBqC8iptW9tWpLpdU9LE
	jy/vRJ0Havlvpndg5IVBLjO2Hcj5eSEKLgenZFJ+FBriCjnRACuQMx3uIyko9utRhEhn
	YgOA==
X-Gm-Message-State: AIkVDXJ6vylVuU+qIRXiCmYqnCYz22fNz/KTaQw+Y6qmjEwRQ4udZxxxSgEL1RkTo/KndQ==
X-Received: by 10.202.102.71 with SMTP id a68mr12223017oic.106.1485804890876; 
	Mon, 30 Jan 2017 11:34:50 -0800 (PST)
Received: from [192.168.0.76] (cpe-70-123-244-133.satx.res.rr.com.
	[70.123.244.133]) by smtp.gmail.com with ESMTPSA id
	t40sm7498802ota.18.2017.01.30.11.34.50
	(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Mon, 30 Jan 2017 11:34:50 -0800 (PST)
Subject: Re: Memory leaks in bash-4.4.0
To: chet.ramey@case.edu, bug-bash@gnu.org
References: <588E7F38.2050209@gmail.com>
	<16034d1c-4fa2-4241-f5a2-490487f717a8@case.edu>
From: Bruce Dubbs <bruce.dubbs@gmail.com>
Message-ID: <588F9559.3090803@gmail.com>
Date: Mon, 30 Jan 2017 13:34:49 -0600
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101
	Firefox/42.0 SeaMonkey/2.39
MIME-Version: 1.0
In-Reply-To: <16034d1c-4fa2-4241-f5a2-490487f717a8@case.edu>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2607:f8b0:4003:c06::230
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 30 Jan 2017 19:35:01 -0000

Chet Ramey wrote:
> On 1/29/17 6:48 PM, Bruce Dubbs wrote:
>
>> Bash Version: 4.4
>> Patch Level: 0
>> Release Status: release
>>
>> Description:
>>
>>     When running regression tests on libinput, I get two different leaks
>> identified by valgrind. The files below are not a part of libinput but are
>> a part of bash.
>
> What is libinput?

https://www.freedesktop.org/software/libinput/

>>     ==10733== 11 bytes in 1 blocks are definitely lost in loss record 81 of 290
>>     ==10733==    at 0x4C2AACD: malloc (vg_replace_malloc.c:299)
>>     ==10733==    by 0x46F7BD: xmalloc (xmalloc.c:112)
>>     ==10733==    by 0x469598: set_default_locale (locale.c:81)
>>     ==10733==    by 0x419950: main (shell.c:411)
>>     ==10733==
>
> http://lists.gnu.org/archive/html/bug-bash/2015-07/msg00073.html
>
>>     ==10733== 17 bytes in 1 blocks are definitely lost in loss record 112 of
>> 290
>>     ==10733==    at 0x4C2AACD: malloc (vg_replace_malloc.c:299)
>>     ==10733==    by 0x46F7BD: xmalloc (xmalloc.c:112)
>>     ==10733==    by 0x4524EA: make_dev_fd_filename (subst.c:5692)
>>     ==10733==    by 0x4524EA: process_substitute (subst.c:5751)
>>     ==10733==    by 0x4524EA: expand_word_internal (subst.c:9172)
>>     ==10733==    by 0x454E33: shell_expand_word_list (subst.c:10565)
>>     ==10733==    by 0x454E33: expand_word_list_internal (subst.c:10688)
>>     ==10733==    by 0x42F14E: execute_simple_command (execute_cmd.c:4153)
>>     ==10733==    by 0x43134B: execute_command_internal (execute_cmd.c:802)
>>     ==10733==    by 0x432BDD: execute_command (execute_cmd.c:405)
>>     ==10733==    by 0x41BD51: reader_loop (eval.c:180)
>>     ==10733==    by 0x41AAAA: main (shell.c:792)
>
> It would help if there were a short reproducer for this, so I can verify
> it.

I'll see what I can do.

>> I was not able to trace everything through, but xmalloc.c:112 does:
>>
>>    temp = malloc (bytes);
>>
>> and as best I can tell, temp is never freed.
>
> xmalloc is a malloc wrapper, and `temp' is the return value from the
> function.

Yes, I know.  The issue is that the caller, in this case 
set_default_locale or possibly main, never runs free on the allocated 
space.  I tried to trace it in set_default_locale but there are a lot of 
paths and I didn't follow it all.  I'll look some more and get back to you.

   -- Bruce



From MAILER-DAEMON Mon Jan 30 15:08:30 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cYIFa-0000nm-5y
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2017 15:08:30 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:51214)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cYIFX-0000m7-I5
	for bug-bash@gnu.org; Mon, 30 Jan 2017 15:08:29 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cYIFU-00032K-DG
	for bug-bash@gnu.org; Mon, 30 Jan 2017 15:08:27 -0500
Received: from mpv1-2015.cwru.edu ([129.22.103.226]:60445
	helo=mpv1-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1cYIFU-00031k-8L
	for bug-bash@gnu.org; Mon, 30 Jan 2017 15:08:24 -0500
Received: from mpv6-2015.CWRU.Edu (EHLO mpv6-2015.case.edu) ([129.22.103.202])
	by mpv1-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AKQ24511; Mon, 30 Jan 2017 15:08:22 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AYM41152 (AUTH cpr);
	Mon, 30 Jan 2017 15:08:22 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: Memory leaks in bash-4.4.0
References: <588E7F38.2050209@gmail.com>
	<16034d1c-4fa2-4241-f5a2-490487f717a8@case.edu>
	<588F9559.3090803@gmail.com>
To: Bruce Dubbs <bruce.dubbs@gmail.com>, bug-bash@gnu.org
Cc: chet.ramey@case.edu
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <1a3c4b73-7a94-7656-f551-b743eb27341b@case.edu>
Date: Mon, 30 Jan 2017 15:08:20 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0)
	Gecko/20100101 Thunderbird/45.7.0
MIME-Version: 1.0
In-Reply-To: <588F9559.3090803@gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Junkmail-Whitelist: YES (by domain whitelist at mpv1-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.226
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 30 Jan 2017 20:08:29 -0000

On 1/30/17 2:34 PM, Bruce Dubbs wrote:

>> xmalloc is a malloc wrapper, and `temp' is the return value from the
>> function.
> 
> Yes, I know.  The issue is that the caller, in this case set_default_locale
> or possibly main, never runs free on the allocated space.  I tried to trace
> it in set_default_locale but there are a lot of paths and I didn't follow
> it all.  I'll look some more and get back to you.

Look at the link I included in my first reply; it explains the
set_default_locale/setlocale issue.

Chet

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


From MAILER-DAEMON Mon Jan 30 15:50:47 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cYIuU-0001OP-Ug
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2017 15:50:46 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:59032)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cYIuR-0001MO-Vs
	for bug-bash@gnu.org; Mon, 30 Jan 2017 15:50:45 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <chet.ramey@case.edu>) id 1cYIuN-0004sy-Fv
	for bug-bash@gnu.org; Mon, 30 Jan 2017 15:50:44 -0500
Received: from mpv4-2015.cwru.edu ([129.22.103.195]:42685
	helo=mpv4-2015.case.edu)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <chet.ramey@case.edu>) id 1cYIuN-0004sh-9Y
	for bug-bash@gnu.org; Mon, 30 Jan 2017 15:50:39 -0500
Received: from mpv6-2015.CWRU.Edu (EHLO mpv6-2015.case.edu) ([129.22.103.202])
	by mpv4-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AJL36189; Mon, 30 Jan 2017 15:50:33 -0500 (EST)
Received: from caleb.INS.CWRU.Edu (EHLO caleb.ins.cwru.edu) ([129.22.8.211])
	by mpv6-2015.case.edu (MOS 4.4.7-GA FastPath queued)
	with ESMTP id AYM51011 (AUTH cpr);
	Mon, 30 Jan 2017 15:50:32 -0500 (EST)
Reply-To: chet.ramey@case.edu
Subject: Re: $$'...' parsing bug?
References: <20170130153147.GA86925@lorvorc.mips.inka.de>
To: Christian Weisgerber <naddy@mips.inka.de>, bug-bash@gnu.org
Cc: chet.ramey@case.edu
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <0c8d15d1-0d96-9046-c672-5f01374028be@case.edu>
Date: Mon, 30 Jan 2017 15:50:31 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0)
	Gecko/20100101 Thunderbird/45.7.0
MIME-Version: 1.0
In-Reply-To: <20170130153147.GA86925@lorvorc.mips.inka.de>
Content-Type: multipart/mixed; boundary="------------B650EA6112DB4B560975AD28"
X-Junkmail-Whitelist: YES (by domain whitelist at mpv4-2015.case.edu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
	[fuzzy]
X-Received-From: 129.22.103.195
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 30 Jan 2017 20:50:45 -0000

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

On 1/30/17 10:31 AM, Christian Weisgerber wrote:
> This came up on comp.unix.shell: 
> There appears to be a parsing problem in bash where the sequence
> $$'...' is treated as $'...', and $$"..." as $"...", when inside
> $(...).

Yes, this is a problem.  Thanks for the report. I've attached a one-line
patch that fixes it.

Chet

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

--------------B650EA6112DB4B560975AD28
Content-Type: application/x-patch;
 name="parse-comsub-wasdol.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="parse-comsub-wasdol.patch"

KioqIC4uL2Jhc2gtNC40LXBhdGNoZWQvcGFyc2UueQkyMDE2LTA5LTExIDExOjMxOjQ2LjAw
MDAwMDAwMCAtMDQwMAotLS0gcGFyc2UueQkyMDE3LTAxLTMwIDEzOjUzOjQyLjAwMDAwMDAw
MCAtMDUwMAoqKioqKioqKioqKioqKioKKioqIDQxOTEsNDE5NSAqKioqCiAgCSAgRlJFRSAo
bmVzdHJldCk7CiAgCX0KISAgICAgICBpZiBNQlRFU1QoY2ggPT0gJyQnKQogIAl0ZmxhZ3Mg
fD0gTEVYX1dBU0RPTDsKICAgICAgICBlbHNlCi0tLSA0MjEzLDQyMTcgLS0tLQogIAkgIEZS
RUUgKG5lc3RyZXQpOwogIAl9CiEgICAgICAgaWYgTUJURVNUKGNoID09ICckJyAmJiAodGZs
YWdzICYgTEVYX1dBU0RPTCkgPT0gMCkKICAJdGZsYWdzIHw9IExFWF9XQVNET0w7CiAgICAg
ICAgZWxzZQo=
--------------B650EA6112DB4B560975AD28--



From MAILER-DAEMON Mon Jan 30 21:14:02 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cYNxK-0004OI-9E
	for mharc-bug-bash@gnu.org; Mon, 30 Jan 2017 21:14:02 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:59346)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1cYNxH-0004Nv-8R
	for bug-bash@gnu.org; Mon, 30 Jan 2017 21:14:00 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1cYNxE-0000DA-3t
	for bug-bash@gnu.org; Mon, 30 Jan 2017 21:13:59 -0500
Received: from hapkido.dreamhost.com ([66.33.216.122]:38272)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <jidanni@jidanni.org>) id 1cYNxD-0000Ba-RX
	for bug-bash@gnu.org; Mon, 30 Jan 2017 21:13:56 -0500
Received: from homiemail-a37.g.dreamhost.com (homie.mail.dreamhost.com
	[208.97.132.208])
	by hapkido.dreamhost.com (Postfix) with ESMTP id 053F692067
	for <bug-bash@gnu.org>; Mon, 30 Jan 2017 18:13:53 -0800 (PST)
Received: from homiemail-a37.g.dreamhost.com (localhost [127.0.0.1])
	by homiemail-a37.g.dreamhost.com (Postfix) with ESMTP id 362D520806F
	for <bug-bash@gnu.org>; Mon, 30 Jan 2017 18:13:51 -0800 (PST)
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=RLuyc8E11j2fmFNWAS8WO9LISvE=; b=Cdaw5T+U/xYVLwjl
	WUGS86BsIfs4hN4EKvEvdB1uHyWnzxsnPowpEGjHdUglBvilCD19MqjYvrfhv4bA
	iplj+eBc/BxOorrf04dCpvGUGqgRcrvbhvHSuISVUIDT746SzHBaM7DXnysinkmO
	9o0RJPFe1s714SWOufsx8qXaYOI=
Received: from jidanni.org (114-26-45-43.dynamic.hinet.net [114.26.45.43])
	(using TLSv1 with cipher AES256-SHA (256/256 bits))
	(No client certificate requested)
	(Authenticated sender: jidanni@jidanni.org)
	by homiemail-a37.g.dreamhost.com (Postfix) with ESMTPSA id DFC9820806E
	for <bug-bash@gnu.org>; Mon, 30 Jan 2017 18:13:50 -0800 (PST)
From: =?utf-8?B?56mN5Li55bC8?= Dan Jacobson <jidanni@jidanni.org>
To: bug-bash@gnu.org
Subject: history vs. poweroff
Date: Tue, 31 Jan 2017 10:13:46 +0800
Message-ID: <87k29c7z8l.fsf@jidanni.org>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy]
X-Received-From: 66.33.216.122
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 31 Jan 2017 02:14:00 -0000

Man page says:
 When a shell with history enabled exits...

 and

 The shell exits by default upon receipt of a SIGHUP...

However on slower systems, at the end of the day when the user issues
the poweroff(8) command, all this might not complete, resulting in the
entire day's of history getting thrown away.

So perhaps on the man page add a word of caution.

I even had to write a batch(1) script to stop (killall -1) my shells,
then X-Windows, then finally poweroff. (a simple nohup script wasn't
enough.)

(But doing export PROMPT_COMMAND='history -a' is overkill).


From MAILER-DAEMON Tue Jan 31 07:28:29 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cYXXx-0001KV-8a
	for mharc-bug-bash@gnu.org; Tue, 31 Jan 2017 07:28:29 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:47681)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <nforro@redhat.com>) id 1cYXXt-0001IL-9J
	for bug-bash@gnu.org; Tue, 31 Jan 2017 07:28:27 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <nforro@redhat.com>) id 1cYXXr-0005ra-D6
	for bug-bash@gnu.org; Tue, 31 Jan 2017 07:28:25 -0500
Received: from mx1.redhat.com ([209.132.183.28]:55574)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <nforro@redhat.com>) id 1cYXXr-0005r9-4h
	for bug-bash@gnu.org; Tue, 31 Jan 2017 07:28:23 -0500
Received: from int-mx14.intmail.prod.int.phx2.redhat.com
	(int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by mx1.redhat.com (Postfix) with ESMTPS id CA4B380F90
	for <bug-bash@gnu.org>; Tue, 31 Jan 2017 12:28:22 +0000 (UTC)
Received: from unused-4-153.brq.redhat.com (unused-4-153.brq.redhat.com
	[10.34.4.153])
	by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id v0VCSKth006871
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256
	verify=NO) for <bug-bash@gnu.org>; Tue, 31 Jan 2017 07:28:21 -0500
Message-ID: <1485865699.10716.3.camel@redhat.com>
Subject: [PATCH v2] doc/bash.1: fix references to sections not present in
	builtins.1
From: Nikola =?ISO-8859-1?Q?Forr=F3?= <nforro@redhat.com>
Reply-To: nforro@redhat.com
To: bug-bash@gnu.org
Date: Tue, 31 Jan 2017 13:28:19 +0100
In-Reply-To: <1466079989.2236.3.camel@redhat.com>
References: <1466079989.2236.3.camel@redhat.com>
Organization: Red Hat
Content-Type: text/plain; charset="UTF-8"
Mime-Version: 1.0
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
	(mx1.redhat.com [10.5.110.27]);
	Tue, 31 Jan 2017 12:28:22 +0000 (UTC)
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 209.132.183.28
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 31 Jan 2017 12:28:27 -0000

When SHELL BUILTIN COMMANDS section from bash.1 is included into
builtins.1, references to other sections in bash.1 become invalid.

This patch adds conditions to make those references refer
to bash(1) in case builtins.1 man page is viewed.

Signed-off-by: Nikola Forr=C3=B3 <nforro@redhat.com>
---
I've updated the patch to apply cleanly on current master.
Can it be merged?

 doc/bash.1 | 194 ++++++++++++++++++++++++++++++++++++++++++++++++++-----=
------
 1 file changed, 161 insertions(+), 33 deletions(-)

diff --git a/doc/bash.1 b/doc/bash.1
index 9a7a384..4d8978c 100644
--- a/doc/bash.1
+++ b/doc/bash.1
@@ -7441,7 +7441,12 @@ apply to ``empty'' command completion; that is, co=
mpletion attempted on a
 blank line.
 .sp 1
 The process of applying these completion specifications when word comple=
tion
-is attempted is described above under \fBProgrammable Completion\fP.
+is attempted is described
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)
+\}
+.el above
+under \fBProgrammable Completion\fP.
 .sp 1
 Other options, if specified, have the following meanings.
 The arguments to the \fB\-G\fP, \fB\-W\fP, and \fB\-X\fP options
@@ -7712,12 +7717,18 @@ to give variables attributes:
 .B \-a
 Each \fIname\fP is an indexed array variable (see
 .B Arrays
-above).
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)).
+\}
+.el above).
 .TP
 .B \-A
 Each \fIname\fP is an associative array variable (see
 .B Arrays
-above).
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)).
+\}
+.el above).
 .TP
 .B \-f
 Use function names only.
@@ -7726,7 +7737,11 @@ Use function names only.
 The variable is treated as an integer; arithmetic evaluation (see
 .SM
 .B "ARITHMETIC EVALUATION"
-above) is performed when the variable is assigned a value.
+.ie \n(zZ=3D1 \{ in
+.BR bash (1))
+\}
+.el above)
+is performed when the variable is assigned a value.
 .TP
 .B \-l
 When the variable is assigned a value, all upper-case characters are
@@ -7789,7 +7804,11 @@ an attempt is made to assign a value to a readonly=
 variable,
 an attempt is made to assign a value to an array variable without
 using the compound assignment syntax (see
 .B Arrays
-above), one of the \fInames\fP is not a valid shell variable name,
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)),
+\}
+.el above),
+one of the \fInames\fP is not a valid shell variable name,
 an attempt is made to turn off readonly status for a readonly variable,
 an attempt is made to turn off array status for an array variable,
 or an attempt is made to display a non-existent function with \fB\-f\fP.
@@ -8546,7 +8565,10 @@ Each
 is an arithmetic expression to be evaluated (see
 .SM
 .B "ARITHMETIC EVALUATION"
-above).
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)).
+\}
+.el above).
 If the last
 .I arg
 evaluates to 0,
@@ -8846,7 +8868,12 @@ The characters in
 .SM
 .B IFS
 are used to split the line into words using the same rules the shell
-uses for expansion (described above under \fBWord Splitting\fP).
+uses for expansion (described
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)
+\}
+.el above
+under \fBWord Splitting\fP).
 The backslash character (\fB\e\fP) may be used to remove any special
 meaning for the next character read and for line continuation.
 Options, if supplied, have the following meanings:
@@ -8873,7 +8900,11 @@ is coming from a terminal,
 (see
 .SM
 .B READLINE
-above) is used to obtain the line.
+.ie \n(zZ=3D1 \{ in
+.BR bash (1))
+\}
+.el above)
+is used to obtain the line.
 Readline uses the current (or default, if line editing was not previousl=
y
 active) editing settings.
 .TP
@@ -9059,7 +9090,11 @@ or a \fIcompound command\fP
 (see
 .SM
 .B SHELL GRAMMAR
-above), exits with a non-zero status.
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)),
+\}
+.el above),
+exits with a non-zero status.
 The shell does not exit if the
 command that fails is part of the command list immediately following a
 .B while
@@ -9087,7 +9122,11 @@ This option applies to the shell environment and e=
ach subshell environment
 separately (see
 .SM
 .B "COMMAND EXECUTION ENVIRONMENT"
-above), and may cause
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)),
+\}
+.el above),
+and may cause
 subshells to exit before executing all the commands in the subshell.
 .if t .sp 0.5
 .if n .sp 1
@@ -9119,7 +9158,10 @@ by default for interactive shells on systems that =
support
 it (see
 .SM
 .B JOB CONTROL
-above).
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)).
+\}
+.el above).
 All processes run in a separate process group.
 When a background job completes, the shell prints a line
 containing its exit status.
@@ -9170,7 +9212,12 @@ Same as
 .BR \-H .
 .TP 8
 .B history
-Enable command history, as described above under
+Enable command history, as described
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)
+\}
+.el above
+under
 .SM
 .BR HISTORY .
 This option is on by default in interactive shells.
@@ -9182,7 +9229,10 @@ The effect is as if the shell command
 had been executed
 (see
 .B Shell Variables
-above).
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)).
+\}
+.el above).
 .TP 8
 .B keyword
 Same as
@@ -9237,7 +9287,11 @@ from the POSIX standard to match the standard (\fI=
posix mode\fP).
 See
 .SM
 .B "SEE ALSO"
-below for a reference to a document that details how posix mode affects
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)
+\}
+.el below
+for a reference to a document that details how posix mode affects
 bash's behavior.
 .TP 8
 .B privileged
@@ -9323,7 +9377,11 @@ or associated word list.
 .B \-B
 The shell performs brace expansion (see
 .B Brace Expansion
-above).  This is on by default.
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)).
+\}
+.el above).
+This is on by default.
 .TP 8
 .B \-C
 If set,
@@ -9509,7 +9567,11 @@ the exit to be deferred until a second exit is att=
empted without an
 intervening command (see
 .SM
 .B "JOB CONTROL"
-above).  The shell always
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)).
+\}
+.el above).
+The shell always
 postpones exiting if any jobs are stopped.
 .TP 8
 .B checkwinsize
@@ -9638,7 +9700,12 @@ builtin command.  An interactive shell does not ex=
it if
 fails.
 .TP 8
 .B expand_aliases
-If set, aliases are expanded as described above under
+If set, aliases are expanded as described
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)
+\}
+.el above
+under
 .SM
 .BR ALIASES .
 This option is enabled by default for interactive shells.
@@ -9670,7 +9737,11 @@ a call to \fBreturn\fP.
 and
 .SM
 .B BASH_ARGV
-are updated as described in their descriptions above.
+are updated as described in their descriptions
+.ie \n(zZ=3D1 \{ in
+.BR bash (1).
+\}
+.el above.
 .TP
 .B 5.
 Function tracing is enabled: command substitution, shell functions, and
@@ -9684,7 +9755,12 @@ subshells invoked with \fB(\fP \fIcommand\fP \fB)\=
fP inherit the
 .RE
 .TP 8
 .B extglob
-If set, the extended pattern matching features described above under
+If set, the extended pattern matching features described
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)
+\}
+.el above
+under
 \fBPathname Expansion\fP are enabled.
 .TP 8
 .B extquote
@@ -9706,7 +9782,11 @@ the ignored words are the only possible completion=
s.
 See
 .SM
 \fBSHELL VARIABLES\fP
-above for a description of
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)
+\}
+.el above
+for a description of
 .SM
 .BR FIGNORE .
 This option is enabled by default.
@@ -9715,7 +9795,11 @@ This option is enabled by default.
 If set, range expressions used in pattern matching bracket expressions (=
see
 .SM
 .B Pattern Matching
-above) behave as if in the traditional C locale when performing
+.ie \n(zZ=3D1 \{ in
+.BR bash (1))
+\}
+.el above)
+behave as if in the traditional C locale when performing
 comparisons.  That is, the current locale's collating sequence
 is not taken into account, so
 .B b
@@ -9764,7 +9848,10 @@ word containing a \fB@\fP is being completed (see
 under
 .SM
 .B READLINE
-above).
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)).
+\}
+.el above).
 This is enabled by default.
 .TP 8
 .B huponexit
@@ -9785,7 +9872,11 @@ to cause that word and all remaining characters on=
 that
 line to be ignored in an interactive shell (see
 .SM
 .B COMMENTS
-above).  This option is enabled by default.
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)).
+\}
+.el above).
+This option is enabled by default.
 .TP 8
 .B lastpipe
 If set, and job control is not active, the shell runs the last command o=
f
@@ -9801,7 +9892,10 @@ embedded newlines rather than using semicolon sepa=
rators where possible.
 The shell sets this option if it is started as a login shell (see
 .SM
 .B "INVOCATION"
-above).
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)).
+\}
+.el above).
 The value may not be changed.
 .TP 8
 .B mailwarn
@@ -9826,7 +9920,10 @@ If set,
 matches filenames in a case\-insensitive fashion when performing pathnam=
e
 expansion (see
 .B Pathname Expansion
-above).
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)).
+\}
+.el above).
 .TP 8
 .B nocasematch
 If set,
@@ -9842,12 +9939,20 @@ If set,
 allows patterns which match no
 files (see
 .B Pathname Expansion
-above)
+.ie \n(zZ=3D1 \{ in
+.BR bash (1))
+\}
+.el above)
 to expand to a null string, rather than themselves.
 .TP 8
 .B progcomp
 If set, the programmable completion facilities (see
-\fBProgrammable Completion\fP above) are enabled.
+\fBProgrammable Completion\fP
+.ie \n(zZ=3D1 \{ in
+.BR bash (1))
+\}
+.el above)
+are enabled.
 This option is enabled by default.
 .TP 8
 .B promptvars
@@ -9856,13 +9961,20 @@ parameter expansion, command substitution, arithm=
etic
 expansion, and quote removal after being expanded as described in
 .SM
 .B PROMPTING
-above.  This option is enabled by default.
+.ie \n(zZ=3D1 \{ in
+.BR bash (1).
+\}
+.el above.
+This option is enabled by default.
 .TP 8
 .B restricted_shell
 The shell sets this option if it is started in restricted mode (see
 .SM
 .B "RESTRICTED SHELL"
-below).
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)).
+\}
+.el below).
 The value may not be changed.
 This is not reset when the startup files are executed, allowing
 the startup files to discover whether or not a shell is restricted.
@@ -9906,7 +10018,12 @@ Return a status of 0 (true) or 1 (false) dependin=
g on
 the evaluation of the conditional expression
 .IR expr .
 Each operator and operand must be a separate argument.
-Expressions are composed of the primaries described above under
+Expressions are composed of the primaries described
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)
+\}
+.el above
+under
 .SM
 .BR "CONDITIONAL EXPRESSIONS" .
 \fBtest\fP does not accept any options, nor does it accept and ignore
@@ -9959,7 +10076,11 @@ The expression is true if and only if the argumen=
t is not null.
 2 arguments
 If the first argument is \fB!\fP, the expression is true if and
 only if the second argument is null.
-If the first argument is one of the unary conditional operators listed a=
bove
+If the first argument is one of the unary conditional operators listed
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)
+\}
+.el above
 under
 .SM
 .BR "CONDITIONAL EXPRESSIONS" ,
@@ -9969,7 +10090,11 @@ is false.
 .TP
 3 arguments
 The following conditions are applied in the order listed.
-If the second argument is one of the binary conditional operators listed=
 above
+If the second argument is one of the binary conditional operators listed
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)
+\}
+.el above
 under
 .SM
 .BR "CONDITIONAL EXPRESSIONS" ,
@@ -10069,7 +10194,10 @@ is executed before every \fIsimple command\fP, \=
fIfor\fP command,
 command, and before the first command executes in a shell function (see
 .SM
 .B SHELL GRAMMAR
-above).
+.ie \n(zZ=3D1 \{ in
+.BR bash (1)).
+\}
+.el above).
 Refer to the description of the \fBextdebug\fP option to the
 \fBshopt\fP builtin for details of its effect on the \fBDEBUG\fP trap.
 If a
--=20
2.7.4



From MAILER-DAEMON Tue Jan 31 08:42:52 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cYYhw-00043N-Iy
	for mharc-bug-bash@gnu.org; Tue, 31 Jan 2017 08:42:52 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:36463)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cYYhq-0003xv-SP
	for bug-bash@gnu.org; Tue, 31 Jan 2017 08:42:50 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cYYhl-0006TQ-Ti
	for bug-bash@gnu.org; Tue, 31 Jan 2017 08:42:46 -0500
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:41462 helo=svr4.eeg.ccf.org)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cYYhl-00062G-MS
	for bug-bash@gnu.org; Tue, 31 Jan 2017 08:42:41 -0500
Received: (qmail 8476 invoked from network); 31 Jan 2017 13:42:11 -0000
Received: from imadev.eeg.ccf.org (qmailr@10.76.173.78)
	by gateway.eeg.ccf.org with SMTP; Tue, 31 Jan 2017 08:42:11 -0500
Received: (qmail 21869 invoked by uid 563); 31 Jan 2017 13:42:11 -0000
Date: Tue, 31 Jan 2017 08:42:11 -0500
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Dan Jacobson <jidanni@jidanni.org>
Cc: bug-bash@gnu.org
Subject: Re: history vs. poweroff
Message-ID: <20170131134211.GV27281@eeg.ccf.org>
References: <87k29c7z8l.fsf@jidanni.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <87k29c7z8l.fsf@jidanni.org>
User-Agent: Mutt/1.4.2.3i
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 139.137.100.1
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 31 Jan 2017 13:42:50 -0000

On Tue, Jan 31, 2017 at 10:13:46AM +0800, ????????? Dan Jacobson wrote:
> However on slower systems, at the end of the day when the user issues
> the poweroff(8) command, all this might not complete, resulting in the
> entire day's of history getting thrown away.

I'm confused.  You don't logout before shutting down your computer?
I would strongly recommend doing so, unless it's an emergency.

If there's an issue with your operating system's shutdown sequence
being unnecessarily brutal to running processes, then you would need to
address that with your OS support people.  It's not bash's place to try
to document the behavior of systemd or upstart or System V init or any
other low-level operating system behaviors.


From MAILER-DAEMON Tue Jan 31 13:57:29 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cYdcO-0004t7-W5
	for mharc-bug-bash@gnu.org; Tue, 31 Jan 2017 13:57:29 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:35042)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1cYdcM-0004qc-7H
	for bug-bash@gnu.org; Tue, 31 Jan 2017 13:57:27 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1cYdcJ-00058b-2H
	for bug-bash@gnu.org; Tue, 31 Jan 2017 13:57:26 -0500
Received: from havoc.proulx.com ([96.88.95.61]:34123)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bob@proulx.com>) id 1cYdcI-00058T-So
	for bug-bash@gnu.org; Tue, 31 Jan 2017 13:57:22 -0500
Received: from joseki.proulx.com (localhost [127.0.0.1])
	by havoc.proulx.com (Postfix) with ESMTP id 54B377A6;
	Tue, 31 Jan 2017 11:57:22 -0700 (MST)
Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119])
	by joseki.proulx.com (Postfix) with ESMTP id 2368B21243;
	Tue, 31 Jan 2017 11:57:22 -0700 (MST)
Received: by hysteria.proulx.com (Postfix, from userid 1000)
	id 1AECB2DC5F; Tue, 31 Jan 2017 11:57:22 -0700 (MST)
Date: Tue, 31 Jan 2017 11:57:22 -0700
From: Bob Proulx <bob@proulx.com>
To: Brian 'geeknik' Carpenter <brian.carpenter@gmail.com>, bug-bash@gnu.org,
	bash@packages.debian.org
Subject: Re: null pointer deref, segfault
Message-ID: <20170131115548009028372@bob.proulx.com>
Mail-Followup-To: Brian 'geeknik' Carpenter <brian.carpenter@gmail.com>,
	bug-bash@gnu.org, bash@packages.debian.org
References: <CANMVOuwkOsFaJ8k_XJTU7+oCZ-wWWfzGwHgVFnx+WgqVtaTZUQ@mail.gmail.com>
	<a49b8b6b-19d7-8405-2fe6-171ca4794dda@case.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <a49b8b6b-19d7-8405-2fe6-171ca4794dda@case.edu>
User-Agent: NeoMutt/20170113 (1.7.2)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 96.88.95.61
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 31 Jan 2017 18:57:27 -0000

Chet Ramey wrote:
> On 1/24/17 2:07 AM, Brian 'geeknik' Carpenter wrote:
> > Going through some ancient bug reports and I came across
> > https://savannah.gnu.org/support/index.php?108884 which apparently nobody
> > uses anymore.
> > 
> > <<$(()())|>_[$($(<<0)) crashes bash on Debian, Red Hat, FreeBSD, etc.
> 
> It's marked as `Done'.

Since it is both marked as Done and also reported to be resolved in
bash 4.4 then I have closed the ticket.

Bob



From MAILER-DAEMON Tue Jan 31 14:14:05 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cYdsT-00046O-JF
	for mharc-bug-bash@gnu.org; Tue, 31 Jan 2017 14:14:05 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:39238)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1cYdsN-000408-Fo
	for bug-bash@gnu.org; Tue, 31 Jan 2017 14:14:03 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1cYdsK-0001yG-9h
	for bug-bash@gnu.org; Tue, 31 Jan 2017 14:13:59 -0500
Received: from homie.mail.dreamhost.com ([208.97.132.208]:46947
	helo=homiemail-a62.g.dreamhost.com)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <jidanni@jidanni.org>) id 1cYdsK-0001wH-0q
	for bug-bash@gnu.org; Tue, 31 Jan 2017 14:13:56 -0500
Received: from homiemail-a62.g.dreamhost.com (localhost [127.0.0.1])
	by homiemail-a62.g.dreamhost.com (Postfix) with ESMTP id 2F622634073;
	Tue, 31 Jan 2017 11:13:54 -0800 (PST)
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=PtfTqhLZzYxaDShiT/XuE1QHf0g=; b=T1EwPMg0ByaJP
	I22SB+UfShXBIbAFrQunipO7mOkB6tOtVJ4rPAPSi7FLoOGnD/1lFmoWm0LDguYV
	yzMrezqE77oPuwlG1hIkqGFbutssnUTne5hL8ACiSY+5oYgCST83KgSMK6aZ5cLo
	PbjLjtw4bppUe2FEE57Q5caKhtgMe4=
Received: from jidanni.org (114-41-29-86.dynamic.hinet.net [114.41.29.86])
	(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 4B70D63406F; 
	Tue, 31 Jan 2017 11:13:52 -0800 (PST)
From: =?utf-8?B?56mN5Li55bC8?= Dan Jacobson <jidanni@jidanni.org>
To: Greg Wooledge <wooledg@eeg.ccf.org>
Cc: bug-bash@gnu.org
Subject: Re: history vs. poweroff
References: <87k29c7z8l.fsf@jidanni.org>
Date: Wed, 01 Feb 2017 03:13:45 +0800
Message-ID: <87zii76o0m.fsf@jidanni.org>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy]
X-Received-From: 208.97.132.208
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 31 Jan 2017 19:14:04 -0000

GW> I'm confused.  You don't logout before shutting down your computer?
GW> I would strongly recommend doing so, unless it's an emergency.

All I know is I want to issue one command to turn off the computer.
If I logged off first, how could I issue that (poweroff(8)) command?

OK you people turn off your computers by pressing buttons. I see. It is
my problem.


From MAILER-DAEMON Tue Jan 31 14:20:27 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cYdyc-0001eO-Jv
	for mharc-bug-bash@gnu.org; Tue, 31 Jan 2017 14:20:26 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:40712)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cYdyZ-0001bw-W2
	for bug-bash@gnu.org; Tue, 31 Jan 2017 14:20:24 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cYdyW-0005JA-R4
	for bug-bash@gnu.org; Tue, 31 Jan 2017 14:20:23 -0500
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:41544 helo=svr4.eeg.ccf.org)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cYdyW-0005Is-KS
	for bug-bash@gnu.org; Tue, 31 Jan 2017 14:20:20 -0500
Received: (qmail 10539 invoked from network); 31 Jan 2017 19:20:19 -0000
Received: from imadev.eeg.ccf.org (qmailr@10.76.173.78)
	by gateway.eeg.ccf.org with SMTP; Tue, 31 Jan 2017 14:20:19 -0500
Received: (qmail 22511 invoked by uid 563); 31 Jan 2017 19:20:19 -0000
Date: Tue, 31 Jan 2017 14:20:19 -0500
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: Dan Jacobson <jidanni@jidanni.org>
Cc: bug-bash@gnu.org
Subject: Re: history vs. poweroff
Message-ID: <20170131192018.GA27281@eeg.ccf.org>
References: <87k29c7z8l.fsf@jidanni.org> <87zii76o0m.fsf@jidanni.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <87zii76o0m.fsf@jidanni.org>
User-Agent: Mutt/1.4.2.3i
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 139.137.100.1
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 31 Jan 2017 19:20:25 -0000

On Wed, Feb 01, 2017 at 03:13:45AM +0800, ????????? Dan Jacobson wrote:
> GW> I'm confused.  You don't logout before shutting down your computer?
> GW> I would strongly recommend doing so, unless it's an emergency.
> 
> All I know is I want to issue one command to turn off the computer.
> If I logged off first, how could I issue that (poweroff(8)) command?

Log out, log back in as root, issue the command, and accept that root's
(very short) shell history will be lost.

> OK you people turn off your computers by pressing buttons. I see. It is
> my problem.

Yes, most people probably do it this way.


From MAILER-DAEMON Tue Jan 31 14:32:10 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cYe9x-0005Bn-WE
	for mharc-bug-bash@gnu.org; Tue, 31 Jan 2017 14:32:10 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:43002)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1cYe9w-0005AS-AB
	for bug-bash@gnu.org; Tue, 31 Jan 2017 14:32:09 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jidanni@jidanni.org>) id 1cYe9r-0008IP-Df
	for bug-bash@gnu.org; Tue, 31 Jan 2017 14:32:08 -0500
Received: from homie.mail.dreamhost.com ([208.97.132.208]:38740
	helo=homiemail-a62.g.dreamhost.com)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <jidanni@jidanni.org>) id 1cYe9r-0008IJ-47
	for bug-bash@gnu.org; Tue, 31 Jan 2017 14:32:03 -0500
Received: from homiemail-a62.g.dreamhost.com (localhost [127.0.0.1])
	by homiemail-a62.g.dreamhost.com (Postfix) with ESMTP id 9989163406F;
	Tue, 31 Jan 2017 11:32:01 -0800 (PST)
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=t9zDdB1Oe+UqLky3Omv4LKAfEzc=; b=Njp1kDNYb2zOR
	FtL4WuDZ0+V4B4OaToB9T0ftyTooOVKF2/acYvRgipnoEgMD08Xe0H03YM1+dAOp
	lJuB3nZQOYkInTexcrStj8otYMwrScJ7qAPvzv9AGb8DFvx1aWtr7u2S2rejmEve
	AWaA6I6seX2hL9QSruVhpXo2O2whIw=
Received: from jidanni.org (114-41-29-86.dynamic.hinet.net [114.41.29.86])
	(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 450E863406E; 
	Tue, 31 Jan 2017 11:32:01 -0800 (PST)
From: =?utf-8?B?56mN5Li55bC8?= Dan Jacobson <jidanni@jidanni.org>
To: Greg Wooledge <wooledg@eeg.ccf.org>
Cc: bug-bash@gnu.org
Subject: Re: history vs. poweroff
References: <87k29c7z8l.fsf@jidanni.org>
Date: Wed, 01 Feb 2017 03:31:57 +0800
Message-ID: <87vasv6n6a.fsf@jidanni.org>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy]
X-Received-From: 208.97.132.208
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 31 Jan 2017 19:32:09 -0000

GW> Log out, log back in as root, issue the command, and accept that root's
GW> (very short) shell history will be lost.

Well mention that on the man page.
I.e., the man page should address the paradox of saving a complete
history vs. being able to turn off one's computer.


From MAILER-DAEMON Tue Jan 31 14:40:20 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cYeHs-0003X0-JH
	for mharc-bug-bash@gnu.org; Tue, 31 Jan 2017 14:40:20 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:45390)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cYeHq-0003Vr-DX
	for bug-bash@gnu.org; Tue, 31 Jan 2017 14:40:19 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cYeHm-0002Ka-Er
	for bug-bash@gnu.org; Tue, 31 Jan 2017 14:40:18 -0500
Received: from ccfadm.eeg.ccf.org ([139.137.100.1]:41549 helo=svr4.eeg.ccf.org)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <wooledg@eeg.ccf.org>) id 1cYeHm-0002J8-8c
	for bug-bash@gnu.org; Tue, 31 Jan 2017 14:40:14 -0500
Received: (qmail 10676 invoked from network); 31 Jan 2017 19:40:13 -0000
Received: from imadev.eeg.ccf.org (qmailr@10.76.173.78)
	by gateway.eeg.ccf.org with SMTP; Tue, 31 Jan 2017 14:40:13 -0500
Received: (qmail 22545 invoked by uid 563); 31 Jan 2017 19:40:12 -0000
Date: Tue, 31 Jan 2017 14:40:12 -0500
From: Greg Wooledge <wooledg@eeg.ccf.org>
To: ????????? Dan Jacobson <jidanni@jidanni.org>
Cc: bug-bash@gnu.org
Subject: Re: history vs. poweroff
Message-ID: <20170131194012.GB27281@eeg.ccf.org>
References: <87k29c7z8l.fsf@jidanni.org> <87vasv6n6a.fsf@jidanni.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <87vasv6n6a.fsf@jidanni.org>
User-Agent: Mutt/1.4.2.3i
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 139.137.100.1
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 31 Jan 2017 19:40:19 -0000

On Wed, Feb 01, 2017 at 03:31:57AM +0800, ????????? Dan Jacobson wrote:
> GW> Log out, log back in as root, issue the command, and accept that root's
> GW> (very short) shell history will be lost.
> 
> Well mention that on the man page.
> I.e., the man page should address the paradox of saving a complete
> history vs. being able to turn off one's computer.

I do not believe that it is bash(1)'s job to teach basic Unix system
administration.


From MAILER-DAEMON Tue Jan 31 14:54:16 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1cYeVM-000198-M8
	for mharc-bug-bash@gnu.org; Tue, 31 Jan 2017 14:54:16 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:48221)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jhankins@apps.homewood.k12.al.us>)
	id 1cYeVJ-00018n-Ue
	for bug-bash@gnu.org; Tue, 31 Jan 2017 14:54:15 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jhankins@apps.homewood.k12.al.us>)
	id 1cYeVI-0006BL-Uy
	for bug-bash@gnu.org; Tue, 31 Jan 2017 14:54:13 -0500
Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]:37529)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <jhankins@apps.homewood.k12.al.us>)
	id 1cYeVI-0006B7-M0
	for bug-bash@gnu.org; Tue, 31 Jan 2017 14:54:12 -0500
Received: by mail-wm0-x22f.google.com with SMTP id v77so4148650wmv.0
	for <bug-bash@gnu.org>; Tue, 31 Jan 2017 11:54:11 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=homewood-k12-al-us.20150623.gappssmtp.com; s=20150623;
	h=mime-version:references:in-reply-to:from:date:message-id:subject:to
	:cc; bh=FSFHGQztiZPRP818KH2BGLRj/0eSbp/o/8StrIrhLbY=;
	b=j1yREjUp+mqjy1NjPyPBNQdvtFNaD9Lagnp3uhQF1fVXdr9wp7kO9sUJjxxHQeuIKB
	08OjRcF4KzC9nHY3gNyoPXSNL85P55lvMCr2nJ25hpdVqi57fP8gtYgRzG85XiJm63XI
	Sn3HwiQE4+ahsRsckgQ/KPd0cgw05qC3+CwYZwk6tNgAvDkWBrorR4ktqyvK1TaubmJg
	OFetGyeIxSYBCFuGufPY8x//jx4nwPi6cWqT8lmtiEXUnc8pUYM+nit/KgMJCxnUsVHK
	MeFpiYtwnHQMTTCQSgYU8PsSXWPOh6EmVMnYBpmBEBuD9UPKJUuVU4eBMGtiuBBeqixp
	f83w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:references:in-reply-to:from:date
	:message-id:subject:to:cc;
	bh=FSFHGQztiZPRP818KH2BGLRj/0eSbp/o/8StrIrhLbY=;
	b=ErFs/hJiMg2uh8pO0ziqOGYDKFrCzbHuHGqpPz7dTqvfP19DMAH3emQXxr2JR4etZi
	Ai5LISLKEfkUI2bSiSiQTGZDC49xqCS3D2s/5JpkuEAaEuJB5rdgZAKsJe9wbHPAI+sv
	UkD4MvJrkqfukTQu1fS8b+rWilj1wb8s997vxMuF4Ob63XpijI79xBN6nbY2s3iDHdPl
	QGCnHp2C471eJmYvD8rYARwuuVgxVM1H8e6thboBdL7L6BrvaG0k3S9f5KwcIx1ixrcs
	8PN2Crv0735r470UpzyhoKWh6jdwGR5Zr+x20oR/VxB8i2/QxU1v956XQwG38GXdfzYD
	gG2g==
X-Gm-Message-State: AIkVDXLPa2VmvCrGhYBOoB6VH79sk3vxLjKObVfnqCod86cUrVXHcH0HP2jfCv6fL33hjLdgjpAeyQmWBIpP/EYQxFAl6RT8ufdcwcczcpD4B9wIbJ3vr7oN88cjP3QAGe98v6ainSsY
X-Received: by 10.223.160.14 with SMTP id k14mr28501183wrk.69.1485892450811;
	Tue, 31 Jan 2017 11:54:10 -0800 (PST)
MIME-Version: 1.0
References: <87k29c7z8l.fsf@jidanni.org> <87vasv6n6a.fsf@jidanni.org>
	<20170131194012.GB27281@eeg.ccf.org>
In-Reply-To: <20170131194012.GB27281@eeg.ccf.org>
From: "Hankins, Jonathan" <jhankins@homewood.k12.al.us>
Date: Tue, 31 Jan 2017 19:54:00 +0000
Message-ID: <CAAiD57gATPgcQTik4fwB-Nr0mAsgRYATVQyv=vT54Sv162Kjkg@mail.gmail.com>
Subject: Re: history vs. poweroff
To: Greg Wooledge <wooledg@eeg.ccf.org>,
	"????????? Dan Jacobson" <jidanni@jidanni.org>
Cc: bug-bash@gnu.org
Content-Type: multipart/alternative; boundary=94eb2c184fc4b497b90547694b36
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2a00:1450:400c:c09::22f
X-BeenThere: bug-bash@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-bash/>
List-Post: <mailto:bug-bash@gnu.org>
List-Help: <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-bash>,
	<mailto:bug-bash-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 31 Jan 2017 19:54:15 -0000

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

This is discussed a bit here, along with a common pain point for
tmux/screen users:

https://news.ycombinator.com/item?id=10164053

zsh gets around both issues with a variety of options to have a synchronous
and interleaved history file.

-Jonathan Hankins

On Tue, Jan 31, 2017 at 1:40 PM Greg Wooledge <wooledg@eeg.ccf.org> wrote:

> On Wed, Feb 01, 2017 at 03:31:57AM +0800, ????????? Dan Jacobson wrote:
> > GW> Log out, log back in as root, issue the command, and accept that
> root's
> > GW> (very short) shell history will be lost.
> >
> > Well mention that on the man page.
> > I.e., the man page should address the paradox of saving a complete
> > history vs. being able to turn off one's computer.
>
> I do not believe that it is bash(1)'s job to teach basic Unix system
> administration.
>
>

-- 
This e-mail is intended only for the recipient and may contain confidential 
or proprietary information. If you are not the intended recipient, the 
review, distribution, duplication or retention of this message and its 
attachments is prohibited. Please notify the sender of this error 
immediately by reply e-mail, and permanently delete this message and its 
attachments in any form in which they may have been preserved.

--94eb2c184fc4b497b90547694b36
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">This is discussed a bit here, along with a common pain poi=
nt for tmux/screen users:<div><br></div><div><a href=3D"https://news.ycombi=
nator.com/item?id=3D10164053">https://news.ycombinator.com/item?id=3D101640=
53</a><br></div><div><br></div><div>zsh gets around both issues with a vari=
ety of options to have a synchronous and interleaved history file.</div><di=
v><br></div><div>-Jonathan Hankins</div></div><br><div class=3D"gmail_quote=
"><div dir=3D"ltr">On Tue, Jan 31, 2017 at 1:40 PM Greg Wooledge &lt;<a hre=
f=3D"mailto:wooledg@eeg.ccf.org">wooledg@eeg.ccf.org</a>&gt; wrote:<br></di=
v><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:=
1px #ccc solid;padding-left:1ex">On Wed, Feb 01, 2017 at 03:31:57AM +0800, =
????????? Dan Jacobson wrote:<br class=3D"gmail_msg">
&gt; GW&gt; Log out, log back in as root, issue the command, and accept tha=
t root&#39;s<br class=3D"gmail_msg">
&gt; GW&gt; (very short) shell history will be lost.<br class=3D"gmail_msg"=
>
&gt;<br class=3D"gmail_msg">
&gt; Well mention that on the man page.<br class=3D"gmail_msg">
&gt; I.e., the man page should address the paradox of saving a complete<br =
class=3D"gmail_msg">
&gt; history vs. being able to turn off one&#39;s computer.<br class=3D"gma=
il_msg">
<br class=3D"gmail_msg">
I do not believe that it is bash(1)&#39;s job to teach basic Unix system<br=
 class=3D"gmail_msg">
administration.<br class=3D"gmail_msg">
<br class=3D"gmail_msg">
</blockquote></div>

<br>
<span style=3D"color:rgb(128,128,128);font-family:Arial;font-size:x-small;b=
ackground-color:rgb(255,255,255)">This=E2=80=84e-mail=E2=80=84is=E2=80=84in=
tended=E2=80=84only=E2=80=84for=E2=80=84the=E2=80=84recipient=E2=80=84and=
=E2=80=84may=E2=80=84contain=E2=80=84confidential=E2=80=84or=E2=80=84propri=
etary=E2=80=84information.=E2=80=84If=E2=80=84you=E2=80=84are=E2=80=84not=
=E2=80=84the=E2=80=84intended=E2=80=84recipient,=E2=80=84the=E2=80=84review=
,=E2=80=84distribution,=E2=80=84duplication=E2=80=84or=E2=80=84retention=E2=
=80=84of=E2=80=84this=E2=80=84message=E2=80=84and=E2=80=84its=E2=80=84attac=
hments=E2=80=84is=E2=80=84prohibited.=E2=80=84Please=E2=80=84notify=E2=80=
=84the=E2=80=84sender=E2=80=84of=E2=80=84this=E2=80=84error=E2=80=84immedia=
tely=E2=80=84by=E2=80=84reply=E2=80=84e-mail,=E2=80=84and=E2=80=84permanent=
ly=E2=80=84delete=E2=80=84this=E2=80=84message=E2=80=84and=E2=80=84its=E2=
=80=84attachments=E2=80=84in=E2=80=84any=E2=80=84form=E2=80=84in=E2=80=84wh=
ich=E2=80=84they=E2=80=84may=E2=80=84have=E2=80=84been=E2=80=84preserved.</=
span>
--94eb2c184fc4b497b90547694b36--


