forked from yencarnacion/html4tree
-
Notifications
You must be signed in to change notification settings - Fork 0
fix(io): attempt atomic publication of generated index files #296
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
Draft
seonghobae
wants to merge
2
commits into
master
Choose a base branch
from
sentinel-fix-toctou-16582868529218540884
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+29
−2
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
Repository: ContextualWisdomLab/html4tree
Length of output: 27307
🏁 Script executed:
Repository: ContextualWisdomLab/html4tree
Length of output: 1072
🌐 Web query:
Java Files.move ATOMIC_MOVE REPLACE_EXISTING existing target option ignored provider-specific replacement official documentation💡 Result:
According to the official Java documentation for the java.nio.file.Files.move method, when the ATOMIC_MOVE option is specified, all other CopyOption arguments (including REPLACE_EXISTING) are ignored [1][2]. The behavior of ATOMIC_MOVE regarding an existing target is defined as implementation-specific: if the target file exists, the underlying file system implementation may either replace the existing file or fail by throwing an IOException [1][3]. Because ATOMIC_MOVE must be performed as an atomic file system operation, the method will throw an AtomicMoveNotSupportedException if the operation cannot be completed atomically—such as when the target location is on a different FileStore or is associated with a different file system provider [1][2]. In summary, you cannot rely on REPLACE_EXISTING to force a replacement when using ATOMIC_MOVE. If you require atomic behavior and the target file might exist, you must handle the potential for an IOException or implementation-dependent behavior [1][4].
Citations:
🏁 Script executed:
Repository: ContextualWisdomLab/html4tree
Length of output: 325
원자적 교체 정책을 코드, 테스트, 문서에서 일치시키세요.
ATOMIC_MOVE를 지정하면REPLACE_EXISTING은 무시됩니다. 기존index.html의 교체 여부는 파일 시스템 제공자에 따라 달라집니다.AtomicMoveNotSupportedException이외의 교체 실패도 명시적으로 처리하고, 비원자적 fallback을 허용할지 결정하세요.src/test/kotlin/html4tree/MainTest.kt:366-375: 기존index.html을 남긴 상태에서 fallback 교체를 테스트하세요..jules/sentinel.md:87-90: fallback이 원자성을 보장하지 않는 호환성 경로임을 명시하세요.🧰 Tools
🪛 detekt (1.23.8)
[warning] 246-246: The caught exception is swallowed. The original exception could be lost.
(detekt.exceptions.SwallowedException)
📍 Affects 3 files
src/main/kotlin/html4tree/main.kt#L233-L248(this comment)src/test/kotlin/html4tree/MainTest.kt#L365-L375.jules/sentinel.md#L86-L90🤖 Prompt for AI Agents
Source: Coding guidelines