mirror of
https://github.com/containers/podman.git
synced 2025-11-30 01:58:46 +08:00
vendor: update c/{buildah,common,image,storage} to main
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
10
vendor/github.com/moby/buildkit/frontend/dockerfile/parser/errors.go
generated
vendored
10
vendor/github.com/moby/buildkit/frontend/dockerfile/parser/errors.go
generated
vendored
@@ -5,14 +5,14 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// ErrorLocation gives a location in source code that caused the error
|
||||
type ErrorLocation struct {
|
||||
// LocationError gives a location in source code that caused the error
|
||||
type LocationError struct {
|
||||
Locations [][]Range
|
||||
error
|
||||
}
|
||||
|
||||
// Unwrap unwraps to the next error
|
||||
func (e *ErrorLocation) Unwrap() error {
|
||||
func (e *LocationError) Unwrap() error {
|
||||
return e.error
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ func setLocation(err error, location []Range, add bool) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
var el *ErrorLocation
|
||||
var el *LocationError
|
||||
if errors.As(err, &el) {
|
||||
if add {
|
||||
el.Locations = append(el.Locations, location)
|
||||
@@ -54,7 +54,7 @@ func setLocation(err error, location []Range, add bool) error {
|
||||
}
|
||||
return err
|
||||
}
|
||||
return stack.Enable(&ErrorLocation{
|
||||
return stack.Enable(&LocationError{
|
||||
error: err,
|
||||
Locations: [][]Range{location},
|
||||
})
|
||||
|
||||
4
vendor/github.com/moby/buildkit/frontend/dockerfile/parser/line_parsers.go
generated
vendored
4
vendor/github.com/moby/buildkit/frontend/dockerfile/parser/line_parsers.go
generated
vendored
@@ -318,7 +318,7 @@ func parseMaybeJSON(rest string, d *directives) (*Node, map[string]bool, error)
|
||||
if err == nil {
|
||||
return node, attrs, nil
|
||||
}
|
||||
if err == errDockerfileNotStringArray {
|
||||
if errors.Is(err, errDockerfileNotStringArray) {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ func parseMaybeJSONToList(rest string, d *directives) (*Node, map[string]bool, e
|
||||
if err == nil {
|
||||
return node, attrs, nil
|
||||
}
|
||||
if err == errDockerfileNotStringArray {
|
||||
if errors.Is(err, errDockerfileNotStringArray) {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
|
||||
6
vendor/github.com/moby/buildkit/frontend/dockerfile/parser/parser.go
generated
vendored
6
vendor/github.com/moby/buildkit/frontend/dockerfile/parser/parser.go
generated
vendored
@@ -114,7 +114,7 @@ type Heredoc struct {
|
||||
var (
|
||||
dispatch map[string]func(string, *directives) (*Node, map[string]bool, error)
|
||||
reWhitespace = regexp.MustCompile(`[\t\v\f\r ]+`)
|
||||
reHeredoc = regexp.MustCompile(`^(\d*)<<(-?)([^<]*)$`)
|
||||
reHeredoc = regexp.MustCompile(`^(\d*)<<(-?)\s*([^<]*)$`)
|
||||
reLeadingTabs = regexp.MustCompile(`(?m)^\t+`)
|
||||
)
|
||||
|
||||
@@ -556,8 +556,8 @@ func scanLines(data []byte, atEOF bool) (advance int, token []byte, err error) {
|
||||
}
|
||||
|
||||
func handleScannerError(err error) error {
|
||||
switch err {
|
||||
case bufio.ErrTooLong:
|
||||
switch {
|
||||
case errors.Is(err, bufio.ErrTooLong):
|
||||
return errors.Errorf("dockerfile line greater than max allowed size of %d", bufio.MaxScanTokenSize-1)
|
||||
default:
|
||||
return err
|
||||
|
||||
28
vendor/github.com/moby/buildkit/frontend/dockerfile/shell/lex.go
generated
vendored
28
vendor/github.com/moby/buildkit/frontend/dockerfile/shell/lex.go
generated
vendored
@@ -177,6 +177,7 @@ func (sw *shellWord) processStopOn(stopChar rune, rawEscapes bool) (string, []st
|
||||
// no need to initialize all the time
|
||||
var charFuncMapping = map[rune]func() (string, error){
|
||||
'$': sw.processDollar,
|
||||
'<': sw.processPossibleHeredoc,
|
||||
}
|
||||
if !sw.SkipProcessQuotes {
|
||||
charFuncMapping['\''] = sw.processSingleQuote
|
||||
@@ -512,6 +513,25 @@ func (sw *shellWord) processName() string {
|
||||
return name.String()
|
||||
}
|
||||
|
||||
func (sw *shellWord) processPossibleHeredoc() (string, error) {
|
||||
sw.scanner.Next()
|
||||
if sw.scanner.Peek() != '<' {
|
||||
return "<", nil // not a heredoc
|
||||
}
|
||||
sw.scanner.Next()
|
||||
|
||||
// heredoc might have whitespace between << and word terminator
|
||||
var space bytes.Buffer
|
||||
nextCh := sw.scanner.Peek()
|
||||
for isWhitespace(nextCh) {
|
||||
space.WriteRune(nextCh)
|
||||
sw.scanner.Next()
|
||||
nextCh = sw.scanner.Peek()
|
||||
}
|
||||
result := "<<" + space.String()
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// isSpecialParam checks if the provided character is a special parameters,
|
||||
// as defined in http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_05_02
|
||||
func isSpecialParam(char rune) bool {
|
||||
@@ -677,3 +697,11 @@ func trimSuffix(pattern, word string, greedy bool) (string, error) {
|
||||
}
|
||||
return reverseString(str), nil
|
||||
}
|
||||
|
||||
func isWhitespace(r rune) bool {
|
||||
switch r {
|
||||
case '\t', '\r', ' ':
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
2
vendor/github.com/moby/buildkit/util/stack/compress.go
generated
vendored
2
vendor/github.com/moby/buildkit/util/stack/compress.go
generated
vendored
@@ -25,7 +25,7 @@ loop0:
|
||||
}
|
||||
// full match, potentially skip all
|
||||
if idx == len(st.Frames)-1 {
|
||||
if st.Pid == prev.Pid && st.Version == prev.Version && slices.Compare(st.Cmdline, st.Cmdline) == 0 {
|
||||
if st.Pid == prev.Pid && st.Version == prev.Version && slices.Equal(st.Cmdline, prev.Cmdline) {
|
||||
continue loop0
|
||||
}
|
||||
}
|
||||
|
||||
12
vendor/github.com/moby/buildkit/util/stack/stack.go
generated
vendored
12
vendor/github.com/moby/buildkit/util/stack/stack.go
generated
vendored
@@ -50,7 +50,7 @@ func Traces(err error) []*Stack {
|
||||
func traces(err error) []*Stack {
|
||||
var st []*Stack
|
||||
|
||||
switch e := err.(type) {
|
||||
switch e := err.(type) { //nolint:errorlint
|
||||
case interface{ Unwrap() error }:
|
||||
st = Traces(e.Unwrap())
|
||||
case interface{ Unwrap() []error }:
|
||||
@@ -63,7 +63,7 @@ func traces(err error) []*Stack {
|
||||
}
|
||||
}
|
||||
|
||||
switch ste := err.(type) {
|
||||
switch ste := err.(type) { //nolint:errorlint
|
||||
case interface{ StackTrace() errors.StackTrace }:
|
||||
st = append(st, convertStack(ste.StackTrace()))
|
||||
case interface{ StackTrace() *Stack }:
|
||||
@@ -85,7 +85,7 @@ func Enable(err error) error {
|
||||
}
|
||||
|
||||
func Wrap(err error, s *Stack) error {
|
||||
return &withStack{stack: s, error: err}
|
||||
return &withStackError{stack: s, error: err}
|
||||
}
|
||||
|
||||
func hasLocalStackTrace(err error) bool {
|
||||
@@ -173,15 +173,15 @@ func convertStack(s errors.StackTrace) *Stack {
|
||||
return &out
|
||||
}
|
||||
|
||||
type withStack struct {
|
||||
type withStackError struct {
|
||||
stack *Stack
|
||||
error
|
||||
}
|
||||
|
||||
func (e *withStack) Unwrap() error {
|
||||
func (e *withStackError) Unwrap() error {
|
||||
return e.error
|
||||
}
|
||||
|
||||
func (e *withStack) StackTrace() *Stack {
|
||||
func (e *withStackError) StackTrace() *Stack {
|
||||
return e.stack
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user