Pacman

Historical bug tracker for the Pacman package manager.

The pacman bug tracker has moved to gitlab:
https://gitlab.archlinux.org/pacman/pacman/-/issues

This tracker remains open for interaction with historical bugs during the transition period. Any new bugs reports will be closed without further action.
Tasklist

FS#70415 - setting "set -u" in PKGBUILD causes error messages to fail in errortrap

Attached to Project: Pacman
Opened by James (thx1138) - Sunday, 11 April 2021, 17:43 GMT
Last edited by Allan McRae (Allan) - Sunday, 11 April 2021, 22:10 GMT
Task Type Bug Report
Category makepkg
Status Unconfirmed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version 5.2.2
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

This is an existing issue in pacman 5.2.2, not a regression in "testing" for pacman 5.2.2-3.

In this case, here is evdi-git building a library after a kernel upgrade but before a reboot, and trying to use the now nonexistant /lib/modules/ directory. This can be resolved with a reboot, to build with the correct new /lib/modules/ directory. That's on evdi-git and its PKGBUILD.

But that is not the issue. Instead, the makepkg error which is reported seems pretty useless - or worse - misdirecting. There is:

...
make[2]: *** /lib/modules/5.11.6-arch1-1/build: No such file or directory. Stop.
...
make: *** [Makefile:8: all] Error 2
==> ERROR: A failure occurred in build().
/usr/share/makepkg/util/message.sh: line 51: QUIET: unbound variable
/usr/bin/makepkg: line 132: logpipe: unbound variable
error making: evdi-git

This error message looks like an error in the makepkg script /usr/share/makepkg/util/message.sh. Why is that, when this was a make error?

The bash scripting, with all its nested and indirect references, seems "a little too clever for itself".

Maybe this script can be improved, so that it actually reports the make error, instead of *becoming* the error, and reporting itself.
This task depends upon

Comment by Allan McRae (Allan) - Sunday, 11 April 2021, 22:09 GMT
This is caused by the PKGBUILD setting "set -u" for some reason. When the build fails, this does not get reset by the PKGBUILD. Makepkg's error trap see the build error and proceeds to exit. This misses makepkg's reseting of the environment back to the default, causing this issue.

Minimal replicator attached.
   PKGBUILD (0.1 KiB)

Loading...