cli: don't split multiple-strings flags on comma
Looks like I used StringSliceVar (which splits on comma) where I should have always used StringArrayVar (which does not). Bug report contains this example of misbehavoir: #gocryptfs -extpass 'echo abc,123' -init testdir Reading password from extpass program "echo abc", arguments: ["123"] extpass cmd start failed: exec: "echo abc": executable file not found in $PATH Fixes https://github.com/rfjakob/gocryptfs/issues/730
This commit is contained in:
parent
6c14d25d44
commit
aa1d8a0f90
16
cli_args.go
16
cli_args.go
@ -210,16 +210,16 @@ func parseCliOpts(osArgs []string) (args argContainer) {
|
|||||||
flagSet.StringVar(&args.fido2, "fido2", "", "Protect the masterkey using a FIDO2 token instead of a password")
|
flagSet.StringVar(&args.fido2, "fido2", "", "Protect the masterkey using a FIDO2 token instead of a password")
|
||||||
|
|
||||||
// Exclusion options
|
// Exclusion options
|
||||||
flagSet.StringSliceVar(&args.exclude, "e", nil, "Alias for -exclude")
|
flagSet.StringArrayVar(&args.exclude, "e", nil, "Alias for -exclude")
|
||||||
flagSet.StringSliceVar(&args.exclude, "exclude", nil, "Exclude relative path from reverse view")
|
flagSet.StringArrayVar(&args.exclude, "exclude", nil, "Exclude relative path from reverse view")
|
||||||
flagSet.StringSliceVar(&args.excludeWildcard, "ew", nil, "Alias for -exclude-wildcard")
|
flagSet.StringArrayVar(&args.excludeWildcard, "ew", nil, "Alias for -exclude-wildcard")
|
||||||
flagSet.StringSliceVar(&args.excludeWildcard, "exclude-wildcard", nil, "Exclude path from reverse view, supporting wildcards")
|
flagSet.StringArrayVar(&args.excludeWildcard, "exclude-wildcard", nil, "Exclude path from reverse view, supporting wildcards")
|
||||||
flagSet.StringSliceVar(&args.excludeFrom, "exclude-from", nil, "File from which to read exclusion patterns (with -exclude-wildcard syntax)")
|
flagSet.StringArrayVar(&args.excludeFrom, "exclude-from", nil, "File from which to read exclusion patterns (with -exclude-wildcard syntax)")
|
||||||
|
|
||||||
// multipleStrings options ([]string)
|
// multipleStrings options ([]string)
|
||||||
flagSet.StringSliceVar(&args.extpass, "extpass", nil, "Use external program for the password prompt")
|
flagSet.StringArrayVar(&args.extpass, "extpass", nil, "Use external program for the password prompt")
|
||||||
flagSet.StringSliceVar(&args.badname, "badname", nil, "Glob pattern invalid file names that should be shown")
|
flagSet.StringArrayVar(&args.badname, "badname", nil, "Glob pattern invalid file names that should be shown")
|
||||||
flagSet.StringSliceVar(&args.passfile, "passfile", nil, "Read password from file")
|
flagSet.StringArrayVar(&args.passfile, "passfile", nil, "Read password from file")
|
||||||
|
|
||||||
flagSet.Uint8Var(&args.longnamemax, "longnamemax", 255, "Hash encrypted names that are longer than this")
|
flagSet.Uint8Var(&args.longnamemax, "longnamemax", 255, "Hash encrypted names that are longer than this")
|
||||||
|
|
||||||
|
@ -157,13 +157,13 @@ func TestParseCliOpts(t *testing.T) {
|
|||||||
}...)
|
}...)
|
||||||
|
|
||||||
o = defaultArgs
|
o = defaultArgs
|
||||||
o.exclude = []string{"foo", "bar"}
|
o.exclude = []string{"foo", "bar", "baz,boe"}
|
||||||
testcases = append(testcases, []testcaseContainer{
|
testcases = append(testcases, []testcaseContainer{
|
||||||
{
|
{
|
||||||
i: []string{"gocryptfs", "-e", "foo", "-e", "bar"},
|
i: []string{"gocryptfs", "-e", "foo", "-e", "bar", "-e", "baz,boe"},
|
||||||
o: o,
|
o: o,
|
||||||
}, {
|
}, {
|
||||||
i: []string{"gocryptfs", "--exclude", "foo", "--exclude", "bar"},
|
i: []string{"gocryptfs", "--exclude", "foo", "--exclude", "bar", "--exclude", "baz,boe"},
|
||||||
o: o,
|
o: o,
|
||||||
}, /* TODO BROKEN {
|
}, /* TODO BROKEN {
|
||||||
i: []string{"gocryptfs", "--exclude", "foo", "-e", "bar"},
|
i: []string{"gocryptfs", "--exclude", "foo", "-e", "bar"},
|
||||||
|
Loading…
Reference in New Issue
Block a user