Skip to content

pacman: fail the install on scriptlet and hook errors - #429

Open
daandemeyer wants to merge 1 commit into
amutable:mainfrom
daandemeyer:pacman-hook-errors
Open

daandemeyer wants to merge 1 commit into
amutable:mainfrom
daandemeyer:pacman-hook-errors

Conversation

@daandemeyer

Copy link
Copy Markdown
Member

libalpm commits a transaction even when an install scriptlet or a hook
fails, and pacman then exits with status 0. The install driver only checks
the exit status, so a root with a failed scriptlet passes as a good one.
Let's read pacman's stderr in the driver, still forwarding it, and fail the
install when pacman prints the error of a failed scriptlet or hook.

libalpm commits a transaction even when an install scriptlet or a hook
fails, and pacman then exits with status 0. The install driver only checks
the exit status, so a root with a failed scriptlet passes as a good one.
Let's read pacman's stderr in the driver, still forwarding it, and fail the
install when pacman prints the error of a failed scriptlet or hook.

Signed-off-by: Daan De Meyer <daan@amutable.com>

@martinpitt martinpitt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm, is that safe? I wonder how many broken Arch package scripts there are out there that can exit non-zero, if pacman/alpm doesn't enforce their success.

@daandemeyer

Copy link
Copy Markdown
Member Author

It's the same as reproducibility to me, something to fix in Arch

@martinpitt martinpitt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm. This is a horrible hack (scraping stderr), and my gut tells me it'll break image builds and tine is just the wrong place to try and enforce this. OOI, is that blocking anything you are doing, i.e. do you really want to land this now? or was it more like a "CI test run"?

@daandemeyer

Copy link
Copy Markdown
Member Author

I don't have a strong preference. This came up as a side-thing from some claude review. I'll see if there's a cleaner way, otherwise I'll close

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants