Skip to content

Commit

Permalink
Merge pull request #5753 from nalind/newline-error
Browse files Browse the repository at this point in the history
chroot: add newlines at the end of printed error messages
  • Loading branch information
openshift-merge-bot[bot] authored Oct 23, 2024
2 parents aeec2a1 + 2ff91b8 commit 83b5dcf
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions chroot/run_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ func runUsingChroot(spec *specs.Spec, bundlePath string, ctty *os.File, stdin io
BundlePath: bundlePath,
})
if conferr != nil {
fmt.Fprintf(os.Stderr, "error re-encoding configuration for %q", runUsingChrootExecCommand)
fmt.Fprintf(os.Stderr, "error re-encoding configuration for %q\n", runUsingChrootExecCommand)
os.Exit(1)
}

Expand Down Expand Up @@ -567,7 +567,7 @@ func runUsingChroot(spec *specs.Spec, bundlePath string, ctty *os.File, stdin io
}
}
}
fmt.Fprintf(os.Stderr, "process exited with error: %v", err)
fmt.Fprintf(os.Stderr, "process exited with error: %v\n", err)
os.Exit(1)
}

Expand Down Expand Up @@ -695,23 +695,23 @@ func runUsingChrootExecMain() {
}
logrus.Debugf("setting supplemental groups")
if err = syscall.Setgroups(gids); err != nil {
fmt.Fprintf(os.Stderr, "error setting supplemental groups list: %v", err)
fmt.Fprintf(os.Stderr, "error setting supplemental groups list: %v\n", err)
os.Exit(1)
}
} else {
setgroups, _ := os.ReadFile("/proc/self/setgroups")
if strings.Trim(string(setgroups), "\n") != "deny" {
logrus.Debugf("clearing supplemental groups")
if err = syscall.Setgroups([]int{}); err != nil {
fmt.Fprintf(os.Stderr, "error clearing supplemental groups list: %v", err)
fmt.Fprintf(os.Stderr, "error clearing supplemental groups list: %v\n", err)
os.Exit(1)
}
}
}

logrus.Debugf("setting gid")
if err = unix.Setresgid(int(user.GID), int(user.GID), int(user.GID)); err != nil {
fmt.Fprintf(os.Stderr, "error setting GID: %v", err)
fmt.Fprintf(os.Stderr, "error setting GID: %v\n", err)
os.Exit(1)
}

Expand All @@ -732,7 +732,7 @@ func runUsingChrootExecMain() {

logrus.Debugf("setting uid")
if err = unix.Setresuid(int(user.UID), int(user.UID), int(user.UID)); err != nil {
fmt.Fprintf(os.Stderr, "error setting UID: %v", err)
fmt.Fprintf(os.Stderr, "error setting UID: %v\n", err)
os.Exit(1)
}

Expand All @@ -745,7 +745,7 @@ func runUsingChrootExecMain() {
logrus.Debugf("Running %#v (PATH = %q)", cmd, os.Getenv("PATH"))
interrupted := make(chan os.Signal, 100)
if err = cmd.Start(); err != nil {
fmt.Fprintf(os.Stderr, "process failed to start with error: %v", err)
fmt.Fprintf(os.Stderr, "process failed to start with error: %v\n", err)
}
go func() {
for range interrupted {
Expand All @@ -772,7 +772,7 @@ func runUsingChrootExecMain() {
}
}
}
fmt.Fprintf(os.Stderr, "process exited with error: %v", err)
fmt.Fprintf(os.Stderr, "process exited with error: %v\n", err)
os.Exit(1)
}
}
Expand Down

1 comment on commit 83b5dcf

@packit-as-a-service
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman-next COPR build failed. @containers/packit-build please check.

Please sign in to comment.