NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: install/55700: postinstall doesn't work correctly with BSD grep(1)
The following reply was made to PR install/55700; it has been noted by GNATS.
From: Valery Ushakov <uwe%stderr.spb.ru@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: install/55700: postinstall doesn't work correctly with BSD
grep(1)
Date: Thu, 8 Oct 2020 02:21:12 +0300
Before I forget, exclude_libs() is broken in other ways. Sorry to
hijack this PR, but it's related.
Existing uses of exclude() in do_defaults() and do_rc() take care to
strip the directory name - but it's obfuscated: the \(\) parens come
from the call but the \1 that refer to them is hidden deep inside
select_set_files().
exclude_libs() then abused exlcude() without realizing it's doing it
wrong. It passes "libfoo.so.1.2" for exclusion, but the input it gets
is "/lib/libfoo.so.1.2" and b/c of the ^-anchored pattern it doesn't
work, nothing is ever excluded.
It's not immediately obvious to me why exclude() doesn't also $-anchor
its patterns. If the uses in do_rc() and do_defaults() should
$-anchor them, then I'd ditch the existing baroque version in favor of
something like (untested):
exclude() {
local cmd="${CAT}"
for pattern; do
if [ "${cmd}" = "${CAT}" ]; then
cmd="${GREP}"
set -- --fixed-strings --line-regexp --invert-match
fi
set -- "$@" "-e" "${pattern}"
done
"${cmd}" "$@"
}
and then rewrite exlcude_libs() to not use exlcude(), trying to
over-generalize the latter.
-uwe
Home |
Main Index |
Thread Index |
Old Index