Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#43502 - Usage of undocumented subroutines in PKGBUILDs

Attached to Project: Arch Linux
Opened by Max (silverhammermba) - Monday, 19 January 2015, 03:36 GMT
Last edited by David Runge (dvzrv) - Friday, 17 January 2020, 12:44 GMT
Task Type General Gripe
Category Packages: Core
Status Closed
Assigned To No-one
Architecture All
Severity Very Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 5
Private No


Many PKGBUILDs show packaging progress by using message subroutines defined by makepkg e.g. msg, msg2, warning. These subroutines are undocumented and - according to at least one [[|wiki editor]] - are only intended for internal use by makepkg. Quite a lot of community PKGBUILDs use these subroutines and even a few core and extra ones do too. As I see it, either these message subroutines should be well-documented and encouraged or they should be patched out of official PKGBUILDs.

To find all PKGBUILDs that use them, run:

grep -Rl '^\s\+\(msg\|msg2\|warning\|error\|plain\) ' /var/abs/*/*/PKGBUILD
This task depends upon

Closed by  David Runge (dvzrv)
Friday, 17 January 2020, 12:44 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed in Packaging Guidelines and a TODO.
Comment by Allan McRae (Allan) - Monday, 19 January 2015, 04:07 GMT
I vote for removing them.
Comment by Earnestly (Earnest) - Wednesday, 21 January 2015, 10:20 GMT
Either that are make them part of the PKGBUILD API, however, I like that the build and package environments represent isolated steps and shouldn't contain makepkg related output.
Comment by Jakub Klinkovský (lahwaacz) - Wednesday, 21 January 2015, 17:04 GMT
E.g. grub [1] and refind-efi [2] (ab)use msg instead of comments, I fail to see how this is relevant in the console output.

What should be done next, create a bug report per package?

Comment by Max (silverhammermba) - Wednesday, 21 January 2015, 17:33 GMT
It might be nice to add deprecation warnings to the subroutines in the meantime. That would help raise awareness in the AUR, where their usage is the most common.
Comment by Kyle Keen (keenerd) - Monday, 13 March 2017, 03:36 GMT
Added a warning to namcap.
Comment by Fredy García (frealgagu) - Tuesday, 07 August 2018, 17:57 GMT
What do you recommend for printing messages in aur packages instead? I was using msg2 method a lot in my packages. How should I print them?
Thanks in advance.
Comment by Eli Schwartz (eschwartz) - Tuesday, 07 August 2018, 18:00 GMT
Well, the better question is why do you think you need to print anything at all?
Comment by Daniel M. Capella (polyzen) - Tuesday, 07 August 2018, 18:03 GMT
Use `echo` if you need it, but odds are you don't need to print anything.
Comment by Earnestly (Earnest) - Tuesday, 07 August 2018, 18:04 GMT
Let the tools speak for themselves.

If you *absolutely* need markers to delineate regions of output, then just use printf (or echo) as you usually would in any other script.
Comment by Daniel M. Capella (polyzen) - Tuesday, 07 August 2018, 18:10 GMT
If you need to get a message across to the user, you may want to consider `.install` scripts:
Comment by Jake Kreiger (Magali75) - Sunday, 06 January 2019, 14:01 GMT
Printing messages makes it easier to find at which point something failed especially for a large PKGBUILDS like kernels. Also msg2 looks prettier than simple echo. If you want to stop people from using it you should make it looks ugly :)
Comment by Andreas Radke (AndyRTR) - Tuesday, 10 December 2019, 09:31 GMT
It should be documented there if we either allow msg or prefer usage of echo:

Then someone please create a todo list to clean related PKGBUILDs.
Comment by David Runge (dvzrv) - Friday, 17 January 2020, 12:43 GMT