databio / bulker

Manager for multi-container computing environments
https://bulker.io
BSD 2-Clause "Simplified" License
24 stars 2 forks source link

Issues when $SHELL isnt bash or zsh #69

Closed rcorces closed 4 years ago

rcorces commented 4 years ago

I'm not sure if I've properly diagnosed this. I've already fixed the problem but figured I would post in case it helped. I was running on a cluster environment where the compute node default value for $SHELL was /bin/sh. This was (I think) resulting in the following error:

activating bulker
Bulker config: /wynton/group/corces/shared/tools/bulker/bulker_config.yaml
Activating bulker crate: databio/pepatac:1.0.4
Shell must be bash or zsh. Specified shell was: '/bin/sh'. Using /bin/bash.
No built-in custom prompt for shells other than bash or zsh
Traceback (most recent call last):
  File "/wynton/home/corces/rcorces/tools/python/p3.6.8/bin/bulker", line 8, in <module>
    sys.exit(main())
  File "/wynton/home/corces/rcorces/tools/python/p3.6.8/lib/python3.6/site-packages/bulker/bulker.py", line 946, in main
    bulker_activate(bulker_config, cratelist, echo=args.echo, strict=args.strict, prompt=args.no_prompt)
  File "/wynton/home/corces/rcorces/tools/python/p3.6.8/lib/python3.6/site-packages/bulker/bulker.py", line 581, in bulker_activate
    ps1 = ps1.replace("\\b", name)  # for bash
UnboundLocalError: local variable 'ps1' referenced before assignment

I think this is caused by the following if statement: https://github.com/databio/bulker/blob/0ded559711164098904eb3d582d2ca4ff6849e46/bulker/bulker.py#L567

If your shell is not bash or zsh, you get a warning but you dont end up setting ps1 prior to calling ps1 = ps1.replace("\\b", name). This (i think) causes the UnboundLocalError shown above.

nsheff commented 4 years ago

yes you're right. did you fix it in bulker? can you submit it as a PR?

nsheff commented 4 years ago

Actually I think this may be solved here on dev:

https://github.com/databio/bulker/commit/47358a79f5d3a2ddcc07f5d96fa7a33a4dcd19cd

rcorces commented 4 years ago

Yes - that does look like it is fixed on dev. I didnt fix it in the source of bulker, just forced $SHELL to be /bin/bash on the compute node.