mirror of
https://github.com/containers/podman.git
synced 2025-07-04 10:10:32 +08:00
libpod: fix case for executable file not found errors
do not change the runtime error to be lowercase, but use a case insensitive regex matching. In this way the original error from the OCI runtime is reported back. regression introduced by bc485bce47f55135d6ead80537bc145edb779ae9 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -82,18 +82,16 @@ func bindPorts(ports []ocicni.PortMapping) ([]*os.File, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getOCIRuntimeError(runtimeMsg string) error {
|
func getOCIRuntimeError(runtimeMsg string) error {
|
||||||
r := strings.ToLower(runtimeMsg)
|
|
||||||
|
|
||||||
includeFullOutput := logrus.GetLevel() == logrus.DebugLevel
|
includeFullOutput := logrus.GetLevel() == logrus.DebugLevel
|
||||||
|
|
||||||
if match := regexp.MustCompile(".*permission denied.*|.*operation not permitted.*").FindString(r); match != "" {
|
if match := regexp.MustCompile("(?i).*permission denied.*|.*operation not permitted.*").FindString(runtimeMsg); match != "" {
|
||||||
errStr := match
|
errStr := match
|
||||||
if includeFullOutput {
|
if includeFullOutput {
|
||||||
errStr = runtimeMsg
|
errStr = runtimeMsg
|
||||||
}
|
}
|
||||||
return errors.Wrapf(define.ErrOCIRuntimePermissionDenied, "%s", strings.Trim(errStr, "\n"))
|
return errors.Wrapf(define.ErrOCIRuntimePermissionDenied, "%s", strings.Trim(errStr, "\n"))
|
||||||
}
|
}
|
||||||
if match := regexp.MustCompile(".*executable file not found in.*|.*no such file or directory.*").FindString(r); match != "" {
|
if match := regexp.MustCompile("(?i).*executable file not found in.*|.*no such file or directory.*").FindString(runtimeMsg); match != "" {
|
||||||
errStr := match
|
errStr := match
|
||||||
if includeFullOutput {
|
if includeFullOutput {
|
||||||
errStr = runtimeMsg
|
errStr = runtimeMsg
|
||||||
|
Reference in New Issue
Block a user