summaryrefslogtreecommitdiff
path: root/scripts/dpkg-maintscript-helper.sh
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2015-02-21 17:00:06 +0100
committerGuillem Jover <guillem@debian.org>2015-04-01 04:54:50 +0200
commit4266c68bc4516d706544555026b00c5be759b24c (patch)
tree5f4abdfc6f606d20e8f73c34a486426c25ce1c70 /scripts/dpkg-maintscript-helper.sh
parent595395466b0820b8231bb4ef373b976e9bb8152a (diff)
downloaddpkg-4266c68bc4516d706544555026b00c5be759b24c.tar.gz
dpkg-maintscript-helper: Handle symlinks and pathnames ending in slash
For symlinks, error out as the argument is obviously bogus. For pathnames just strip the trailing slash, as this is a common way to name directories. Closes: #771752
Diffstat (limited to 'scripts/dpkg-maintscript-helper.sh')
-rwxr-xr-xscripts/dpkg-maintscript-helper.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/dpkg-maintscript-helper.sh b/scripts/dpkg-maintscript-helper.sh
index 5bb8125c3..92bf29b47 100755
--- a/scripts/dpkg-maintscript-helper.sh
+++ b/scripts/dpkg-maintscript-helper.sh
@@ -254,6 +254,8 @@ symlink_to_dir() {
[ -n "$SYMLINK" ] || error "symlink parameter is missing"
[ "${SYMLINK#/}" = "$SYMLINK" ] && \
error "symlink pathname is not an absolute path"
+ [ "${SYMLINK%/}" = "$SYMLINK" ] && \
+ error "symlink pathname ends with a slash"
[ -n "$SYMLINK_TARGET" ] || error "original symlink target is missing"
[ -n "$1" ] || error "maintainer script parameters are missing"
@@ -305,7 +307,7 @@ symlink_to_dir() {
## Functions to replace a directory with a symlink
##
dir_to_symlink() {
- local PATHNAME="$1"
+ local PATHNAME="${1%/}"
local SYMLINK_TARGET="$2"
local LASTVERSION="$3"
local PACKAGE="$4"