From 747d4683221b5584f9663695fb48145689b42ceb Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 4 Jan 2021 02:42:38 +0100 Subject: [PATCH] fixes century selector of %ExY and %Exy in datepattern for tests, considering interval from 2005 (alternate now) to now; + better grouping algorithm for resulting century RE --- fail2ban/server/strptime.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/fail2ban/server/strptime.py b/fail2ban/server/strptime.py index 1464a96d1f..39fc795865 100644 --- a/fail2ban/server/strptime.py +++ b/fail2ban/server/strptime.py @@ -36,10 +36,30 @@ def _getYearCentRE(cent=(0,3), distance=3, now=(MyTime.now(), MyTime.alternateNo Thereby respect possible run in the test-cases (alternate date used there) """ cent = lambda year, f=cent[0], t=cent[1]: str(year)[f:t] + def grp(exprset): + c = None + if len(exprset) > 1: + for i in exprset: + if c is None or i[0:-1] == c: + c = i[0:-1] + else: + c = None + break + if not c: + for i in exprset: + if c is None or i[0] == c: + c = i[0] + else: + c = None + break + if c: + return "%s%s" % (c, grp([i[len(c):] for i in exprset])) + return ("(?:%s)" % "|".join(exprset) if len(exprset[0]) > 1 else "[%s]" % "".join(exprset)) \ + if len(exprset) > 1 else "".join(exprset) exprset = set( cent(now[0].year + i) for i in (-1, distance) ) if len(now) and now[1]: - exprset |= set( cent(now[1].year + i) for i in (-1, distance) ) - return "(?:%s)" % "|".join(exprset) if len(exprset) > 1 else "".join(exprset) + exprset |= set( cent(now[1].year + i) for i in xrange(-1, now[0].year-now[1].year+1, distance) ) + return grp(sorted(list(exprset))) timeRE = TimeRE() mmitter'>committer
path: root/etc/guix-install.sh
AgeCommit message (Expand)Author
2018-05-19guix-install.sh: Fix chk_require exiting without warning....* etc/guix-install.sh (chk_require): Because of the set -e option, Bash was exiting when the command `command -v "$c" &>/dev/null' was running on its own. Instead, we now test the command and accumulate warning messages in a single statement by chaining the command with a logical OR. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Maxim Cournoyer
2018-03-29guix-install.sh: Explicitly set root's home directory....* etc/guix-install.sh (ROOT_HOME): New variable. (sys_create_store, sys_enable_guix_daemon, sys_authorize_build_farms): Use ROOT_HOME instead of ~root or the HOME environment variable. * doc/guix.texi (Binary Installation): Instead of assuming that ~ and $HOME refer to root's directory simply because commands are being run as root, explicilty refer to it via ~root. Fixes: <https://bugs.gnu.org/30728> Chris Marusich
2018-02-21etc: guix-install.sh: Add aarch64-linux support....* etc/guix-install.sh (chk_sys_arch): Add aarch64 case. Efraim Flashner
2018-01-30etc: Add installation script....* etc/guix-install.sh: New file. * Makefile.am (EXTRA_DIST): Add it. * doc/guix.texi (Binary Installation): Mention it. Co-authored-by: sharlatan <sharlatanus@gmail.com> Ricardo Wurmus