diff --git a/osh/word_eval.py b/osh/word_eval.py index 0dfb5e8e4b..233abb8363 100644 --- a/osh/word_eval.py +++ b/osh/word_eval.py @@ -1580,16 +1580,13 @@ def _EvalWordFrame(self, frame, argv): # Array of strings, some of which are BOTH IFS-escaped and GLOB escaped! frags = [] # type: List[str] for frag, quoted, do_split in frame: - if will_glob: - if quoted: - frag = glob_.GlobEscape(frag) - else: - # We're going to both split and glob, so backslash escape TWICE. - - # If we have a literal \, then we turn it into \\\\. - # Splitting takes \\\\ -> \\ - # Globbing takes \\ to \ if it doesn't match - frag = _BackslashEscape(frag) + if will_glob and quoted: + frag = glob_.GlobEscape(frag) + else: + # If we have a literal \, then we turn it into \\\\. + # Splitting takes \\\\ -> \\ + # Globbing takes \\ to \ if it doesn't match + frag = _BackslashEscape(frag) if do_split: frag = _BackslashEscape(frag) diff --git a/test/spec.sh b/test/spec.sh index 0b669f716d..b4b5ca9570 100755 --- a/test/spec.sh +++ b/test/spec.sh @@ -472,7 +472,7 @@ sh-func() { glob() { # Note: can't pass because it assumes 'bin' exists, etc. - sh-spec spec/glob.test.sh --no-cd-tmp --osh-failures-allowed 8 \ + sh-spec spec/glob.test.sh --no-cd-tmp --osh-failures-allowed 7 \ ${REF_SHELLS[@]} $BUSYBOX_ASH $OSH_LIST "$@" }