Re: Assigning to BASHPID fails silently

2016-10-20 Thread Chet Ramey
On 10/20/16 3:57 PM, Dan Douglas wrote: >> No, it's trivial. It's an assignment failure. The fix is to remove >> the readonly attribute. > > Makes sense to me. I noticed the problem on the same day this was > reported while trying to compare two environments while eliminating all > the non-cons

Re: Assigning to BASHPID fails silently

2016-10-20 Thread Dan Douglas
On Thu, Oct 20, 2016 at 2:35 PM, Chet Ramey wrote: > On 10/20/16 11:32 AM, Martijn Dekker wrote: > >> So, in some contexts this bug causes a premature exit of the shell, in >> others it causes a premature exit of a loop. This bug hunt could get >> interesting. > > No, it's trivial. It's an assign

Re: Assigning to BASHPID fails silently

2016-10-20 Thread Chet Ramey
On 10/20/16 11:32 AM, Martijn Dekker wrote: > So, in some contexts this bug causes a premature exit of the shell, in > others it causes a premature exit of a loop. This bug hunt could get > interesting. No, it's trivial. It's an assignment failure. The fix is to remove the readonly attribute.

Re: Assigning to BASHPID fails silently

2016-10-20 Thread lolilolicon
On Fri, Oct 21, 2016 at 1:31 AM, lolilolicon wrote: > bash simply aborts this command. I think I mean "list".

Re: Assigning to BASHPID fails silently

2016-10-20 Thread lolilolicon
On Thu, Oct 20, 2016 at 11:32 PM, Martijn Dekker wrote: > #! /usr/local/bin/bash > insubshell() { > return "$((BASHPID=$$))" > # ^ fatal typo > } > for ((i=0; i<1; i++)); do insubshell; done > echo $i > insubshell || echo ok > echo continuing > > The output of t

Re: Assigning to BASHPID fails silently

2016-10-20 Thread Martijn Dekker
Op 20-10-16 om 14:22 schreef Greg Wooledge: > On Wed, Oct 19, 2016 at 11:53:37PM +0200, Martijn Dekker wrote: >> Assigning to BASHPID most certainly does have an effect. Since you >> didn't quote that part, I think you might have missed my point that >> attempting this will silently exit the shell

Re: Assigning to BASHPID fails silently

2016-10-20 Thread Chet Ramey
On 10/19/16 5:53 PM, Martijn Dekker wrote: > Op 19-10-16 om 15:18 schreef Chet Ramey: >> On 10/17/16 2:38 PM, Martijn Dekker wrote: >>> bash 4.4.0 (I did not investigate other versions) does not produce an >>> error message if you try to assign something to the BASHPID readonly >>> using either ari

Re: Assigning to BASHPID fails silently

2016-10-20 Thread Chet Ramey
On 10/19/16 8:16 PM, Eduardo A. Bustamante López wrote: > I wonder the same thing. I don't understand the reasoning for picking (2). It's useful functionality with a particular meaning. If you want to use that variable for something else, you can. -- ``The lyf so short, the craft so long to l

Re: Assigning to BASHPID fails silently

2016-10-20 Thread PePa
Picking 2 allows old scripts that work to keep working. Changing to 1 would change the functionality of formerly working scripts in very undesirable ways. ;-) > 1. BASHPID is readonly, therefore assignment to it is fatal and the script > exits > (with an error message printed). That's what my pre

Re: Assigning to BASHPID fails silently

2016-10-20 Thread Greg Wooledge
On Wed, Oct 19, 2016 at 11:53:37PM +0200, Martijn Dekker wrote: > Assigning to BASHPID most certainly does have an effect. Since you > didn't quote that part, I think you might have missed my point that > attempting this will silently exit the shell without any error message, > causing the problem

Re: Assigning to BASHPID fails silently

2016-10-19 Thread Eduardo A . Bustamante López
On Wed, Oct 19, 2016 at 11:53:37PM +0200, Martijn Dekker wrote: [...] > Assigning to BASHPID most certainly does have an effect. Since you > didn't quote that part, I think you might have missed my point that > attempting this will silently exit the shell without any error message, > causing the pr

Re: Assigning to BASHPID fails silently

2016-10-19 Thread Martijn Dekker
Op 19-10-16 om 15:18 schreef Chet Ramey: > On 10/17/16 2:38 PM, Martijn Dekker wrote: >> bash 4.4.0 (I did not investigate other versions) does not produce an >> error message if you try to assign something to the BASHPID readonly >> using either arithmetic or normal assignment. Other readonlies pr

Re: Assigning to BASHPID fails silently

2016-10-19 Thread Chet Ramey
On 10/17/16 2:38 PM, Martijn Dekker wrote: > bash 4.4.0 (I did not investigate other versions) does not produce an > error message if you try to assign something to the BASHPID readonly > using either arithmetic or normal assignment. Other readonlies produce a > message on an assignment attempt. BA

Re: Assigning to BASHPID fails silently

2016-10-18 Thread Eduardo A . Bustamante López
On Mon, Oct 17, 2016 at 08:38:29PM +0200, Martijn Dekker wrote: [...] The BASHPID variable is initialized with null_assign as its "assign_func". The default value for this attribute in newly created variables is NULL. The problem here is caused by the following code from variables.c (function is

Assigning to BASHPID fails silently

2016-10-17 Thread Martijn Dekker
bash 4.4.0 (I did not investigate other versions) does not produce an error message if you try to assign something to the BASHPID readonly using either arithmetic or normal assignment. Other readonlies produce a message on an assignment attempt. BASHPID seems to be an exception. Particularly anno