FS#43541 - [linux] Missing error handling in linux.install
Attached to Project:
Arch Linux
Opened by Andrey Vihrov (andreyv) - Thursday, 22 January 2015, 15:17 GMT
Last edited by Tobias Powalowski (tpowa) - Sunday, 08 February 2015, 19:23 GMT
Opened by Andrey Vihrov (andreyv) - Thursday, 22 January 2015, 15:17 GMT
Last edited by Tobias Powalowski (tpowa) - Sunday, 08 February 2015, 19:23 GMT
|
Details
When installing the linux and linux-headers packages, I
received this output:
http://pastie.org/9851647
I noticed and fixed the problem, but the worrying part is that the installation continued even after the error occurred (see the "reinstalling linux-headers" and the pacman exit code part). If this was one of many packages being installed at the same time, the error could have gone unnoticed, and the package would have been left in a corrupt state. It seems that this is because all commands in the linux.install file are called without checking their exit status. |
This task depends upon
Closed by Tobias Powalowski (tpowa)
Sunday, 08 February 2015, 19:23 GMT
Reason for closing: Not a bug
Sunday, 08 February 2015, 19:23 GMT
Reason for closing: Not a bug
Is it a bug or a design feature in pacman? I understand that pacman might want to install all requested packages at once, but still it could display
error: install-time scripts failed for the following packages: xxx yyy zzz
in the end after installing everything, and exit unsuccessfully.
I tried a test install action that just does "return 1" from the script function. As you said, pacman continued installation, but at least pacman displayed
error: command failed to execute correctly
for the test package. So making the install script check errors still could be of value, as pacman would now know about the failure. Since pacman runs a separate shell for each install action, it seems that "set -e" in the .install file would be enough to implement error checking.
On the other hand, maybe pacman itself should append "-e" to the shell parameters as it executes the function? It looks like it would be easy to add it in https://projects.archlinux.org/pacman.git/tree/lib/libalpm/trans.c#n328.
I could also post a question about this on the pacman-dev mailing list if it is the correct place.