Description
In cmd/urunc/create.go, the function that handles the nsenter reexec result checks whether reexec.Process.Wait() returned an error, then separately checks whether the exit status was successful. The second branch — reached only when err is nil — wraps err into an error message using %w. At that point err is guaranteed to be nil because the first check already handled the non-nil case. The resulting error message reads "nsenter unsuccessful exit: <nil>", which hides the actual exit code and is meaningless to anyone reading logs or error output.
Expected behavior: When the nsenter process exits unsuccessfully, the error message includes the actual exit status (e.g. "nsenter unsuccessful exit: exit status 1").
Current behavior: The error message reads "nsenter unsuccessful exit: <nil>" because err is nil at the point it is formatted.
Proposed solution: Replace the fmt.Errorf call that wraps err with one that formats the exit status from the status value instead, so the real exit code appears in the error string.
Description
In
cmd/urunc/create.go, the function that handles the nsenter reexec result checks whetherreexec.Process.Wait()returned an error, then separately checks whether the exit status was successful. The second branch — reached only whenerrisnil— wrapserrinto an error message using%w. At that pointerris guaranteed to benilbecause the first check already handled the non-nil case. The resulting error message reads"nsenter unsuccessful exit: <nil>", which hides the actual exit code and is meaningless to anyone reading logs or error output.Expected behavior: When the nsenter process exits unsuccessfully, the error message includes the actual exit status (e.g.
"nsenter unsuccessful exit: exit status 1").Current behavior: The error message reads
"nsenter unsuccessful exit: <nil>"becauseerris nil at the point it is formatted.Proposed solution: Replace the
fmt.Errorfcall that wrapserrwith one that formats the exit status from thestatusvalue instead, so the real exit code appears in the error string.