commit a076350
shrub
·
2026-05-19 19:47:20 +0000 UTC
parent 1c4d5c7
pattern macros in substitution references are not allowed in posix 2008
1 files changed,
+9,
-0
+9,
-0
1@@ -415,6 +415,15 @@ expandsubstref(struct EvalCtx *ctx, const char *s, size_t colon, size_t eq, size
2 free(name);
3
4 if (base) {
5+ if (ctx->mode == MODE_POSIX_2008 && (strchr(from, '%') || strchr(to, '%'))) {
6+ evalerr(ctx,
7+ "pattern macros in substitution references are not valid in POSIX 2008",
8+ 0);
9+ free(base);
10+ free(from);
11+ free(to);
12+ return xstrdup("");
13+ }
14 val = substval(base, from, to);
15 free(base);
16 } else if (auto_name) {