csh and path() Context Manager #1300

Closed
lucacorti opened this Issue Mar 31, 2015 · 5 comments

Projects

None yet

4 participants

@lucacorti

Hi,

the path context manager seems to fail when trying to append path on FreeBSD/csh containing unescaped characters like $, ~ and .. It also seems to add unneeded extra quotes.

E.g., with bower installed locally:

...
@task
def staging()
...
    env.directory = '~/'
    env.venv_activate = 'bin/activate.csh'
    env.venv = env.directory + 'venv/'
    env.use_shell = False
    env.add_to_path = [
        env.directory + 'node_modules/bower/bin',
        env.directory + 'node_modules/uglifyjs/bin',
        env.directory + 'node_modules/yuglify/bin',
    ]
...
@task
def deploy()
    with cd(env.directory), prefix('source ' + env.venv + env.venv_activate), path(":".join(env.add_to_path)):
        env.run('npm install')
        env.run('bower install')
...

fab staging deploy

returns

[freebsd] run: npm install
[freebsd] out: Bad : modifier in $ (").
[freebsd] out: 

Fatal error: run() received nonzero return code 1 while executing!

Requested: npm install
Executed: cd ~/ && source ~/venv/bin/activate.csh && export PATH="$PATH:"~/node_modules/bower/bin/:~/node_modules/yuglify/bin/:~/node_modules/uglify-js/bin/"" && npm install

also export is probably not working anyway in csh, should be setenv I think.

@lucacorti

Forgot to mention I'm on Python 2.7.9, Fabric 1.10.1.

@jeamland

It looks like something somewhere is over-quoting the path string. In the "Executed" line, we see:

[...] export PATH="$PATH:"[...]"" [...]

i.e. we're opening quotes before $PATH, then opening again after the : (causing csh to complain) and then closing both sets at the end.

@mradziej
mradziej commented Jul 7, 2016

csh behaviour with quoting and backslashes is strange. I had similar problems and found a fix: You need to set backslash_quote in csh. See pull request #1483. Feedback welcome.

@bitprophet
Member

Please comment if the setting from #1483 is insufficient and we can reopen - thanks! (Though - I'll note that Fabric 1's aggressively "helpful" autoquoting is generally problematic and won't be present by default in 2.x.)

@bitprophet bitprophet closed this Jul 19, 2016
@lucacorti

Still getting the same error. However I'm not currently using path() so I'm fine with leaving it this way and eventually retesting on 2.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment