From 0c0a85f3bb245b55c8bb08df6e1ae5a3a84ab395 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Wed, 11 Jan 2023 19:07:38 +0100 Subject: [PATCH] getHookFiles: print exact error from getFiles (MR 28) Instead of assuming that the error is "unable to find file", print the actual error from getFiles. I just had a situation where the file exists, but a dependency couldn't be found. Before: generateInitfsExtra: getHookFiles: unable to find file "/usr/bin/expect" required by "/etc/postmarketos-mkinitfs/files-extra/ondev2-test.files" After: generateInitfsExtra: getHookFiles: unable to add file "/usr/bin/expect" required by "/etc/postmarketos-mkinitfs/files-extra/ondev2-test.files": getBinaryDeps: unable to locate dependency for "/usr/bin/expect": libexpect5.45.4.so --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 9698421..72dc4a3 100644 --- a/main.go +++ b/main.go @@ -165,7 +165,7 @@ func getHookFiles(filesdir string) (files []string, err error) { s := bufio.NewScanner(f) for s.Scan() { if filelist, err := getFiles([]string{s.Text()}, true); err != nil { - return nil, fmt.Errorf("getHookFiles: unable to find file %q required by %q", s.Text(), path) + return nil, fmt.Errorf("getHookFiles: unable to add file %q required by %q: %w", s.Text(), path, err) } else { files = append(files, filelist...) }