diff options
author | Guillem Jover <guillem@debian.org> | 2015-02-21 17:00:06 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2015-04-01 04:54:50 +0200 |
commit | 4266c68bc4516d706544555026b00c5be759b24c (patch) | |
tree | 5f4abdfc6f606d20e8f73c34a486426c25ce1c70 /scripts/dpkg-maintscript-helper.sh | |
parent | 595395466b0820b8231bb4ef373b976e9bb8152a (diff) | |
download | dpkg-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-x | scripts/dpkg-maintscript-helper.sh | 4 |
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" |