allthingssecurity commented on PR #27162:
URL: https://github.com/apache/camel/pull/27162#issuecomment-5926777674

   Thanks for the review. Good point about the symlink and the permissions: 
rather than documenting it, I changed `trunkStore` to keep both (commit 
0d11ac986992):
   
   - When the store exists, `trunkStore` resolves it with `toRealPath()` and 
replaces that real file. A symlinked store stays a link, and the `.tmp` file is 
created next to the real file, so it is on the same file system and the atomic 
move still applies.
   - Before the move, the temporary file gets the store's POSIX permissions 
(`Files.getPosixFilePermissions`/`setPosixFilePermissions`), when the file 
system has a `PosixFileAttributeView`. Otherwise (such as on Windows) nothing 
changes.
   
   Two new tests in `FileStateRepositoryTest`:
   - `shouldKeepSymlinkedStoreWhenRewriting` (disabled on Windows, skipped 
through an assumption if a symbolic link cannot be created): after a rewrite 
the store is still the same link, the real file has the state, and no `.tmp` 
file is left.
   - `shouldKeepStorePermissionsWhenRewriting` (assumes POSIX): a `rw-r-----` 
store keeps its permissions after a rewrite.
   
   `FileStateRepositoryTest` passes 12/12 locally (macOS, JDK 21). With the 
previous `trunkStore` the two new tests fail (the link becomes a regular file, 
and the permissions become `rw-r--r--`), and the other 10 pass.
   
   _Claude Code on behalf of allthingssecurity_
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to