diff --git a/Cargo.toml b/Cargo.toml index bab87d8d4ca89ed93f1c6381ac2a42b8d0650524..85c63b5a58b1ad74effa2cc0dbc9a4ebafd08092 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -72,5 +72,5 @@ version_check = "0.1.3" [profile.release] # debug = true # rustflags = [ "-C", "target-cpu=native"] -lto = true +# lto = true panic = "abort" diff --git a/examples/glob.ion b/examples/glob.ion index ff060ea4fa4b3263c6148b2adc01d8ec9964ae2a..24f8c1cd9e0c0d14cd6080a0e5753fdb58a354b3 100644 --- a/examples/glob.ion +++ b/examples/glob.ion @@ -6,6 +6,8 @@ echo Cargo.* echo Cargo?toml echo Cargo.[tqr]oml echo examples/[ef]*.ion +echo "[]" +echo "[] []" mkdir glob_test touch glob_test/{one,two,three} cd glob_test diff --git a/examples/glob.out b/examples/glob.out index 17ff9ff8f470f2080235da7d36dc718b858c7f64..75cbc78f9be5d56150d6db9ca8c6f8c95277b29c 100644 --- a/examples/glob.out +++ b/examples/glob.out @@ -1,11 +1,13 @@ Cargo.toml examples/braces.ion examples/braces.out examples/break.ion examples/break.out -Cargo.toml +Cargo.toml l Cargo.toml Cargo.lock Cargo.toml Cargo.toml Cargo.toml examples/else_if.ion examples/exists.ion examples/fail.ion examples/fibonacci.ion examples/fn.ion examples/for.ion examples/function_piping.ion +[] +[] [] one three two three two -three two +three two one three two diff --git a/src/parser/shell_expand/words.rs b/src/parser/shell_expand/words.rs index 8670a5be0620a9c1a3fb4d6b00fe7360032ab35c..75ce36ff2e2394f27171b9a7ecfd2abde16de0ab 100644 --- a/src/parser/shell_expand/words.rs +++ b/src/parser/shell_expand/words.rs @@ -1179,7 +1179,7 @@ impl<'a, E: Expander + 'a> WordIterator<'a, E> { for _ in 0..moves { iterator.next(); } - self.read += moves + 1; + self.read += moves; true } else { self.read += 1; @@ -1278,7 +1278,7 @@ impl<'a, E: Expander + 'a> Iterator for WordIterator<'a, E> { self.read += 1; return Some(self.braces(&mut iterator)); } - b'[' if !self.flags.contains(SQUOTE) => if self.glob_check(&mut iterator) { + b'[' if !self.flags.contains(SQUOTE | DQUOTE) => if self.glob_check(&mut iterator) { glob = true; } else { return Some(self.array(&mut iterator)); @@ -1398,7 +1398,7 @@ impl<'a, E: Expander + 'a> Iterator for WordIterator<'a, E> { return self.next(); }; } - b'[' if !self.flags.contains(SQUOTE) => if self.glob_check(&mut iterator) { + b'[' if !self.flags.contains(SQUOTE | DQUOTE) => if self.glob_check(&mut iterator) { glob = true; } else { return Some(WordToken::Normal(&self.data[start..self.read], glob, tilde));