Use strings.TrimPrefix() for relative paths instead of strings.TrimLeft(), since TrimLeft takes in a cutset instead of a prefix sub-string.
In this particular case, if the --root (output) directory is /tmp/foo and we are determining the relative path for /tmp/foo/tmp-foo, the relative path would result in /-foo since /tmp/foo/tmp would be matched by the /tmp/foo/ cutset.
This results in a flawed map of knownPaths inside slicer.go, which is only checked by the mutation script functions such as content.list().
Use
strings.TrimPrefix()
for relative paths instead ofstrings.TrimLeft()
, sinceTrimLeft
takes in a cutset instead of a prefix sub-string.In this particular case, if the
--root
(output) directory is/tmp/foo
and we are determining the relative path for/tmp/foo/tmp-foo
, the relative path would result in/-foo
since/tmp/foo/tmp
would be matched by the/tmp/foo/
cutset.This results in a flawed map of
knownPaths
inside slicer.go, which is only checked by the mutation script functions such ascontent.list()
.This commit fixes said bug.