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#34974 - [pacman] makepkg substitutes error message if pkgver() fails, causing subsequent builds to fail

Attached to Project: Pacman
Opened by Alain Kalker (ackalker) - Friday, 26 April 2013, 16:33 GMT
Last edited by Allan McRae (Allan) - Tuesday, 30 April 2013, 11:38 GMT
Task Type Bug Report
Category General
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version 4.1.0
Due in Version 4.1.1
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

When pkgver() produces an error, makepkg substitutes the error message in place of the previous version. This causes any future builds (even after fixing pkgver() ) to fail unless the pkgver= is cleaned up manually to remove the trailing garbage left by previous failing attempts.

Additional info:
* package version(s)
* config and/or log files etc.


Steps to reproduce:
- Try to build an SVN package from AUR using a faulty pkgver()
- Fix the pkgver()
- Try to build the package again.

In a -git package I'm testing, this resulted in the following in PKGBUILD, after two failed attempts, then a fix:
pkgver=0.0 No names found, cannot describe anything. No names found, cannot describe anything.
This task depends upon

Closed by  Allan McRae (Allan)
Tuesday, 30 April 2013, 11:38 GMT
Reason for closing:  Fixed
Additional comments about closing:  git commit c5a4b355
Comment by Alain Kalker (ackalker) - Friday, 26 April 2013, 16:40 GMT
I think that:

/usr/bin/makepkg:790:sed --follow-symlinks -i "s/^pkgver=[^ ]*/pkgver=$newpkgver/" "$BUILDFILE"

should be something like:

/usr/bin/makepkg:790:sed --follow-symlinks -i "s/^pkgver=[^#]*/pkgver=$newpkgver/" "$BUILDFILE"

in order to remove any error message while preserving any comment after the package version. (I'm not aware of any VCS producing error messages with '#'s in them.)
Comment by Dave Reisner (falconindy) - Friday, 26 April 2013, 16:45 GMT
> In a -git package I'm testing, this resulted in the following in PKGBUILD, after two failed attempts, then a fix:
Would be nice to actually see the PKGBUILD... the error message you cite is written to stderr, not stdout. makepkg does not capture stderr from pkgver().
Comment by Alain Kalker (ackalker) - Friday, 26 April 2013, 23:40 GMT
Here's a minimal test PKGBUILD which pulls from a test Git repository I've set up.
The pkgver() contains two commands as they occur "in the wild" in the AUR. The first one fails for this Git repo, as it has no tags at all, whether annotated or not.
I've left my (slightly modified from the Wiki) 'working' command commented out, so you can try them both.
The complete log I get from trying to build using this PKGBUILD is:

$ makepkg
==> Making package: testpkg-git 0-1 (Sat Apr 27 01:32:51 CEST 2013)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Cloning testpkg git repo...
Cloning into bare repository '/home/miki/pkg/export/testpkg'...
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 5 (delta 0), reused 5 (delta 0)
Receiving objects: 100% (5/5), done.
==> Validating source files with md5sums...
testpkg ... Skipped
==> Extracting sources...
-> Creating working copy of testpkg git repo...
Cloning into 'testpkg'...
done.
==> Starting pkgver()...
/home/miki/pkg/wip/testpkg-git/PKGBUILD: line 3: No: command not found
==> Updated version: testpkg-git 0-1
==> ERROR: pkgver is not allowed to contain colons, hyphens or whitespace.

and the PKGBUILD on disk is changed as I've explained in the original report.
   PKGBUILD (0.6 KiB)
Comment by Alain Kalker (ackalker) - Friday, 26 April 2013, 23:50 GMT
I see I forgot to add:
Additional info:
* package version(s)
pacman 4.1.0-2

to the original report. Sorry for that :)
Comment by Dave Reisner (falconindy) - Friday, 26 April 2013, 23:56 GMT
Seems the problem is https://projects.archlinux.org/pacman.git/tree/scripts/makepkg.sh.in#n1454 -- i'm not sure why this is done...
Comment by Alain Kalker (ackalker) - Saturday, 27 April 2013, 00:05 GMT
pkgver() standard error does get redirected. See:
/usr/bin/makepkg:1454: $pkgfunc 2>&1
Comment by Alain Kalker (ackalker) - Saturday, 27 April 2013, 00:06 GMT
Yep, our replies crossed :-)
Comment by Alain Kalker (ackalker) - Saturday, 27 April 2013, 00:13 GMT
I've done `git gui blame makepkg.sh.in` all the way down, can't find any reason for the redirect. Ask Allan ;)

Loading...