Skip to content

Commit 13ce842

Browse files
committed
dockerfile: fix escape parser directive
Signed-off-by: Hank Donnay <[email protected]>
1 parent 923d5fd commit 13ce842

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

rhel/dockerfile/dockerfile.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ func (p *labelParser) Run() error {
100100
if strings.Contains(v, `escape=`) {
101101
eq := strings.IndexByte(v, '=')
102102
if eq == -1 {
103-
return fmt.Errorf("botched parser directive: %#q", i.val)
103+
panic("string changed while parsing?")
104104
}
105-
esc, _ := utf8.DecodeRuneInString(v[:eq+1])
105+
esc, _ := utf8.DecodeRuneInString(v[eq+1:])
106106
p.lex.Escape(esc)
107107
p.unquote.Escape(esc)
108108
p.vars.Escape(esc)

rhel/dockerfile/testdata/Escape.txtar

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- Dockerfile --
2+
# escape=ꙮ
3+
LABEL a ꙮ
4+
ꙮ$b
5+
-- Want --
6+
{
7+
"a": "$b"
8+
}

0 commit comments

Comments
 (0)