Skip to content

uucore(windows): rewrite fsext with safe Win32 wrappers, real free space and mount paths; df(windows): resolve paths by mount prefix - #14455

Open
nikolalukovic wants to merge 1 commit into
uutils:mainfrom
nikolalukovic:uucore-fsext-windows
Open

uucore(windows): rewrite fsext with safe Win32 wrappers, real free space and mount paths; df(windows): resolve paths by mount prefix#14455
nikolalukovic wants to merge 1 commit into
uutils:mainfrom
nikolalukovic:uucore-fsext-windows

Conversation

@nikolalukovic

Copy link
Copy Markdown
Contributor

No description provided.

@sylvestre

Copy link
Copy Markdown
Contributor

@lhecker if you have an opinion :)

…ace and mount paths; df(windows): resolve paths by mount prefix
@sylvestre
sylvestre force-pushed the uucore-fsext-windows branch from aac8d79 to c12fd33 Compare September 8, 2026 12:55
@sylvestre

Copy link
Copy Markdown
Contributor

much easier to review !

@nikolalukovic

nikolalukovic commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

I still have no idea how to use stacks though, lol it's just two separate PRs now, I don't know how to combine them so they're visible here in the UI as a stack

much easier to review !

that it is, agreed

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/tail-n0f (passes in this run but fails in the 'main' branch)

@lhecker lhecker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR will inevitably conflict with #12244, but I can fix it on my side. It does, however, naturally remove most of the code that moves in this PR, so it may be worth merging #12244 first and then move it in this PR.

Comment on lines +49 to +65
let path = path.as_ref();
let file = path.as_os_str().to_owned();
// Not `canonicalize`: it resolves SUBST drives and junctions away and
// yields `\\?\` prefixes that never match a mount directory.
let absolute = std::path::absolute(path).map_err(|_| FsError::InvalidPath)?;
absolute.metadata().map_err(|_| FsError::InvalidPath)?;
let longest = mounts
.iter()
.filter(|m| absolute.starts_with(&m.mount_dir))
.max_by_key(|m| m.mount_dir.len());
let mount_info = if let Some(mount_info) = longest {
mount_info.clone()
} else {
let root = uucore::fs::volume_path_name(&absolute).map_err(|_| FsError::MountMissing)?;
MountInfo::from_mount_dir(root.into_os_string())
};
Filesystem::new(mount_info, Some(file)).ok_or(FsError::MountMissing)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand what this does.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

old Filesystem::from_path(mounts, path) was unix only and I didn't want to introduce a windows fix there

@nikolalukovic

Copy link
Copy Markdown
Contributor Author

This PR will inevitably conflict with #12244, but I can fix it on my side. It does, however, naturally remove most of the code that moves in this PR, so it may be worth merging #12244 first and then move it in this PR.

biggest conflict will be with this PR #14456

since you introduced the nt module I think it would be better to merge your PR first, I'll adjust to those changes

@lhecker

lhecker commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Ah yeah, I forgot about #14456. That PR is really nice.

@sylvestre

Copy link
Copy Markdown
Contributor

sorry, 2 conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants