Skip to content

feat(libkernel): implement lutimes - #4622

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
jagrat04:feat/libkernel-lutimes
Oct 13, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
jagrat04:feat/libkernel-lutimes

Conversation

@jagrat04

Copy link
Copy Markdown
Contributor

What

Implement lutimes (PmZfv0lup1c) in libkernel:

  • Add followLink parameter to NativeUtimes (defaulting to true for utimes and futimes).
  • On Windows, pass FILE_FLAG_OPEN_REPARSE_POINT when followLink is false so timestamps are set on the symbolic link or reparse point itself rather than the target file.
  • On Linux, delegate to ::lutimes when followLink is false.
  • Export lutimes_nid_postfix with standard path validation, invalid microsecond checks, and path resolution.
  • Add test coverage in GuestFileTimestamps for fractional timestamps, invalid microseconds, null/empty/missing paths, and symbolic links.

Tested

  • Windows 11 (x86_64), GuestFileTimestamps test suite: verified fractional timestamps, invalid microsecond rejection, error reporting (EFAULT, ENOENT, EINVAL), and symlink timestamp modification without altering target file times.
  • python tools/check_conventions.py --base origin/main passed cleanly.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Progress report (510a218 → 8d08caa)

➖ System libraries: 87.92% (+0.0%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel lutimes_nid_postfix

@github-actions github-actions Bot added libkernel docs needs rebase Conflicts with main, rebase needed labels Oct 12, 2026
@jagrat04
jagrat04 force-pushed the feat/libkernel-lutimes branch from 7f68ea1 to de4ae5b Compare October 12, 2026 18:54
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@jagrat04
jagrat04 force-pushed the feat/libkernel-lutimes branch from de4ae5b to 9227bda Compare October 12, 2026 20:19

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. The implementation of lutimes_nid_postfix looks right, but the test aborts on Linux:

  • core/libs/tests/GuestFileTimestamps.cpp:152: CheckTimes(path, fd, second) uses fd, which was closed at line 129 (close fixture descriptor). guest_file_timestamps aborts with FillFileStat: fstat failed for fd 6. Check the target with stat_nid_postfix(path...) instead, or reopen it.
  • Same block: the symlink case only checks that the target is unchanged. Also stat/lstat the link itself and require its mtime to be first, otherwise nothing shows the link was modified.
  • The branch conflicts with main in docs/dev/debt/libkernel.md (the "Windows file timestamps" line); please rebase.

Please rerun ctest -R guest_file_timestamps locally after the fix.

@jagrat04
jagrat04 force-pushed the feat/libkernel-lutimes branch from 9227bda to 1ddf976 Compare October 12, 2026 22:43
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@jagrat04
jagrat04 requested a review from adriadam10 October 12, 2026 23:09
@jagrat04
jagrat04 force-pushed the feat/libkernel-lutimes branch from 1ddf976 to 8d08caa Compare October 13, 2026 01:01
@jagrat04

Copy link
Copy Markdown
Contributor Author

@adriadam10 Thanks for the review! Updated as requested:

  • Rebased cleanly onto latest origin/main resolving the debt doc conflict.
  • In core/libs/tests/GuestFileTimestamps.cpp: verified the target file timestamps using stat_nid_postfix(path.c_str(), &targetStatus) rather than the closed file descriptor, and verified the symlink's own mtime was updated to first using lstat_nid_postfix on Linux / reparse point query on Windows.
  • Verified locally with ctest -R guest_file_timestamps (passed) and tools/check_conventions.py --base origin/main.

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#4938 docs/dev/debt/libkernel.md L97-98

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the build and guest_file_timestamps on Linux merged onto current main (full libs ctest green), and that the new test fails without the change; the symlink checks (target untouched, link mtime updated) and the error cases match utimes. Merging.

@adriadam10
adriadam10 merged commit fc1f063 into boykopovar:main Oct 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants