Issue #50 resolved

do not use aliased version of rm

Serdar Tumgoren
created an issue

Hi Doug,

I'm having similar issues as the person who filed <<issue 49>> . I'm using virtualenv 1.4.9 and virtualenvwrapper 2.2 on Ubuntu 10.04 LTS.

The bash shell hangs when:

I try to source //.bashrc// after adding the recommended export/source code to the end of the file

I try to use "workon <projectname>" to activate a project.

In both cases, hitting CTRL-C or hitting return twice kicks the script back into gear and it completes successfully (i.e. the source completes or the virtual environment activates, as the case may be).

I haven't been able to pinpoint the precise source of the problem but would be happy to answer any other questions if it helps.



Comments (15)

  1. Serdar Tumgoren reporter

    Nope -- the script runs without hanging when I use the bash -x command (and it outputs the lines in the previous attachment).

    Is there something else I can try so I can provide more helpful feedback? Any chance there's a debugger (similar to pdb) that lets you set breakpoints and step through code? I'd be happy to spend some time mucking about with it if you can point me in the right direction....

  2. Doug Hellmann repo owner

    I'm not aware of any interactive debuggers for bash scripts. Using the -x option usually does the trick for me.

    When you ran from the command line, had it already been sourced in the environment through the .bashrc? If so, can you try in a shell where that was not the case?

    The fact that pressing return makes it continue leads me to believe it is trying to ask you a question. Do you have rm aliased to force confirmation when a file is removed?

    Can you send your complete .bashrc (stripping any private data you don't want to share, of course)?

  3. Serdar Tumgoren reporter

    Yes, you hit it on the head. When I open a new shell, it automatically hangs because of the source /usr/local/bin/ line at the end of file. When I comment out that line, I'm able to source .bashrc without any problems. I'm also able to open a new shell without having it hang.

    However, even after commenting out the source line in .bashrc, my shell hangs when I try to execute workon <projectname> and deactivate the project. Basically, it seems to hang any time is invoked.

    I've attached a copy of my .bashrc in case that proves useful.

    Oh, and yes, I do indeed have rm aliased to force confirmation. I tried commenting out all of my rm aliases, and then tried workon, source, etc. again but no dice -- the shell still hangs when I invoke

  4. Doug Hellmann repo owner

    I see that .bashrc loads a separate .bash_aliases file, if it exists. Do you have one of those?

    Try leaving commented out in .bashrc, then from the command line of a brand new shell run:

    $ set -x
    $ source /usr/local/bin/

    That should be the same as if you had sourced it in your .bashrc, except that it will print all of the commands it runs as they are executed.

  5. Doug Hellmann repo owner

    It's strange that the -x option is making the script work.

    What happens if you add "set -x" to your .bashrc before sourcing the file? You can put "set +x" after it to turn the echoing back off.

    If that doesn't tell us anything, the next step I would take is to comment out everything else in the .bashrc and then uncomment each line one at a time until the problem returns.

  6. Serdar Tumgoren reporter

    Huh, very strange. So I added your suggestions to my .bashrc and commented out my "rm" alias, and I can now use without having the shell hang. The only minor annoyance is that every time I source .bashrc or open a new shell, it prints set +x to the shell.

    ~~~ .bash_aliases ~~~
    #alias rm='rm -i'
    ~~~ .bashrc ~~~
    export WORKON_HOME=$HOME/code/virtenvs
    set -x
    set +x
    source /usr/local/bin/

    The above configuration produced these results:

    • fresh shell fires up without hanging (though it renders "+ set +x" to shell)
    • source .bashrc works also without hanging (though it renders "++ set +x" to shell)
    • workon and deactivate work now without hanging.

    So it's not a clean solution, but at least it's working now. I'll try rolling back to an earlier version of virtualenvwrapper and see if that makes a difference, and will also try commenting out line-by-line. I'll report back anything of interest.

    Meantime, thanks for the help!

  7. Doug Hellmann repo owner

    The "set +x" was meant to go after the source line, but you can take both lines out now. The problem was the alias that forces rm to interactively ask you if you really mean to remove the file. I'll escape the call to rm to avoid any alias.

  8. Serdar Tumgoren reporter

    Ah, I see. Yes indeed. It works fine without the set -x/+x (as long as my "rm" alias is commented out. Thanks for working through this. It's greatly appreciated!

  9. Log in to comment