Skip to content

9p client truncates modified time nanoseconds field to zero when setting it #7581

@mvondev

Description

@mvondev

Version

Microsoft Windows [Version 10.0.22000.258]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.10.60.1

Distro Version

Debian 11.0

Other Software

'touch' utility from the Debian distro's Coreutils package (version 8.32).

Repro Steps

Assume the current user is named fred. All steps are performed in the directory C:\Users\fred\Documents.

Reason for the choice of directory: it is in an NTFS partition which supports a timestamp resolution of 10^-7 seconds.
Steps to follow:

  1. Launch Debian Linux and get a bash prompt.
  2. Enter cd /mnt/c/Users/fred/Documents.
  3. Enter touch newfile to create a new file.
  4. Enter stat newfile to get the timestamps of the new file. Here is a sample output:
  File: newfile
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: 41h/65d Inode: 3659174697380631  Links: 1
Access: (0777/-rwxrwxrwx)  Uid: ( 1000/   wiser)   Gid: ( 1000/   wiser)
Access: 2021-10-21 13:18:53.270571800 +0800
Modify: 2021-10-21 13:18:53.270571800 +0800
Change: 2021-10-21 13:18:53.270571800 +0800
 Birth: -
  1. Using this file as a reference file, create another by entering touch anothernewfile -r newfile.
  2. Get its timestamps via stat anothernewfile. Here is a sample output:
  File: anothernewfile
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: 41h/65d Inode: 4785074604233393  Links: 1
Access: (0777/-rwxrwxrwx)  Uid: ( 1000/   wiser)   Gid: ( 1000/   wiser)
Access: 2021-10-21 13:18:53.000000000 +0800
Modify: 2021-10-21 13:18:53.000000000 +0800
Change: 2021-10-21 13:23:15.413922200 +0800
 Birth: -

Expected Behavior

Both stat commands should output timestamps in a resolution of 10^-7 second.

Actual Behavior

The second stat command shows that the second touch command truncate the 'Access' and 'Modify' timestamps to the nearest second.

Diagnostic Logs

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions