Subject: [bug#77926] [PATCH] gnu: Add proftpd

From: André Batista <[email-masked]>
Date: Fri, 16 May 2025 17:26:18 -0300

Hi Grigory,

seg 14 abr 2025 às 21:00:11 (1744675211), [email-masked] enviou:
> 
> Notes:
> 1. "no-install-user.patch" is stolen from nixpkgs
> 2. By default it looks for ScoreboardFile file in $output/var/<scoreboard-file> and won't find it
> 3. By default tries to setup PidFile in $CWD/var/proftpd.pid
> 4. By default mod_delay.c is on and proftpd looks for DelayTable file in $output/var/share
> 
> Example configuration that disables all of that above:
> #+begin_src conf
>   ServerName "Secure FTP Server"
>   ServerType standalone
>   DefaultServer on
>   ScoreboardFile off # won't find $output/var/<scoreboard-file>
>   PidFile /var/proftpd.pid # will try to launch in $CWD/var/proftpd.pid
> 
> 
>   # http://proftpd.org/docs/modules/mod_delay.html#DelayTable
>   <IfModule mod_delay.c> # won't find delaytable in $output/var/share
>     DelayEngine off # very minor security consern
>   </IfModule>
> #+end_src
> 

Thanks for the detailed explanation.  However, as is, the becomes the
ChangeLog message and the proper guix changelog is missing.

> Change-Id: Ic96745df7ef23664099f73d7130688151c5fc128
> ---
>  gnu/packages/ftp.scm                       |  31 ++++
>  gnu/packages/patches/no-install-user.patch | 189 +++++++++++++++++++++

I'd suggest to add proftpd to the patch filename, so we can know where this
patch applies without opening, grepping or what not.

Also, you need to add an entry to gnu/local.mk registering this patch
on "dist_patch_DATA" - keep the alphabetical order, please.

>  2 files changed, 220 insertions(+)
>  create mode 100644 gnu/packages/patches/no-install-user.patch
> 
> diff --git a/gnu/packages/ftp.scm b/gnu/packages/ftp.scm
> index 2df6797c42..0027e3dfbc 100644
> --- a/gnu/packages/ftp.scm
> +++ b/gnu/packages/ftp.scm
> @@ -25,6 +25,7 @@
> 
>  (define-module (gnu packages ftp)
>    #:use-module ((guix licenses) #:select (gpl2 gpl2+ gpl3+ clarified-artistic))
> +  #:use-module (gnu packages perl)
>    #:use-module (guix build-system gnu)
>    #:use-module (guix download)
>    #:use-module (guix gexp)
> @@ -334,3 +335,33 @@ (define-public vsftpd
>  guarantee.")
>      (home-page "https://security.appspot.com/vsftpd.html")
>      (license gpl2)))                    ; with OpenSSL exception
> +
> +(define-public proftpd
> +  (package
> +    (name "proftpd")
> +    (version "1.3.9")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/proftpd/proftpd")
> +             (commit (string-append "v" version))))
> +       (file-name (git-file-name name version))
> +       (patches (search-patches "no-install-user.patch"))
> +       (sha256
> +        (base32
> +         "0zgx652qdwj2xkc7218v74x919dxmcs3q5s61v1kpdcw8f9v7370"))))
> +    (build-system gnu-build-system)
> +    (inputs (list libcap linux-pam openssl perl
> +                  libxcrypt ncurses zlib libsodium))
> +    (arguments
> +     (list
> +      #:configure-flags #~(list "--enable-openssl"
> +                                "--with-modules=mod_sftp")))
> +    (synopsis "Highly configurable GPL-licensed FTP server software")

I would remove GPL-licensed as it does not seem to be critical info that
on expects on a synopsis.

> +    (description
> +     "ProFTPD grew out of the desire to have a secure and configurable FTP server, and out of a significant admiration of the Apache web server.
> +
> +ProFTPD is not a hack based on any other server, it's an independent source tree from the ground up. A number of well known and high traffic sites use ProFTPD.")

When starting new sentences, add double spaces, so:

"... ground up.  A number well known..."

Also, this package description sounds like advertising for proftpd in place of
a proper description.  Could you rework it so it becomes more of neutral
description?

Other than that, when applying this patch, git trows the following warning:

Applying: gnu: Add proftpd
.git/rebase-apply/patch:82: space before tab in indent.
        @if [ ! -d $@ ]; then \
.git/rebase-apply/patch:83: space before tab in indent.
                mkdir -p $@; \
.git/rebase-apply/patch:85: space before tab in indent.
                chmod 0755 $@; \
.git/rebase-apply/patch:86: space before tab in indent.
        fi
.git/rebase-apply/patch:89: space before tab in indent.
                rm -f $(DESTDIR)$(sbindir)/in.proftpd ; \
warning: squelched 53 whitespace errors
warning: 58 lines add whitespace errors.

But they seem to be related to the file to be patched so not much one can do.

Could you please send a v2 of this patch contemplating the suggested changes?

Thanks