bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bash --debugger on a script with no arguments


From: Rocky Bernstein
Subject: bash --debugger on a script with no arguments
Date: Tue, 28 Apr 2015 22:11:45 -0400

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. 

An example will probably make this clear. Suppose /tmp/foo.sh is:

    echo hi

And you run:

    bash --debugger /tmp/foo.sh

I get "hi" printed without DEBUGGER_START_FILE sourced. However it is sourced if I run 
   bash --debugger /tmp/foo.sh ""


Investigating why this might be, I see this in bash/shell.c at line 724:

  if (debugging_mode && locally_skip_execution == 0 && running_setuid == 0 && dollar_vars[1])
    start_debugger ();

I can see why you wouldn't want to source DEBUGGER_START_FILE if a script name (/tmp/foo.sh) were not given, but I'm not sure why you would want to skip if it didn't have an argument.

So shouldn't the end of that test be dollar_vars[0] instead? 

Thanks.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]