1# Changelog 2 3## 3.12.0 4 5- Add a `keep(keep: bool)` function to builder that suppresses delete-on-drop behavior (thanks to @RalfJung). 6- Update `windows-sys` from 0.52 to 0.59. 7 8## 3.11.0 9 10- 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. 11 12## 3.10.1 13 14- Handle potential integer overflows in 32-bit systems when seeking/truncating "spooled" temporary files past 4GiB (2³²). 15- 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. 16 17Thanks to @stoeckmann for finding and fixing both of these issues. 18 19## 3.10.0 20 21- Drop `redox_syscall` dependency, we now use `rustix` for Redox. 22- Add `Builder::permissions` for setting the permissions on temporary files and directories (thanks to @Byron). 23- Update rustix to 0.38.31. 24- Update fastrand to 2.0.1. 25 26## 3.9.0 27 28- Updates windows-sys to 0.52 29- Updates minimum rustix version to 0.38.25 30 31## 3.8.1 32 33- Update rustix to fix a potential panic on `persist_noclobber` on android. 34- Update redox_syscall to 0.4 (on redox). 35- Fix some docs typos. 36 37## 3.8.0 38 39- Added `with_prefix` and `with_prefix_in` to `TempDir` and `NamedTempFile` to make it easier to create temporary files/directories with nice prefixes. 40- Misc cleanups. 41 42## 3.7.1 43 44- Tempfile builds on haiku again. 45- Under the hood, we've switched from the unlinkat/linkat syscalls to the regular unlink/link syscalls where possible. 46 47## 3.7.0 48 49BREAKING: This release updates the MSRV to 1.63. This isn't an API-breaking change (so no major 50release) but it's still a breaking change for some users. 51 52- Update fastrand from 1.6 to 2.0 53- Update rustix to 0.38 54- Updates the MSRV to 1.63. 55- Provide AsFd/AsRawFd on wasi. 56 57## 3.6.0 58 59- Update windows-sys to 0.48. 60- Update rustix min version to 0.37.11 61- Forward some `NamedTempFile` and `SpooledTempFile` methods to the underlying `File` object for 62 better performance (especially vectorized writes, etc.). 63- Implement `AsFd` and `AsHandle`. 64- Misc documentation fixes and code cleanups. 65 66## 3.5.0 67 68- Update rustix from 0.36 to 0.37.1. This makes wasi work on rust stable 69- Update `windows-sys`, `redox_syscall` 70- 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). 71 72## 3.4.0 73 74SECURITY: 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. 75 76Features: 77 78- Generalized temporary files: `NamedTempFile` can now abstract over different kinds of files (e.g., 79 unix domain sockets, pipes, etc.): 80 - Add `Builder::make` and `Builder::make_in` for generalized temp file 81 creation. 82 - Add `NamedTempFile::from_parts` to complement `NamedTempFile::into_parts`. 83 - Add generic parameter to `NamedTempFile` to support wrapping non-File types. 84 85Bug Fixes/Improvements: 86 87- Don't try to create a temporary file multiple times if the file path has been fully specified by 88 the user (no random characters). 89- `NamedTempFile::persist_noclobber` is now always atomic on linux when `renameat_with` is 90 supported. Previously, it would first link the new path, then unlink the previous path. 91- Fix compiler warnings on windows. 92 93Trivia: 94 95- Switch from `libc` to `rustix` on wasi/unix. This now makes direct syscalls instead of calling 96 through libc. 97- Remove `remove_dir_all` dependency. The rust standard library has optimized their internal version 98 significantly. 99 - Switch to official windows-sys windows bindings. 100 101Breaking: 102 103 - The minimum rust version is now `1.48.0`. 104 - Mark most functions as `must_use`. 105 - Uses direct syscalls on linux by default, instead of libc. 106 - The new type parameter in `NamedTempFile` may lead to type inference issues in some cases. 107 108## 3.3.0 109 110Features: 111 112- Replace rand with fastrand for a significantly smaller dependency tree. Cryptographic randomness 113 isn't necessary for temporary file names, and isn't all that helpful either. 114- Add limited WASI support. 115- Add a function to extract the inner data from a `SpooledTempFile`. 116 117Bug Fixes: 118 119- Make it possible to persist unnamed temporary files on linux by removing the `O_EXCL` flag. 120- Fix redox minimum crate version. 121 122## 3.2.0 123 124Features: 125 126- Bump rand dependency to `0.8`. 127- Bump cfg-if dependency to `1.0` 128 129Other than that, this release mostly includes small cleanups and simplifications. 130 131Breaking: The minimum rust version is now `1.40.0`. 132 133## 3.1.0 134 135Features: 136 137- Bump rand dependency to `0.7`. 138 139Breaking: The minimum rust version is now `1.32.0`. 140 141## 3.0.9 142 143Documentation: 144 145- Add an example for reopening a named temporary file. 146- Flesh out the security documentation. 147 148Features: 149 150- Introduce an `append` option to the builder. 151- Errors: 152 - No longer implement the soft-deprecated `description`. 153 - Implement `source` instead of `cause`. 154 155Breaking: The minimum rust version is now 1.30. 156 157## 3.0.8 158 159This is a bugfix release. 160 161Fixes: 162 163- Export `PathPersistError`. 164- Fix a bug where flushing a `SpooledTempFile` to disk could fail to write part 165 of the file in some rare, yet-to-reproduced cases. 166 167## 3.0.7 168 169Breaking: 170 171- `Builder::prefix` and `Builder::suffix` now accept a generic `&AsRef<OsStr>`. 172 This could affect type inference. 173- Temporary files (except unnamed temporary files on Windows and Linux >= 3.11) 174 now use absolute path names. This will break programs that create temporary 175 files relative to their current working directory when they don't have the 176 search permission (x) on some ancestor directory. This is only likely to 177 affect programs with strange chroot-less filesystem sandboxes. If you believe 178 you're affected by this issue, please comment on #40. 179 180Features: 181 182- Accept anything implementing `&AsRef<OsStr>` in the builder: &OsStr, &OsString, &Path, etc. 183 184Fixes: 185 186- Fix LFS support. 187- Use absolute paths for named temporary files to guard against changes in the 188 current directory. 189- Use absolute paths when creating unnamed temporary files on platforms that 190 can't create unlinked or auto-deleted temporary files. This fixes a very 191 unlikely race where the current directory could change while the temporary 192 file is being created. 193 194Misc: 195 196- Use modern stdlib features to avoid custom unsafe code. This reduces the 197 number of unsafe blocks from 12 to 4. 198 199## 3.0.6 200 201- Don't hide temporary files on windows, fixing #66 and #69. 202 203## 3.0.5 204 205Features: 206 207- Added a spooled temporary file implementation. This temporary file variant 208 starts out as an in-memory temporary file but "rolls-over" onto disk when it 209 grows over a specified size (#68). 210- Errors are now annotated with paths to make debugging easier (#73). 211 212Misc: 213 214- The rand version has been bumped to 0.6 (#74). 215 216Bugs: 217 218- Tempfile compiles again on Redox (#75). 219 220## 3.0.4 221 222- Now compiles on unsupported platforms. 223 224## 3.0.3 225 226- update rand to 0.5 227 228## 3.0.2 229 230- Actually *delete* temporary files on non-Linux unix systems (thanks to 231@oliverhenshaw for the fix and a test case). 232 233## 3.0.1 234 235- Restore NamedTempFile::new_in 236 237## 3.0.0 238 239- Adds temporary directory support (@KodrAus) 240- Allow closing named temporary files without deleting them (@jasonwhite) 241 242## 2.2.0 243 244- Redox Support 245 246## 2.1.6 247 248- Remove build script and bump minimum rustc version to 1.9.0 249 250## 2.1.5 251 252- Don't build platform-specific dependencies on all platforms. 253- Cleanup some documentation. 254 255## 2.1.4 256 257- Fix crates.io tags. No interesting changes. 258 259## 2.1.3 260 261Export `PersistError`. 262 263## 2.1.2 264 265Add `Read`/`Write`/`Seek` impls on `&NamedTempFile`. This mirrors the 266implementations on `&File`. One can currently just deref to a `&File` but these 267implementations are more discoverable. 268 269## 2.1.1 270 271Add LFS Support. 272 273## 2.1.0 274 275- Implement `AsRef<File>` for `NamedTempFile` allowing named temporary files to 276 be borrowed as `File`s. 277- Add a method to convert a `NamedTempFile` to an unnamed temporary `File`. 278 279## 2.0.1 280 281- Arm bugfix 282 283## 2.0.0 284 285This release replaces `TempFile` with a `tempfile()` function that returns 286`std::fs::File` objects. These are significantly more useful because most rust 287libraries expect normal `File` objects. 288 289To continue supporting shared temporary files, this new version adds a 290`reopen()` method to `NamedTempFile`. 291