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

[low pri] Makefile: bad dependencies on podman-remote #14756

Closed
edsantiago opened this issue Jun 28, 2022 · 0 comments · Fixed by #14957
Closed

[low pri] Makefile: bad dependencies on podman-remote #14756

edsantiago opened this issue Jun 28, 2022 · 0 comments · Fixed by #14957
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@edsantiago
Copy link
Member

In short: run make, then run make again, and podman-remote gets rebuilt even though it just got built.

Reason:

podman/Makefile

Lines 307 to 308 in d095053

.PHONY: podman-remote
podman-remote: $(SRCBINDIR) $(SRCBINDIR)/podman$(BINSFX) ## Build podman-remote binary

$(SRCBINDIR) is bin, so the rule is triggering on the mtime of a directory which has just been touched. The rule also depends on bin/podman, which seems weird, especially on platforms (Windows, Mac) that only have podman-remote.

As best I can tell it dates to #9381 (April 2021), but I think something has changed recently because I run make a lot, even on fresh-compiled directories, and am pretty sure I would've noticed this earlier.

Since Makefiles are fragile, and since I'm flying out for a few days without net access, and since I don't even have access to Windows or Mac systems, I'm not even going to think about touching this. I'm even going to keep quiet with my recommendation. I'll look into it next week if it hasn't been fixed by then.

edsantiago added a commit to edsantiago/libpod that referenced this issue Jul 19, 2022
podman-remote has a dependency on $(SRCBINDIR), because on
Mac and Windows that's a special dir that may not exist.
But depending on a directory means depending on its mtime,
which changes every time a file in it is updated, which
means running 'make' twice in a row will rebuild podman-remote
for no good reason.

Solution: GNU Make has the concept of "order-only" prerequisites,
precisely for this situation. Use it. Since it's an obscure
feature, document it.

UPDATE: This exposed some nasty duplication wrt podman-remote rules.
Clean those up, and add comments to some confusing sections.

Fixes: containers#14756

(Also, drive-by edit to remove a stray misdocumented non-option)

Signed-off-by: Ed Santiago <[email protected]>
mheon pushed a commit to mheon/libpod that referenced this issue Jul 26, 2022
podman-remote has a dependency on $(SRCBINDIR), because on
Mac and Windows that's a special dir that may not exist.
But depending on a directory means depending on its mtime,
which changes every time a file in it is updated, which
means running 'make' twice in a row will rebuild podman-remote
for no good reason.

Solution: GNU Make has the concept of "order-only" prerequisites,
precisely for this situation. Use it. Since it's an obscure
feature, document it.

UPDATE: This exposed some nasty duplication wrt podman-remote rules.
Clean those up, and add comments to some confusing sections.

Fixes: containers#14756

(Also, drive-by edit to remove a stray misdocumented non-option)

Signed-off-by: Ed Santiago <[email protected]>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant