New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

put fails with filenames containing glob patterns #812

Closed
legrostdg opened this Issue Jan 8, 2013 · 2 comments

Comments

Projects
None yet
2 participants
@legrostdg

legrostdg commented Jan 8, 2013

Command line:

$ touch ~/'test1[foo].txt'
$ touch ~/'test2.txt'

Python shell:

>>> from fabric.api import put
>>> put('~/test1\[foo\].txt', '/tmp')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/fabric/network.py", line 465, in host_prompting_wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/fabric/operations.py", line 369, in put
    raise ValueError(err)
ValueError: '/home/myuser/test1\[foo\].txt' is not a valid local path or glob.
>>> put('~/test2.txt', '/tmp')
[example.com] put: /home/myuser/test2.txt -> /tmp/test2.txt
['/tmp/test2.txt']
@bitprophet

This comment has been minimized.

Member

bitprophet commented Jan 27, 2013

put/get support glob patterns via the stdlib's fnmatch module, which is why this is happening. That's a feature; unfortunately it doesn't seem fnmatch allows for escaping so there's no great workaround at the moment. Sorry!

I'd probably accept a patch making the globbing optional (but on by default, i.e. backwards compat) which would help in this type of situation. Will leave this open so if I have time I am reminded to do it myself.

@bitprophet

This comment has been minimized.

Member

bitprophet commented Apr 2, 2013

See #869 yay

@bitprophet bitprophet closed this Apr 2, 2013

bitprophet added a commit that referenced this issue Apr 2, 2013

Remove env var checking behavior for use_glob.
There was no env var and I actually don't think it makes
sense for this to be globally true/false.

Re #869, #812
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment