Skip to content

Ensure any file object in a tar archive has an mtime#18113

Merged
donoghuc merged 2 commits intoelastic:mainfrom
donoghuc:mtime-dirs
Sep 4, 2025
Merged

Ensure any file object in a tar archive has an mtime#18113
donoghuc merged 2 commits intoelastic:mainfrom
donoghuc:mtime-dirs

Conversation

@donoghuc
Copy link
Member

@donoghuc donoghuc commented Sep 3, 2025

Release notes

Summary

Following up on #18091, when minitar writes a directory or symlink it also needs explicit mtime. After inspecting artifacts built from #18019 we see some other missing mtimes. This commit ensures that information is explicitly passed to the minitar writer.

Following up on elastic#18091, when minitar
writes a directory or symlink it also needs explicit mtime. After inspecting
artifacts built from elastic#18019 we see some other missing mtimes. This commit
ensures that information is explicitly passed to the minitar writer.
@github-actions
Copy link
Contributor

github-actions bot commented Sep 3, 2025

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@mergify
Copy link
Contributor

mergify bot commented Sep 3, 2025

This pull request does not have a backport label. Could you fix it @donoghuc? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit.
  • If no backport is necessary, please add the backport-skip label
@donoghuc
Copy link
Member Author

donoghuc commented Sep 3, 2025

Reminder this is the minitar impl https://github.com/halostatue/minitar/blob/main/lib/minitar/writer.rb

I noticed this looking at artifacts produced from https://buildkite.com/elastic/logstash-dra-snapshot-pipeline/builds/3680 based on #18091

➜  u curl -LO https://artifacts-snapshot.elastic.co/logstash/9.2.0-834691a1/downloads/logstash/logstash-9.2.0-SNAPSHOT-linux-x86_64.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  407M  100  407M    0     0  42.7M      0  0:00:09  0:00:09 --:--:-- 43.2M
➜  u tar -xf logstash-9.2.0-SNAPSHOT-linux-x86_64.tar.gz
➜  u cd logstash-9.2.0-SNAPSHOT
➜  logstash-9.2.0-SNAPSHOT ls -lt
total 1544
drwxr-xr-x@ 11 cas  wheel     352 Sep  3 14:12 jdk
drwxr-xr-x@ 14 cas  wheel     448 Sep  3 14:12 x-pack
drwxr-xr-x@  4 cas  wheel     128 Sep  3 14:12 vendor
drwxr-xr-x@  5 cas  wheel     160 Sep  3 14:12 logstash-core-plugin-api
drwxr-xr-x@  6 cas  wheel     192 Sep  3 14:12 logstash-core
drwxr-xr-x@  6 cas  wheel     192 Sep  3 14:12 lib
drwxr-xr-x@  8 cas  wheel     256 Sep  3 14:12 config
drwxr-xr-x@ 20 cas  wheel     640 Sep  3 14:12 bin
-rw-r--r--@  1 cas  wheel   30907 Sep  3 13:06 Gemfile.lock
-rw-r--r--@  1 cas  wheel      16 Sep  3 13:00 JDK_VERSION
-rw-r--r--@  1 cas  wheel    4449 Sep  3 12:58 Gemfile
-rw-r--r--@  1 cas  wheel    2276 Sep  3 12:56 CONTRIBUTORS
-rw-r--r--@  1 cas  wheel   13675 Sep  3 12:56 LICENSE.txt
-rw-r--r--@  1 cas  wheel  724574 Sep  3 12:56 NOTICE.TXT
drwxr-xr-x@  2 cas  wheel      64 Dec 31  1969 data

You can see that the empty data dir we lay down in packaging also has a missing mtime. This led me to look at the other Writer methods we use (mkdir and symlink) and see we need to include those as well.

Copy link
Member

@jsvd jsvd left a comment

Choose a reason for hiding this comment

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

LGTM, minor edit suggestion to document why we did it.

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
@elastic-sonarqube
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@elasticmachine
Copy link

💛 Build succeeded, but was flaky

Failed CI Steps

History

@donoghuc donoghuc merged commit ef97a87 into elastic:main Sep 4, 2025
13 checks passed
@donoghuc
Copy link
Member Author

donoghuc commented Sep 4, 2025

handling backports manually with the existing PRs that inspired this follow on.

donoghuc added a commit that referenced this pull request Sep 4, 2025
* Ensure any file object in a tar archive has an mtime

Following up on #18091, when minitar
writes a directory or symlink it also needs explicit mtime. After inspecting
artifacts built from #18019 we see some other missing mtimes. This commit
ensures that information is explicitly passed to the minitar writer.

* Update rakelib/artifacts.rake

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

---------

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
donoghuc added a commit that referenced this pull request Sep 4, 2025
* Ensure any file object in a tar archive has an mtime

Following up on #18091, when minitar
writes a directory or symlink it also needs explicit mtime. After inspecting
artifacts built from #18019 we see some other missing mtimes. This commit
ensures that information is explicitly passed to the minitar writer.

* Update rakelib/artifacts.rake

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

---------

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
donoghuc added a commit that referenced this pull request Sep 4, 2025
* Ensure any file object in a tar archive has an mtime

Following up on #18091, when minitar
writes a directory or symlink it also needs explicit mtime. After inspecting
artifacts built from #18019 we see some other missing mtimes. This commit
ensures that information is explicitly passed to the minitar writer.

* Update rakelib/artifacts.rake

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

---------

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
donoghuc added a commit that referenced this pull request Sep 4, 2025
* Ensure any file object in a tar archive has an mtime

Following up on #18091, when minitar
writes a directory or symlink it also needs explicit mtime. After inspecting
artifacts built from #18019 we see some other missing mtimes. This commit
ensures that information is explicitly passed to the minitar writer.

* Update rakelib/artifacts.rake

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

---------

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
donoghuc added a commit that referenced this pull request Sep 4, 2025
* Ensure any file object in a tar archive has an mtime

Following up on #18091, when minitar
writes a directory or symlink it also needs explicit mtime. After inspecting
artifacts built from #18019 we see some other missing mtimes. This commit
ensures that information is explicitly passed to the minitar writer.

* Update rakelib/artifacts.rake

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

---------

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
donoghuc added a commit that referenced this pull request Sep 4, 2025
…artifacts (#18108)

* Preserve mtime explicitly when creating tar artifacts (#18091)

* Preserve mtime explicitly when creating tar artifacts

When building tar archives, explicitly set mtime. This avoids losing that
information in the minitar `Writer.add_file_simple` method
 https://github.com/halostatue/minitar/blob/a531136b17b9efdddf0a0f39537845b454c2371e/lib/minitar/writer.rb#L139

* Better default for mtime

If for some reason we cant get a time from a File object (very unlikely)
a better default is Time.now rather than 0.

* Update rakelib/artifacts.rake

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

---------

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
(cherry picked from commit d9b95bf)

# Conflicts:
#	rakelib/artifacts.rake

* Ensure any file object in a tar archive has an mtime (#18113)

* Ensure any file object in a tar archive has an mtime

Following up on #18091, when minitar
writes a directory or symlink it also needs explicit mtime. After inspecting
artifacts built from #18019 we see some other missing mtimes. This commit
ensures that information is explicitly passed to the minitar writer.

* Update rakelib/artifacts.rake

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

---------

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

* fix merge conflicts

---------

Co-authored-by: Cas Donoghue <cas.donoghue@gmail.com>
Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
donoghuc added a commit that referenced this pull request Sep 4, 2025
…artifacts (#18109)

* Preserve mtime explicitly when creating tar artifacts (#18091)

* Preserve mtime explicitly when creating tar artifacts

When building tar archives, explicitly set mtime. This avoids losing that
information in the minitar `Writer.add_file_simple` method
 https://github.com/halostatue/minitar/blob/a531136b17b9efdddf0a0f39537845b454c2371e/lib/minitar/writer.rb#L139

* Better default for mtime

If for some reason we cant get a time from a File object (very unlikely)
a better default is Time.now rather than 0.

* Update rakelib/artifacts.rake

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

---------

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
(cherry picked from commit d9b95bf)

# Conflicts:
#	rakelib/artifacts.rake

* Ensure any file object in a tar archive has an mtime (#18113)

* Ensure any file object in a tar archive has an mtime

Following up on #18091, when minitar
writes a directory or symlink it also needs explicit mtime. After inspecting
artifacts built from #18019 we see some other missing mtimes. This commit
ensures that information is explicitly passed to the minitar writer.

* Update rakelib/artifacts.rake

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

---------

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

* fix merge conflicts

---------

Co-authored-by: Cas Donoghue <cas.donoghue@gmail.com>
Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
donoghuc added a commit that referenced this pull request Sep 4, 2025
…rtifacts (#18111)

* Preserve mtime explicitly when creating tar artifacts (#18091)

* Preserve mtime explicitly when creating tar artifacts

When building tar archives, explicitly set mtime. This avoids losing that
information in the minitar `Writer.add_file_simple` method
 https://github.com/halostatue/minitar/blob/a531136b17b9efdddf0a0f39537845b454c2371e/lib/minitar/writer.rb#L139

* Better default for mtime

If for some reason we cant get a time from a File object (very unlikely)
a better default is Time.now rather than 0.

* Update rakelib/artifacts.rake

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

---------

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
(cherry picked from commit d9b95bf)

# Conflicts:
#	rakelib/artifacts.rake

* Ensure any file object in a tar archive has an mtime (#18113)

* Ensure any file object in a tar archive has an mtime

Following up on #18091, when minitar
writes a directory or symlink it also needs explicit mtime. After inspecting
artifacts built from #18019 we see some other missing mtimes. This commit
ensures that information is explicitly passed to the minitar writer.

* Update rakelib/artifacts.rake

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

---------

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

* fix merge conflicts

---------

Co-authored-by: Cas Donoghue <cas.donoghue@gmail.com>
Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
donoghuc added a commit that referenced this pull request Sep 4, 2025
…rtifacts (#18112)

* Preserve mtime explicitly when creating tar artifacts (#18091)

* Preserve mtime explicitly when creating tar artifacts

When building tar archives, explicitly set mtime. This avoids losing that
information in the minitar `Writer.add_file_simple` method
 https://github.com/halostatue/minitar/blob/a531136b17b9efdddf0a0f39537845b454c2371e/lib/minitar/writer.rb#L139

* Better default for mtime

If for some reason we cant get a time from a File object (very unlikely)
a better default is Time.now rather than 0.

* Update rakelib/artifacts.rake

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

---------

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
(cherry picked from commit d9b95bf)

# Conflicts:
#	rakelib/artifacts.rake

* Ensure any file object in a tar archive has an mtime (#18113)

* Ensure any file object in a tar archive has an mtime

Following up on #18091, when minitar
writes a directory or symlink it also needs explicit mtime. After inspecting
artifacts built from #18019 we see some other missing mtimes. This commit
ensures that information is explicitly passed to the minitar writer.

* Update rakelib/artifacts.rake

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

---------

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

* fix merge conflicts

---------

Co-authored-by: Cas Donoghue <cas.donoghue@gmail.com>
Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
donoghuc added a commit that referenced this pull request Sep 4, 2025
…artifacts (#18110)

* Preserve mtime explicitly when creating tar artifacts (#18091)

* Preserve mtime explicitly when creating tar artifacts

When building tar archives, explicitly set mtime. This avoids losing that
information in the minitar `Writer.add_file_simple` method
 https://github.com/halostatue/minitar/blob/a531136b17b9efdddf0a0f39537845b454c2371e/lib/minitar/writer.rb#L139

* Better default for mtime

If for some reason we cant get a time from a File object (very unlikely)
a better default is Time.now rather than 0.

* Update rakelib/artifacts.rake

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

---------

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
(cherry picked from commit d9b95bf)

* Ensure any file object in a tar archive has an mtime (#18113)

* Ensure any file object in a tar archive has an mtime

Following up on #18091, when minitar
writes a directory or symlink it also needs explicit mtime. After inspecting
artifacts built from #18019 we see some other missing mtimes. This commit
ensures that information is explicitly passed to the minitar writer.

* Update rakelib/artifacts.rake

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

---------

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

---------

Co-authored-by: Cas Donoghue <cas.donoghue@gmail.com>
Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants