|
108 | 108 | //! rename("/path/to/directory/.filename.XXXXXX", "/path/to/directory/filename"); |
109 | 109 | //! ``` |
110 | 110 | //! |
111 | | -//! This Linux-specific behavior is enabled using the `unnamed-tmpfile` feature, which is enabled |
112 | | -//! by default. |
| 111 | +//! This Linux-specific behavior is controlled by the `unnamed-tmpfile` feature of this Crate, |
| 112 | +//! which is enabled by default. |
113 | 113 | //! |
114 | 114 | //! ## Notes and Limitations |
115 | 115 | //! |
116 | 116 | //! * If the path of an [`AtomicWriteFile`] is a directory or a file that cannot be removed (due to |
117 | | -//! permissions or special attributes), an error will be produce when the [`AtomicWriteFile`] is |
| 117 | +//! permissions or special attributes), an error will be produced when the [`AtomicWriteFile`] is |
118 | 118 | //! committed. This is in contrast with the standard `File`, which would instead produce an error |
119 | 119 | //! at `open()` time. |
120 | 120 | //! |
121 | 121 | //! * [`AtomicWriteFile`] is designed so that the temporary files it creates are automatically |
122 | 122 | //! removed if an error (such as a panic) occurs. However, if the process is interrupted abruptly |
123 | | -//! (without unwinding or running destructors), temporary files may be left in the filesystem. |
| 123 | +//! (without unwinding or running destructors), temporary files may be left on the filesystem. |
124 | 124 | //! |
125 | 125 | //! * On Linux, with the `unnamed-tmpfile` feature (enabled by default), [`AtomicWriteFile`] uses |
126 | 126 | //! unnamed temporary files. This ensures that, if the process is interrupted abruptly *before* a |
|
131 | 131 | //! * On Linux, with the `unnamed-tmpfile` feature (enabled by default), [`AtomicWriteFile`] |
132 | 132 | //! requires the `/proc` filesystem to be mounted. This makes [`AtomicWriteFile`] unsuitable for |
133 | 133 | //! use in processes that run early at boot. Disable the `unnamed-tmpfile` feature if you need to |
134 | | -//! run on |
| 134 | +//! run your program in situations where `/proc` is not available. |
135 | 135 | //! |
136 | 136 | //! * If the path of an [`AtomicWriteFile`] is a symlink to another file, the symlink is replaced, |
137 | | -//! the target of the original symlink is left untouched. |
138 | | -//! |
139 | | -//! If you intend to modify the file pointed by a symlink at open time, call |
140 | | -//! [`Path::canonicalize()`] prior to calling [`AtomicWriteFile::open()`] or |
141 | | -//! [`OpenOptions::open()`]. In the future, handling of symlinks will be better customizable. |
| 137 | +//! and the target of the original symlink is left untouched. If you intend to modify the file |
| 138 | +//! pointed by a symlink at open time, call [`Path::canonicalize()`] prior to calling |
| 139 | +//! [`AtomicWriteFile::open()`] or [`OpenOptions::open()`]. In the future, handling of symlinks |
| 140 | +//! will be better customizable. |
142 | 141 | //! |
143 | 142 | //! * Because [`AtomicWriteFile`] works by creating a temporary file, and then replacing the |
144 | 143 | //! original file (see ["how it works"](#how-it-works) above), some metadata of the original file |
145 | 144 | //! may be lost: |
146 | 145 | //! |
147 | 146 | //! * On Unix, it is possible to preserve permissions and ownership of the original file. |
148 | 147 | //! However, it is not generally possible to preserve the same owner user/group of the original |
149 | | -//! file unless the process runs as root, or with the `CAP_CHOWN` capability on Linux. See |
| 148 | +//! file unless the process runs as root (or with the `CAP_CHOWN` capability on Linux). See |
150 | 149 | //! [`OpenOptionsExt::try_preserve_owner()`](crate::unix::OpenOptionsExt::try_preserve_owner) |
151 | 150 | //! for more details on the behavior of [`open()`](OpenOptions::open) when ownership cannot be |
152 | 151 | //! preserved. |
|
0 commit comments