On Tue, Sep 30, 2025 at 10:43:19AM +0200, Robin Candau wrote:
On 9/30/25 9:28 AM, Óscar García Amor wrote:
Hello folks,
Hey
Let me tell you, I've been maintaining the Telegraf[1] package in AUR for some time now, and whenever I update it (or generate it), I have to do it in a container because it's not possible with the `extra-x86_64- build` command.
If you look at the PKGBUILD, there is a point where the configuration is generated with the newly created binary itself. It is the last line of `build()`, `./build/telegraf config > telegraf.conf`. It is at this point that the execution stops completely if I build the package with `extra-x86_64-build`.
Can you think of any reason why this might happen or how it could be fixed? This step is necessary because there is no other way to generate the base configuration.
For some reason it seems like, despite the "config" argument (which you would expect to solely generate the config), the telegraf binary runs as a daemon and therefore never stops unless you kill it. The `--once` flag, which supposedly should prevent this to happen according to the help message, does not help here.
The above was discussed further downthread, included for context only.
A sketchy workaround is to run `timeout 2s ./build/telegraf config > telegraf.conf || true`
The timeout command will kill the process after 2s (to ensure it doesn't run endlessly) and the `|| true` part will ensure the build doesn't fail due to the error exit code produced by the process being killed by `timeout`. As I said, it's a bit of a sketchy workaround but should allow the build to succeed in a clean chroot.
In similar cases, I've found it useful to do something like: timeout 2s ... || [ "$?" -eq 124 ] ...or whatever code the previous command will exit with in the timeout case. This helps stop the execution of the whole thing if the program exits with a different code - if it encounters a different error, not the timeout. (of course, if this is certain to be Bash, [[ $? -eq 124 ]] is valid too) G'luck, Peter -- Peter Pentchev roam@ringlet.net roam@debian.org peter@morpheusly.com PGP key: https://www.ringlet.net/roam/roam.key.asc Key fingerprint 2EE7 A7A5 17FC 124C F115 C354 651E EFB0 2527 DF13