FS#69002 - updpkgsums breaks when msg is used in PKGBUILD

Attached to Project: Community Packages
Opened by jozef riha (jose1711) - Wednesday, 16 December 2020, 13:16 GMT
Last edited by Eli Schwartz (eschwartz) - Thursday, 17 December 2020, 13:37 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
updpkgsums corrupts PKGBUILD when `msg` is called in PKGBUILD

Additional info:
* pacman-contrib 1.4.0-1

Steps to reproduce:
```
yay -G realrtcw
cd realrtcw
updpkgsums
makepkg
```

Expected result:
package builds

Actual result:
`PKGBUILD` is corrupted

Workaround:
remove `msg` from PKGBUILD and run `updpkgsums` once more
This task depends upon

Closed by  Eli Schwartz (eschwartz)
Thursday, 17 December 2020, 13:37 GMT
Reason for closing:  Not a bug
Additional comments about closing:  The PKGBUILD is broken, but has been fixed. Nothing to do with updpkgsums.
Comment by Morten Linderud (Foxboron) - Wednesday, 16 December 2020, 13:19 GMT
Internal functions like "msg" shouldn't be used inside PKGBUILDs. I don't think qualifies as a valid bug because of it.
Comment by Doug Newgard (Scimmia) - Wednesday, 16 December 2020, 13:40 GMT
That's true, but this is still weird.
Comment by Eli Schwartz (eschwartz) - Wednesday, 16 December 2020, 14:12 GMT
Note how it uses 'msg' outside of a function. Even sourcing the file will produce random output. This is an extremely serious violation of makepkg's API contract.

I am therefore ruling that not only is this not a bug in updpkgsums (which is trusting to makepkg's API contract), it is not even a PKGBUILD, even if it looks very similar to one.

The AUR package must be fixed, or I will moderate and delete it.
Comment by Eli Schwartz (eschwartz) - Wednesday, 16 December 2020, 14:15 GMT
To be clear, it doesn't matter whether you use makepkg internal functions like msg, or use echo. The printed output itself gets inserted as text into the updated PKGBUILD file (which is not in PKGBUILD format either now or after updpkgsums).
Comment by Eli Schwartz (eschwartz) - Wednesday, 16 December 2020, 14:17 GMT
urlmain=$(curl

Needs to be fixed too. I recommend using DLAGENTS for this. Or ask upstream to support proper redirects...
Comment by jozef riha (jose1711) - Wednesday, 16 December 2020, 14:46 GMT
Maybe this is something that could be intercepted by `git` scripts when pushing the PKGBUILDs to AUR?
Comment by Eli Schwartz (eschwartz) - Wednesday, 16 December 2020, 14:59 GMT
Well, we don't parse PKGBUILDs at all, only the .SRCINFO, but the package maintainer is very obviously editing the .SRCINFO by hand to remove the corruption produced by `msg`. Try running makepkg --printsrcinfo > .SRCINFO and then git diff...
Comment by jozef riha (jose1711) - Thursday, 17 December 2020, 11:56 GMT
Now that the PKGBUILD is fixed I think this can be closed.

Loading...