Skip to content

Commit eda0b1c

Browse files
committed
NEWS: add entry about disabling wildcard support by default
1 parent 80fcfc0 commit eda0b1c

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

web/docs/c.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ With mingw-w64, there are three ways wildcard expansion can be configured:
1111

1212
1. mingw-w64 can be configured at build time to either enable or disable wildcard expansion by default via the `--enable-wildcard` configure flags. This can to be overridden on a per .exe basis by the user.
1313

14-
Currently wildcard expansion is enabled by default in MSYS2.
14+
Wildcard expansion is disabled by default in MSYS2.
1515

1616
2. You can set `_dowildcard` in your source code to either `0` or `-1` to disable or enable wildcard expansion.
1717

@@ -30,3 +30,10 @@ With mingw-w64, there are three ways wildcard expansion can be configured:
3030
# To force-disable wildcard expansion
3131
cc main.c $(cc -print-file-name=CRT_noglob.o)
3232
```
33+
34+
### Changelog
35+
36+
* Starting with 2024-11-03 we have changed mingw-w64 to to disable wildcard
37+
handling by default. You can still enable it on a per application basis as
38+
described above. For more info on the change see [the news
39+
entry](../news.md#2024-11-03---disabling-mingw-w64-wildcard-support-by-default).

web/news.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,42 @@ summary: Important events happening.
55

66
This page lists important changes or issues affecting MSYS2 users. We also post them to [Twitter](https://twitter.com/msys2org) and [Mastodon](https://fosstodon.org/@msys2org), including some not-so-important things :)
77

8+
### 2024-11-03 - Disabling mingw-w64 wildcard support by default
9+
10+
For historical reasons MSYS2 enabled wildcard support in mingw-w64 at build
11+
time. This means that every built executable had wildcard support enabled by
12+
default, unless it explicitly opted out. Wildcard support in this case means
13+
that program arguments containing `?`and `*` can be expanded to one or more file
14+
paths if the pattern happens to match paths of files on disk. Note that this
15+
happens directly in the target program, not in a shell beforehand.
16+
17+
This expansion has several problems:
18+
19+
* Behave differently than MSVC built executables
20+
* It's confusing to users when wildcard handling is accidentally triggered. For
21+
example, passing a regex as an argument to a CLI tool that starts matching
22+
random files, breaking the pattern.
23+
* It may have security implications if arguments to executables are forwarded
24+
from user-controlled input, in which case an argument could expand to a
25+
different string depending on the files present on the filesystem.
26+
27+
Given all this, we have decided to disable wildcard handling by default. This
28+
means that any package and executable that is built after this change will get
29+
the new default behavior.
30+
31+
```console
32+
$ python -c 'import sys; print(sys.argv)' '*a.txt' # before
33+
['-c', 'a.txt', 'aaaa.txt', 'bla.txt']
34+
$ python -c 'import sys; print(sys.argv)' '*a.txt' # after
35+
['-c', '*a.txt']
36+
```
37+
38+
Our hope/assumption is that this will not affect many users, as most will rely
39+
on globbing at a higher level, be it bash, or build systems. If you experience
40+
any problems, please let us know. See also [the
41+
documentation](./docs/c.md#expanding-wildcard-arguments) on how to force
42+
wildcard handling for your applications even after this change.
43+
844
### 2024-09-23 - Starting to drop the CLANG32 environment
945

1046
9 months ago we started to reduce the number of packages for the 32-bit

0 commit comments

Comments
 (0)