Skip to content
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

Fix unquoting arguments before passing to shell #7473

Closed
wants to merge 2 commits into from
Closed

Fix unquoting arguments before passing to shell #7473

wants to merge 2 commits into from

Conversation

nuid64
Copy link
Contributor

@nuid64 nuid64 commented Jun 28, 2023

#7453
Now quotes all arguments passed to the shell

Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the behavior and limits the usefulness of :sh: :sh echo "$EDITOR foo" for example will no longer expand $EDITOR because of the single quotes.

I believe the way to fix this is to have a way to disable shellwords for the :sh command. We shouldn't try to process any of the text passed to :sh.

@the-mikedavis the-mikedavis linked an issue Jun 28, 2023 that may be closed by this pull request
@pascalkuthe
Copy link
Member

pascalkuthe commented Jun 28, 2023

I think we still want some very basic processing so that #6979 can be used with :sh. i think kakune simply splits whitespace and only replaces (%...) when needed

@nuid64
Copy link
Contributor Author

nuid64 commented Jun 28, 2023

Do we want " act same as '?

@pascalkuthe
Copy link
Member

Mike was just giving an example. There are lots of similar edge cases. I was about to make a similar comment. Simply forwarding the arguments to the shell unchanged (with the minor exception I mentioned above) is the only consistent and intuitive solution IMO

@nuid64
Copy link
Contributor Author

nuid64 commented Jun 29, 2023

We could just not trim the quotes when parsing shellwords. Is it a good solution?

@the-mikedavis
Copy link
Member

No, the quotes should be dropped where shellwords are actually used. For example :open "a b.txt" should open a file a b.txt but with that change it would open "a b.txt" (where the quotes would be part of the filename).

@kirawi kirawi added A-helix-term Area: Helix term improvements S-waiting-on-review Status: Awaiting review from a maintainer. labels Jun 30, 2023
@nuid64 nuid64 closed this by deleting the head repository Aug 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sh command doesn't handle arguments with spaces
4 participants