Repository: shell-pool/shpool
Pull request #231 (2025-05-12 05:08:08)

chore: bump tempfile from 3.17.1 to 3.20.0
Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.17.1 to 3.20.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md">tempfile's changelog</a>.</em></p>
<blockquote>
<h2>3.20.0</h2>
<p>This release mostly unifies the behavior/capabilities around &quot;keeping&quot; temporary files:</p>
<ul>
<li>Rename <code>Builder::keep(bool)</code> (via deprecation) to <code>Builder::disable_cleanup(bool)</code> to make it clear that behaves differently from <code>NamedTempFile::keep()</code>. The former disables automatic cleanup while the latter <em>consumes</em> the <code>NamedTempFile</code> object entirely and unsets the &quot;temporary file&quot; attribute (on Windows).</li>
<li>Rename <code>TempDir::into_path</code> (via deprecation) to <code>TempDir::keep</code> to mirror <code>NamedTempFile::keep</code>.</li>
<li>Add <code>TempDir::disable_cleanup</code>, <code>NamedTempFile::disable_cleanup</code>, and <code>TempPath::disable_cleanup</code> making it possible to disable automatic cleanup in-place <em>after</em> creating a temporary file/directory (equivalent to calling <code>Builder::disable_cleanup</code> before creating the file/directory).</li>
</ul>
<p>Additionally, it adds a few spooled temporary file features:</p>
<ul>
<li>Add <code>SpooledTempFile::into_file</code> for turning a <code>SpooledTempFile</code> into a regular unnamed temporary file, writing it to the backing storage (&quot;rolling&quot; it) if it was still stored in-memory.</li>
<li>Add <code>spooled_tempfile_in</code> and <code>SpooledTempFile::new_in</code> methods for creating spooled temporary files in a specific directory. This makes it possible to choose the backing device for your spooled temporary file which is rather important on Linux where the default temporary directory is likely backed by memory (defeating the entire point of having a spooled temporary file).</li>
</ul>
<p>Finally, this release improves documentation, especially the top-level documentation explaining which temporary file type to use.</p>
<p><strong>BREAKING</strong> for those with <code>deny(warnings)</code>:</p>
<ul>
<li><code>Builder::keep</code> deprecated in favor of <code>Builder::disable_cleanup</code>.</li>
<li><code>TempDir::into_path</code> is deprecated in favor of <code>TempDir::keep</code>.</li>
</ul>
<p><strong>BREAKING</strong>:</p>
<h2>3.19.1</h2>
<ul>
<li>Don't unlink temporary files immediately on Windows (fixes <a href="https://redirect.github.com/Stebalien/tempfile/issues/339">#339</a>). Unfortunately, this seemed to corrupt the file object (possibly a Windows kernel bug) in rare cases and isn't strictly speaking necessary.</li>
</ul>
<h2>3.19.0</h2>
<ul>
<li>Remove direct dependency on <code>cfg-if</code>. It's still in the tree, but we didn't really need to use it in this crate.</li>
<li>Add an unstable feature (<code>unstable-windows-keep-open-tempfile</code>) to test a potential fix to <a href="https://redirect.github.com/Stebalien/tempfile/issues/339">#339</a>.</li>
</ul>
<h2>3.18.0</h2>
<ul>
<li>Update <code>rustix</code> to 1.0.0.</li>
<li>Make <code>NamedTempFile::persist_noclobber</code> atomic on Apple operating systems. It's now atomic on MacOS, Windows, and Linux (depending on the OS version and filesystem used).</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/Stebalien/tempfile/commit/99ffea61ade621161db326b6745c7b36a90ddbd0"><code>99ffea6</code></a> chore: release v3.20.0 (<a href="https://redirect.github.com/Stebalien/tempfile/issues/358">#358</a>)</li>
<li><a href="https://github.com/Stebalien/tempfile/commit/bd2b2674423ae6598070fab30e6627810ac282a9"><code>bd2b267</code></a> feat: make it possible to disable cleanup in-place after creation (<a href="https://redirect.github.com/Stebalien/tempfile/issues/355">#355</a>)</li>
<li><a href="https://github.com/Stebalien/tempfile/commit/3b30099abd7585a9b6600276f6dcdfa557e88f19"><code>3b30099</code></a> ci: really check docs for warnings (<a href="https://redirect.github.com/Stebalien/tempfile/issues/357">#357</a>)</li>
<li><a href="https://github.com/Stebalien/tempfile/commit/f701f5245624b8cfcd782dfd62fcfe86d35c173b"><code>f701f52</code></a> ci: check docs (<a href="https://redirect.github.com/Stebalien/tempfile/issues/356">#356</a>)</li>
<li><a href="https://github.com/Stebalien/tempfile/commit/d34afe99fd93bb13253128cc58dfc4032edfa5a5"><code>d34afe9</code></a> doc: improve SpooledData documentation</li>
<li><a href="https://github.com/Stebalien/tempfile/commit/6deb42e04ceb2f2c306510b1605d9548e77868e5"><code>6deb42e</code></a> doc: make it easier to pick the correct tempfile constructor/type</li>
<li><a href="https://github.com/Stebalien/tempfile/commit/e284782c6c1c2f565af2ab9b5c0be9f9c5ed3607"><code>e284782</code></a> feat: allow creating spooled temporary files in a specific directory (<a href="https://redirect.github.com/Stebalien/tempfile/issues/353">#353</a>)</li>
<li><a href="https://github.com/Stebalien/tempfile/commit/07edc310a5c8725346cd2bb2a5d065ff298f4fa0"><code>07edc31</code></a> feat: implement <code>SpooledTempFile::into_file</code> (<a href="https://redirect.github.com/Stebalien/tempfile/issues/352">#352</a>)</li>
<li><a href="https://github.com/Stebalien/tempfile/commit/b1223553bb888e35bab7675fbac235e4be6eaf7e"><code>b122355</code></a> fix: add must_use attribute to TempDir::keep (<a href="https://redirect.github.com/Stebalien/tempfile/issues/351">#351</a>)</li>
<li><a href="https://github.com/Stebalien/tempfile/commit/cbd1e976e106d4a12432e124494f735bf40eafe2"><code>cbd1e97</code></a> feat: rename <code>TempDir::into_path</code> to <code>TempDir::keep</code> (<a href="https://redirect.github.com/Stebalien/tempfile/issues/349">#349</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/Stebalien/tempfile/compare/v3.17.1...v3.20.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tempfile&package-manager=cargo&previous-version=3.17.1&new-version=3.20.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index f486f584..957a2646 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -565,6 +565,12 @@ version = "0.4.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
 
+[[package]]
+name = "linux-raw-sys"
+version = "0.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12"
+
 [[package]]
 name = "log"
 version = "0.4.22"
@@ -830,7 +836,20 @@ dependencies = [
  "bitflags 2.4.2",
  "errno 0.3.10",
  "libc",
- "linux-raw-sys",
+ "linux-raw-sys 0.4.14",
+ "windows-sys 0.59.0",
+]
+
+[[package]]
+name = "rustix"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266"
+dependencies = [
+ "bitflags 2.4.2",
+ "errno 0.3.10",
+ "libc",
+ "linux-raw-sys 0.9.4",
  "windows-sys 0.59.0",
 ]
 
@@ -1024,15 +1043,14 @@ dependencies = [
 
 [[package]]
 name = "tempfile"
-version = "3.17.1"
+version = "3.20.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22e5a0acb1f3f55f65cc4a866c361b2fb2a0ff6366785ae6fbb5f85df07ba230"
+checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1"
 dependencies = [
- "cfg-if",
  "fastrand",
  "getrandom",
  "once_cell",
- "rustix",
+ "rustix 1.0.7",
  "windows-sys 0.59.0",
 ]
 
@@ -1298,7 +1316,7 @@ dependencies = [
  "either",
  "home",
  "once_cell",
- "rustix",
+ "rustix 0.38.42",
  "windows-sys 0.52.0",
 ]
 


Test patch:
diff --git a/shpool/tests/attach.rs b/shpool/tests/attach.rs
index 6969b84b..47d4d2ef 100644
--- a/shpool/tests/attach.rs
+++ b/shpool/tests/attach.rs
@@ -1222,7 +1222,7 @@ fn motd_dump() -> anyhow::Result<()> {
         let tmp_dir_path = if env::var("SHPOOL_LEAVE_TEST_LOGS").is_ok() {
             // leave the tmp files around for later inspection if we have been asked
             // to leave the logs in place.
-            tmp_dir.into_path()
+            tmp_dir.keep()
         } else {
             PathBuf::from(tmp_dir.path())
         };
@@ -1300,7 +1300,7 @@ fn motd_pager() -> anyhow::Result<()> {
         let tmp_dir_path = if env::var("SHPOOL_LEAVE_TEST_LOGS").is_ok() {
             // leave the tmp files around for later inspection if we have been asked
             // to leave the logs in place.
-            tmp_dir.into_path()
+            tmp_dir.keep()
         } else {
             PathBuf::from(tmp_dir.path())
         };
@@ -1357,7 +1357,7 @@ fn motd_debounced_pager_debounces() -> anyhow::Result<()> {
         let tmp_dir_path = if env::var("SHPOOL_LEAVE_TEST_LOGS").is_ok() {
             // leave the tmp files around for later inspection if we have been asked
             // to leave the logs in place.
-            tmp_dir.into_path()
+            tmp_dir.keep()
         } else {
             PathBuf::from(tmp_dir.path())
         };
@@ -1418,7 +1418,7 @@ fn motd_debounced_pager_unbounces() -> anyhow::Result<()> {
         let tmp_dir_path = if env::var("SHPOOL_LEAVE_TEST_LOGS").is_ok() {
             // leave the tmp files around for later inspection if we have been asked
             // to leave the logs in place.
-            tmp_dir.into_path()
+            tmp_dir.keep()
         } else {
             PathBuf::from(tmp_dir.path())
         };
@@ -1482,7 +1482,7 @@ fn motd_env_test_pager_preserves_term_env_var() -> anyhow::Result<()> {
         let tmp_dir_path = if env::var("SHPOOL_LEAVE_TEST_LOGS").is_ok() {
             // leave the tmp files around for later inspection if we have been asked
             // to leave the logs in place.
-            tmp_dir.into_path()
+            tmp_dir.keep()
         } else {
             PathBuf::from(tmp_dir.path())
         };
@@ -1526,7 +1526,7 @@ fn dynamic_config_change() -> anyhow::Result<()> {
         let tmp_dir_path = if env::var("SHPOOL_LEAVE_TEST_LOGS").is_ok() {
             // leave the tmp files around for later inspection if we have been asked
             // to leave the logs in place.
-            tmp_dir.into_path()
+            tmp_dir.keep()
         } else {
             PathBuf::from(tmp_dir.path())
         };
@@ -1600,7 +1600,7 @@ fn autodaemonize() -> anyhow::Result<()> {
     support::dump_err(|| {
         let tmp_dir = tempfile::TempDir::with_prefix("shpool-test-autodaemonize")?;
         let tmp_dir_path = if env::var("SHPOOL_LEAVE_TEST_LOGS").is_ok() {
-            tmp_dir.into_path()
+            tmp_dir.keep()
         } else {
             PathBuf::from(tmp_dir.path())
         };
diff --git a/shpool/tests/support/daemon.rs b/shpool/tests/support/daemon.rs
index 2cabd58b..c439aa42 100644
--- a/shpool/tests/support/daemon.rs
+++ b/shpool/tests/support/daemon.rs
@@ -423,7 +423,7 @@ impl std::ops::Drop for Proc {
             eprintln!("err killing daemon proc: {e:?}");
         }
         if std::env::var("SHPOOL_LEAVE_TEST_LOGS").unwrap_or(String::from("")) == "true" {
-            self.local_tmp_dir.take().map(|d| d.into_path());
+            self.local_tmp_dir.take().map(|d| d.keep());
         }
     }
 }