From 60c81c1e45ff80c933f84f20646f726b772e26af Mon Sep 17 00:00:00 2001 From: Emily McMullan Date: Thu, 21 Sep 2023 14:02:31 -0400 Subject: [PATCH] do not allow input and output dirs to be the same for transform Signed-off-by: Emily McMullan --- cmd/shimconvert.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/shimconvert.go b/cmd/shimconvert.go index e752987..f8e10ae 100644 --- a/cmd/shimconvert.go +++ b/cmd/shimconvert.go @@ -77,6 +77,11 @@ func (w *windupShimCommand) Validate() error { if w.input == nil || len(w.input) == 0 { return fmt.Errorf("input for rule file or directory must not be empty") } + for _, r := range w.input { + if r == w.output { + return fmt.Errorf("input rule directory and output directory must be different") + } + } // try to get abs path, if not, continue with relative path if absPath, err := filepath.Abs(w.output); err == nil { w.output = absPath