changeset 348:9b388927b12b

FIX: Use BREs with grep because is handles "+" characters in package names properly. Otherwise a package like "lucene++" given an error: egrep: repetition-operator operand invalid
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 07 Dec 2022 01:37:39 +0100
parents 673505e96cea
children f98622ae852c
files sbin/check-ports
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/sbin/check-ports	Mon Dec 05 16:01:54 2022 +0100
+++ b/sbin/check-ports	Wed Dec 07 01:37:39 2022 +0100
@@ -161,7 +161,12 @@
         # "grep" does a fast pre-selection, reading, parsing and comparing is done for
         # exact matching.
         #
-        _lines=$(egrep '^'"${_package}" "${_indexdir}/${_indexfile}")
+        # Use BREs because a `+' char needs to be handled as an ordinary
+        # character (e.g. for the "lucene++" package).
+        # Note that `^' at the start of an RE is not an ordinary
+        # character. See re_format(7).
+        #
+        _lines=$(/usr/bin/grep -G '^'"${_package}" "${_indexdir}/${_indexfile}")
         while read _line ; do
             _fqpn="${_line%%|*}"
             _n=${_fqpn%-*}