canonical / chisel

GNU Affero General Public License v3.0
270 stars 42 forks source link

hotfix: use strings.TrimPrefix() for relative paths #145

Closed rebornplusplus closed 3 months ago

rebornplusplus commented 3 months ago

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().

This commit fixes said bug.