Skip to content

Paths not trimmed throws exception when path starts with space #158

@hype8912

Description

@hype8912

Below is the command line I used and accidentally left a space in the beginning when I was trying to call a file directly. You can duplicate it with any file type by leaving a space at the beginning of the quotes.

Environment:

  • Windows 10.0.19045 Pro Build 19045
  • 48 GB RAM
  • Release is 1.6.0
validator -quiet " C:\Temp\dotnet_examples\DotNet Examples\BenchmarkRunner\TestObjects\HashFile_Small.xml"

Here's the output:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x28 pc=0xa075a5]

goroutine 1 [running]:
github.com/Boeing/config-file-validator/pkg/finder.FileSystemFinder.findOne.func1({0xc0000660c0, 0x57}, {0x0, 0x0}, {0x57?, 0x5c?})
        /github/workspace/pkg/finder/fsfinder.go:122 +0x45
path/filepath.WalkDir({0xc0000660c0, 0x57}, 0xc000087810)
        /usr/local/go/src/path/filepath/path.go:531 +0x9c
github.com/Boeing/config-file-validator/pkg/finder.FileSystemFinder.findOne({{0xc000020500, 0x1, 0x1}, {0xd19540, 0xb, 0xb}, 0xc00001b590, 0xc00001b5c0, 0x0}, {0xc0000660c0, ...})
        /github/workspace/pkg/finder/fsfinder.go:119 +0x198
github.com/Boeing/config-file-validator/pkg/finder.FileSystemFinder.Find({{0xc000020500, 0x1, 0x1}, {0xd19540, 0xb, 0xb}, 0xc00001b590, 0xc00001b5c0, 0x0})
        /github/workspace/pkg/finder/fsfinder.go:81 +0x18b
github.com/Boeing/config-file-validator/pkg/cli.CLI.Run({{0xb1db40?, 0xc000065ae0?}, {0xb1dba0?, 0xd9e580?}})
        /github/workspace/pkg/cli/cli.go:82 +0x56
main.mainInit()
        /github/workspace/cmd/validator/validator.go:225 +0x6e7
main.main()
        /github/workspace/cmd/validator/validator.go:234 +0x13

If you remove the space at the beginning of the quoted path it runs correctly. Not a major issue since there is a workaround.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions