diff options
author | Ron Yorston <rmy@pobox.com> | 2021-08-17 08:26:36 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-08-17 08:26:36 +0100 |
commit | f13defb1c8f892ecf3e8dd5dbe486cc2b53e6f03 (patch) | |
tree | 15c9c174532e433e5632637c541d09e591c01d60 /shell/ash.c | |
parent | 41f31584037be6b9d74a89245dff9ad8f0db146f (diff) | |
parent | 540aa116615713ad53e5ac98850993162e27c32d (diff) | |
download | busybox-w32-f13defb1c8f892ecf3e8dd5dbe486cc2b53e6f03.tar.gz busybox-w32-f13defb1c8f892ecf3e8dd5dbe486cc2b53e6f03.tar.bz2 busybox-w32-f13defb1c8f892ecf3e8dd5dbe486cc2b53e6f03.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/shell/ash.c b/shell/ash.c index 28f74e8a8..c9eaaf52a 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -7855,7 +7855,7 @@ subevalvar(char *start, char *str, int strloc, | |||
7855 | while (idx <= end) { | 7855 | while (idx <= end) { |
7856 | try_to_match: | 7856 | try_to_match: |
7857 | if (no_meta_len == 0) { | 7857 | if (no_meta_len == 0) { |
7858 | /* pattern has meta chars, have to glob; or ENABLE_ASH_OPTIMIZE_FOR_SIZE */ | 7858 | /* pattern has meta chars, have to glob; or ENABLE_ASH_OPTIMIZE_FOR_SIZE */ |
7859 | loc = scanright(idx, rmesc, rmescend, str, quotes, /*match_at_start:*/ 1); | 7859 | loc = scanright(idx, rmesc, rmescend, str, quotes, /*match_at_start:*/ 1); |
7860 | } else { | 7860 | } else { |
7861 | /* Testcase for very slow replace (performs about 22k replaces): | 7861 | /* Testcase for very slow replace (performs about 22k replaces): |
@@ -7863,16 +7863,19 @@ subevalvar(char *start, char *str, int strloc, | |||
7863 | * x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;echo ${#x} | 7863 | * x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;echo ${#x} |
7864 | * echo "${x//:/|}" | 7864 | * echo "${x//:/|}" |
7865 | */ | 7865 | */ |
7866 | size_t n; | ||
7867 | if (strncmp(rmesc, str, no_meta_len) != 0) | 7866 | if (strncmp(rmesc, str, no_meta_len) != 0) |
7868 | goto no_match; | 7867 | goto no_match; |
7869 | n = no_meta_len; | ||
7870 | loc = idx; | 7868 | loc = idx; |
7871 | do { | 7869 | if (!quotes) { |
7872 | if (quotes && (unsigned char)*loc == CTLESC) | 7870 | loc += no_meta_len; |
7871 | } else { | ||
7872 | size_t n = no_meta_len; | ||
7873 | do { | ||
7874 | if ((unsigned char)*loc == CTLESC) | ||
7875 | loc++; | ||
7873 | loc++; | 7876 | loc++; |
7874 | loc++; | 7877 | } while (--n != 0); |
7875 | } while (--n != 0); | 7878 | } |
7876 | } | 7879 | } |
7877 | //bb_error_msg("scanright('%s'):'%s'", str, loc); | 7880 | //bb_error_msg("scanright('%s'):'%s'", str, loc); |
7878 | if (!loc) { | 7881 | if (!loc) { |