Skip to content

Commit a4f0ed0

Browse files
authored
Ignore symlinks within directory and permission tests (#254)
Symlinks will always display as `777` files, so we can ignore them by default when running recursive tests. If we care about a specific symlink permission, we can use a `file` check similar to what our test does. Signed-off-by: egibs <[email protected]>
1 parent f949050 commit a4f0ed0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/structure/structure.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,11 @@ func (d DirsCondition) Check(i v1.Image) error {
231231
return err
232232
}
233233

234+
// ignore symlinks which will register as 777
235+
if d.Type()&fs.ModeSymlink == fs.ModeSymlink {
236+
return nil
237+
}
238+
234239
if dir.FilesOnly && d.IsDir() {
235240
return nil
236241
}
@@ -312,6 +317,11 @@ func (p PermissionsCondition) Check(i v1.Image) error {
312317
return err
313318
}
314319

320+
// ignore symlinks which will register as 777
321+
if d.Type()&fs.ModeSymlink == fs.ModeSymlink {
322+
return nil
323+
}
324+
315325
fi, err := d.Info()
316326
if err != nil {
317327
errs = append(errs, err)

0 commit comments

Comments
 (0)