Debian Codegraph @

debian/rust-vendor/tempfile/CHANGELOG.md

raw
1 # Changelog
2
3 ## 3.27.0
4
5 This release adds `TempPath::try_from_path` and deprecates `TempPath::from_path`.
6
7 Prior to this release, `TempPath::from_path` made no attempts to convert relative paths into absolute paths. The following code would have deleted the wrong file:
8
9 ```rust
10 let tmp_path = TempPath::from_path("foo")
11 std::env::set_current_dir("/some/other/path").unwrap();
12 drop(tmp_path);
13 ```
14
15 Now:
16
17 1. `TempPath::from_path` will attempt to convert relative paths into absolute paths. However, this isn't always possible as we need to call `std::env::current_dir`, which can fail. If we fail to convert the relative path to an absolute path, we simply keep the relative path.
18 2. The `TempPath::try_from_path` behaves exactly like `TempPath::from_path`, except that it returns an error if we fail to convert a relative path into an absolute path (or if the passed path is empty).
19
20 Neither function attempt to verify the existence of the file in question.
21
22 Thanks to @meng-xu-cs for reporting this issue.
23
24 ## 3.26.0
25
26 - Support `NamedTempFile::persist` on RedoxOS (#393) (thanks to @Andy-Python-Programmer).
27
28 ## 3.25.0
29
30 - Allow `getrandom` 0.4.x while retaining support for `getrandom` 0.3.x.
31
32 ## 3.24.0
33
34 - Actually support WASIp2 without the nightly feature. This library is now feature complete on WASIp2 without any additional feature flags.
35 - Exclude CI scripts from the published crate.
36
37 ## 3.23.0
38
39 - Remove need for the "nightly" feature to compile with "wasip2".
40
41 ## 3.22.0
42
43 - Updated `windows-sys` requirement to allow version 0.61.x
44 - Remove `unstable-windows-keep-open-tempfile` feature.
45
46 ## 3.21.0
47
48 - Updated `windows-sys` requirement to allow version 0.60.x
49
50 ## 3.20.0
51
52 This release mostly unifies the behavior/capabilities around "keeping" temporary files:
53
54 - Rename `Builder::keep(bool)` (via deprecation) to `Builder::disable_cleanup(bool)` to make it clear that behaves differently from `NamedTempFile::keep()`. The former disables automatic cleanup while the latter _consumes_ the `NamedTempFile` object entirely and unsets the "temporary file" attribute (on Windows).
55 - Rename `TempDir::into_path` (via deprecation) to `TempDir::keep` to mirror `NamedTempFile::keep`.
56 - Add `TempDir::disable_cleanup`, `NamedTempFile::disable_cleanup`, and `TempPath::disable_cleanup` making it possible to disable automatic cleanup in-place _after_ creating a temporary file/directory (equivalent to calling `Builder::disable_cleanup` before creating the file/directory).
57
58 Additionally, it adds a few spooled temporary file features:
59 git lo
60 - Add `SpooledTempFile::into_file` for turning a `SpooledTempFile` into a regular unnamed temporary file, writing it to the backing storage ("rolling" it) if it was still stored in-memory.
61 - Add `spooled_tempfile_in` and `SpooledTempFile::new_in` 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).
62
63 Finally, this release improves documentation, especially the top-level documentation explaining which temporary file type to use.
64
65 **BREAKING** for those with `deny(warnings)`:
66
67 - `Builder::keep` deprecated in favor of `Builder::disable_cleanup`.
68 - `TempDir::into_path` is deprecated in favor of `TempDir::keep`.
69
70 ## 3.19.1
71
72 - Don't unlink temporary files immediately on Windows (fixes #339). Unfortunately, this seemed to corrupt the file object (possibly a Windows kernel bug) in rare cases and isn't strictly speaking necessary.
73
74 ## 3.19.0
75
76 - Remove direct dependency on `cfg-if`. It's still in the tree, but we didn't really need to use it in this crate.
77 - Add an unstable feature (`unstable-windows-keep-open-tempfile`) to test a potential fix to #339.
78
79 ## 3.18.0
80
81 - Update `rustix` to 1.0.0.
82 - Make `NamedTempFile::persist_noclobber` atomic on Apple operating systems. It's now atomic on MacOS, Windows, and Linux (depending on the OS version and filesystem used).
83
84 ## 3.17.1
85
86 - Fix build with `windows-sys` 0.52. Unfortunately, we have no CI for older `windows-sys` versions at the moment...
87
88 ## 3.17.0
89
90 - Make sure to use absolute paths in when creating unnamed temporary files (avoids a small race in the "immediate unlink" logic) and in `Builder::make_in` (when creating temporary files of arbitrary types).
91 - Prevent a theoretical crash that could (maybe) happen when a temporary file is created from a drop function run in a TLS destructor. Nobody has actually reported a case of this happening in practice and I have been unable to create this scenario in a test.
92 - When reseeding with `getrandom`, use platform (e.g., CPU) specific randomness sources where possible.
93 - Clarify some documentation.
94 - Unlink unnamed temporary files on windows _immediately_ when possible instead of waiting for the handle to be closed. We open files with "Unix" semantics, so this is generally possible.
95
96 ## 3.16.0
97
98 - Update `getrandom` to `0.3.0` (thanks to @paolobarbolini).
99 - Allow `windows-sys` versions `0.59.x` in addition to `0.59.0` (thanks @ErichDonGubler).
100 - Improved security documentation (thanks to @n0toose for collaborating with me on this).
101
102 ## 3.15.0
103
104 Re-seed the per-thread RNG from system randomness when we repeatedly fail to create temporary files (#314). This resolves a potential DoS vector (#178) while avoiding `getrandom` in the common case where it's necessary. The feature is optional but enabled by default via the `getrandom` feature.
105
106 For libc-free builds, you'll either need to disable this feature or opt-in to a different [`getrandom` backend](https://github.com/rust-random/getrandom?tab=readme-ov-file#opt-in-backends).
107
108 ## 3.14.0
109
110 - Make the wasip2 target work (requires tempfile's "nightly" feature to be enabled). [#305](https://github.com/Stebalien/tempfile/pull/305).
111 - Allow older windows-sys versions [#304](https://github.com/Stebalien/tempfile/pull/304).
112
113 ## 3.13.0
114
115 - Add `with_suffix` constructors for easily creating new temporary files with a specific suffix (e.g., a specific file extension). Thanks to @Borgerr.
116 - Update dependencies (fastrand & rustix).
117
118 ## 3.12.0
119
120 - Add a `keep(keep: bool)` function to builder that suppresses delete-on-drop behavior (thanks to @RalfJung).
121 - Update `windows-sys` from 0.52 to 0.59.
122
123 ## 3.11.0
124
125 - Add the ability to override the default temporary directory. This API shouldn't be used in general, but there are some cases where it's unavoidable.
126
127 ## 3.10.1
128
129 - Handle potential integer overflows in 32-bit systems when seeking/truncating "spooled" temporary files past 4GiB (2³²).
130 - Handle a theoretical 32-bit overflow when generating a temporary file name larger than 4GiB. Now it'll panic (on allocation failure) rather than silently succeeding due to wraparound.
131
132 Thanks to @stoeckmann for finding and fixing both of these issues.
133
134 ## 3.10.0
135
136 - Drop `redox_syscall` dependency, we now use `rustix` for Redox.
137 - Add `Builder::permissions` for setting the permissions on temporary files and directories (thanks to @Byron).
138 - Update rustix to 0.38.31.
139 - Update fastrand to 2.0.1.
140
141 ## 3.9.0
142
143 - Updates windows-sys to 0.52
144 - Updates minimum rustix version to 0.38.25
145
146 ## 3.8.1
147
148 - Update rustix to fix a potential panic on `persist_noclobber` on android.
149 - Update redox_syscall to 0.4 (on redox).
150 - Fix some docs typos.
151
152 ## 3.8.0
153
154 - Added `with_prefix` and `with_prefix_in` to `TempDir` and `NamedTempFile` to make it easier to create temporary files/directories with nice prefixes.
155 - Misc cleanups.
156
157 ## 3.7.1
158
159 - Tempfile builds on haiku again.
160 - Under the hood, we've switched from the unlinkat/linkat syscalls to the regular unlink/link syscalls where possible.
161
162 ## 3.7.0
163
164 BREAKING: This release updates the MSRV to 1.63. This isn't an API-breaking change (so no major
165 release) but it's still a breaking change for some users.
166
167 - Update fastrand from 1.6 to 2.0
168 - Update rustix to 0.38
169 - Updates the MSRV to 1.63.
170 - Provide AsFd/AsRawFd on wasi.
171
172 ## 3.6.0
173
174 - Update windows-sys to 0.48.
175 - Update rustix min version to 0.37.11
176 - Forward some `NamedTempFile` and `SpooledTempFile` methods to the underlying `File` object for
177 better performance (especially vectorized writes, etc.).
178 - Implement `AsFd` and `AsHandle`.
179 - Misc documentation fixes and code cleanups.
180
181 ## 3.5.0
182
183 - Update rustix from 0.36 to 0.37.1. This makes wasi work on rust stable
184 - Update `windows-sys`, `redox_syscall`
185 - BREAKING: Remove the implementation of `Write for &NamedTempFile<F> where &F: Write`. Unfortunately, this can cause compile issues in unrelated code (https://github.com/Stebalien/tempfile/issues/224).
186
187 ## 3.4.0
188
189 SECURITY: Prior `tempfile` releases depended on `remove_dir_all` version 0.5.0 which was vulnerable to a [TOCTOU race](https://github.com/XAMPPRocky/remove_dir_all/security/advisories/GHSA-mc8h-8q98-g5hr). This same race is present in rust versions prior to 1.58.1.
190
191 Features:
192
193 - Generalized temporary files: `NamedTempFile` can now abstract over different kinds of files (e.g.,
194 unix domain sockets, pipes, etc.):
195 - Add `Builder::make` and `Builder::make_in` for generalized temp file
196 creation.
197 - Add `NamedTempFile::from_parts` to complement `NamedTempFile::into_parts`.
198 - Add generic parameter to `NamedTempFile` to support wrapping non-File types.
199
200 Bug Fixes/Improvements:
201
202 - Don't try to create a temporary file multiple times if the file path has been fully specified by
203 the user (no random characters).
204 - `NamedTempFile::persist_noclobber` is now always atomic on linux when `renameat_with` is
205 supported. Previously, it would first link the new path, then unlink the previous path.
206 - Fix compiler warnings on windows.
207
208 Trivia:
209
210 - Switch from `libc` to `rustix` on wasi/unix. This now makes direct syscalls instead of calling
211 through libc.
212 - Remove `remove_dir_all` dependency. The rust standard library has optimized their internal version
213 significantly.
214 - Switch to official windows-sys windows bindings.
215
216 Breaking:
217
218 - The minimum rust version is now `1.48.0`.
219 - Mark most functions as `must_use`.
220 - Uses direct syscalls on linux by default, instead of libc.
221 - The new type parameter in `NamedTempFile` may lead to type inference issues in some cases.
222
223 ## 3.3.0
224
225 Features:
226
227 - Replace rand with fastrand for a significantly smaller dependency tree. Cryptographic randomness
228 isn't necessary for temporary file names, and isn't all that helpful either.
229 - Add limited WASI support.
230 - Add a function to extract the inner data from a `SpooledTempFile`.
231
232 Bug Fixes:
233
234 - Make it possible to persist unnamed temporary files on linux by removing the `O_EXCL` flag.
235 - Fix redox minimum crate version.
236
237 ## 3.2.0
238
239 Features:
240
241 - Bump rand dependency to `0.8`.
242 - Bump cfg-if dependency to `1.0`
243
244 Other than that, this release mostly includes small cleanups and simplifications.
245
246 Breaking: The minimum rust version is now `1.40.0`.
247
248 ## 3.1.0
249
250 Features:
251
252 - Bump rand dependency to `0.7`.
253
254 Breaking: The minimum rust version is now `1.32.0`.
255
256 ## 3.0.9
257
258 Documentation:
259
260 - Add an example for reopening a named temporary file.
261 - Flesh out the security documentation.
262
263 Features:
264
265 - Introduce an `append` option to the builder.
266 - Errors:
267 - No longer implement the soft-deprecated `description`.
268 - Implement `source` instead of `cause`.
269
270 Breaking: The minimum rust version is now 1.30.
271
272 ## 3.0.8
273
274 This is a bugfix release.
275
276 Fixes:
277
278 - Export `PathPersistError`.
279 - Fix a bug where flushing a `SpooledTempFile` to disk could fail to write part
280 of the file in some rare, yet-to-reproduced cases.
281
282 ## 3.0.7
283
284 Breaking:
285
286 - `Builder::prefix` and `Builder::suffix` now accept a generic `&AsRef<OsStr>`.
287 This could affect type inference.
288 - Temporary files (except unnamed temporary files on Windows and Linux >= 3.11)
289 now use absolute path names. This will break programs that create temporary
290 files relative to their current working directory when they don't have the
291 search permission (x) on some ancestor directory. This is only likely to
292 affect programs with strange chroot-less filesystem sandboxes. If you believe
293 you're affected by this issue, please comment on #40.
294
295 Features:
296
297 - Accept anything implementing `&AsRef<OsStr>` in the builder: &OsStr, &OsString, &Path, etc.
298
299 Fixes:
300
301 - Fix LFS support.
302 - Use absolute paths for named temporary files to guard against changes in the
303 current directory.
304 - Use absolute paths when creating unnamed temporary files on platforms that
305 can't create unlinked or auto-deleted temporary files. This fixes a very
306 unlikely race where the current directory could change while the temporary
307 file is being created.
308
309 Misc:
310
311 - Use modern stdlib features to avoid custom unsafe code. This reduces the
312 number of unsafe blocks from 12 to 4.
313
314 ## 3.0.6
315
316 - Don't hide temporary files on windows, fixing #66 and #69.
317
318 ## 3.0.5
319
320 Features:
321
322 - Added a spooled temporary file implementation. This temporary file variant
323 starts out as an in-memory temporary file but "rolls-over" onto disk when it
324 grows over a specified size (#68).
325 - Errors are now annotated with paths to make debugging easier (#73).
326
327 Misc:
328
329 - The rand version has been bumped to 0.6 (#74).
330
331 Bugs:
332
333 - Tempfile compiles again on Redox (#75).
334
335 ## 3.0.4
336
337 - Now compiles on unsupported platforms.
338
339 ## 3.0.3
340
341 - update rand to 0.5
342
343 ## 3.0.2
344
345 - Actually *delete* temporary files on non-Linux unix systems (thanks to
346 @oliverhenshaw for the fix and a test case).
347
348 ## 3.0.1
349
350 - Restore NamedTempFile::new_in
351
352 ## 3.0.0
353
354 - Adds temporary directory support (@KodrAus)
355 - Allow closing named temporary files without deleting them (@jasonwhite)
356
357 ## 2.2.0
358
359 - Redox Support
360
361 ## 2.1.6
362
363 - Remove build script and bump minimum rustc version to 1.9.0
364
365 ## 2.1.5
366
367 - Don't build platform-specific dependencies on all platforms.
368 - Cleanup some documentation.
369
370 ## 2.1.4
371
372 - Fix crates.io tags. No interesting changes.
373
374 ## 2.1.3
375
376 Export `PersistError`.
377
378 ## 2.1.2
379
380 Add `Read`/`Write`/`Seek` impls on `&NamedTempFile`. This mirrors the
381 implementations on `&File`. One can currently just deref to a `&File` but these
382 implementations are more discoverable.
383
384 ## 2.1.1
385
386 Add LFS Support.
387
388 ## 2.1.0
389
390 - Implement `AsRef<File>` for `NamedTempFile` allowing named temporary files to
391 be borrowed as `File`s.
392 - Add a method to convert a `NamedTempFile` to an unnamed temporary `File`.
393
394 ## 2.0.1
395
396 - Arm bugfix
397
398 ## 2.0.0
399
400 This release replaces `TempFile` with a `tempfile()` function that returns
401 `std::fs::File` objects. These are significantly more useful because most rust
402 libraries expect normal `File` objects.
403
404 To continue supporting shared temporary files, this new version adds a
405 `reopen()` method to `NamedTempFile`.