Re: bash --debugger on a script with no arguments
On 4/28/15 10:11 PM, Rocky Bernstein wrote: > It's come to my attention that running bash --debugger doesn't source > DEBUGGER_START_FILE when the script to be debugged isn't followed by any > arguments. This was changed last November in the devel branch as part of a set of changes to make the absence of the debugger start file a visible error. The change will be in the next bash release. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: bash --debugger on a script with no arguments
Now I am really confused and I am not sure we are talking about the same thing. In bash-4.3.30 on ftp://ftp.gnu.org/gnu/bash at line 723 of shell.c there is: if (debugging_mode && locally_skip_execution == 0 && running_setuid == 0 && dollar_vars[1]) start_debugger (); Shouldn't dollar_vars[1] be dollar_vars[0] (the name of the script to be debugged)? It might be a good idea to add an else branch to give a warning, but that warning would warn about the fact that suid was set, or no debugged script was given, or even -n (skip_execution) was given so debugger main file is getting read. But this is different from the problem encountered. On Wed, Apr 29, 2015 at 10:57 AM, Chet Ramey wrote: > On 4/28/15 10:11 PM, Rocky Bernstein wrote: > > It's come to my attention that running bash --debugger doesn't source > > DEBUGGER_START_FILE when the script to be debugged isn't followed by any > > arguments. > > This was changed last November in the devel branch as part of a set of > changes to make the absence of the debugger start file a visible error. > The change will be in the next bash release. > > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, ITS, CWRUc...@case.edu > http://cnswww.cns.cwru.edu/~chet/ >
Re: declare -p doesn't show the global attribute
On 4/27/15 2:26 AM, isabella parakiss wrote: > On 4/27/15, Chet Ramey wrote: >> On 4/26/15 5:26 PM, isabella parakiss wrote: >>> $ fn () { declare -g var=x; declare -p var; } ; fn >>> declare -- var="x" >>> >>> I think the correct output should be declare -g var="x" >>> Is this intended or is it a bug? >> >> There is no such thing as `the global attribute'. The -g option simply >> causes declare to create variables at the global scope instead of in a >> function-local scope. The output you see is no different than what >> would have been displayed had `var' been declared and given a value at >> the global scope outside the function. >> > > Ok I understand, but would it be possible to add it? It really doesn't make sense. Since you're writing your file once, why not just grep the output of `set'? That will give you proper quoting without the `declare'. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: bash --debugger on a script with no arguments
On 4/29/15 1:51 PM, Rocky Bernstein wrote: > Now I am really confused and I am not sure we are talking about the same > thing We really are. > In bash-4.3.30 on ftp://ftp.gnu.org/gnu/bash at line 723 of shell.c > there is: > > if (debugging_mode && locally_skip_execution == 0 && running_setuid == 0 > && dollar_vars[1]) > start_debugger (); > > Shouldn't dollar_vars[1] be dollar_vars[0] (the name of the script to be > debugged)? I understand your question, and, as I said, that code was changed back last November when I was looking at http://lists.gnu.org/archive/html/bug-bash/2014-11/msg00137.html As part of investigating it, I noticed the same thing you just reported, so I fixed that as well. The change log entries for both issues appear one right after the other. That code is in the bash devel branch on savannah. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: bash --debugger on a script with no arguments
I am sure you have changed this as you said. But I just don't see it in the current source on savannah in the devel branch. For example I looked at: http://git.savannah.gnu.org/cgit/bash.git/tree/shell.c?h=devel Is there a URL like the one above folks can look at and see the change? Thanks. On Wed, Apr 29, 2015 at 7:21 PM, Chet Ramey wrote: > On 4/29/15 1:51 PM, Rocky Bernstein wrote: > > Now I am really confused and I am not sure we are talking about the same > > thing > > We really are. > > > In bash-4.3.30 on ftp://ftp.gnu.org/gnu/bash at line 723 of shell.c > > there is: > > > > if (debugging_mode && locally_skip_execution == 0 && running_setuid == > 0 > > && dollar_vars[1]) > > start_debugger (); > > > > Shouldn't dollar_vars[1] be dollar_vars[0] (the name of the script to be > > debugged)? > > I understand your question, and, as I said, that code was changed back last > November when I was looking at > > http://lists.gnu.org/archive/html/bug-bash/2014-11/msg00137.html > > As part of investigating it, I noticed the same thing you just reported, > so I fixed that as well. The change log entries for both issues appear > one right after the other. That code is in the bash devel branch on > savannah. > > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, ITS, CWRUc...@case.edu > http://cnswww.cns.cwru.edu/~chet/ >
Re: bash --debugger on a script with no arguments
On 4/29/15 8:05 PM, Rocky Bernstein wrote: > I am sure you have changed this as you said. But I just don't see it in the > current source on savannah in the devel branch. For example I looked at: > > http://git.savannah.gnu.org/cgit/bash.git/tree/shell.c?h=devel > > Is there a URL like the one above folks can look at and see the change? I am not sure what you're talking about. The code change is in there: if (debugging_mode && locally_skip_execution == 0 && running_setuid == 0 && (dollar_vars[1] || interactive_shell == 0)) start_debugger (); If it doesn't work like you think it should, let me know, but at least test it first. Don't assume it wasn't changed just because it doesn't test dollar_vars[0]. Since dollar_vars[0] is always set, testing it would not have any effect. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: bash --debugger on a script with no arguments
Ok. I see my mistake. That long expression is deceptively similar to the other long expression; neither has a comment as to what's going on. As you suggest, I've tested from the git devel branch and yes, this works. Chet writes: > Since dollar_vars[0] is always set, testing it would not have any effect. Ok. If you had written this, it might have saved a bit of back-and-forth by mentioning this right at the beginning. And to the end of being more informative, In the thread you cited, there was a suggestion about being more informative about skipping debugger_start() : > >* Maybe something like this:* > > > >* bash: foo: debugger /usr/local/share/bashdb/bashdb-main.inc: No such file > >or * > >* directory* > >* bash: foo: disabling debugging mode* *...* *> > bash: foo: debugger /usr/bin/x: Permission denied* *> > bash: foo: disabling debugging mode* It wouldn't be that hard to add this in an "else" branch. Thanks. and Thanks for addressing this issue. On Wed, Apr 29, 2015 at 8:22 PM, Chet Ramey wrote: > On 4/29/15 8:05 PM, Rocky Bernstein wrote: > > I am sure you have changed this as you said. But I just don't see it in > the > > current source on savannah in the devel branch. For example I looked at: > > > > http://git.savannah.gnu.org/cgit/bash.git/tree/shell.c?h=devel > > > > Is there a URL like the one above folks can look at and see the change? > > I am not sure what you're talking about. The code change is in there: > > if (debugging_mode && locally_skip_execution == 0 && running_setuid == 0 > && (dollar_vars[1] || interactive_shell == 0)) > start_debugger (); > > If it doesn't work like you think it should, let me know, but at least > test it first. > > Don't assume it wasn't changed just because it doesn't test dollar_vars[0]. > Since dollar_vars[0] is always set, testing it would not have any effect. > > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, ITS, CWRUc...@case.edu > http://cnswww.cns.cwru.edu/~chet/ >
Re: bash --debugger on a script with no arguments
On 4/29/15 9:07 PM, Rocky Bernstein wrote: > And to the end of being more informative, In the thread you cited, there > was a suggestion about being more informative about skipping debugger_start() > : > >> >/ Maybe something like this:/ >> >/ / >> >/ bash: foo: debugger /usr/local/share/bashdb/bashdb-main.inc: No such file >> >or / >> >/ directory/ >> >/ bash: foo: disabling debugging mode/ > > /.../ > > /> > bash: foo: debugger /usr/bin/x: Permission denied/ > > /> > bash: foo: disabling debugging mode/ > > > It wouldn't be that hard to add this in an "else" branch. You might have tested that, too. That went in at the same time. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: bash --debugger on a script with no arguments
/bash --debugger -i /tmp/foo.sh hi On Wed, Apr 29, 2015 at 9:39 PM, Chet Ramey wrote: > On 4/29/15 9:07 PM, Rocky Bernstein wrote: > > > And to the end of being more informative, In the thread you cited, there > > was a suggestion about being more informative about skipping > debugger_start() : > > > >> >/ Maybe something like this:/ > >> >/ / > >> >/ bash: foo: debugger /usr/local/share/bashdb/bashdb-main.inc: No such > file or / > >> >/ directory/ > >> >/ bash: foo: disabling debugging mode/ > > > > /.../ > > > > /> > bash: foo: debugger /usr/bin/x: Permission denied/ > > > > /> > bash: foo: disabling debugging mode/ > > > > > > It wouldn't be that hard to add this in an "else" branch. > > You might have tested that, too. That went in at the same time. > $ ./bash --debugger -i /tmp/foo.sh hi $ ./bash --debugger /tmp/foo.sh bash debugger, bashdb, release 4.3-0.91 Copyright 2002, 2003, 2004, 2006-2012, 2014 Rocky Bernstein This is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. (/tmp/foo.sh:2): 2:echo "hi" bashdb<0> > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, ITS, CWRUc...@case.edu > http://cnswww.cns.cwru.edu/~chet/ >