diff --git a/rhel/dockerfile/dockerfile.go b/rhel/dockerfile/dockerfile.go index e49a3688a..3e24df4e0 100644 --- a/rhel/dockerfile/dockerfile.go +++ b/rhel/dockerfile/dockerfile.go @@ -100,9 +100,9 @@ func (p *labelParser) Run() error { if strings.Contains(v, `escape=`) { eq := strings.IndexByte(v, '=') if eq == -1 { - return fmt.Errorf("botched parser directive: %#q", i.val) + panic("string changed while parsing?") } - esc, _ := utf8.DecodeRuneInString(v[:eq+1]) + esc, _ := utf8.DecodeRuneInString(v[eq+1:]) p.lex.Escape(esc) p.unquote.Escape(esc) p.vars.Escape(esc) diff --git a/rhel/dockerfile/testdata/Escape.txtar b/rhel/dockerfile/testdata/Escape.txtar new file mode 100644 index 000000000..3e9bb865b --- /dev/null +++ b/rhel/dockerfile/testdata/Escape.txtar @@ -0,0 +1,8 @@ +-- Dockerfile -- +# escape=ꙮ +LABEL a ꙮ +ꙮ$b +-- Want -- +{ + "a": "$b" +}