Skip to content

Commit

Permalink
dockerfile: fix escape parser directive
Browse files Browse the repository at this point in the history
Signed-off-by: Hank Donnay <[email protected]>
  • Loading branch information
hdonnay committed Feb 8, 2024
1 parent 345c85e commit 4ee0d8a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rhel/dockerfile/dockerfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions rhel/dockerfile/testdata/Escape.txtar
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- Dockerfile --
# escape=ꙮ
LABEL a ꙮ
ꙮ$b
-- Want --
{
"a": "$b"
}

0 comments on commit 4ee0d8a

Please sign in to comment.