Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not deterministic behavior in patch tree append #11

Closed
priv-kweihmann opened this issue Dec 19, 2021 · 2 comments
Closed

Not deterministic behavior in patch tree append #11

priv-kweihmann opened this issue Dec 19, 2021 · 2 comments

Comments

@priv-kweihmann
Copy link

for filename in (f for f in os.listdir(dir)):
uses os.listdir, which is in the end depending on the inode order of the underlying fs. Therefore you could have different results on different hosts (or even on the same host at different points in time)

Either sort the list using sorted(os.listdir(...)) or find another alternative to make the function reproducible.

And I think this function needs some further treatment... here are my suggestions

  • remove the print call or replace it with bb.debug or bb.note
  • rework the whole block of
for filename in (f for f in os.listdir(dir)):
    path = os.path.join(dir, filename)
    print(path, filename)

    if os.path.isfile(path) and filename.endswith(".patch"):
        # TODO Escape evil characters ;-)
        src_uri_patches.append("file://" + filename)

to

for filename in sorted(glob.glob(os.path.join(dir, "*.patch"))):
   if os.os.path.isfile(filename):
       src_uri_patches.append("file://%s" % os.path.relpath(d.getVar("WORKSPACE"), filename))
@smk-embedded
Copy link
Collaborator

Thanks for the hint. I will have look at it.

@smk-embedded
Copy link
Collaborator

fixed in commit 2cfb5b6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants