Revert fstatat on *nix and test symlinks in path_filestat calls (#1725)
* Revert fstatat on *nix and test symlinks in path_filestat calls
This commit effectively reverts too eager refactoring on my part which
resulted in incorrect `path_filestat_{get, set_times}` behaviour on
*nix hosts. In the presence of symlinks, neither of the calls would
work properly.
In order to shield ourselves from similar errors in the future, I've
augmented the `path_filestat` test cases with symlink checks as well.
* Pass appropriate flags to fstatat and utimensat
* Fix formatting
* Fix Windows build
* Expand final symlinks if follow is set on Windows
* Fix formatting
* Do not follow symlinks unless specified on Windows
* Update comments and restart CI
* Skip testing volatile atim field
This commit is contained in:
@@ -600,6 +600,36 @@ impl Handle for VirtualDir {
|
||||
}
|
||||
}
|
||||
}
|
||||
fn filestat_get_at(&self, path: &str, _follow: bool) -> Result<types::Filestat> {
|
||||
let stat = self
|
||||
.openat(
|
||||
path,
|
||||
false,
|
||||
false,
|
||||
types::Oflags::empty(),
|
||||
types::Fdflags::empty(),
|
||||
)?
|
||||
.filestat_get()?;
|
||||
Ok(stat)
|
||||
}
|
||||
fn filestat_set_times_at(
|
||||
&self,
|
||||
path: &str,
|
||||
atim: types::Timestamp,
|
||||
mtim: types::Timestamp,
|
||||
fst_flags: types::Fstflags,
|
||||
_follow: bool,
|
||||
) -> Result<()> {
|
||||
self.openat(
|
||||
path,
|
||||
false,
|
||||
false,
|
||||
types::Oflags::empty(),
|
||||
types::Fdflags::empty(),
|
||||
)?
|
||||
.filestat_set_times(atim, mtim, fst_flags)?;
|
||||
Ok(())
|
||||
}
|
||||
fn openat(
|
||||
&self,
|
||||
path: &str,
|
||||
|
||||
Reference in New Issue
Block a user