Path: csiph.com!au2pb.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!usenet.stanford.edu!not-for-mail From: Nicholas Bamber Newsgroups: gnu.bash.bug Subject: Debian: bash --debugger doesn't start the debugger Date: Mon, 12 Oct 2015 21:16:12 +0100 Organization: Periapt Technologies Lines: 66 Approved: bug-bash@gnu.org Message-ID: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030701000304010608050702" X-Trace: usenet.stanford.edu 1444724589 13441 208.118.235.17 (13 Oct 2015 08:23:09 GMT) X-Complaints-To: action@cs.stanford.edu To: 403304@bugs.debian.org, Matthias Klose , bug-bash@gnu.org, Oleksandr Moskalenko Envelope-to: bug-bash@gnu.org User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 212.67.218.27 X-Mailman-Approved-At: Tue, 13 Oct 2015 04:23:07 -0400 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11644 This is a multi-part message in MIME format. --------------030701000304010608050702 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit My investigations indicate that it is still true that as per Debian bug report (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=403304) --debugger does NOT start the debugger UNLESS the debugged script has a $1. For example /bin/bash --debugger -- ~/scripts/ex1.sh will just run the script but /bin/bash --debugger -- ~/scripts/ex1.sh XXX will enter the debugger. To comment on the other prior information on the Debian bug report: 1. The upstream bashdb developer is correct that checking "strings `which bash` | grep bashdb" is a good test for whether bash will find bashdb-main.inc, but this is not relevant to Debian becase this is set correctly in Debian's case. 2. If you take an upstream tarball of bash and compile it then even the extra $1 will not make the debugger run under that bash, unless you link the upsteram location of '/usr/local/share/bashdb' to the Debian value of /usr/share/bashdb. In other words the other commenters were correct but had not got to the root issue. The root issue is appears to be this line in shell.c in the bash code: if (debugging_mode && locally_skip_execution == 0 && running_setuid == 0 && dollar_vars[1]) start_debugger (); I enclose a patch that I believe would address this, and suggest it is an upstream bash issue. --------------030701000304010608050702 Content-Type: text/x-diff; name="bashdb_fix.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="bashdb_fix.patch" Description: correct check on $0 in conditions for entering debugger Author: Nicholas Bamber Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=403304 Last-Update: 2015-10-12 Index: bash-4.3/shell.c =================================================================== --- bash-4.3.orig/shell.c +++ bash-4.3/shell.c @@ -720,7 +720,7 @@ main (argc, argv, env) /* Bind remaining args to $1 ... $n */ arg_index = bind_args (argv, arg_index, argc, 1); - if (debugging_mode && locally_skip_execution == 0 && running_setuid == 0 && dollar_vars[1]) + if (debugging_mode && locally_skip_execution == 0 && running_setuid == 0 && dollar_vars[0]) start_debugger (); /* Do the things that should be done only for interactive shells. */ --------------030701000304010608050702--