Skip to content

Add test for promoting over a running binary#14173

Merged
Leonidas-from-XIV merged 1 commit intoocaml:mainfrom
robinbb:fix-3484-promote-running-binary
Apr 17, 2026
Merged

Add test for promoting over a running binary#14173
Leonidas-from-XIV merged 1 commit intoocaml:mainfrom
robinbb:fix-3484-promote-running-binary

Conversation

@robinbb
Copy link
Copy Markdown
Collaborator

@robinbb robinbb commented Apr 13, 2026

Summary

Closes #3484

Promoting a binary via (promote (into ...)) while it is running used to
crash with Sys_error("Text file busy") and a raw stacktrace. This was
fixed by the refactoring of artifact_substitution.ml to use atomic copy
(write to temp file, then rename), since rename replaces the directory
entry while the running process keeps its open file descriptor.

This PR adds a regression test to prevent this from breaking again.

New test added: promote/promote-over-running-binary.t passes

@robinbb robinbb marked this pull request as draft April 13, 2026 05:11
@robinbb robinbb marked this pull request as ready for review April 13, 2026 05:40
Comment thread test/blackbox-tests/test-cases/promote/promote-over-running-binary.t Outdated
Comment thread test/blackbox-tests/test-cases/promote/promote-over-running-binary.t Outdated
Comment thread test/blackbox-tests/test-cases/promote/promote-over-running-binary.t Outdated
Comment thread test/blackbox-tests/test-cases/promote/promote-over-running-binary.t Outdated
Comment thread test/blackbox-tests/test-cases/promote/promote-over-running-binary.t Outdated
@robinbb robinbb force-pushed the fix-3484-promote-running-binary branch 2 times, most recently from fc5a98e to 87b7222 Compare April 13, 2026 18:23
@robinbb
Copy link
Copy Markdown
Collaborator Author

robinbb commented Apr 14, 2026

@Leonidas-from-XIV Back to you for review. I have addressed each concern.

Comment thread test/blackbox-tests/test-cases/promote/promote-over-running-binary.t Outdated
Comment thread test/blackbox-tests/test-cases/promote/promote-over-running-binary.t Outdated
@robinbb robinbb force-pushed the fix-3484-promote-running-binary branch 2 times, most recently from ba80782 to d88629c Compare April 16, 2026 00:47
Closes ocaml#3484

Promotion of a binary that is currently running used to crash with
`Sys_error("Text file busy")`. This was fixed by the refactoring of
`artifact_substitution.ml` to use atomic copy (write to temp file, then
rename), since `rename` replaces the directory entry while the running
process keeps its open file descriptor.

Add a regression test to prevent this from breaking again.

Signed-off-by: Robin Bate Boerop <me@robinbb.com>
@robinbb robinbb force-pushed the fix-3484-promote-running-binary branch from d88629c to 6529813 Compare April 16, 2026 20:59
@robinbb
Copy link
Copy Markdown
Collaborator Author

robinbb commented Apr 16, 2026

@Leonidas-from-XIV The CI was briefly failing due to an unrelated problem, but is now green again.

Copy link
Copy Markdown
Collaborator

@Leonidas-from-XIV Leonidas-from-XIV left a comment

Choose a reason for hiding this comment

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

Looks good to me; thanks for addressing all the concerns!

@Leonidas-from-XIV Leonidas-from-XIV merged commit 764b9b2 into ocaml:main Apr 17, 2026
29 checks passed
@robinbb robinbb deleted the fix-3484-promote-running-binary branch April 17, 2026 16:16
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

Successfully merging this pull request may close these issues.

stacktrace when trying to promote into a binary in use (linux)

3 participants