summaryrefslogtreecommitdiff
path: root/vendor/github.com/openshift/imagebuilder/shell_parser.go
diff options
context:
space:
mode:
authordependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>2020-10-23 08:18:13 +0000
committerDaniel J Walsh <dwalsh@redhat.com>2020-10-23 06:52:53 -0400
commit22b1d10d31dfa31da14171c4eebd599dcd4523fc (patch)
tree1d6ad6eb695521e840239e24a879d8be36d5faaa /vendor/github.com/openshift/imagebuilder/shell_parser.go
parent2adc1b284d7f61083d19e82822f79ea14c14de2d (diff)
downloadpodman-22b1d10d31dfa31da14171c4eebd599dcd4523fc.tar.gz
podman-22b1d10d31dfa31da14171c4eebd599dcd4523fc.tar.bz2
podman-22b1d10d31dfa31da14171c4eebd599dcd4523fc.zip
Bump github.com/containers/buildah from 1.16.4 to 1.16.5
Bumps [github.com/containers/buildah](https://github.com/containers/buildah) from 1.16.4 to 1.16.5. - [Release notes](https://github.com/containers/buildah/releases) - [Changelog](https://github.com/containers/buildah/blob/master/CHANGELOG.md) - [Commits](https://github.com/containers/buildah/compare/v1.16.4...v1.16.5) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'vendor/github.com/openshift/imagebuilder/shell_parser.go')
-rw-r--r--vendor/github.com/openshift/imagebuilder/shell_parser.go21
1 files changed, 16 insertions, 5 deletions
diff --git a/vendor/github.com/openshift/imagebuilder/shell_parser.go b/vendor/github.com/openshift/imagebuilder/shell_parser.go
index 65f1db6dc..5c461a34a 100644
--- a/vendor/github.com/openshift/imagebuilder/shell_parser.go
+++ b/vendor/github.com/openshift/imagebuilder/shell_parser.go
@@ -7,6 +7,7 @@ package imagebuilder
// be added by adding code to the "special ${} format processing" section
import (
+ "errors"
"fmt"
"strings"
"text/scanner"
@@ -119,7 +120,7 @@ func (sw *shellWord) processStopOn(stopChar rune) (string, []string, error) {
if stopChar != scanner.EOF && ch == stopChar {
sw.scanner.Next()
- break
+ return result, words.getWords(), nil
}
if fn, ok := charFuncMapping[ch]; ok {
// Call special processing func for certain chars
@@ -156,6 +157,10 @@ func (sw *shellWord) processStopOn(stopChar rune) (string, []string, error) {
}
}
+ if stopChar != scanner.EOF {
+ return "", []string{}, fmt.Errorf("unexpected end of statement while looking for matching %s", string(stopChar))
+ }
+
return result, words.getWords(), nil
}
@@ -168,9 +173,12 @@ func (sw *shellWord) processSingleQuote() (string, error) {
for {
ch := sw.scanner.Next()
- if ch == '\'' || ch == scanner.EOF {
+ if ch == '\'' {
break
}
+ if ch == scanner.EOF {
+ return "", errors.New("unexpected end of statement while looking for matching single-quote")
+ }
result += string(ch)
}
@@ -184,12 +192,15 @@ func (sw *shellWord) processDoubleQuote() (string, error) {
sw.scanner.Next()
- for sw.scanner.Peek() != scanner.EOF {
+ for {
ch := sw.scanner.Peek()
if ch == '"' {
sw.scanner.Next()
break
}
+ if ch == scanner.EOF {
+ return "", errors.New("unexpected end of statement while looking for matching double-quote")
+ }
if ch == '$' {
tmp, err := sw.processDollar()
if err != nil {
@@ -206,8 +217,8 @@ func (sw *shellWord) processDoubleQuote() (string, error) {
continue
}
- if chNext == '"' || chNext == '$' {
- // \" and \$ can be escaped, all other \'s are left as-is
+ if chNext == '"' || chNext == '$' || chNext == '\\' {
+ // \" and \$ and \\ can be escaped, all other \'s are left as-is
ch = sw.scanner.Next()
}
}