unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#65792] [PATCH] gnu: rottlog: Add gawk as an input.
@ 2023-09-07  2:01 Skyler via Guix-patches via
  2023-09-07  2:02 ` [bug#65793] " Skyler via Guix-patches via
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Skyler via Guix-patches via @ 2023-09-07  2:01 UTC (permalink / raw)
  To: 65792

[-- Attachment #1: Type: text/plain, Size: 1319 bytes --]

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 #2: Type: text/html, Size: 3185 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#65793] [PATCH] gnu: rottlog: Add gawk as an input.
  2023-09-07  2:01 [bug#65792] [PATCH] gnu: rottlog: Add gawk as an input Skyler via Guix-patches via
@ 2023-09-07  2:02 ` Skyler via Guix-patches via
  2023-09-07 17:16   ` [bug#65793] (No Subject) Skyler via Guix-patches via
  2023-09-07 17:17 ` [bug#65792] " Skyler via Guix-patches via
  2023-09-14 14:54 ` bug#65792: [PATCH] gnu: rottlog: Add gawk as an input Ludovic Courtès
  2 siblings, 1 reply; 5+ messages in thread
From: Skyler via Guix-patches via @ 2023-09-07  2:02 UTC (permalink / raw)
  To: 65793

[-- Attachment #1: Type: text/plain, Size: 3071 bytes --]

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:

> 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 #2: Type: text/html, Size: 5451 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#65793] (No Subject)
  2023-09-07  2:02 ` [bug#65793] " Skyler via Guix-patches via
@ 2023-09-07 17:16   ` Skyler via Guix-patches via
  0 siblings, 0 replies; 5+ messages in thread
From: Skyler via Guix-patches via @ 2023-09-07 17:16 UTC (permalink / raw)
  To: 65793@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 88 bytes --]

Sorry, this was meant to be a reply to bug 65792. I misunderstood how the system worked.

[-- Attachment #2: Type: text/html, Size: 103 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#65792] (No Subject)
  2023-09-07  2:01 [bug#65792] [PATCH] gnu: rottlog: Add gawk as an input Skyler via Guix-patches via
  2023-09-07  2:02 ` [bug#65793] " Skyler via Guix-patches via
@ 2023-09-07 17:17 ` Skyler via Guix-patches via
  2023-09-14 14:54 ` bug#65792: [PATCH] gnu: rottlog: Add gawk as an input Ludovic Courtès
  2 siblings, 0 replies; 5+ messages in thread
From: Skyler via Guix-patches via @ 2023-09-07 17:17 UTC (permalink / raw)
  To: 65792@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 71 bytes --]

Additional context: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65793

[-- Attachment #2: Type: text/html, Size: 216 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#65792: [PATCH] gnu: rottlog: Add gawk as an input.
  2023-09-07  2:01 [bug#65792] [PATCH] gnu: rottlog: Add gawk as an input Skyler via Guix-patches via
  2023-09-07  2:02 ` [bug#65793] " Skyler via Guix-patches via
  2023-09-07 17:17 ` [bug#65792] " Skyler via Guix-patches via
@ 2023-09-14 14:54 ` Ludovic Courtès
  2 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2023-09-14 14:54 UTC (permalink / raw)
  To: Skyler; +Cc: 65792-done

Hi,

Skyler <skyvine@protonmail.com> skribis:

> 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.

Applied, thank you, and thanks for explaining!

Ludo’.




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-09-14 15:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-07  2:01 [bug#65792] [PATCH] gnu: rottlog: Add gawk as an input Skyler via Guix-patches via
2023-09-07  2:02 ` [bug#65793] " Skyler via Guix-patches via
2023-09-07 17:16   ` [bug#65793] (No Subject) Skyler via Guix-patches via
2023-09-07 17:17 ` [bug#65792] " Skyler via Guix-patches via
2023-09-14 14:54 ` bug#65792: [PATCH] gnu: rottlog: Add gawk as an input Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).