Skip to content

Preserve symlink directory last modified times#51

Merged
saracen merged 1 commit into
saracen:mainfrom
stanhu:sh-preserve-symlink-directory-mtime
Aug 14, 2025
Merged

Preserve symlink directory last modified times#51
saracen merged 1 commit into
saracen:mainfrom
stanhu:sh-preserve-symlink-directory-mtime

Conversation

@stanhu

@stanhu stanhu commented Aug 6, 2025

Copy link
Copy Markdown
Contributor

Previously if a ZIP file contained symlinks, the symlink last modified times would be preserved, but the directories containing the symlink would have their last modified times updated because:

  1. The directory is created first (if it doesn't exist).
  2. The symlink is then created inside that directory.
  3. Creating the symlink modifies the directory's mtime to the current time.
  4. The directory timestamp restoration happens before or is overwritten by the symlink creation.

Fix this by extracting all the symlinks before doing a final pass to update the modification times of all directories.

Relates to #40

@stanhu stanhu force-pushed the sh-preserve-symlink-directory-mtime branch from 3bdcc4f to 955ba1f Compare August 6, 2025 19:46
@saracen saracen force-pushed the sh-preserve-symlink-directory-mtime branch from 955ba1f to 1d8d4ba Compare August 14, 2025 09:06
Previously if a ZIP file contained symlinks, the symlink last modified
times would be preserved, but the directories containing the symlink
would have their last modified times updated because:

1. The directory is created first (if it doesn't exist).
2. The symlink is then created inside that directory.
3. Creating the symlink modifies the directory's mtime to the current time.
4. The directory timestamp restoration happens before or is overwritten
by the symlink creation.

Fix this by extracting all the symlinks before doing a final pass to
update the modification times of all directories.

Relates to saracen#40
@stanhu stanhu force-pushed the sh-preserve-symlink-directory-mtime branch from 1d8d4ba to 6c80acc Compare August 14, 2025 12:40
@saracen saracen merged commit d6cc276 into saracen:main Aug 14, 2025
9 checks passed
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.

2 participants