FS#19932 - Makepkg uses a wrong pattern match in write_pkginfo()
Attached to Project:
Pacman
Opened by Neal van Veen (Nvveen) - Wednesday, 23 June 2010, 20:37 GMT
Last edited by Allan McRae (Allan) - Thursday, 01 July 2010, 05:59 GMT
Opened by Neal van Veen (Nvveen) - Wednesday, 23 June 2010, 20:37 GMT
Last edited by Allan McRae (Allan) - Thursday, 01 July 2010, 05:59 GMT
|
Details
Summary and Info:
With pacman < 3.4.0 the command to get the disk usage by a pkg is obtained via awk, which (to my understanding), works. With 3.4.0 this has been replaced by a regex pattern match, which doesn't work and gives the following error: /usr/bin/makepkg: line 902: * 1024 : syntax error: operand expected (error token is "* 1024 ") whenever makepkg is invoked. Reverting back to 3.3.3 or splitting up the command removes the error, although it is not clear if it fixes the issue. Steps to Reproduce: Update Pacman to 3.4.0. Run a makepkg script Confirmed architecture: x86_64, 1 day older than Pacman version 3.4.0, Asus Turion64 dualcore laptop. |
This task depends upon
Closed by Allan McRae (Allan)
Thursday, 01 July 2010, 05:59 GMT
Reason for closing: Fixed
Additional comments about closing: git commit: http://projects.archlinux.org/pacman.git /commit/?h=maint&id=0ea52e3a
Thursday, 01 July 2010, 05:59 GMT
Reason for closing: Fixed
Additional comments about closing: git commit: http://projects.archlinux.org/pacman.git /commit/?h=maint&id=0ea52e3a
@@ -882,7 +884,8 @@ write_pkginfo() {
else
local packager="Unknown Packager"
fi
- local size=$(du -sk | awk '{print $1 * 1024}')
+ local size="$(du -sk)"
+ size="$(( ${size%%[^0-9]*} * 1024 ))"
msg2 "$(gettext "Generating .PKGINFO file...")"
echo "# Generated by makepkg $myver" >.PKGINFO
This is the relevant change; I wonder if there are spaces to the left of the numbers causing the issues as that was tightened up a bit.
If you run `echo $(du -sk)` in some small-ish directory, what is the output?
cw isn't the only utility that needs to add to PATH.
makepkg sources /etc/profile which is site dependant. It's like sourcing a file in /usr/local.
makepkg should either use explicit paths or be strict and set PATH in-line, sourcing /etc/profile in a subshell.
With cw, makepkg was making .PKGINFO with 'size = 0':
$ du -sk | awk '{print $1 * 1000}'
0
$ /bin/du -sk | awk '{print $1 * 1000}'
5904000
Apparently the cw wrapper isn't smart enough to know when stdout isn't a terminal:
$ du -sk | cat -A
^[[00;37m^[[01;37m5904^[[00;37m^I.^[[0m$
Anyway... to provide the full path to the coreutils du, we need some autoconf type stuff (it is at /bin/du in Arch but /usr/bin/du in many places). Does someone want to attempt that?