diff mbox series

Check if version is actually a file

Message ID 20250314144539.2885974-1-frederikbraendstrup@gmail.com (mailing list archive)
State New
Headers show
Series Check if version is actually a file | expand

Commit Message

Frederik Brændstrup March 14, 2025, 2:45 p.m. UTC
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(+)

Comments

Alexander Kanavin March 17, 2025, 10:23 a.m. UTC | #1
Thanks for the patch, but it should be sent to openembedded-core list,
as poky is an aggregate repository of various pieces.

Alex

On Fri, 14 Mar 2025 at 15:46, Frederik Brændstrup via
lists.yoctoproject.org
<frederikbraendstrup=gmail.com@lists.yoctoproject.org> wrote:
>
> 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(+)
>
> 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('"\'')
> --
> 2.47.2
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#13567): https://lists.yoctoproject.org/g/poky/message/13567
> Mute This Topic: https://lists.yoctoproject.org/mt/111700337/1686489
> Group Owner: poky+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/poky/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

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('"\'')