#1621 MSYS bash: quoting does not prevent globbing

WSL (6)

Originally reported by Eli Zaretskii; see http://thread.gmane.org/gmane.comp.gnu.mingw.user/38302

When a globbing character appears within a quoted shell command argument, then glob expansion should not occur. This behaviour may be correctly observed when passing such arguments to shell built-in commands, or MSYS-aware applications, (i.e. those linked with msys-1.0.dll). However, when passing such arguments to MinGW applications, the protective quotes are not preserved, and the globbing characters are inappropriately expanded by the MSVCRT startup code.

There are two issues identified in the original mail thread:

1) When passing arguments to MinGW applications, quoting is correctly applied to ensure that embedded white-space, escapes and double quotes are preserved. The same courtesy needs to be accorded to globbing characters which have not been expanded by the shell itself; the current implementation neglects this requirement. The remedy for this defect is entirely within MSYS remit.

2) Recent versions of MSVCRT itself, apparently by Microsoft design, may not honour quoting as protection from glob expansion. It further appears that Microsoft have refused to correct this regression; thus it may be necessary to develop an augmented MinGW startup capability, eschewing the MSVCRT startup code in favour of our own -- perhaps as a user selectable option -- which will DTRT.


<< < 1 2 (Page 2 of 2)
  • Earnie Boyd

    Earnie Boyd - 2013-02-11
    • labels: MSYS --> WSL
    • status: open --> pending
    • milestone: --> MSYS
    • type: --> Bug
    • resolution: --> later
    • category: --> Unknown
    • patch_attached: --> False
  • Keith Marshall

    Keith Marshall - 2013-02-11

    There actually are two patches attached. I thought they'd already been applied, so this should be pretty much ready to go.

<< < 1 2 (Page 2 of 2)