-
-
Notifications
You must be signed in to change notification settings - Fork 25.6k
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
default settings cause scp/rsync to fail with remote globbing #2945
Comments
You can alias those to |
Except it seems like there might very well be times I'd /want/ to glob for git? Or maybe git itself will handle it even if the shell doesn't? |
This is a Zsh issue, not OMZ. Consequently, please close this using the button at the bottom of the page — you can keep posting messages afterwards, and we will kindly try to help you, but at least it will be one less issue open with OMZ. Back to your problem — let me assume that you will be closing this promptly anyway. I strongly advise you against what you want to do. If a globbing/regex pattern should be expanded out of the shell (like with your
If you really really want to take the
But again, you SHOULD not do that. To quote my source:
|
Thanks for the reply. Closing the issue now, though I could use a bit more explanation as to why unsetting no_match is a bad idea? At least for scp style commands not expanding is exactly the behaviour I would expect. |
Reading over that page more carefully I guess my response is the same as the one commenter's: failing to execute the command isn't necessarily more friendly. And that's what I was led to believe oh-my-zsh was about -- an easy, clean introduction to zsh's powerful features. In that regard, I'd expect it to ease me into the transition a bit more, and why I'd argue that maybe this is a default option that /should/ be considered for inclusion. There's potential problems on both sides, so I'd default to the principle of least surprise -- and for most folks, that's what they're used to on existing shells. |
Not sure where you read that. The ReadMe clearly defines the project as:
OMZ is about making you shell easier to use, not easing the transition to Zsh. Also, I personally like my shell to be strict: it seems we disagree on the principle of least surprise. About switching: let's face it, if you go from Bash to Zsh, you are in for a bunch of surprises anyway — most of them will be good, but some (like globbing errors) may feel bittersweet. As to why using $ ls /folder
file_a file_b
$ ssh user@host ls /folder
file_c file_d
$ unsetopt no_match
# If you do not use no_match,
# you are used to quoting your globbers
$ scp user@host:"/folder/file*" .
# Copies file_c and file_d to current dir,
# so it works
$ setopt no_match
# If you use no_match, then you are
# not used to quoting your globbers
$ scp user@host:/folder/file* .
# Tries to copy file_a and file_b from
# remote host, so it fails You can imagine much worse scenarios. |
First, thanks for taking the time to engage on this topic. My impression of omz is based on recommendations I've heard, but at this point I don't remember exactly where so it's either my mis-remembering or who knows what. Appreciate the reminder of the summary. That said, while there may be some instances where no_match is dangerous, the example you showed above isn't one, mostly because it's wrong. It's not dangerous because " user@host:/folder/file* " won't expand in zsh because @ and : are valid in file names. Given that, I wouldn't expect scp or rsync to ever have a problem (unless you happened to have files matching username@hostname:path that /also/ matched). Just to verify, I went and ran that experiment and it did indeed behave as expected (slightly edited 'cause sudo): $ mkdir /folder $ touch /folder/file_a $ touch /folder/file_b $ ssh remote@host "mkdir /folder;touch /folder/file_c; touch /folder/file_d" $ unsetopt no_match $ scp remote@host:/folder/file* . file_c 100% 0 0.0KB/s 00:00 file_d 100% 0 0.0KB/s 00:00 Anyway, I concede that there might indeed be /some/ instances where it's potentially dangerous, but I've been using /bin/sh and variants for quite some time now without running into one, so I'm comfortable taking the risk. On this note, I think we'll just agree to disagree, but thanks again for pointing out the option in the first place. |
FWIW, on my noglobbed git, using tab to expand a globbing character such as Updated with an example: For instance, on a git repo: $ git commit -m ^poo[ENTER] creates a commit with the message being $ git add ^poo[TAB] expands to all files except ones named
|
Bash does the convenient thing: fails to expand, then simply passes along the argument to the application so it can handle it.
This happens with rsync as well. Here's a workaround I found online:
But that's somewhat sub-optimal. Among other problems, I've noticed it has trouble when you paste text.
I understand I can escape the *, but I'd rather not since it's muscle-memory to be undone and is the sort of thing that will turn someone off when they're trying to migrate from bash to zsh.
The text was updated successfully, but these errors were encountered: