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

Backtick "eats" all runes until isSpace #25

Closed
andresvia opened this issue Apr 25, 2019 · 1 comment · Fixed by #26, moby/moby#40045 or docker/cli#2152
Closed

Backtick "eats" all runes until isSpace #25

andresvia opened this issue Apr 25, 2019 · 1 comment · Fixed by #26, moby/moby#40045 or docker/cli#2152

Comments

@andresvia
Copy link

andresvia commented Apr 25, 2019

Hi @mattn , I found a thing while trying to use go-shellwords.

go test -v 
=== RUN   ExampleShellwords
--- FAIL: ExampleShellwords (0.02s)
got:
["-flag=val0" "val1" "-flag=val2"]
want:
["-flag=val0" "-flag=val1" "-flag=val2"]
FAIL
exit status 1
FAIL	testsw	0.041s
cat testsw_test.go 
package testsw

import (
	"fmt"
	"github.com/mattn/go-shellwords"
)

func ExampleShellwords() {
	parser := shellwords.NewParser()
	parser.ParseBacktick = true
	args, err := parser.Parse("-flag=val0 -flag=`cat testdata/flag-val.txt` -flag=val2")
	if err != nil {
		panic(err)
	}
	fmt.Printf("%q\n", args)
	// Output:
	// ["-flag=val0" "-flag=val1" "-flag=val2"]
}
cat go.mod 
module testsw

go 1.12

require github.com/mattn/go-shellwords v1.0.5
cat testdata/flag-val.txt 
val1
mattn added a commit that referenced this issue Apr 25, 2019
mattn added a commit that referenced this issue Apr 25, 2019
@mattn
Copy link
Owner

mattn commented Apr 25, 2019

Thanks your report. Addressed in #26

@mattn mattn closed this as completed in #26 Apr 25, 2019
thaJeztah added a commit to thaJeztah/docker that referenced this issue Oct 6, 2019
full diff: mattn/go-shellwords@v1.0.5...v1.0.6

relevant changes:

- mattn/go-shellwords#24 Add dir option for parser
- mattn/go-shellwords#26 Fix backquote in part of argument
    - fixes mattn/go-shellwords#25 Backtick "eats" all runes until isSpace
- mattn/go-shellwords#28 Fix dollar quote
    - fixes mattn/go-shellwords#27 Multi-commands inside of command substitution are throwing "invalid command line string" errors
- mattn/go-shellwords#24 Add dir option for parser
- mattn/go-shellwords#24 Add dir option for parser
- mattn/go-shellwords#24 Add dir option for parser

Signed-off-by: Sebastiaan van Stijn <[email protected]>
docker-jenkins pushed a commit to docker-archive/docker-ce that referenced this issue Oct 7, 2019
full diff: mattn/go-shellwords@v1.0.5...v1.0.6

relevant changes:

- mattn/go-shellwords#24 Add dir option for parser
- mattn/go-shellwords#26 Fix backquote in part of argument
    - fixes mattn/go-shellwords#25 Backtick "eats" all runes until isSpace
- mattn/go-shellwords#28 Fix dollar quote
    - fixes mattn/go-shellwords#27 Multi-commands inside of command substitution are throwing "invalid command line string" errors
- mattn/go-shellwords#24 Add dir option for parser
- mattn/go-shellwords#24 Add dir option for parser
- mattn/go-shellwords#24 Add dir option for parser

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Upstream-commit: 7dee71e02f82df7a5de88cedefb016ba848b14a2
Component: engine
burnMyDread pushed a commit to burnMyDread/moby that referenced this issue Oct 21, 2019
full diff: mattn/go-shellwords@v1.0.5...v1.0.6

relevant changes:

- mattn/go-shellwords#24 Add dir option for parser
- mattn/go-shellwords#26 Fix backquote in part of argument
    - fixes mattn/go-shellwords#25 Backtick "eats" all runes until isSpace
- mattn/go-shellwords#28 Fix dollar quote
    - fixes mattn/go-shellwords#27 Multi-commands inside of command substitution are throwing "invalid command line string" errors
- mattn/go-shellwords#24 Add dir option for parser
- mattn/go-shellwords#24 Add dir option for parser
- mattn/go-shellwords#24 Add dir option for parser

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: zach <[email protected]>
thaJeztah added a commit to thaJeztah/cli that referenced this issue Oct 23, 2019
full diff: mattn/go-shellwords@v1.0.5...v1.0.6

relevant changes:

- mattn/go-shellwords#24 Add dir option for parser
- mattn/go-shellwords#26 Fix backquote in part of argument
    - fixes mattn/go-shellwords#25 Backtick "eats" all runes until isSpace
- mattn/go-shellwords#28 Fix dollar quote
    - fixes mattn/go-shellwords#27 Multi-commands inside of command substitution are throwing "invalid command line string" errors
- mattn/go-shellwords#24 Add dir option for parser
- mattn/go-shellwords#24 Add dir option for parser
- mattn/go-shellwords#24 Add dir option for parser

Signed-off-by: Sebastiaan van Stijn <[email protected]>
docker-jenkins pushed a commit to docker-archive/docker-ce that referenced this issue Dec 4, 2019
full diff: mattn/go-shellwords@v1.0.5...v1.0.6

relevant changes:

- mattn/go-shellwords#24 Add dir option for parser
- mattn/go-shellwords#26 Fix backquote in part of argument
    - fixes mattn/go-shellwords#25 Backtick "eats" all runes until isSpace
- mattn/go-shellwords#28 Fix dollar quote
    - fixes mattn/go-shellwords#27 Multi-commands inside of command substitution are throwing "invalid command line string" errors
- mattn/go-shellwords#24 Add dir option for parser
- mattn/go-shellwords#24 Add dir option for parser
- mattn/go-shellwords#24 Add dir option for parser

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Upstream-commit: 6a26d370ad3973d9e53cb160433e0fba5e384a7f
Component: cli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants