Merged
Conversation
The `ipfs config edit` command did not correctly handle the `EDITOR` environment variable correctly when its value contains flags and arguments, i.e. `EDITOR=emacs -nw`. The command was treating the entire value of `$EDITOR` as the name of the editor command. This has been fixed to parse the value of `$EDITOR` into separate args, respecting shell quoting. Closes #9375
SgtPooki
approved these changes
Jul 7, 2025
| } | ||
|
|
||
| cmd := exec.Command(editor, filename) | ||
| editorAndArgs, err := shlex.Split(editor, true) |
Member
There was a problem hiding this comment.
Note: go-shlex has not had a commit in 5 years. However, the code of go-shlex is 193 lines long with some sane tests. Perhaps no changes are needed because it works perfectly?
I didn't see any Windows-specific tests.
Contributor
Author
There was a problem hiding this comment.
Note that google/shlex does not handle POSIX correctly in the case of the last argument in this example:
https://go.dev/play/p/EuYSLJB8p5t
Maybe that does not matter?
Member
There was a problem hiding this comment.
i think using anmitsu/go-shlex is fine, we have it pulled by quic-go's deps anyway
lidel
pushed a commit
that referenced
this pull request
Jul 8, 2025
The `ipfs config edit` command did not correctly handle the `EDITOR` environment variable correctly when its value contains flags and arguments, i.e. `EDITOR=emacs -nw`. The command was treating the entire value of `$EDITOR` as the name of the editor command. This has been fixed to parse the value of `$EDITOR` into separate args, respecting shell quoting. Closes #9375 (cherry picked from commit 4195a1d)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
ipfs config editcommand did not correctly handle theEDITORenvironment variable correctly when its value contains flags and arguments, i.e.EDITOR=emacs -nw. The command was treating the entire value of$EDITORas the name of the editor command. This has been fixed to parse the value of$EDITORinto separate args, respecting shell quoting.Closes #9375