Message ID | CADs2FCHRm4-fjjNJyCTB8s_ch6mP62FPjNgp4jKYP=E_tmxK_w@mail.gmail.com |
---|---|
State | New |
Headers | show |
Series | Check if version is actually a file | expand |
On Tue, 18 Mar 2025 at 13:19, Frederik Brændstrup via lists.openembedded.org <frederikbraendstrup=gmail.com@lists.openembedded.org> wrote: > > Recipetool incorrectly made the assumption that version is always a > file, but when it's a directory, the call to open fails Thanks for the patch. There is some missing context in it, specifically, filelist is formed like this: filelist = RecipeHandler.checkfiles(srctree, ['VERSION', 'version']) Shouldn't rather this function/method be fixed to only return files? There are multiple other places in the same file where the same call is used to form filelists, and they all potentially have the same issue. Alex
diff --git a/scripts/lib/recipetool/create_buildsys.py b/scripts/lib/recipetool/create_buildsys.py index ec9d510e23..0a08fc64ca 100644 --- a/scripts/lib/recipetool/create_buildsys.py +++ b/scripts/lib/recipetool/create_buildsys.py @@ -808,6 +808,8 @@ class VersionFileRecipeHandler(RecipeHandler): version = None for fileitem in filelist: linecount = 0 + if not os.path.isfile(fileitem): + continue with open(fileitem, 'r', errors='surrogateescape') as f: for line in f: line = line.rstrip().strip('"\'')
Recipetool incorrectly made the assumption that version is always a file, but when it's a directory, the call to open fails Signed-off-by: Frede Braendstrup <frederikbraendstrup@gmail.com> --- scripts/lib/recipetool/create_buildsys.py | 2 ++ 1 file changed, 2 insertions(+) -- 2.47.2