Conversation
Merged
fingolfin
reviewed
Nov 10, 2025
fingolfin
reviewed
Nov 10, 2025
Comment on lines
+156
to
+158
| @TMPFILE=$$(mktemp $(abspath $@.XXXXXX)); \ | ||
| sed <'$<' >$$TMPFILE -e 's/@JULIA_SHLIB_SYMBOL_VERSION@/JL_LIBJULIA_$(SOMAJOR)/'; \ | ||
| mv $$TMPFILE $@ |
Member
There was a problem hiding this comment.
How about we add a new helper script like this (created via ChatGPT, just to keep it interesting ;-)), stored as, say, atomic_write_if_different.sh somewhere we can easily reach it:
#!/bin/sh
# Atomic write-if-different helper
# Usage: atomic_write_if_different.sh TARGET
set -eu
target=$1
tmp=$(mktemp "${target}.XXXXXX") || exit 1
# Ensure temporary file gets cleaned up on exit or interrupt
cleanup() {
rm -f "$tmp"
}
trap cleanup EXIT INT TERM HUP
# Read stdin to the temporary file
cat > "$tmp"
# If target does not exist, move new file into place
if [ ! -f "$target" ]; then
mv "$tmp" "$target"
trap - EXIT
exit 0
fi
# Compare old and new; only replace if different
if cmp -s "$tmp" "$target"; then
# identical
rm -f "$tmp"
else
mv "$tmp" "$target"
fi
trap - EXIT
exit 0Then here we can write
Suggested change
| @TMPFILE=$$(mktemp $(abspath $@.XXXXXX)); \ | |
| sed <'$<' >$$TMPFILE -e 's/@JULIA_SHLIB_SYMBOL_VERSION@/JL_LIBJULIA_$(SOMAJOR)/'; \ | |
| mv $$TMPFILE $@ | |
| sed <'$<' -e 's/@JULIA_SHLIB_SYMBOL_VERSION@/JL_LIBJULIA_$(SOMAJOR)/' \ | |
| | PATH/TO/atomic_write_if_different.sh $@ |
The result has more comprehensive functionality and is arguably easier to read and maintain -- I think this is more visible in some of the other places.
Member
Author
There was a problem hiding this comment.
I do like that. We need to be careful though, since half of the places we use this, the "if different" policy should not be applied, while the other half it should be (and a few don't care)
fingolfin
added a commit
that referenced
this pull request
Nov 10, 2025
It is not supported in macOS 13 userland which causes CI failures. For background info [see here](#59980 (comment)). This is a subset of PR #60080 but unlike that, it only solves the specific issue causing trouble in CI right now, and does not attempt to resolve a bunch of other things -- which may very well all be fine and nice and desirable, but it's quite a bit more to review.
Use mktemp more to make various file builds atomic (particularly those shared between release and debug).
6cf075d to
55d45cc
Compare
giordano
reviewed
Dec 5, 2025
Comment on lines
-164
to
+171
| rm -f $(BUILDDIR)/julia.expmap | ||
| rm -f $(BUILDDIR)/julia.expmap* |
Member
There was a problem hiding this comment.
This (and same change in src/Makefile) broke make cleanall: #60319
KristofferC
pushed a commit
that referenced
this pull request
Mar 12, 2026
It is not supported in macOS 13 userland which causes CI failures. For background info [see here](#59980 (comment)). This is a subset of PR #60080 but unlike that, it only solves the specific issue causing trouble in CI right now, and does not attempt to resolve a bunch of other things -- which may very well all be fine and nice and desirable, but it's quite a bit more to review. (cherry picked from commit 3747300)
KristofferC
pushed a commit
that referenced
this pull request
Mar 12, 2026
Use mktemp more to make various file builds atomic (particularly those shared between release and debug). (Coded by Claude) (cherry picked from commit 5eb6e28)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some mktemp only added -p argument recently for BSD vs. gnu consistency with other arguments, so use
abspathinstead to emulate it. Use it to make various file builds atomic (particularly those shared between release and debug).](Coded by Claude)