diff --git a/check.t b/check.t index e03b463..1feb5d3 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.153 2008/03/01 16:40:57 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.154 2008/03/01 17:14:17 tg Exp $ # $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $ @@ -1083,8 +1083,12 @@ stdin: pfx=/home/user wd=/home/user/tmp echo ${wd/#$pfx/~} + echo ${wd/#"$pfx"/~} + echo ${wd/#'$pfx'/~} expected-stdout: ~/tmp + ~/tmp + /home/user/tmp --- name: glob-bad-1 description: diff --git a/eval.c b/eval.c index 6056569..6201eb9 100644 --- a/eval.c +++ b/eval.c @@ -2,7 +2,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.41 2008/02/29 11:51:21 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.42 2008/03/01 17:14:17 tg Exp $"); #ifdef MKSH_SMALL #define MKSH_NOPWNAM @@ -1026,11 +1026,11 @@ trimsub(char *str, char *pat, int how) if (!(*d++ = *s++)) break; } else if (c == '/') { - *d++ = '\0'; rrep = s; break; } else *d++ = c; + *d++ = '\0'; /* do not accept empty pattern */ if (!*rpat) { afree(rpat, ATEMP); @@ -1058,6 +1058,10 @@ trimsub(char *str, char *pat, int how) tpat1 = shf_smprintf("%c*%s%c*", MAGIC, rpat, MAGIC); tpat2 = tpat1 + 2; } +#if 0 + fprintf(stderr, "D: 「%s」 → 〔%s|%s〕\n", pat, tpat0, rrep); + fflush(stderr); +#endif again_repl: /* this would not be necessary if gmatchx would return * the start and end values of a match found, like re*