Menu

bashdb versus 'set -e'

2017-07-29
2017-07-29
  • Adam Di Carlo

    Adam Di Carlo - 2017-07-29

    I'm not sure whether this is a bug or not, so I'm asking here.

    Given this script, called test.sh:

    1
    2
    3
    4
    5
    6
    #!/bin/bash
    
    set -e
    
    echo hi
    exit 0
    

    I am presented with this disappointing bashdb session:

    > ./bashdb /tmp/test.sh 
    bash debugger, bashdb, release 4.4-0.92
    
    Copyright 2002-2004, 2006-2012, 2014, 2016-2017 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/test.sh:3):
    3:  set -e
    bashdb<0> s
    Debugged program terminated with code 1. Use q to quit or R to restart.
    bashdb<1> 
    

    Is this a bug? Something I'm doing wrong?

     

    Last edit: Adam Di Carlo 2017-07-29
    • Rocky Bernstein

      Rocky Bernstein - 2017-08-01

      Hi, Adam!

      Comments are in line.

      On Sat, Jul 29, 2017 at 6:50 PM, Adam Di Carlo adicarlo@users.sf.net
      wrote:

      I'm not sure whether this is a bug or not, so I'm asking here.

      Given this script,

      1
      2
      3
      4
      5
      6

      !/bin/bash

      set -e
      echo hiexit 0

      I am presented with this disappointing bashdb session:

      ./bashdb /tmp/test.sh
      bash debugger, bashdb, release 4.4-0.92

      Copyright 2002-2004, 2006-2012, 2014, 2016-2017 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/test.sh:3):
      3: set -e
      bashdb<0> s
      Debugged program terminated with code 1. Use q to quit or R to restart.
      bashdb<1>

      Is this a bug?

      Yes

      Something I'm doing wrong?

      Nah. Should be addressed in commit 384dae9


      bashdb versus 'set -e'
      https://sourceforge.net/p/bashdb/discussion/206895/thread/b5cd8bd7/?limit=25#d866


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/bashdb/discussion/206895/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
      • Adam Di Carlo

        Adam Di Carlo - 2017-08-01

        "Rocky Bernstein" rockyb@users.sf.net writes:

        Is this a bug?

        Yes

        Something I'm doing wrong?

        Nah. Should be addressed in commit 384dae9

        Awesome! I just pulled it, rebuilt, and can confirm the fix:

        ./bashdb /tmp/test.sh
        bash debugger, bashdb, release 4.4-0.92

        Copyright 2002-2004, 2006-2012, 2014, 2016-2017 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/test.sh:3):
        3: set -e
        bashdb<0> s
        (/tmp/test.sh:5):
        5: echo hi
        bashdb<1>
        hi
        (/tmp/test.sh:6):
        6: exit 0
        bashdb<2>
        (/tmp/test.sh:1):
        1: #!/bin/bash
        bashdb<3>

        Interesting how it goes back to the shbang line after 'exit 0'. I guess
        that's the out "calling frame", in a manner of speaking?

        --
        ...Adam Di Carlo...a.p.dicarlo@gmail.com............................

         
        • Rocky Bernstein

          Rocky Bernstein - 2017-08-01

          On Tue, Aug 1, 2017 at 1:07 AM, Adam Di Carlo adicarlo@users.sf.net wrote:

          "Rocky Bernstein" rockyb@users.sf.net writes:

          Is this a bug?

          Yes

          Something I'm doing wrong?

          Nah. Should be addressed in commit 384dae9

          Awesome! I just pulled it, rebuilt, and can confirm the fix:

          ./bashdb /tmp/test.sh
          bash debugger, bashdb, release 4.4-0.92

          Copyright 2002-2004, 2006-2012, 2014, 2016-2017 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/test.sh:3):
          3: set -e
          bashdb<0> s
          (/tmp/test.sh:5):
          5: echo hi
          bashdb<1>
          hi
          (/tmp/test.sh:6):
          6: exit 0
          bashdb<2>
          (/tmp/test.sh:1):
          1: #!/bin/bash
          bashdb<3>

          Interesting how it goes back to the shbang line after 'exit 0'. I guess
          that's the out "calling frame", in a manner of speaking?

          Yep. bashdb is dumb and just gets its information about where you are at
          from ${BASH_LINENO[0]}

          --

          ...Adam Di Carlo...a.p.dicarlo@gmail.com............................

          bashdb versus 'set -e'
          https://sourceforge.net/p/bashdb/discussion/206895/thread/b5cd8bd7/?limit=25#d866/5d1f/9643


          Sent from sourceforge.net because you indicated interest in
          https://sourceforge.net/p/bashdb/discussion/206895/

          To unsubscribe from further messages, please visit
          https://sourceforge.net/auth/subscriptions/

           

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.