-
-
Notifications
You must be signed in to change notification settings - Fork 381
Fix Windows trust-check failure on 9P network shares by handling ERROR_INVALID_FUNCTION #2129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
f1317c9
a7d35d4
0911c7e
0d664ac
9117b6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,36 @@ fn is_path_owned_by_current_user() -> crate::Result { | |
Ok(()) | ||
} | ||
|
||
#[test] | ||
fn is_path_owned_by_current_user_nonexistent() { | ||
let nonexistent = std::path::Path::new("/this/path/does/not/exist"); | ||
let result = gix_sec::identity::is_path_owned_by_current_user(nonexistent); | ||
assert!(result.is_err(), "Should fail for nonexistent paths"); | ||
assert_eq!(result.unwrap_err().kind(), std::io::ErrorKind::NotFound); | ||
} | ||
|
||
#[test] | ||
#[cfg(windows)] | ||
fn windows_home() -> crate::Result { | ||
let home = gix_path::env::home_dir().expect("home dir is available"); | ||
assert!(gix_sec::identity::is_path_owned_by_current_user(&home)?); | ||
Ok(()) | ||
} | ||
|
||
#[test] | ||
fn test_trust_behavior_scenarios() { | ||
// Test 1: Current directory (should work) | ||
let current_dir = std::env::current_dir().unwrap(); | ||
println!("Testing current directory: {:?}", current_dir); | ||
match gix_sec::identity::is_path_owned_by_current_user(¤t_dir) { | ||
Ok(owned) => println!(" Result: owned = {}", owned), | ||
Err(e) => println!(" Error: {}", e), | ||
} | ||
|
||
// Test 3: Trust from path ownership | ||
println!("Testing trust derivation from path ownership:"); | ||
match gix_sec::Trust::from_path_ownership(¤t_dir) { | ||
Ok(trust) => println!(" Trust level: {:?}", trust), | ||
Err(e) => println!(" Error: {}", e), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot Remove this, makes no sense. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed the redundant Trust::from_path_ownership test in commit b2dca1b. The test was duplicating functionality already covered by the is_path_owned_by_current_user test above it. |
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Don't
println
in tests, use assertions with third arguments instead, likeassert_eq!(a, b, "format {} string")
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 0d664ac. Replaced all println statements with proper assertions using third arguments for better error messages.