Skip to content

fs: preserve directory timestamps in cpSync fast path - #65678

Open
abhi128nandan wants to merge 1 commit into
nodejs:mainfrom
abhi128nandan:fix-cpsync-dir-timestamps
Open

fs: preserve directory timestamps in cpSync fast path#65678
abhi128nandan wants to merge 1 commit into
nodejs:mainfrom
abhi128nandan:fix-cpsync-dir-timestamps

Conversation

@abhi128nandan

@abhi128nandan abhi128nandan commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

fs: preserve directory timestamps in cpSync fast path

This completes the work started in PR #65540. While the previous PR fixed
directory timestamp preservation for the JavaScript paths, the native C++
fast path (CpSyncCopyDir in src/node_file.cc) used by fs.cpSync when no
filter is provided still failed to preserve directory timestamps.

This commit invokes the existing CopyUtimes helper for both the root
destination directory and all subdirectories after their contents are
recursively copied, perfectly aligning the native behavior with the
JavaScript fallback.

Signed-off-by: Abhinandan Kumar abhi128618@gmail.com

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to file-system APIs and the fs module. needs-ci PRs that need a full CI run. labels Aug 31, 2026
@abhi128nandan
abhi128nandan marked this pull request as ready for review August 31, 2026 12:05
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.06%. Comparing base (8fe4b64) to head (9227f17).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
src/node_file.cc 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65678      +/-   ##
==========================================
- Coverage   90.07%   90.06%   -0.01%     
==========================================
  Files         754      754              
  Lines      256317   256400      +83     
  Branches    48476    48500      +24     
==========================================
+ Hits       230871   230932      +61     
- Misses      16563    16577      +14     
- Partials     8883     8891       +8     
Files with missing lines Coverage Δ
src/node_file.cc 74.12% <66.66%> (+<0.01%) ⬆️

... and 37 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

abhi128nandan added a commit to abhi128nandan/node that referenced this pull request Aug 31, 2026
This completes the work started in PR nodejs#65540. While the previous PR fixed
directory timestamp preservation for the JavaScript paths, the native C++
fast path (CpSyncCopyDir in src/node_file.cc) used by fs.cpSync when no
filter is provided still failed to preserve directory timestamps.

This commit invokes the existing CopyUtimes helper for both the root
destination directory and all subdirectories after their contents are
recursively copied.

PR-URL: nodejs#65678
Signed-off-by: Abhinandan Kumar <abhi128618@gmail.com>
@abhi128nandan
abhi128nandan force-pushed the fix-cpsync-dir-timestamps branch from 6564718 to e600f00 Compare August 31, 2026 18:02
This completes the work started in PR nodejs#65540. The previous PR fixed
directory timestamp preservation for the JavaScript paths, but the
native C++ fast path (CpSyncCopyDir in src/node_file.cc) used by
fs.cpSync when no filter is provided still failed to preserve directory
timestamps.

This commit invokes the existing CopyUtimes helper for both the root
destination directory and all subdirectories after their contents are
recursively copied, aligning the native behavior with the JavaScript
fallback.

PR-URL: nodejs#65678
Signed-off-by: Abhinandan Kumar <abhi128618@gmail.com>
@abhi128nandan
abhi128nandan force-pushed the fix-cpsync-dir-timestamps branch from e600f00 to 9227f17 Compare August 31, 2026 18:06
@abhi128nandan

Copy link
Copy Markdown
Contributor Author

The lint-js-and-md check was cancelled after reaching the 15-minute
maximum execution time. There was no Markdown lint error reported.

Could someone please rerun the lint-js-and-md check?

All other checks are currently passing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to file-system APIs and the fs module. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants