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.
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.
FS#7803 - makepkg logging function limits use of bash functionality
Attached to Project:
Pacman
Opened by Tobias Kieslich (tobias) - Sunday, 12 August 2007, 20:50 GMT
Last edited by Dan McGee (toofishes) - Sunday, 17 February 2008, 19:55 GMT
Opened by Tobias Kieslich (tobias) - Sunday, 12 August 2007, 20:50 GMT
Last edited by Dan McGee (toofishes) - Sunday, 17 February 2008, 19:55 GMT
|
DetailsSummary and Info:
If you wanna test return values by evaluating $? in bash, makepkg --log stops executing because it evaluates that before a PKGBUILD function can catch it. Steps to Reproduce: the old vi fetch_runtime.sh used the following construction: echo "${_md5} ${_file}" | md5sum -c - >/dev/null 2>&1 # MD5 fails ? ... we don't have the file if [ ${?} -ne 0 ]; then rm ${_file} else _havefile=1 fi and which fails. It had to be rewritten to: # MD5 fails ? ... we don't have the file if [ $(echo "${_md5} ${_file}" | md5sum --status -c -) ]; then rm ${_file} else _havefile=1 fi It worked in this case, but there might be vases when a return value can be more than 0 or 1 and this can't be easily used at all. |
This task depends upon
Closed by Dan McGee (toofishes)
Sunday, 17 February 2008, 19:55 GMT
Reason for closing: Fixed
Additional comments about closing: Fixed WAY back when in commit 58fe79eef64fb87b2553e6514a47beaa6d0249c1
Sunday, 17 February 2008, 19:55 GMT
Reason for closing: Fixed
Additional comments about closing: Fixed WAY back when in commit 58fe79eef64fb87b2553e6514a47beaa6d0249c1
I could see two things to check up on:
the $? check
the ">/dev/null 2>&1" redirection
The second makes more sense, as I could see it somehow redirecting the rest of the output.... not really sure though.
if [ "$LOGGING" = "1" ]; then
BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log"
if [ -f "$BUILDLOG" ]; then
i=1
while true; do
if [ -f "$BUILDLOG.$i" ]; then
i=$(($i +1))
else
break
fi
done
mv "$BUILDLOG" "$BUILDLOG.$i"
fi
#use 'errexit' to bail on syntax error
[ $set_e -eq 1 ] && set -e
build 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]}
[ $set_e -eq 1 ] && set +e
else
#use 'errexit' to bail on syntax error
[ $set_e -eq 1 ] && set -e
build 2>&1 || ret=$?
[ $set_e -eq 1 ] && set +e
fi
if [ $ret -gt 0 ]; then
error "Build Failed. Aborting..."
removedeps
exit 2
fi
When using `makepkg -L` it didn't stop on build failures. You need to either do..
if CMD; then
....
or
ret=0
CMD | ret=$?
if [ $ret = 0 ] ; then
....
http://projects.archlinux.org/git/?p=pacman.git;a=commit;h=58fe79eef64fb87b2553e6514a47beaa6d0249c1