Skip to content

unix,win: accept NAN/INFINITY as file timestamps#4702

Merged
bnoordhuis merged 1 commit intolibuv:v1.xfrom
bnoordhuis:fix4665
Feb 21, 2025
Merged

unix,win: accept NAN/INFINITY as file timestamps#4702
bnoordhuis merged 1 commit intolibuv:v1.xfrom
bnoordhuis:fix4665

Conversation

@bnoordhuis
Copy link
Copy Markdown
Member

Extend uv_fs_utime, uv_fs_futime and uv_fs_lutime to accept NAN and INFINITY, with NAN meaning "don't touch the timestamp" and INFINITY meaning "set to the current timestamp."

Ugly, but it avoids having to add uv_fs_utime2, etc.

Fixes: #4665

@bnoordhuis
Copy link
Copy Markdown
Member Author

bnoordhuis commented Feb 16, 2025

The android test failure is this:

# Output from process `fs_fstat`:
# Assertion failed in /home/runner/work/libuv/libuv/test/test-fs.c on line 1530: s->st_birthtim.tv_nsec == 0 || s->st_birthtim.tv_nsec == t.st_ctim.tv_nsec

Which looks related but really cannot be unless fs_fstat and e.g. fs_futime stomp on each other. I suppose it's possible because they both operate on a file called "test_file". Let's see if it's repeatable.

Copy link
Copy Markdown
Member

@saghul saghul left a comment

Choose a reason for hiding this comment

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

LGTM with a suggestion.

Extend uv_fs_utime, uv_fs_futime and uv_fs_lutime to accept NAN and
INFINITY, with NAN meaning "don't touch the timestamp" and INFINITY
meaning "set to the current timestamp."

Ugly, but it avoids having to add uv_fs_utime2, etc.

UV_FS_UTIME_NOW and UV_FS_UTIME_OMIT constants have been added to make
it more palatable.

Fixes: libuv#4665
@bnoordhuis bnoordhuis merged commit 85b526f into libuv:v1.x Feb 21, 2025
37 of 38 checks passed
@bnoordhuis bnoordhuis deleted the fix4665 branch February 21, 2025 22:08
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.

Support leaving times unchanged in fs__utime

2 participants