mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
chmod: correctly handle modes after --
This commit is contained in:
parent
b841a11421
commit
5825889931
2 changed files with 17 additions and 0 deletions
|
@ -184,6 +184,9 @@ pub fn uu_app() -> App<'static, 'static> {
|
|||
// e.g. "chmod -v -xw -R FILE" -> "chmod -v xw -R FILE"
|
||||
pub fn strip_minus_from_mode(args: &mut Vec<String>) -> bool {
|
||||
for arg in args {
|
||||
if arg == "--" {
|
||||
break;
|
||||
}
|
||||
if arg.starts_with('-') {
|
||||
if let Some(second) = arg.chars().nth(1) {
|
||||
match second {
|
||||
|
|
|
@ -532,3 +532,17 @@ fn test_no_operands() {
|
|||
.code_is(1)
|
||||
.stderr_is("chmod: missing operand");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mode_after_dash_dash() {
|
||||
let (at, ucmd) = at_and_ucmd!();
|
||||
run_single_test(
|
||||
&TestCase {
|
||||
args: vec!["--", "-r", TEST_FILE],
|
||||
before: 0o100777,
|
||||
after: 0o100333,
|
||||
},
|
||||
at,
|
||||
ucmd,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue