mirror of
https://github.com/containers/podman.git
synced 2026-02-05 15:45:08 +01:00
Fix missing newlines in stderr error messages
I happened to run `podman run --config=/path/to/file` and got an error without a trailing newline, which was a bit jarring. Fix the instances I noticed. Assisted-by: OpenCode (Claude Opus 4.5) Signed-off-by: Colin Walters <walters@verbum.org>
This commit is contained in:
@@ -42,7 +42,7 @@ func init() {
|
|||||||
func storeBefore() error {
|
func storeBefore() error {
|
||||||
defaultStoreOptions, err := storage.DefaultStoreOptions()
|
defaultStoreOptions, err := storage.DefaultStoreOptions()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "selecting storage options: %v", err)
|
fmt.Fprintf(os.Stderr, "selecting storage options: %v\n", err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
globalStorageOptions = defaultStoreOptions
|
globalStorageOptions = defaultStoreOptions
|
||||||
|
|||||||
@@ -443,16 +443,16 @@ func configHook() {
|
|||||||
if err != nil && !errors.Is(err, fs.ErrNotExist) {
|
if err != nil && !errors.Is(err, fs.ErrNotExist) {
|
||||||
// Cases where the folder does not exist are allowed, BUT cases where some other Stat() error
|
// Cases where the folder does not exist are allowed, BUT cases where some other Stat() error
|
||||||
// is returned should fail
|
// is returned should fail
|
||||||
fmt.Fprintf(os.Stderr, "Supplied --config folder (%s) exists but is not accessible: %s", dockerConfig, err.Error())
|
fmt.Fprintf(os.Stderr, "Supplied --config folder (%s) exists but is not accessible: %s\n", dockerConfig, err.Error())
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
if err == nil && !statInfo.IsDir() {
|
if err == nil && !statInfo.IsDir() {
|
||||||
// Cases where it does exist but is a file should fail
|
// Cases where it does exist but is a file should fail
|
||||||
fmt.Fprintf(os.Stderr, "Supplied --config file (%s) is not a directory", dockerConfig)
|
fmt.Fprintf(os.Stderr, "Supplied --config file (%s) is not a directory\n", dockerConfig)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
if err := os.Setenv("DOCKER_CONFIG", dockerConfig); err != nil {
|
if err := os.Setenv("DOCKER_CONFIG", dockerConfig); err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "cannot set DOCKER_CONFIG=%s: %s", dockerConfig, err.Error())
|
fmt.Fprintf(os.Stderr, "cannot set DOCKER_CONFIG=%s: %s\n", dockerConfig, err.Error())
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,6 @@ func syslogHook() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(os.Stderr, "Logging to Syslog is not supported on %s", runtime.GOOS)
|
fmt.Fprintf(os.Stderr, "Logging to Syslog is not supported on %s\n", runtime.GOOS)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ func (f *Farm) Build(ctx context.Context, schedule Schedule, options entities.Bu
|
|||||||
buildResults.Range(func(_, v any) bool {
|
buildResults.Range(func(_, v any) bool {
|
||||||
result, ok := v.(buildResult)
|
result, ok := v.(buildResult)
|
||||||
if !ok {
|
if !ok {
|
||||||
fmt.Fprintf(os.Stderr, "report %v not a build result?", v)
|
fmt.Fprintf(os.Stderr, "report %v not a build result?\n", v)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
perArchBuilds[result.report] = result.builder
|
perArchBuilds[result.report] = result.builder
|
||||||
|
|||||||
@@ -101,7 +101,8 @@ var _ = Describe("Podman run", func() {
|
|||||||
tempFileName := tempFile.Name()
|
tempFileName := tempFile.Name()
|
||||||
session := podmanTest.Podman([]string{"--config", tempFileName, "run", ALPINE, "ls"})
|
session := podmanTest.Podman([]string{"--config", tempFileName, "run", ALPINE, "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(ExitWithError(1, fmt.Sprintf(`Supplied --config file (%s) is not a directory`, tempFileName)))
|
// Note: ErrorToString() uses strings.Fields() which normalizes whitespace, so we're not testing the trailing newline
|
||||||
|
Expect(session).Should(ExitWithError(1, fmt.Sprintf("Supplied --config file (%s) is not a directory", tempFileName)))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run from manifest list", func() {
|
It("podman run from manifest list", func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user