[PATCH] gnu: rottlog: Add gawk as an input.

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Skyler
Owner
unassigned
Submitted by
Skyler
Severity
normal
Merged with
S
S
Skyler wrote on 7 Sep 2023 04:02
(name . guix-patches@gnu.org)(address . guix-patches@gnu.org)
ONIrBKQLs3mwJkMh2Qg8nJufvqrZQ6aItRANmNuxJhJTZ_kYCd_xSzsFvEoLtmyR0TDteGBDweyLppUyYhCHilDuAzRqKx6EbVqsQPky87o=@protonmail.com
Hello,

Just to provide some context beyond what was appropriate to include in the commit message, I've been experiencing an issue where rottlog deletes the /tmp directory every time it runs at noon. I speculate that it is due to these lines:

```
0025 BASE_TMP_DIR="/tmp"
....
1638 local tmpd=${BASE_TMP_DIR}/`awk 'BEGIN { srand(); for (i=1;i<21;i++) { a=95; while (a > 90 && a < 97) { a=65+int(50*rand())}; printf("%c", a) } }'`
1639 [ -e "$tmpd" ] && rm -rf "$tmpd"
```

If awk is not available, then the backtick substitution will be empty. There should be an error message printed to stderr, but this will not be captured by the backticks. So the expression on line 1638 will resolve to just /tmp, and then 1639 will delete the directory.

I have not actually seen the error messages in logs or similar, I just updated the package definition and the problem stopped happening. When I reverted the change, the problem started occurring again. I tested it by changing my /root/.config/guix/channels.scm to reference a local mirror of guix (with the patch added), pulling, and reconfiguring. I adding gawk to the inputs without updating the patch-paths phase, but this did not resolve the issue.

There are some other places where rottlog uses command substitution, which includes coreutils commands, grep, and at least one command from util-linux-with-udev. Some of them are included in inputs, but none of them are in the patch-paths phase. If this patch is fine, I can submit ones for the other packages within the next couple of weeks.

Thanks,
Skyler
------- Original Message -------
On Wednesday, September 6th, 2023 at 7:01 PM, Skyler <skyvine@protonmail.com> wrote:

Toggle quote (39 lines)
> This avoids an issue where rottlog will delete the entire /tmp directory
> if gawk is not installed.
>
> * gnu/packages/admin.scm (rottlog): Add gawk input, also update the
> patch-paths build phase for awk invocations.
> ---
> gnu/packages/admin.scm | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
> index 604cd70c02..ea437e9f26 100644
> --- a/gnu/packages/admin.scm
> +++ b/gnu/packages/admin.scm
> @@ -1931,7 +1931,11 @@ (define-public rottlog
> (lambda* (#:key inputs #:allow-other-keys)
> (substitute* "rc/rc"
> (("/usr/sbin/sendmail")
> - (search-input-file inputs "/bin/mail")))))
> + (search-input-file inputs "/bin/mail")))
> + (with-fluids ((%default-port-encoding "ISO-8859-1"))
> + (substitute* "src/rottlog"
> + (("awk")
> + (search-input-file inputs "/bin/awk"))))))
> (add-after 'build 'set-packdir
> (lambda _
> ;; Set a default location for archived logs.
> @@ -1950,7 +1954,7 @@ (define-public rottlog
> (lambda _
> (invoke "make" "install-info"))))))
> (native-inputs (list autoconf automake texinfo util-linux)) ; for 'cal'
> - (inputs (list coreutils mailutils))
> + (inputs (list coreutils gawk mailutils))
> (home-page "https://www.gnu.org/software/rottlog/")
> (synopsis "Log rotation and management")
> (description
>
> base-commit: e365c26a34fa485f9af46538fcea128db681c33d
> --
> 2.41.0
Attachment: file
S
S
Skyler wrote on 7 Sep 2023 19:16
(No Subject)
(name . 65793@debbugs.gnu.org)(address . 65793@debbugs.gnu.org)
-sER1UM1As_nZSnT2HO3bDEK6XjM5NN62bBw31dCesqp869qNZOEoOFhg7__MI1X9MfObrdPmR6DfbQkujSBmHTYFimV7Qt8t5Ijb5Ap9C0=@protonmail.com
Sorry, this was meant to be a reply to bug 65792. I misunderstood how the system worked.
Attachment: file
L
L
Ludovic Courtès wrote on 14 Sep 2023 16:48
control message for bug #65792
(address . control@debbugs.gnu.org)
87h6nwajzl.fsf@gnu.org
merge 65792 65793
quit
?
Your comment

This issue is archived.

To comment on this conversation send an email to 65793@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 65793
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch