Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions internal/ldconfig/ldconfig_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,12 @@ func createFileInRoot(containerRootDirPath string, destinationPath string, mode

// mountProc mounts a clean proc filesystem in the new root.
func mountProc(newroot string) error {
target := filepath.Join(newroot, "/proc")

if err := os.MkdirAll(target, 0755); err != nil {
return fmt.Errorf("error creating directory: %w", err)
target, err := securejoin.SecureJoin(newroot, "proc")
if err != nil {
return err
Copy link

Copilot AI Jul 7, 2025

Choose a reason for hiding this comment

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

Wrap the error from securejoin.SecureJoin with context to aid debugging. For example: return fmt.Errorf("failed to resolve proc path: %w", err)

Suggested change
return err
return fmt.Errorf("failed to resolve proc path: %w", err)

Copilot uses AI. Check for mistakes.
}
if err := utils.MkdirAllInRoot(newroot, target, 0755); err != nil {
return err
Copy link

Copilot AI Jul 7, 2025

Choose a reason for hiding this comment

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

Provide additional context when returning this error, e.g., return fmt.Errorf("failed to create proc directory: %w", err) to clarify which operation failed.

Suggested change
return err
return fmt.Errorf("failed to create proc directory at %s: %w", target, err)

Copilot uses AI. Check for mistakes.
}
return unix.Mount("proc", target, "proc", 0, "")
}
Expand Down