[PATCH] gnu: rottlog: Fix mail reporting.

  • Done
  • quality assurance status badge
Details
4 participants
  • dftxbs3e
  • Efraim Flashner
  • Leo Le Bouter
  • Ludovic Courtès
Owner
unassigned
Submitted by
dftxbs3e
Severity
normal
D
D
dftxbs3e wrote on 10 Dec 2020 04:41
(address . guix-patches@gnu.org)
2691c330f7615c298baeb859c35f489f0de30467.camel@free.fr
Hello!

I was getting errors like this in my GNU Guix System installation:

# cat /var/log/mcron.log
/gnu/store/8q2i735qhdivn5pn87b6ay7z16xnf6py-rottlog-
0.72.2/sbin/rottlog: line 1596: sendmail: command not found
/gnu/store/8q2i735qhdivn5pn87b6ay7z16xnf6py-rottlog-
0.72.2/sbin/rottlog: line 1596: sendmail: command not found
/gnu/store/8q2i735qhdivn5pn87b6ay7z16xnf6py-rottlog-
0.72.2/sbin/rottlog: line 1596: sendmail: command not found
/gnu/store/8q2i735qhdivn5pn87b6ay7z16xnf6py-rottlog-
0.72.2/sbin/rottlog: line 1596: sendmail: command not found
/gnu/store/8q2i735qhdivn5pn87b6ay7z16xnf6py-rottlog-
0.72.2/sbin/rottlog: line 1596: sendmail: command not found

I am guessing this means sendmail needs to be added as propagated-
inputs to ensure it is available to rottlog at runtime.

Attached patch with these changes!

Thank you!
From 6aab4645706f9fe285c253142efe4e9fd40f2c3a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?L=C3=A9o=20Le=20Bouter?= <lle-bout@zaclys.net>
Date: Thu, 10 Dec 2020 04:35:38 +0100
Subject: [PATCH] gnu: rottlog: Fix mail reporting.

* gnu/packages/admin.scm (rottlog):
[propagated-inputs]: Add sendmail.
---
gnu/packages/admin.scm | 1 +
1 file changed, 1 insertion(+)

Toggle diff (14 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 9df14b5ca0..5c22d40d1d 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -1385,6 +1385,7 @@ at once based on a Perl regular expression.")
("automake" ,automake)
("util-linux" ,util-linux))) ; for 'cal'
(inputs `(("coreutils*" ,coreutils)))
+ (propagated-inputs `(("sendmail" ,sendmail)))
(home-page "https://www.gnu.org/software/rottlog/")
(synopsis "Log rotation and management")
(description
--
2.29.2
L
L
Ludovic Courtès wrote on 11 Dec 2020 18:57
(name . dftxbs3e)(address . dftxbs3e@free.fr)(address . 45153@debbugs.gnu.org)
87r1nw444n.fsf@gnu.org
Hi,

dftxbs3e <dftxbs3e@free.fr> skribis:

Toggle quote (21 lines)
> From 6aab4645706f9fe285c253142efe4e9fd40f2c3a Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?L=C3=A9o=20Le=20Bouter?= <lle-bout@zaclys.net>
> Date: Thu, 10 Dec 2020 04:35:38 +0100
> Subject: [PATCH] gnu: rottlog: Fix mail reporting.
>
> * gnu/packages/admin.scm (rottlog):
> [propagated-inputs]: Add sendmail.
> ---
> gnu/packages/admin.scm | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
> index 9df14b5ca0..5c22d40d1d 100644
> --- a/gnu/packages/admin.scm
> +++ b/gnu/packages/admin.scm
> @@ -1385,6 +1385,7 @@ at once based on a Perl regular expression.")
> ("automake" ,automake)
> ("util-linux" ,util-linux))) ; for 'cal'
> (inputs `(("coreutils*" ,coreutils)))
> + (propagated-inputs `(("sendmail" ,sendmail)))

A better approach would be to avoid the propagated inputs and instead
replace the reference to ‘mail’ (or ‘sendmail’?) in the code by a
reference to its absolute file name (if it’s ‘mail’, I’d suggest picking
the ‘mail’ command from Inetutils.)

Thanks,
Ludo’.
J
J
John Doe wrote on 12 Dec 2020 09:46
[PATCH v2] gnu: rottlog: Fix mail reporting.
(address . 45153@debbugs.gnu.org)(name . Léo Le Bouter)(address . lle-bout@zaclys.net)
20201212084639.29377-1-dftxbs3e@free.fr
From: Léo Le Bouter <lle-bout@zaclys.net>

* gnu/packages/admin.scm (rottlog):
[inputs]: Add sendmail.
[phases]: Modify 'patch-paths to substitute sendmail command with
/gnu/store item.
---
gnu/packages/admin.scm | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

Toggle diff (38 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 9df14b5ca0..9394545003 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -107,6 +107,7 @@
#:use-module (gnu packages libusb)
#:use-module (gnu packages linux)
#:use-module (gnu packages lua)
+ #:use-module (gnu packages mail)
#:use-module (gnu packages man)
#:use-module (gnu packages mcrypt)
#:use-module (gnu packages mpi)
@@ -1343,9 +1344,11 @@ at once based on a Perl regular expression.")
#:phases (modify-phases %standard-phases
(add-after 'unpack 'patch-paths
- (lambda _
+ (lambda* (#:key inputs #:allow-other-keys)
(substitute* "rc/rc"
- (("/usr/sbin/sendmail") "sendmail"))
+ (("/usr/sbin/sendmail")
+ (string-append (assoc-ref inputs "sendmail")
+ "/usr/sbin/sendmail")))
#t))
(add-after 'unpack 'fix-configure
(lambda* (#:key inputs native-inputs #:allow-other-keys)
@@ -1384,7 +1387,8 @@ at once based on a Perl regular expression.")
(native-inputs `(("texinfo" ,texinfo)
("automake" ,automake)
("util-linux" ,util-linux))) ; for 'cal'
- (inputs `(("coreutils*" ,coreutils)))
+ (inputs `(("coreutils*" ,coreutils)
+ ("sendmail" ,sendmail)))
(home-page "https://www.gnu.org/software/rottlog/")
(synopsis "Log rotation and management")
(description
--
2.29.2
E
E
Efraim Flashner wrote on 12 Dec 2020 21:25
(name . John Doe)(address . dftxbs3e@free.fr)
X9UnPioF+T24z3/v@E5400
If there's no mail server setup on the Guix System machine where does
the mail go?

On Sat, Dec 12, 2020 at 09:46:39AM +0100, John Doe wrote:
Toggle quote (53 lines)
> From: Léo Le Bouter <lle-bout@zaclys.net>
>
> * gnu/packages/admin.scm (rottlog):
> [inputs]: Add sendmail.
> [phases]: Modify 'patch-paths to substitute sendmail command with
> /gnu/store item.
> ---
> gnu/packages/admin.scm | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
> index 9df14b5ca0..9394545003 100644
> --- a/gnu/packages/admin.scm
> +++ b/gnu/packages/admin.scm
> @@ -107,6 +107,7 @@
> #:use-module (gnu packages libusb)
> #:use-module (gnu packages linux)
> #:use-module (gnu packages lua)
> + #:use-module (gnu packages mail)
> #:use-module (gnu packages man)
> #:use-module (gnu packages mcrypt)
> #:use-module (gnu packages mpi)
> @@ -1343,9 +1344,11 @@ at once based on a Perl regular expression.")
>
> #:phases (modify-phases %standard-phases
> (add-after 'unpack 'patch-paths
> - (lambda _
> + (lambda* (#:key inputs #:allow-other-keys)
> (substitute* "rc/rc"
> - (("/usr/sbin/sendmail") "sendmail"))
> + (("/usr/sbin/sendmail")
> + (string-append (assoc-ref inputs "sendmail")
> + "/usr/sbin/sendmail")))
> #t))
> (add-after 'unpack 'fix-configure
> (lambda* (#:key inputs native-inputs #:allow-other-keys)
> @@ -1384,7 +1387,8 @@ at once based on a Perl regular expression.")
> (native-inputs `(("texinfo" ,texinfo)
> ("automake" ,automake)
> ("util-linux" ,util-linux))) ; for 'cal'
> - (inputs `(("coreutils*" ,coreutils)))
> + (inputs `(("coreutils*" ,coreutils)
> + ("sendmail" ,sendmail)))
> (home-page "https://www.gnu.org/software/rottlog/")
> (synopsis "Log rotation and management")
> (description
> --
> 2.29.2
>
>
>
>

--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl/VJz4ACgkQQarn3Mo9
g1HCzhAAlgtuu1KlcLXJiCmF2LnU/rem/L80srEvyObvpu9KBMWEQORnJP945Vkb
8cr6nZq5AvRlPYeJ+q+SrAF51b4x+ukB8THeOcq+4WjnsSxAhGPX4kIQGi0OlVdW
e/UIpFga2QK9jOVIU5gnGVX1eN7OcfI4zM/yi+uy1HNbWY47438riPNaLRpzy16c
UVYTv61QrfoO8u7QOsmk+Mme8xG3oTxbXCJ59sqKAAw2xqZ5OpY/9YCCQitP1GZ9
tUBRG0zZRUProdCxocpt7xPwSTqXZbfvCNSgt3Wn5PqO6DWUOObacLdkjnBFFK3t
rbXkP5eaBYLxhNm9SnhqRp9X8FxnQHXUi35qwSzprMKpRINHopEnZATdvZBOn6xS
S263KfRjlI/rbUXKvBtRxeDd+i22//wbDvyhmmvO1+n7VgAeDdoA1g9PIz0vqFDK
PVuqe6MbYWFKKINjE0L/CmViVZKo6yKgqDEGTw4PVsYWoINHw+EbZ/7l8HiFqwXH
2Ww7WXkQzsng0maXD8iU4yn0LdCn5lpJfyLyo5CAgLphL4pmqPnFkQXvDZ3mp5Hd
rXM9crRl+vqoXfBtgmaWhGwXKVAm0byqVQKDW4fLgKQeMpHFifVQmcpa+PNvAeLD
/YRRwKShcvaEJGqyhGd8TgK8/rXdq29EKDfaE4GlV1C7SH8ApUA=
=O6vt
-----END PGP SIGNATURE-----


D
D
dftxbs3e wrote on 12 Dec 2020 21:49
(address . 45153@debbugs.gnu.org)
08f072066189b6e55b4b38fa2cee860ae6dadfbf.camel@free.fr
On Sat, 2020-12-12 at 22:25 +0200, Efraim Flashner wrote:
Toggle quote (3 lines)
> If there's no mail server setup on the Guix System machine where does
> the mail go?

Not sure, I don't know how rottlog works and what parameters it gives
to sendmail. Can emails be sent without a mail server? Like when they
are sent to a UNIX account for example? That's what I would guess it
does, write mail to /var/mail/root or something.

Actually fixing mail reporting might need additional patching, I
focused on fixing the issue I met and had logs of.
L
L
Ludovic Courtès wrote on 23 Dec 2020 16:02
(name . John Doe)(address . dftxbs3e@free.fr)
87sg7wwoo4.fsf@gnu.org
Hi!

John Doe <dftxbs3e@free.fr> skribis:

Toggle quote (7 lines)
> From: Léo Le Bouter <lle-bout@zaclys.net>
>
> * gnu/packages/admin.scm (rottlog):
> [inputs]: Add sendmail.
> [phases]: Modify 'patch-paths to substitute sendmail command with
> /gnu/store item.

[...]

Toggle quote (4 lines)
> + (("/usr/sbin/sendmail")
> + (string-append (assoc-ref inputs "sendmail")
> + "/usr/sbin/sendmail")))

I thought this was a typo and then realized that our ‘sendmail’ package
is this broken, due to an incorrect use of ‘DESTDIR’.

The patch below is an attempt to fix that but some of the files are
silently not getting installed. Anyone has ideas here?

Anyhow, can we instead use ‘mail’ from ‘mailutils’ instead? (I
wrongfully mentioned Inetutils earlier, sorry for the confusion.)

Thanks,
Ludo’.
Toggle diff (62 lines)
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index f85713433e..1f06450e6a 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -2759,23 +2759,39 @@ powerful user customization features.")
(("SHELL=/bin/sh") (string-append "SHELL=" (which "sh"))))
#t))
(replace 'configure
- (lambda _
+ (lambda* (#:key outputs #:allow-other-keys)
;; Render harmless any attempts to chown or chgrp
(substitute* "devtools/bin/install.sh"
(("owner=\\$2") "owner=''")
(("group=\\$2") "group=''"))
- (with-output-to-file "devtools/Site/site.config.m4"
- (lambda ()
- (format #t "
+ (let ((out (assoc-ref outputs "out")))
+ (with-output-to-file "devtools/Site/site.config.m4"
+ (lambda ()
+ ;; See 'devtools/M4/UNIX/defines.m4' for the list of
+ ;; installation directories.
+ (format #t "
define(`confCC', `gcc')
define(`confOPTIMIZE', `-g -O2')
define(`confLIBS', `-lresolv')
define(`confINSTALL', `~a/devtools/bin/install.sh')
define(`confDEPEND_TYPE', `CC-M')
define(`confINST_DEP', `')
-" (getcwd))))
+
+define(`confMBINDIR', `~a/bin')
+define(`confUBINDIR', `~a/bin')
+define(`confSBINDIR', `~a/sbin')
+define(`confEBINDIR', `~a/libexec')
+define(`confMANROOT', `~a/share/man')~%"
+ (getcwd)
+ out out out out out))))
+
+ (substitute* "cf/cf/Makefile"
+ (("^MAILDIR=.*")
+ (string-append "MAILDIR = "
+ (assoc-ref outputs "out")
+ "/etc/mail\n")))
#t))
(replace 'build
(lambda _
@@ -2787,10 +2803,9 @@ define(`confINST_DEP', `')
(add-before 'install 'pre-install
(lambda _
(let ((out (assoc-ref %outputs "out")))
- (mkdir-p (string-append out "/usr/bin"))
- (mkdir-p (string-append out "/usr/sbin"))
+ (mkdir-p (string-append out "/bin"))
+ (mkdir-p (string-append out "/sbin"))
(mkdir-p (string-append out "/etc/mail"))
- (setenv "DESTDIR" out)
(with-directory-excursion "cf/cf"
(invoke "sh" "Build" "install-cf"))
#t))))
L
L
Leo Le Bouter wrote on 23 Dec 2020 16:19
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 45153@debbugs.gnu.org)
709c31cd9a6df5372cffb6fec9c8117d269e4c0a.camel@zaclys.net
On Wed, 2020-12-23 at 16:02 +0100, Ludovic Courtès wrote:
Toggle quote (2 lines)
> Hi!

Hello!

Toggle quote (4 lines)
> I thought this was a typo and then realized that our ‘sendmail’
> package
> is this broken, due to an incorrect use of ‘DESTDIR’.

Ah! Well I did not notice that as something wrong outright but now that
you say that yes I see the correct behavior :-)

Toggle quote (3 lines)
> The patch below is an attempt to fix that but some of the files are
> silently not getting installed. Anyone has ideas here?

Will take a look!

Toggle quote (3 lines)
> Anyhow, can we instead use ‘mail’ from ‘mailutils’ instead? (I
> wrongfully mentioned Inetutils earlier, sorry for the confusion.)

Is it going to be compatible? If so then I'll do it!

Toggle quote (3 lines)
> Thanks,
> Ludo’.

Thank *you*! :-)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEFIvLi9gL+xax3g6RRaix6GvNEKYFAl/jX/4ACgkQRaix6GvN
EKbSVw/8DLzF7BskMavWaNo5Fo50pv4SjqbOLove+zrLCYTV+/HjMp2fedLxCv90
CUc2QY2SvE/qfKnokRTlXXrbfIYcoFl+iNaV0uUoUEyDoVEOWCH104O4pAdTK/Kg
VKruQ24idTwPY/8O3o5ZcdWz306vG0Ssd636s8yiHQiKyK+h1sBPh2F0BZ815pHR
Y2OPvjCTTyIGMWX3DUdyl6UImaKJmBJrInMd6jT2KFCXOu68+enBnA0YMkWWnhbV
cbbauhpGo36W9mfDrqLKugOQAkvjDNW//QfEVbMdxX6VJhLVS6hitTXMjBQ6h7+E
2JP2pcBw72YvE2LDFvQz7YKW76MgTlL0Q2vw+nfONRDmhZB3Bs8g4O3VZIzC/CGk
GjjLO51h2WfTxLHbj6xqIonyCvxUgraotZ4J2pQvRxPx1O9apT16dN7IMnJ0aO79
q4KOYSH9WyumnYpCANlbs6ldRQDOQ1WzKn7pTvoyc8Bt/YLZUFj1SxOjPE6FYrFw
Ecq+Dk0r1AqBqWpytkSxY/Gq3fVZxMYuEgiuWRBq3gRWDkB0Faj3kCnM2O1sLapt
hvvr5pUCI6l7sUhJJ1lpTrq2Vyu4+xYIV/3nNuqex5TNAMEzBgO/iFmZzVvjy7QM
IDO+T7HWa/tKfRDGu2+U8iOQzstktjh/Tll/NZRvt3OWhcM6H3U=
=q7lG
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 27 Dec 2020 16:07
(name . Leo Le Bouter)(address . lle-bout@zaclys.net)(address . 45153-done@debbugs.gnu.org)
87ft3rthh5.fsf@gnu.org
Hi,

Leo Le Bouter <lle-bout@zaclys.net> skribis:

Toggle quote (12 lines)
>> I thought this was a typo and then realized that our ‘sendmail’
>> package
>> is this broken, due to an incorrect use of ‘DESTDIR’.
>
> Ah! Well I did not notice that as something wrong outright but now that
> you say that yes I see the correct behavior :-)
>
>> The patch below is an attempt to fix that but some of the files are
>> silently not getting installed. Anyone has ideas here?
>
> Will take a look!

Great.

Toggle quote (5 lines)
>> Anyhow, can we instead use ‘mail’ from ‘mailutils’ instead? (I
>> wrongfully mentioned Inetutils earlier, sorry for the confusion.)
>
> Is it going to be compatible? If so then I'll do it!

Yes, I think so, again provided there’s a mail setup on the machine.

I went ahead and made this change since it was a minor change compared
to the patch you had sent earlier.

Thanks!

Ludo’.
Closed
?