Repository navigation
fix(archive): 복원 시 파일·디렉터리 mtime 보존 - #185
Merged
Merged
Conversation
아카이브는 tar.FileInfoHeader 로 mtime 을 이미 담고 있었는데 복원이 그 값을 버려, 동결·복원을 거친 모든 파일이 복원 시각으로 찍혔다(운영 non-root 셸 스모크에서 관측). - restoreModTime(archive_mtime.go): 저장된 mtime 으로 os.Chtimes. atime 도 같은 값(기본 tar 포맷에 atime 이 없다). 심볼릭 링크는 건드리지 않는다 (Chtimes 가 링크를 따라가 대상을 바꾼다). - state_archive.go: 일반 파일은 Chmod 뒤에, 디렉터리는 자식 생성이 끝난 뒤 기존 깊은 곳 우선 모드 복원 패스에서. shared 볼륨으로 복사하는 copyRestoredTree 도 같은 규칙. 상태 트리는 rename 으로 설치돼 그대로 남는다. - 정밀도는 초 단위(기본 tar writer). 이미 저장된 아카이브도 mtime 을 담고 있어 고친 뒤 복원하면 원래 시각으로 돌아온다. - 테스트: 상태·shared 트리의 파일·디렉터리 mtime 왕복, 심볼릭 링크 대상 미변경. 둘 다 수정 전 코드에서 실패함을 확인. - 주석 원장 #4: 지문만 갱신(`*dirModes = append` 코드 줄 오검출, 판정 0줄). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Xb2pE6EtTVPjXUZqzS2Kk
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.
왜
운영 non-root 셸 동결·복원 스모크에서 복원된 파일의 mtime 이 복원 시각으로 바뀌어 있었다. 아카이브는
tar.FileInfoHeader로 mtime 을 이미 담는데, 복원(extractClaudeStateEntry·copyRestoredTree)이 권한만 되돌리고 시각은 버렸다.무엇을
data-plane/cmd/agent/archive_mtime.go(새 파일):restoreModTime— 저장된 mtime 으로os.Chtimes. atime 도 같은 값(기본 tar 포맷에 atime 이 없어 "방금 읽은 파일"처럼 보이지 않게). 0 시각은 건너뜀.state_archive.go(코드만):Chmod다음restoreModTime.restoredDirMode에modTime을 싣고, 자식 생성이 끝난 뒤 도는 기존 깊은 곳 우선 모드 복원 패스에서 함께 찍는다(자식을 만들면 부모 mtime 이 다시 움직이므로).copyRestoredTree도 같은 규칙.os.Chtimes가 링크를 따라가 대상을 바꾸기 때문.installClaudeState가 rename 으로 설치하므로 찍힌 시각이 그대로 남는다.범위·한계
Format: tar.FormatPAX를 지정하는 별도 변경.테스트
TestStateArchiveRestorePreservesModTimes: 상태·shared 트리의 파일·중첩 디렉터리에 과거 시각을 찍고 왕복 →ModTime일치.TestStateArchiveRestoreDoesNotStampThroughSymlinks: 링크가 있어도 대상 파일의 시각이 유지.go test ./...(data-plane), 정적 게이트 넷 통과.*dirModes = append(...)코드 줄이\*[^/]패턴에 걸리는 오검출이 움직였다.Generated by Claude Code