cyrusimap / cyrus-imapd

Cyrus IMAP is an email, contacts and calendar server
http://cyrusimap.org
Other
544 stars 148 forks source link

Move the service programs by default to $libexecdir/cyrus #2155

Open dilyanpalauzov opened 7 years ago

dilyanpalauzov commented 7 years ago

Cyrus installs now its main process as libexec/master . Postgresql and postfix also have their main process called master. Imagine they decide to install their binaries the same way cyrus does under libexec...

git, gcc, emacs install their service programs under libexec/git-core, libexec/gcc/{platform}/{version} and libexec/emacs/{version}/{platform} without letting the user ./configure the destination exactly, only letting her set libexecdir.

Install the service programs for cyrus by default under libexec/cyrus.

diff --git a/Makefile.am b/Makefile.am
--- a/Makefile.am
+++ b/Makefile.am
@@ -45,13 +45,15 @@ ACLOCAL_AMFLAGS = -I cmulocal
 AM_CFLAGS = @PERL_CCCDLFLAGS@ $(GCOV_CFLAGS)
 AM_CXXFLAGS = $(GCOV_CXXFLAGS)

+servicedir = ${libexecdir}/cyrus
+
 AM_CPPFLAGS = \
        $(COM_ERR_CPPFLAGS) \
        -I${top_builddir} \
        -I${top_builddir}/lib \
        -I${top_srcdir} \
        -I${top_srcdir}/lib \
-       -DLIBEXEC_DIR=\"$(libexecdir)\" \
+       -DSERVICE_DIR=\"$(servicedir)\" \
        -DSBIN_DIR=\"$(sbindir)\" \
        -DSYSCONF_DIR=\"$(sysconfdir)\" \
        ${DEFS} \
@@ -113,7 +115,7 @@ DIST_SUBDIRS = . perl/annotator perl/imap perl/sieve/managesieve
 dist_sysconf_DATA =
 lib_LTLIBRARIES = lib/libcyrus_min.la lib/libcyrus.la
 check_PROGRAMS =
-libexec_PROGRAMS =
+service_PROGRAMS =
 sbin_PROGRAMS =
 noinst_HEADERS =
 noinst_LTLIBRARIES =
@@ -143,7 +145,7 @@ BUILT_SOURCES += \

 lib_LTLIBRARIES += imap/libcyrus_imap.la

-libexec_PROGRAMS += \
+service_PROGRAMS += \
        master/master \
        imap/imapd \
        imap/lmtpd \
@@ -192,22 +194,22 @@ sbin_PROGRAMS += imap/squatter
 endif

 if NNTPD
-libexec_PROGRAMS += imap/nntpd
+service_PROGRAMS += imap/nntpd
 sbin_PROGRAMS += imap/fetchnews
 endif # NNTPD

-libexec_PROGRAMS += imap/fud
+service_PROGRAMS += imap/fud

 if IDLED
-libexec_PROGRAMS += imap/idled
+service_PROGRAMS += imap/idled
 endif # IDLED

 if MURDER
-libexec_PROGRAMS += imap/mupdate
+service_PROGRAMS += imap/mupdate
 endif # MURDER

 if CALALARMD
-libexec_PROGRAMS += imap/calalarmd
+service_PROGRAMS += imap/calalarmd
 endif

 if HTTPD
@@ -222,7 +224,7 @@ BUILT_SOURCES += \
        imap/tz_err.c \
        imap/tz_err.h

-libexec_PROGRAMS += imap/httpd
+service_PROGRAMS += imap/httpd
 sbin_PROGRAMS += \
        imap/ctl_jmapauth \
        imap/ctl_zoneinfo \
@@ -231,14 +233,14 @@ sbin_PROGRAMS += \
 endif # HTTPD

 if REPLICATION
-libexec_PROGRAMS += imap/sync_server
+service_PROGRAMS += imap/sync_server
 sbin_PROGRAMS += imap/sync_client imap/sync_reset
 endif # REPLICATION

 if BACKUP
 noinst_LTLIBRARIES += backup/libcyrus_backup.la
 noinst_HEADERS += backup/backup.h
-libexec_PROGRAMS += backup/backupd
+service_PROGRAMS += backup/backupd
 sbin_PROGRAMS += backup/ctl_backups backup/cyr_backup backup/restore
 endif # BACKUP

@@ -250,7 +252,7 @@ sbin_PROGRAMS += imap/unexpunge

 if SIEVE
 check_PROGRAMS += notifyd/notifytest
-libexec_PROGRAMS += notifyd/notifyd
+service_PROGRAMS += notifyd/notifyd
 endif # SIEVE
 endif # SERVER

@@ -261,8 +263,7 @@ endif # CMULOCAL

 if PTCLIENT
 sbin_PROGRAMS += ptclient/ptdump ptclient/ptexpire
-libexec_PROGRAMS += \
-       ptclient/ptloader
+service_PROGRAMS += ptclient/ptloader
 endif # PTCLIENT

 if PERL
@@ -283,7 +284,7 @@ check_PROGRAMS += sieve/test
 sbin_PROGRAMS += sieve/sievec sieve/sieved

 if SERVER
-libexec_PROGRAMS += timsieved/timsieved
+service_PROGRAMS += timsieved/timsieved
 endif # SERVER

 endif # SIEVE
@@ -1875,9 +1876,9 @@ if PERL
 endif

 ## The @$(MKDIR_P) line is added due to a bug in Automake 1.10 and can be removed if using Automake 1.12.
-       @$(MKDIR_P) $(DESTDIR)$(libexecdir)
+       @$(MKDIR_P) $(DESTDIR)$(servicedir)
 if SERVER
-       cd $(DESTDIR)$(libexecdir) && \
+       cd $(DESTDIR)$(servicedir) && \
          $(LN_S) -f pop3d pop3proxyd && \
          $(LN_S) -f imapd proxyd && \
          $(LN_S) -f lmtpd lmtpproxyd
@@ -1919,7 +1920,7 @@ endif
 install-binsymlinks:
 ## Let's symlink everything else
        for prog in $(sbin_PROGRAMS); do $(LN_S) -f $(sbindir)/`basename $$prog` $(DESTDIR)$(bindir)/; done
-       for prog in $(libexec_PROGRAMS); do $(LN_S) -f $(libexecdir)/`basename $$prog` $(DESTDIR)$(bindir)/; done
+       for prog in $(service_PROGRAMS); do $(LN_S) -f $(servicedir)/`basename $$prog` $(DESTDIR)$(bindir)/; done

 SUFFIXES = .fig.png

diff --git a/master/master.c b/master/master.c
--- a/master/master.c
+++ b/master/master.c
@@ -236,7 +236,7 @@ static void get_daemon(char *path, size_t size, const strarray_t *cmd)
         /* master lacks strlcpy, due to no libcyrus */
         strncpy(path, cmd->data[0], size - 1);
     }
-    else snprintf(path, size, "%s/%s", LIBEXEC_DIR, cmd->data[0]);
+    else snprintf(path, size, SERVICE_DIR "/%s", cmd->data[0]);
     path[size-1] = '\0';
 }

diff --git a/master/service.c b/master/service.c
--- a/master/service.c
+++ b/master/service.c
@@ -466,7 +466,7 @@ int main(int argc, char **argv, char **envp)
     if (service_argv.data[0][0] == '/')
         strlcpy(path, service_argv.data[0], sizeof(path));
     else
-        snprintf(path, sizeof(path), "%s/%s", LIBEXEC_DIR, service_argv.data[0]);
+        snprintf(path, sizeof(path), SERVICE_DIR "/%s", service_argv.data[0]);

     stat(path, &sbuf);
     start_ino= sbuf.st_ino;
brong commented 7 years ago

Don't agree - we should rename our programs to not clash.

On Sat, 16 Sep 2017, at 23:24, Дилян Палаузов wrote:

Cyrus installs now its main process as libexec/master . Postgresql and postfix also have their main process called master. Imagine they decide to install their binaries the same way cyrus does under libexec...> git, gcc, emacs install their service programs under libexec/git-core, libexec/gcc/{platform}/{version} and libexec/emacs/{version}/{platform}.> Install the service programs for cyrus by default under libexec/cyrus.> diff --git a/Makefile.am b/Makefile.am --- a/Makefile.am +++ b/Makefile.am @@ -51,7 +51,7 @@ AM_CPPFLAGS = \ -I${top_builddir}/lib \ -I${top_srcdir} \ -I${top_srcdir}/lib \

  • -DLIBEXEC_DIR=\"$(libexecdir)\" \
  • -DSERVICE_DIR=\"$(servicedir)\" \ -DSBIN_DIR=\"$(sbindir)\" \ -DSYSCONF_DIR=\"$(sysconfdir)\" \ ${DEFS} \ @@ -113,7 +113,7 @@ DIST_SUBDIRS = . perl/annotator perl/imap perl/sieve/managesieve dist_sysconf_DATA = lib_LTLIBRARIES = lib/libcyrus_min.la lib/libcyrus.la check_PROGRAMS = - libexec_PROGRAMS = +service_PROGRAMS = sbin_PROGRAMS = noinst_HEADERS = noinst_LTLIBRARIES = @@ -143,7 +143,7 @@ BUILT_SOURCES += \ lib_LTLIBRARIES += imap/libcyrus_imap.la -libexec_PROGRAMS += \ +service_PROGRAMS += \ master/master \ imap/imapd \ imap/lmtpd \ @@ -192,22 +192,22 @@ sbin_PROGRAMS += imap/squatter endif if NNTPD -libexec_PROGRAMS += imap/nntpd +service_PROGRAMS += imap/nntpd sbin_PROGRAMS += imap/fetchnews endif # NNTPD -libexec_PROGRAMS += imap/fud +service_PROGRAMS += imap/fud if IDLED -libexec_PROGRAMS += imap/idled +service_PROGRAMS += imap/idled endif # IDLED if MURDER -libexec_PROGRAMS += imap/mupdate +service_PROGRAMS += imap/mupdate endif # MURDER if CALALARMD -libexec_PROGRAMS += imap/calalarmd +service_PROGRAMS += imap/calalarmd endif if HTTPD @@ -222,7 +222,7 @@ BUILT_SOURCES += \ imap/tz_err.c \ imap/tz_err.h -libexec_PROGRAMS += imap/httpd +service_PROGRAMS += imap/httpd sbin_PROGRAMS += \ imap/ctl_jmapauth \ imap/ctl_zoneinfo \ @@ -231,14 +231,14 @@ sbin_PROGRAMS += \ endif # HTTPD if REPLICATION - libexec_PROGRAMS += imap/sync_server +service_PROGRAMS += imap/sync_server sbin_PROGRAMS += imap/sync_client imap/sync_reset endif # REPLICATION if BACKUP noinst_LTLIBRARIES += backup/libcyrus_backup.la noinst_HEADERS += backup/backup.h -libexec_PROGRAMS += backup/backupd +service_PROGRAMS += backup/backupd sbin_PROGRAMS += backup/ctl_backups backup/cyr_backup backup/restore endif # BACKUP @@ -250,7 +250,7 @@ sbin_PROGRAMS += imap/unexpunge if SIEVE check_PROGRAMS += notifyd/notifytest -libexec_PROGRAMS += notifyd/notifyd +service_PROGRAMS += notifyd/notifyd endif

    SIEVE endif # SERVER @@ -261,8 +261,7 @@ endif # CMULOCAL

    if PTCLIENT sbin_PROGRAMS += ptclient/ptdump ptclient/ptexpire
    -libexec_PROGRAMS += \
  • ptclient/ptloader +service_PROGRAMS += ptclient/ptloader endif

    PTCLIENT if PERL @@ -283,7 +283,7 @@ check_PROGRAMS +=

    sieve/test sbin_PROGRAMS += sieve/sievec sieve/sieved  if
    SERVER -libexec_PROGRAMS += timsieved/timsieved
    +service_PROGRAMS += timsieved/timsieved endif # SERVER  endif
    # SIEVE @@ -1875,9 +1875,9 @@ if PERL endif  ## The
    @$(MKDIR_P) line is added due to a bug in Automake 1.10 and
    can be removed if using Automake 1.12.
  • @$(MKDIR_P) $(DESTDIR)$(libexecdir)
  • @$(MKDIR_P) $(DESTDIR)$(servicedir) if SERVER
  • cd $(DESTDIR)$(libexecdir) && \
  • cd $(DESTDIR)$(servicedir) && \ $(LN_S) -f pop3d pop3proxyd && \ $(LN_S) -f imapd proxyd && \ $(LN_S) -f lmtpd lmtpproxyd @@ -1919,7 +1919,7 @@ endif install-binsymlinks: ## Let's symlink everything else for prog in $(sbin_PROGRAMS); do $(LN_S) -f $(sbindir)/basename $$prog $(DESTDIR)$(bindir)/; done
  • for prog in $(libexec_PROGRAMS); do $(LN_S) -f $(libexecdir)/basename $$prog $(DESTDIR)$(bindir)/; done
  • for prog in $(service_PROGRAMS); do $(LN_S) -f $(servicedir)/basename $$prog $(DESTDIR)$(bindir)/; done SUFFIXES = .fig.png diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -81,6 +81,11 @@ AM_INIT_AUTOMAKE([- Wall -Werror -Wno-portability foreign dist-bzip2 no- installinfo subdir-objects silent-rules tar-ustar]) AC_CONFIG_LIBOBJ_DIR([lib]) +AC_ARG_WITH(servicedir,
  • [AS_HELP_STRING([--with-service-dir=DIR], [use DIR as service install directory [LIBEXEC/cyrus]])],,
  • servicedir="$libexecdir/cyrus") +AC_SUBST(servicedir)
  • dnl Useful hook for distributions AC_ARG_WITH(extraident, [AS_HELP_STRING([--with- extraident=STRING],[use STRING as extra version information])], diff --git a/master/master.c b/master/master.c --- a/master/master.c +++ b/master/master.c @@ -236,7 +236,7 @@ static void get_daemon(char path, size_t size, const strarray_t cmd) / master lacks strlcpy, due to no libcyrus / strncpy(path, cmd->data[0], size - 1); }
  • else snprintf(path, size, "%s/%s", LIBEXEC_DIR, cmd->data[0]);
  • else snprintf(path, size, SERVICE_DIR "/%s", cmd->data[0]); path[size- 1] = '\0'; } diff --git a/master/service.c b/master/service.c --- a/master/service.c +++ b/master/service.c @@ -466,7 +466,7 @@ int main(int argc, char argv, char envp) if (service_argv.data[0][0] == '/') strlcpy(path, service_argv.data[0], sizeof(path)); else
  • snprintf(path, sizeof(path), "%s/%s", LIBEXEC_DIR, service_argv.data[0]);
  • snprintf(path, sizeof(path), SERVICE_DIR "/%s", service_argv.data[0]); stat(path, &sbuf); start_ino= sbuf.st_ino;

    — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub[1], or mute the thread[2].>

-- Bron Gondwana, CEO, FastMail Pty Ltd brong@fastmailteam.com

Links:

  1. https://github.com/cyrusimap/cyrus-imapd/issues/2155
  2. https://github.com/notifications/unsubscribe-auth/AABE7foSTGhzFxRfZCe5hwy9bSecOb4kks5si8whgaJpZM4PZ0SK
dilyanpalauzov commented 7 years ago

It makes no big difference whether each service program x is renamed to cyrus-x or cyrus/x .

In fact the main process of postgresql is called "postmaster".

Doing ./configure && make install puts for postgresql its daemon-process under /usr/local/psql/bin/postmaster and for nginx it is /usr/local/nginx/sbin/nginx, other examples for the daemon file locations are sbin/clamd, sbin/rsyslogd, bin/dbus-daemon, sbin/php-fpm ... , . I am not aware of a single other project, which puts its daemon process undex libexec . For libexec/master it is not only a matter of renaming, but also moving it out of libexec.

jasontibbitts commented 7 years ago

In the Fedora packaging, I avoid many conflicts by passing a custom --libexecdir to configure. But I still have to manually rename the manpages to live in the "8cyrus" namespace.

I still have to rename the fetchnews, restore and quota binaries to cyr* because those are installed to /usr/sbin and either directly conflict with system binaries, or randomly override them depending on how $PATH is set. I recall that "cyr" was the preferred prefix for renaming.

Sadly if we rename or move master then all existing cyrus.conf files become outdated. But I think it's a small price to pay and I'd love to see that happen as part of 3.1.

dilyanpalauzov commented 7 years ago

How shall the filenames of the man pages be called and where shall they be installed?

For linux from scratch system it is utmost uncommon to have to pass per package --libexec -- all packages are supposed to work and live together with the same prefix, sysconfdir...

Programs that shall be run by the cyrus user are not to be placed under sbin/.