New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SOURCE_DATE_EPOCH=0 not clamping file mtime #2679
Comments
Well yes, that commit does turn value 0 into "disabled" as is common in rpm. As it says in the commit message. If it's a SOURCE_DATE_EPOCH spec violation then please point out the relevant section, I guess we need to do something about it (it's not exactly hard to fix). Otherwise I have a hard time seeing ability to set time to that one second in the seventies as a particularly important real-world use-scenario. |
I build rpm to be used by rpm-ostree, rpm-ostree set all dates to 0 that's why I picked 0 in the past. Using 1 or any other values should work for me, but I think SOURCE_DATE_EPOCH=0 is valid and it use to work, so if we don't fix it we should document it or warn about it. |
What? 😳 Why would it do that? @cgwalters But okay, it is actually used for whatever reasons I do not fathom, so I guess we should fix this. |
ostree always uses zero for mtime of files it writes because there are no timestamps in the file format at all. And in order to have sharing via hardlinks, there's then the question of what time to apply to that inode. If there was a way in a Unix filesystem to have no timestamp at all, we'd definitely do that! In Rust terms, ideally Longer term though, we're moving towards https://github.com/containers/composefs which will give us in-memory/on-disk sharing even if we just let file timestamps float to "whatever", which will be helpful here. Also, it's likely in that world that we could consider switching to canonicalizing the on-disk (in EROFS) timestamp to e.g. something like the overall build's SOURCE_DATE_EPOCH, which could definitely be non-zero. |
Commit 11132fc assumed that the value of 0 is never used in practice and thus used it to indicate "disabled", however that assumption has turned out to be wrong because ostree uses precisely that value as mtime in inodes, which in turn breaks existing workflows in this space (see the associated ticket). Fix this by reverting the above commit (except leaving source_date_epoch initialized to 0, to prevent GCC warnings as mentioned in that commit). As to why not just initialize source_date_epoch to -1: time_t happens to be a signed integer on most platforms but POSIX doesn't specify its signed-ness. Add some accompanying tests too. Fixes: rpm-software-management#2679
Commit 11132fc assumed that the value of 0 is never used in practice and thus used it to indicate "disabled", however that assumption has turned out to be wrong because ostree uses precisely that value as mtime in inodes, which in turn breaks existing workflows in this space (see the associated ticket). Fix this by reverting the above commit (except leaving source_date_epoch initialized to 0, to prevent GCC warnings as mentioned in that commit). As to why not just initialize source_date_epoch to -1: time_t happens to be a signed integer on most platforms but POSIX doesn't specify its signed-ness. Add some accompanying tests too. Fixes: rpm-software-management#2679
Commit 11132fc assumed that the value of 0 is never used in practice and thus used it to indicate "disabled", however that assumption has turned out to be wrong because ostree uses precisely that value as mtime in inodes, which in turn breaks existing workflows in this space (see the associated ticket). Fix this by reverting the above commit (except leaving source_date_epoch initialized to 0, to prevent GCC warnings as mentioned in that commit). As to why not just initialize source_date_epoch to -1: time_t happens to be a signed integer on most platforms but POSIX doesn't specify its signed-ness. Add some accompanying tests too. Fixes: rpm-software-management#2679
Commit 11132fc assumed that the value of 0 is never used in practice and thus used it to indicate "disabled", however that assumption has turned out to be wrong because ostree uses precisely that value as mtime in inodes, which in turn breaks existing workflows in this space (see the associated ticket). Fix this by reverting the above commit (except leaving source_date_epoch initialized to 0, to prevent GCC warnings as mentioned in that commit). As to why not just initialize source_date_epoch to -1: time_t happens to be a signed integer on most platforms but POSIX doesn't specify its signed-ness. Add some accompanying tests too. Fixes: #2679
Commit 11132fc assumed that the value of 0 is never used in practice and thus used it to indicate "disabled", however that assumption has turned out to be wrong because ostree uses precisely that value as mtime in inodes, which in turn breaks existing workflows in this space (see the associated ticket). Fix this by reverting the above commit (except leaving source_date_epoch initialized to 0, to prevent GCC warnings as mentioned in that commit). As to why not just initialize source_date_epoch to -1: time_t happens to be a signed integer on most platforms but POSIX doesn't specify its signed-ness. Add some accompanying tests too. Fixes: rpm-software-management#2679 (backported from commit bb1eeb4)
Commit 11132fc assumed that the value of 0 is never used in practice and thus used it to indicate "disabled", however that assumption has turned out to be wrong because ostree uses precisely that value as mtime in inodes, which in turn breaks existing workflows in this space (see the associated ticket). Fix this by reverting the above commit (except leaving source_date_epoch initialized to 0, to prevent GCC warnings as mentioned in that commit). As to why not just initialize source_date_epoch to -1: time_t happens to be a signed integer on most platforms but POSIX doesn't specify its signed-ness. Add some accompanying tests too. Fixes: rpm-software-management#2679 (backported from commit bb1eeb4)
Commit 11132fc assumed that the value of 0 is never used in practice and thus used it to indicate "disabled", however that assumption has turned out to be wrong because ostree uses precisely that value as mtime in inodes, which in turn breaks existing workflows in this space (see the associated ticket). Fix this by reverting the above commit (except leaving source_date_epoch initialized to 0, to prevent GCC warnings as mentioned in that commit). As to why not just initialize source_date_epoch to -1: time_t happens to be a signed integer on most platforms but POSIX doesn't specify its signed-ness. Add some accompanying tests too. Fixes: #2679 (backported from commit bb1eeb4)
Commit 11132fc assumed that the value of 0 is never used in practice and thus used it to indicate "disabled", however that assumption has turned out to be wrong because ostree uses precisely that value as mtime in inodes, which in turn breaks existing workflows in this space (see the associated ticket). Fix this by reverting the above commit (except leaving source_date_epoch initialized to 0, to prevent GCC warnings as mentioned in that commit). As to why not just initialize source_date_epoch to -1: time_t happens to be a signed integer on most platforms but POSIX doesn't specify its signed-ness. Add some accompanying tests too. Fixes: rpm-software-management#2679 (cherry picked from commit bb1eeb4)
Commit 11132fc assumed that the value of 0 is never used in practice and thus used it to indicate "disabled", however that assumption has turned out to be wrong because ostree uses precisely that value as mtime in inodes, which in turn breaks existing workflows in this space (see the associated ticket). Fix this by reverting the above commit (except leaving source_date_epoch initialized to 0, to prevent GCC warnings as mentioned in that commit). As to why not just initialize source_date_epoch to -1: time_t happens to be a signed integer on most platforms but POSIX doesn't specify its signed-ness. Add some accompanying tests too. Fixes: rpm-software-management#2679 (cherry picked from commit bb1eeb4)
Commit 11132fc assumed that the value of 0 is never used in practice and thus used it to indicate "disabled", however that assumption has turned out to be wrong because ostree uses precisely that value as mtime in inodes, which in turn breaks existing workflows in this space (see the associated ticket). Fix this by reverting the above commit (except leaving source_date_epoch initialized to 0, to prevent GCC warnings as mentioned in that commit). As to why not just initialize source_date_epoch to -1: time_t happens to be a signed integer on most platforms but POSIX doesn't specify its signed-ness. Add some accompanying tests too. Fixes: #2679 (cherry picked from commit bb1eeb4)
Here a simple reproducer:
It works fine with SOURCE_DATE_EPOCH=1
This is an issue on both Fedora 38 (rpm-4.18.1-3.fc38.x86_64) and Alma 9 (rpm-4.16.1.3-22.el9.x86_64)
It works fine on Alma 8 (rpm-4.14.3-26.el8.x86_64)
The text was updated successfully, but these errors were encountered: