We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b63dee9 commit 84bc552Copy full SHA for 84bc552
test-framework/sudo-compliance-tests/src/sudoedit.rs
@@ -398,3 +398,31 @@ done",
398
);
399
}
400
401
+
402
+#[test]
403
+fn can_edit_in_current_dir() {
404
+ let env = Env(SUDOERS_ALL_ALL_NOPASSWD)
405
+ .user(USERNAME)
406
+ .file(
407
+ DEFAULT_EDITOR,
408
+ TextFile(
409
+ "#!/bin/sh
410
411
+for f in \"$@\"
412
+do echo \"$f\" > \"$f\"
413
+done",
414
+ )
415
+ .chmod(CHMOD_EXEC),
416
417
+ .build();
418
419
+ Command::new("sh")
420
+ .args(["-c", "cd / && sudoedit foo"])
421
+ .as_user(USERNAME)
422
+ .output(&env)
423
+ .assert_success();
424
425
+ let actual = Command::new("cat").arg("/foo").output(&env).stdout();
426
427
+ assert_starts_with!(actual[actual.rfind('/').unwrap()..], "/foo");
428
+}
0 commit comments