aboutsummaryrefslogtreecommitdiffstats
path: root/main/cracklib/fix-trigger-warning.patch
blob: 21ec638b27b1f2c6d5e40497774e2efd38a1ab6a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From: Dermot Bradley <dermot_bradley@yahoo.com>
Date: Sat, 12 Sep 2020 20:03 +0100
Subject: [PATCH] cracklib: prevent "line out of order" warnings

Workaround for handling excessively long lines in cracklib-words.gz file.
Ensure that all lines read from any words files are truncated to 1023
characters as the cracklib-packer utility (run by the Alpine package trigger)
breaks up long lines on this boundary and processes them separately as if
they were seperate lines and it can potentially generate "line out of order"
warnings.

It also ignores blank lines in word files, this prevents "skipping line"
warnings when blank lines are encountered.

Upstream PR 33 has been raised with this fix.

---

--- a/util/cracklib-format
+++ b/util/cracklib-format
@@ -3,8 +3,17 @@
 # This preprocesses a set of word lists into a suitable form for input
 # into cracklib-packer
 #
+# Truncates lines longer than 1022 characters long as cracklib-packer
+# does not handle them correctly.
+#
+# The last part of the pipeline uses 'grep -v' to remove any blank
+# lines (possibly introduced by earlier parts of the pipeline) as
+# cracklib-packer will generate "skipping line" warnings otherwise.
+#
 gzip -cdf "$@" |
-    grep -v '^\(#\|$\)' |
+    grep -a -v '^#' |
     tr '[A-Z]' '[a-z]' |
     tr -cd '\012[a-z][0-9]' |
+    cut -c 1-1022 |
+    grep -v '^$' |
     env LC_ALL=C sort -u