Subject: [bug#47435] gnu: mail: Make the sendmail package actually output its binary

From: Léo Le Bouter <[email-masked]>
Date: Tue, 30 Mar 2021 04:05:10 +0200

On Mon, 2021-03-29 at 16:24 +0200, Rovanion Luckey wrote:
> Attached to this email you will find three patches that
> 1. make the sendmail binary appear in PATH after the sendmail package
> is
> installed,
> 2. add libmilter to the package collection and
> 3. updates sendmail and libmilter to 8.16.1.
> 
> I ended up putting smrsh back in libexec because that is where all
> the
> other distros put it and seems like a program that should only be
> used by
> sendmail itself.

Thank you for the patches!

> +    (synopsis "Sendmail library for creating mail filters.")))
> +

On the commit message, the convention is that all titles end with a
period, also all statements in the subtext also end with a period, and
that the subtext is wrapped to 80 columns (unless links). Look at other
commit messages for examples.

It seems in your latest patches applied on top of master, the
'sendmail' package does not build:

starting phase `pre-install'
Using M4=/gnu/store/jlm51s1gz6pah5bn7mc1i12kj5xilhck-m4-1.4.18/bin/m4
../../devtools/bin/install.sh -c -o root -g bin -m 0444 sendmail.cf
/gnu/store/6iaqmnb3rgcjdh3jz56x4r1hafalrvmg-sendmail-
8.16.1/etc/mail/sendmail.cf
cp: cannot create regular file
'/gnu/store/6iaqmnb3rgcjdh3jz56x4r1hafalrvmg-sendmail-
8.16.1/etc/mail/sendmail.cf': No such file or directory
make: *** [Makefile:83: install-sendmail-cf] Error 1
command "sh" "Build" "install-cf" failed with status 2
builder for `/gnu/store/7rm2hkxw5sqz34k562wfgwsfvpg0avsk-sendmail-
8.16.1.drv' failed with exit code 1
@ build-failed /gnu/store/7rm2hkxw5sqz34k562wfgwsfvpg0avsk-sendmail-
8.16.1.drv - 1 builder for
`/gnu/store/7rm2hkxw5sqz34k562wfgwsfvpg0avsk-sendmail-8.16.1.drv'
failed with exit code 1
derivation '/gnu/store/7rm2hkxw5sqz34k562wfgwsfvpg0avsk-sendmail-
8.16.1.drv' offloaded to 'www.proxmox-2.schmilblick.org' failed: build
of `/gnu/store/7rm2hkxw5sqz34k562wfgwsfvpg0avsk-sendmail-8.16.1.drv'
failed
build of /gnu/store/7rm2hkxw5sqz34k562wfgwsfvpg0avsk-sendmail-
8.16.1.drv failed

libmilter builds fine however.

I noticed it builds as a static library:

/gnu/store/vdg98ynngj637sdn1xazgafb8af8fv2j-libmilter-
1.0.1/lib/libmilter.so.: ELF 64-bit LSB shared object, x86-64, version
1 (SYSV), statically linked, not stripped

Is there any build flag to disable that? If so, I think we probably
should, for security updates of it's dependencies, but it doesnt look
like it has any, not even the glibc? Maybe it's not so important here.

I also noticed that there was a weird naming for the actual so file, it
ends with a dot '.':

$ tree $(./pre-inst-env guix build libmilter)
/gnu/store/vdg98ynngj637sdn1xazgafb8af8fv2j-libmilter-1.0.1
├── include
│   └── libmilter
│       ├── mfapi.h
│       └── mfdef.h
├── lib
│   ├── libmilter.a
│   ├── libmilter.so -> libmilter.so. <<-- here
│   └── libmilter.so. <<-- also here
└── share
    └── doc
        └── libmilter-1.0.1
            └── LICENSE

6 directories, 6 files

Again it will work anyways I believe, not crucial.

> +(define-public libmilter
> +  (package
> +    (inherit sendmail)
> +    (name "libmilter")
> +    (version "1.0.1")

Where does this version come from? Are you sure about that? Also do
note that changing the version field here in libmilter does not change
the version used in the origin of the inherited package So it's using
the same sources as sendmail exactly, that's what you want?

> +    (arguments
> +     (substitute-keyword-arguments (package-arguments sendmail)
> +       ((#:phases phases)
> +        `(modify-phases ,phases
> +           (replace 'build
> +             (lambda* _
> +               (with-directory-excursion "libmilter"
> +                 (invoke "sh" "Build"))
> +               #t))
> +           (delete 'pre-install)
> +           (replace 'install
> +             (lambda* _
> +               (with-directory-excursion "libmilter"
> +                 (mkdir-p (string-append (assoc-ref %outputs "out")
> "/lib"))
> +                 (invoke "make" "install"))
> +               #t))))))
> +    (synopsis "Sendmail library for creating mail filters.")))
> +

I suggest adding a dedicated synopsis and description here, also
synopsises as I see it should not be sentences and not end with a
period, descriptions on the other hand should be full sentences, look
at the other packages for inspiration.

Léo