[Reproducible-commits] [dpkg] 39/63: dpkg-maintscript-helper: Anchor pathnames in sed and grep regexes
Jérémy Bobbio
lunar at moszumanska.debian.org
Fri Mar 4 17:44:44 UTC 2016
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch pu/buildinfo
in repository dpkg.
commit 678e4a0def7808d90ca476dd9a4f55b8cb285c6e
Author: Carsten Hey <carsten at debian.org>
Date: Sat Feb 20 10:26:29 2016 +0100
dpkg-maintscript-helper: Anchor pathnames in sed and grep regexes
Make conffile checks a bit more robust, by anchoring them at the
beginning of the string. This requires both «dpkg-query -W -f» and
md5sum(1) to prepended a space but nothing else to pathnames.
Signed-off-by: Guillem Jover <guillem at debian.org>
---
debian/changelog | 2 ++
scripts/dpkg-maintscript-helper.sh | 6 +++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index f267261..b7ee445 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -31,6 +31,8 @@ dpkg (1.18.5) UNRELEASED; urgency=medium
Thanks to Carsten Hey <carsten at debian.org>.
* Quote shell variables in dpkg-maintscript-helper.
Thanks to Carsten Hey <carsten at debian.org>.
+ * Anchor pathnames in sed and grep regexes in dpkg-maintscript-helper.
+ Thanks to Carsten Hey <carsten at debian.org>.
* Portability:
- Move DPKG_ADMINDIR environment variable name out from update-alternatives
code, to make life easier for non-dpkg-based systems.
diff --git a/scripts/dpkg-maintscript-helper.sh b/scripts/dpkg-maintscript-helper.sh
index 7504145..beea63d 100755
--- a/scripts/dpkg-maintscript-helper.sh
+++ b/scripts/dpkg-maintscript-helper.sh
@@ -90,7 +90,7 @@ prepare_rm_conffile() {
local md5sum="$(md5sum "$CONFFILE" | sed -e 's/ .*//')"
local old_md5sum="$(dpkg-query -W -f='${Conffiles}' "$PACKAGE" | \
- sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")"
+ sed -n -e "\'^ $CONFFILE ' { s/ obsolete$//; s/.* //; p }")"
if [ "$md5sum" != "$old_md5sum" ]; then
mv -f "$CONFFILE" "$CONFFILE.dpkg-backup"
else
@@ -193,7 +193,7 @@ prepare_mv_conffile() {
local md5sum="$(md5sum "$CONFFILE" | sed -e 's/ .*//')"
local old_md5sum="$(dpkg-query -W -f='${Conffiles}' "$PACKAGE" | \
- sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")"
+ sed -n -e "\'^ $CONFFILE ' { s/ obsolete$//; s/.* //; p }")"
if [ "$md5sum" = "$old_md5sum" ]; then
mv -f "$CONFFILE" "$CONFFILE.dpkg-remove"
fi
@@ -391,7 +391,7 @@ prepare_dir_to_symlink()
# If there are conffiles we should not perform the switch.
if dpkg-query -W -f='${Conffiles}' "$PACKAGE" | \
- grep -q "$PATHNAME/."; then
+ grep -q "^ $PATHNAME/."; then
error "directory '$PATHNAME' contains conffiles," \
"cannot switch to symlink"
fi
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list