From 04af9ae3fcf0ad44a4214725c8e351a70341ad4d Mon Sep 17 00:00:00 2001 From: Peiyuan Song Date: Mon, 8 Sep 2025 17:18:32 +0800 Subject: [PATCH] fix(emulation): handle fs.ErrNotExist in registeredBinfmtMisc When `/proc/sys/fs/binfmt_misc` is not mounted, filepath.WalkDir may return fs.ErrNotExist errors. These should be handled gracefully and return nil instead of causing a panic. Signed-off-by: Peiyuan Song --- pkg/emulation/binfmtmisc_linux.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/emulation/binfmtmisc_linux.go b/pkg/emulation/binfmtmisc_linux.go index a67de0525c..90fc665690 100644 --- a/pkg/emulation/binfmtmisc_linux.go +++ b/pkg/emulation/binfmtmisc_linux.go @@ -27,7 +27,10 @@ func registeredBinfmtMisc() ([]string, error) { if filepath.Base(path) == "register" { // skip this one return nil } - if err != nil && !errors.Is(err, os.ErrNotExist) { + if err != nil { + if errors.Is(err, fs.ErrNotExist) { + return nil + } return err } info, err := d.Info()