[GH-ISSUE #897] Metadata mtime (x-amz-meta-mtime) defined as floating point number is reported as "Jan 1 1970" #520

Closed
opened 2026-03-04 01:46:19 +03:00 by kerem · 3 comments
Owner

Originally created by @aritgithub on GitHub (Jan 17, 2019).
Original GitHub issue: https://github.com/s3fs-fuse/s3fs-fuse/issues/897

Last stable version 1.84 on standard S3 bucket always reports "Jan 1 1970" as modification timestamp of files with Metadata mtime (x-amz-meta-mtime) inserted by some external tools as floating point since the epoch accurate to 1 ns.
Test case:

$ aws s3api head-object --bucket mybucket --key "myfile.png"
{
    "AcceptRanges": "bytes", 
    "ContentType": "image/png", 
    "LastModified": "Thu, 17 Jan 2019 10:14:34 GMT", 
    "ContentLength": 302676, 
    "VersionId": "null", 
    "ETag": "\"6561503ed3e299f621ae104dba3e2eea\"", 
    "Metadata": {
        "mtime": "1547720072.89938138"
    }
}

$ ls -l /mnt/s3fs
-rwxrwxr-x 1 s3fs s3fs 302676 Jan  1  1970 myfile.png

Metadata mtime defined as long number (no floating point) reports the correct timestamp of file:

$ aws s3api head-object --bucket mybucket --key "myfile.png"
{
    "AcceptRanges": "bytes", 
    "ContentType": "image/png", 
    "LastModified": "Thu, 17 Jan 2019 10:33:32 GMT", 
    "ContentLength": 302676, 
    "VersionId": "null", 
    "ETag": "\"6561503ed3e299f621ae104dba3e2eea\"", 
    "Metadata": {
        "mtime": "1547721185"
    }
}

$ ls -l /mnt/s3fs
-rwxrwxr-x 1 s3fs s3fs 302676 Jan 17 10:33 myfile.png

Is possible to exclude decimal part of floating point number from parser function of this metadata?

Originally created by @aritgithub on GitHub (Jan 17, 2019). Original GitHub issue: https://github.com/s3fs-fuse/s3fs-fuse/issues/897 Last stable version 1.84 on standard S3 bucket always reports "Jan 1 1970" as modification timestamp of files with Metadata mtime (x-amz-meta-mtime) inserted by some external tools as floating point since the epoch accurate to 1 ns. Test case: ``` $ aws s3api head-object --bucket mybucket --key "myfile.png" { "AcceptRanges": "bytes", "ContentType": "image/png", "LastModified": "Thu, 17 Jan 2019 10:14:34 GMT", "ContentLength": 302676, "VersionId": "null", "ETag": "\"6561503ed3e299f621ae104dba3e2eea\"", "Metadata": { "mtime": "1547720072.89938138" } } $ ls -l /mnt/s3fs -rwxrwxr-x 1 s3fs s3fs 302676 Jan 1 1970 myfile.png ``` Metadata mtime defined as long number (no floating point) reports the correct timestamp of file: ``` $ aws s3api head-object --bucket mybucket --key "myfile.png" { "AcceptRanges": "bytes", "ContentType": "image/png", "LastModified": "Thu, 17 Jan 2019 10:33:32 GMT", "ContentLength": 302676, "VersionId": "null", "ETag": "\"6561503ed3e299f621ae104dba3e2eea\"", "Metadata": { "mtime": "1547721185" } } $ ls -l /mnt/s3fs -rwxrwxr-x 1 s3fs s3fs 302676 Jan 17 10:33 myfile.png ``` Is possible to exclude decimal part of floating point number from parser function of this metadata?
kerem closed this issue 2026-03-04 01:46:19 +03:00
Author
Owner

@gaul commented on GitHub (Jan 18, 2019):

This seems reasonable. Can you share which application uses this format and perhaps submit a pull request to fix this? You will want to look at s3fs_util.cpp:get_time and string_util.cpp:s3fs_strtoofft. #905 has some unit tests which might help implement this.

<!-- gh-comment-id:455443810 --> @gaul commented on GitHub (Jan 18, 2019): This seems reasonable. Can you share which application uses this format and perhaps submit a pull request to fix this? You will want to look at `s3fs_util.cpp:get_time` and `string_util.cpp:s3fs_strtoofft`. #905 has some unit tests which might help implement this.
Author
Owner

@aritgithub commented on GitHub (Jan 18, 2019):

The tool used is rclone; technical notes of the project say:

rclone reads and writes the modified time using an accuracy determined by the OS. Typically this is 1ns on Linux, 10 ns on Windows and 1 Second on OS X.

Sure, I can try... thanks for your suggestion.

<!-- gh-comment-id:455479562 --> @aritgithub commented on GitHub (Jan 18, 2019): The tool used is rclone; technical notes of the project say: > rclone reads and writes the modified time using an accuracy determined by the OS. Typically this is 1ns on Linux, 10 ns on Windows and 1 Second on OS X. Sure, I can try... thanks for your suggestion.
Author
Owner

@ggtakec commented on GitHub (Jan 20, 2019):

@aritgithub I merged new code for floating point number in x-amz-meta-mtime by #909.
If you can please use master branch source code for your buckets which has objects stamped mtime by rclone.
I'm closing this issue, but if you have a problem yet please reopen.
Thanks in advance for your assistance.

<!-- gh-comment-id:455851479 --> @ggtakec commented on GitHub (Jan 20, 2019): @aritgithub I merged new code for floating point number in x-amz-meta-mtime by #909. If you can please use master branch source code for your buckets which has objects stamped mtime by rclone. I'm closing this issue, but if you have a problem yet please reopen. Thanks in advance for your assistance.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/s3fs-fuse#520
No description provided.