#30 bashdb-4.2-0.8: typeset: -A: invalid option

closed-works-for-me
nobody
9
2012-01-27
2012-01-26
Hayk
No

Hi, thank you for bashdb.

When trying to call the BASH debugger from inside the example program as described in the manual, I get errors related to an "invalid typeset option -A".

<my prompt> % ./fact.sh
/depot/bashdb-4.2-0.8/share/bashdb/init/require.sh: line 49: typeset: -A: invalid option
typeset: usage: typeset [-afFirtx] [-p] name[=value] ...
/depot/bashdb-4.2-0.8/share/bashdb/lib/action.sh: line 42: typeset: -A: invalid option
typeset: usage: typeset [-afFirtx] [-p] name[=value] ...
/depot/bashdb-4.2-0.8/share/bashdb/lib/action.sh: line 45: typeset: -A: invalid option
typeset: usage: typeset [-afFirtx] [-p] name[=value] ...
/depot/bashdb-4.2-0.8/share/bashdb/lib/alias.sh: line 19: typeset: -A: invalid option
typeset: usage: typeset [-afFirtx] [-p] name[=value] ...
and so on ....
............................
===========================

I have added the following row into the script:

source /depot/bashdb-4.2-0.8/share/bashdb/bashdb-trace

the command for running the script is:

./fact.sh

debugger: bashdb--4.2-0.8
OS is: Red Hat Enterprise Linux v.4
bash version: bash-4.2

Discussion

  • Hayk
    Hayk
    2012-01-26

    • priority: 5 --> 9
     
  • Hayk
    Hayk
    2012-01-26

    The example script modified

     
    Attachments
  • Add this line
    typeset -p BASH_VERSION

    both as the second line of fact.sh and as the first line of

    /depot/bashdb-4.2-0.8/share/bashdb/init/require.sh

    The run ./fact again and send the output of the first 10 or so lines.

    Thanks.

     
  • Hayk
    Hayk
    2012-01-27

    Hi Rocky,

    Thank you for feedback.
    Unfortunately, I cannot edit the following file: /depot/bashdb-4.2-0.8/share/bashdb/init/require.sh,
    since I don't have an administrator privileges. I can only edit the files that are in my home directory.

    Anyway, I tried to run ./fact.sh with added "typeset -p BASH_VERSION" row and got the following output:

    ==========================

    declare -- BASH_VERSION="4.2.0(1)-release"
    fact 0 is: 1
    fact 3 s: 6
    Debugged program terminated normally. Use q to quit or R to restart.
    bashdb<0>

    ==========================

    Is there any alternative to the test suggested by you, which would not require editing files outside my home directory?

    BTW, what I need is calling the bashdb from inside a script and stopping the execution of the program at a desired position in the script. I tried adding --debugger option to the first row of the script (without sourcing the bashdb-trace):

    #!/depot/bash-4.2/bin/bash --debugger

    however, in this case the program is executed without invoking the debugger:

    ================

    <my_prompt> > ./fact.sh
    fact 0 is: 1
    fact 3 s: 6
    <my_prompt> >

    ===================

    Thank you.

     
  • You ask

    >Is there any alternative to the test suggested by you, which would not
    require editing files outside my home directory?

    You can build and install bashdb somewhere in your home directory by using the --prefix option when you configure bashdb. In fact, that is probably how this got installed into /deopt/bashdb-4.2-0.8

    Let's say your home directory is $HOME. Download the bashdb package untar it and run:

    bash ./configure --prefix=$HOME --with-bash=/depot/bash-4.2/bin/bash && make && make install

    >Anyway, I tried to run ./fact.sh with added "typeset -p BASH_VERSION" row and got the following output:
    >==========================
    > declare -- BASH_VERSION="4.2.0(1)-release"
    > fact 0 is: 1
    > fact 3 s: 6
    > Debugged program terminated normally. Use q to quit or R to restart.
    > bashdb<0>

    This is totally expected. Adding that line just shows what version of bash you are using.
    The relevant section you should be using is 2.3.1.1 Explicit Debugging Calls. It is not enough
    to just source bashdb-trace, as that pulls in the debugger code. It doesn't *stop* the program.
    For that you need to make a call to _Dbg_debugger. Since you didn't do that above your program didn't stop until after it was finished, because the trace code also hooks into termination of your program.

    And any rate, I'm pretty sure that the initial problem you were having has nothing to do with bashdb, but somehow the fact that bash version 3 (which happens to be the default bash version on Redhat AS 4) was getting used. I don't completely know how you did that, but it happened.

     
    • status: open --> closed-works-for-me
     
  • Wow that was strange. I just wrote an very long comment but after I clicked submit my comment didn't appear. Grrrr... well I'm not writing all that over again. Anyways, just wanted to say fantastic blog!
    cheap north face http://www.barbaragrengs.com/forum/topic.php?id=655061&replies=1