From 62d4c68f629084ce26df64b9ac6920491ce4e9dc Mon Sep 17 00:00:00 2001 From: Magic_RB Date: Tue, 13 Jun 2023 23:03:01 +0200 Subject: [PATCH] Add overlay for `getmail6` Signed-off-by: Magic_RB --- flake.nix | 1 + overlays/getmail6/default.nix | 14 ++++ .../getmail-read-exec-from-path.patch | 73 +++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 overlays/getmail6/default.nix create mode 100644 overlays/getmail6/getmail-read-exec-from-path.patch diff --git a/flake.nix b/flake.nix index 2df1bf6..44ba009 100644 --- a/flake.nix +++ b/flake.nix @@ -56,6 +56,7 @@ overlays/zfs-relmount overlays/ical2org.nix overlays/mautrix-discord.nix + overlays/getmail6 overlays/maildrop ]; diff --git a/overlays/getmail6/default.nix b/overlays/getmail6/default.nix new file mode 100644 index 0000000..e988e38 --- /dev/null +++ b/overlays/getmail6/default.nix @@ -0,0 +1,14 @@ +{ lib, ... }: +let + inherit (lib) + singleton; +in +{ + flake.overlays.getmail6 = + final: prev: + { + getmail6 = prev.getmail6.overrideAttrs (old: { + patches = singleton ./getmail-read-exec-from-path.patch; + }); + }; +} diff --git a/overlays/getmail6/getmail-read-exec-from-path.patch b/overlays/getmail6/getmail-read-exec-from-path.patch new file mode 100644 index 0000000..6a9455d --- /dev/null +++ b/overlays/getmail6/getmail-read-exec-from-path.patch @@ -0,0 +1,73 @@ +diff --git a/getmailcore/baseclasses.py b/getmailcore/baseclasses.py +index 7143886..e94ba0d 100755 +--- a/getmailcore/baseclasses.py ++++ b/getmailcore/baseclasses.py +@@ -261,7 +261,7 @@ class ConfFile(ConfString): + if val is None: + return None + val = expand_user_vars(val) +- if not os.path.isfile(val): ++ if not os.path.isfile(val) and not self.name == 'path' and not self.name == 'password_command': + raise getmailConfigurationError( + '%s: specified file "%s" does not exist' % (self.name, val) + ) +@@ -473,7 +473,7 @@ class ForkingBase(object): + stdout, stderr, args, nolog=False): + self._pipemail(msg, delivered_to, received, unixfrom, stdout, stderr) + nolog or self.log.debug('about to execl() with args %s\n' % str(args)) +- os.execl(*args) ++ os.execlp(*args) + + def forkchild(self, childfun, with_out=True): + self.child = child = Namespace() +diff --git a/getmailcore/destinations.py b/getmailcore/destinations.py +index 2d25558..d7adeba 100755 +--- a/getmailcore/destinations.py ++++ b/getmailcore/destinations.py +@@ -607,9 +607,9 @@ class MDA_external(DeliverySkeleton, ForkingBase): + def initialize(self): + self.log.trace() + self.conf['command'] = os.path.basename(self.conf['path']) +- if not os.access(self.conf['path'], os.X_OK): +- raise getmailConfigurationError('%s not executable' +- % self.conf['path']) ++ # if not os.access(self.conf['path'], os.X_OK): ++ # raise getmailConfigurationError('%s not executable' ++ # % self.conf['path']) + if type(self.conf['arguments']) != tuple: + raise getmailConfigurationError( + 'incorrect arguments format; see documentation (%s)' +diff --git a/getmailcore/filters.py b/getmailcore/filters.py +index e118e8e..014970a 100755 +--- a/getmailcore/filters.py ++++ b/getmailcore/filters.py +@@ -193,10 +193,10 @@ class Filter_external(FilterSkeleton, ForkingBase): + def initialize(self): + self.log.trace() + self.conf['command'] = os.path.basename(self.conf['path']) +- if not os.access(self.conf['path'], os.X_OK): +- raise getmailConfigurationError( +- '%s not executable' % self.conf['path'] +- ) ++ # if not os.access(self.conf['path'], os.X_OK): ++ # raise getmailConfigurationError( ++ # '%s not executable' % self.conf['path'] ++ # ) + if type(self.conf['arguments']) != tuple: + raise getmailConfigurationError( + 'incorrect arguments format; see documentation (%s)' +@@ -332,10 +332,10 @@ class Filter_TMDA(FilterSkeleton, ForkingBase): + def initialize(self): + self.log.trace() + self.conf['command'] = os.path.basename(self.conf['path']) +- if not os.access(self.conf['path'], os.X_OK): +- raise getmailConfigurationError( +- '%s not executable' % self.conf['path'] +- ) ++ # if not os.access(self.conf['path'], os.X_OK): ++ # raise getmailConfigurationError( ++ # '%s not executable' % self.conf['path'] ++ # ) + self.exitcodes_keep = (0, ) + self.exitcodes_drop = (99, ) +