Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/incatools/odk/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,14 @@ def seed(
if gitemail is not None:
os.environ["GIT_AUTHOR_EMAIL"] = gitemail
os.environ["GIT_COMMITTER_EMAIL"] = gitemail
files_to_commit = [
t for t in tgts if not t.startswith(outdir + "/src/ontology/tmp/stamp-")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest os.path.basename(t).startswith("stamp-component-") wouldn't care where the template lives. to not get some weirdness with outdir differences across systems..

]
runcmd(
"cd {dir} && git init -b {branch} && git add {files} && git commit -m 'initial commit'".format(
dir=outdir,
branch=project.git_main_branch,
files=" ".join([t.replace(outdir, ".", 1) for t in tgts]),
files=" ".join([t.replace(outdir, ".", 1) for t in files_to_commit]),
)
)
runcmd(
Expand Down
2 changes: 2 additions & 0 deletions src/incatools/odk/templates/_dynamic_files.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,8 @@ Documentation of the Default DOSDP Pipeline

<!-- This is a placeholder, it will be regenerated when makefile is first executed -->
</rdf:RDF>
^^^ src/ontology/tmp/stamp-component-{{ component.filename }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The analysis makes sense, but the fix relies on the stamp having a newer mtime than the placeholder, and that doesn't hold on Linux.

On macOS the two files are written ~120µs apart, so it works. On Linux (I think) the kernel stamps mtimes from a coarse clock, so two files written back to back get the same timestamp (tested on overlayfs and tmpfs; GNU Make 4.4.1 then treats the target as up to date). That covers ODK containers on Linux hosts and our ubuntu-latest CI jobs. It also fails for exactly the case this fix targets: newly added components (ontology-metadata#210).

Suggestion: make the ordering explicit instead of relying on write order. After unpacking, backdate the placeholder:

os.utime(component_path, (0, 0))

This works on any kernel, and backdating is safer than pushing the stamp into the future. Perhaps add a comment explaining why, so nobody deletes it later.

Also, consider adding a check in test-configs.sh that each stamp is newer than its component after seeding. Since seed-tests.yml runs on both ubuntu-latest and macos-15, this should have caught the problem.


{% endfor -%}
{% endif -%}
{% if 'basic' in project.release_artefacts or project.primary_release == 'basic' -%}
Expand Down
Loading