[BUG] 'case' does not match double-quoted backslash

Kang-Che Sung explorer09 at gmail.com
Tue Feb 13 02:09:38 UTC 2018


On Tue, Feb 13, 2018 at 5:36 AM, Martijn Dekker <martijn at inlv.org> wrote:
> The following outputs BUG in ash:
>
> case "\z" in
> "\z" )  echo ok ;;
> * )     echo BUG ;;
> esac
>
> Apparently `case` has trouble matching the "\z" pattern due to the
> backslash within the double quotes. Quoting it in any other way works.
>
> Also, backslash-escaping the backslash within the double quotes is a
> workaround. But this is not supposed to be necessary unless the
> backslash precedes one of the special characters $, `, ", \, or <newline>.
>
> The bug is in 1.28.0 but not 1.27.0.
>
> According to my testing, this bug appears to have been introduced by
> this commit, which fixed another related bug.
>
> | commit fda9fafe279d9394ad53313320a949c86f646734
>
> | Author: Denys Vlasenko <vda.linux at googlemail.com>
> | Date:   Wed Jul 5 19:10:21 2017 +0200
>
> |
> |     ash: fix matching of unicode greek letter rho (cf 81) and similar
> cases
> |
>
> |     Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>

Just wondering, why using "\z" and not "\\z" ?
The former doesn't seem to be a valid syntax.


More information about the busybox mailing list