Re: The restricted shell can be easily circumvented.

2015-04-06 Thread Chet Ramey
On 4/4/15 1:22 AM, David Bonner wrote: > Bash Version: 4.3 > Patch Level: 30 > Release Status: release > > Description: > The restricted shell opened by calling rbash or bash with the -r or > --restricted option can be easily circumvented with the > command 'chroot / bash' making

Re: Sourcing a file ending in \ disables aliases for 1 command

2015-04-06 Thread Chet Ramey
On 4/3/15 3:55 PM, Eduardo A. Bustamante López wrote: > I'm replying to this report, because it's the latest. > > This seems to be caused by last_read_token having an incorrect value set. > `alias_expand_token' in parse.y relies on > `command_token_position (last_read_token)' (and parser_state), t

Re: Regression with declare -i and arrays

2015-04-06 Thread Chet Ramey
On 4/3/15 10:48 PM, Eduardo A. Bustamante López wrote: > -#define NEXT_VARIABLE() free (name); list = list->next; continue > +#define NEXT_VARIABLE() do { free (name); list = list->next; continue; } > while(0) That won't work; adding the do {...} while (0) negates the continue in the code block.

Re: Regression with declare -i and arrays

2015-04-06 Thread Chet Ramey
On 4/3/15 8:40 PM, Eduardo A. Bustamante López wrote: > Hello Chet, > > You introduced a regression: > > [dual...@ma.sdf.org /tmp/tmp.ps6HXrLSZX/devel-]$ ./bash -c 'typeset -i x; > x=([0]=1+1); echo "$x"' > 1+1 > > vs > > dualbus@yaqui ~ % bash -c 'typeset -i x; x=([0]=1+1); echo "$x"' > 2 T

Re: Second trap invocation is ignored?

2015-04-06 Thread Greg Wooledge
On Mon, Apr 06, 2015 at 10:31:49AM -0500, Eduardo A. Bustamante López wrote: > dualbus@yaqui ~ % bash -c 'trap "echo bar" DEBUG; source /dev/fd/0; :' <<< > 'trap "echo foo" DEBUG; :' > bar > foo > bar > > Here, the first `bar' is executed before `source'. Then, we enter a new > `scope', or whate

Re: Second trap invocation is ignored?

2015-04-06 Thread Eduardo A . Bustamante López
After reading the manual, it is indeed undocumented that DEBUG, RETURN and ERR have the same semantics for `source' and function calls. Or perhaps it's documented, but I didn't take the time to read it all. There information related to DEBUG is scattered across man bash. Some of the relevant stuff

Re: read -N ignores IFS

2015-04-06 Thread Chet Ramey
On 3/29/15 5:03 AM, isabella parakiss wrote: > $ read -n 100 a b <<< 'x y'; declare -p a b > declare -- a="x" > declare -- b="y" > $ read -N 100 a b <<< 'x y'; declare -p a b > declare -- a="x y > " > declare -- b="" > > From my understanding of the documentation, read -N should ignore the > delim

Re: Second trap invocation is ignored?

2015-04-06 Thread Scott Bronson
On Mon, Apr 6, 2015 at 8:04 AM, Eduardo A. Bustamante López wrote: > There is no bug. Simply, your expectations on when the DEBUG trap runs are > wrong. > > The `script2' I provided ran with set -T is the closest you'll get to what you > expect, but, since DEBUG runs *before* the source command, i

Re: Second trap invocation is ignored?

2015-04-06 Thread Greg Wooledge
On Mon, Apr 06, 2015 at 10:04:12AM -0500, Eduardo A. Bustamante López wrote: > The `script2' I provided ran with set -T is the closest you'll get to what you > expect, but, since DEBUG runs *before* the source command, it'll not work as > you want. It doesn't matter whether the old DEBUG trap runs

Re: Second trap invocation is ignored?

2015-04-06 Thread Eduardo A . Bustamante López
There is no bug. Simply, your expectations on when the DEBUG trap runs are wrong. The `script2' I provided ran with set -T is the closest you'll get to what you expect, but, since DEBUG runs *before* the source command, it'll not work as you want. -- Eduardo Bustamante https://dualbus.me/

Re: Second trap invocation is ignored?

2015-04-06 Thread Scott Bronson
On Mon, Apr 6, 2015 at 5:38 AM, Greg Wooledge wrote: > Without the source shenanigans, it works: > > imadev:~$ trap 'echo first' DEBUG > imadev:~$ echo hi > first > hi > imadev:~$ trap 'echo second' DEBUG > first > imadev:~$ echo hi > second > hi Absolutely right, and I should have included that

Re: Second trap invocation is ignored?

2015-04-06 Thread Scott Bronson
On Mon, Apr 6, 2015 at 6:10 AM, Eduardo A. Bustamante López wrote: > Read about set -T in the manual. Hi, I did, over and over. :) I didn't see anything about -T being unnecessary the first time you set a trap from a sourced script, but being required every time thereafter. (quick parentheses:

Re: Second trap invocation is ignored?

2015-04-06 Thread Eduardo A . Bustamante López
Read about set -T in the manual. Also, you have an error in your trap definition. The $1 inside "..." will expand at *definition* time, not when the trap is executed. See: dualbus@yaqui ~/t % cat script echo ' trap "echo $1" DEBUG ' > ./trapcmd source ./trapcmd first s

Re: Second trap invocation is ignored?

2015-04-06 Thread Greg Wooledge
On Sun, Apr 05, 2015 at 09:39:50AM -0700, Scott Bronson wrote: > Hi, I don't understand the behavior of the trap command... > >echo ' > trap "echo $1" DEBUG > ' > ./trapcmd > >source ./trapcmd first >source ./trapcmd second > > I would expect the debug trap to now be '