Copying someone else's performance tweak

About CI performance on Windows.


I needed to re-implement the same whacky parser for the wild crate to emulate Unix-like early glob expansion.

I might copy the extra test cases, because I’ve “only” followed the documentation :slight_smile:

The situation is actually kind of bad, for a couple reasons:

The Windows™ way of handling backslashes in argument lists doesn’t make sense with globs. Is \[ supposed to be a path separator followed by a literal square bracket, like native Windows apps do, or is it an escaped square bracket? Windows file names are allowed to contain square brackets, but are not allowed to contain asterisks or question marks, so this situation doesn’t come up if you follow FindFirstFileW, which only supports * and ?.

Also, you would be failing to match the behavior of other Windows utilities, which only perform glob expansion on actual file names, not on whole arguments. Notice how echo * literally writes a star to the console, and link /tlbout:* actually behaves like link /tlbout:firstfile /tlbout:secondfile ..., treating * as the glob instead of treating /tlbout:* as the glob.

I went for a simpler rule — unquoted metacharacters are globs, quoted aren’t.

On Windows this whole area is full of non-standard behaviors, not just for globs, but even quoting can vary between applications (fun fact: Rust’s stdlib can’t run cmd /c properly).