FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 03-09-2012, 06:59 AM
Allan McRae
 
Default makepkg: prevent issues with files starting with a hyphen

Most places in makepkg deal with full file paths, but a few use the
file name only. Protect from potential issues when a file name
starts with a hyphen.

Signed-off-by: Allan McRae <allan@archlinux.org>
---
scripts/makepkg.sh.in | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 384e142..8dd2d39 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -833,7 +833,7 @@ extract_sources() {
esac ;;
*)
# See if bsdtar can recognize the file
- if bsdtar -tf "$file" -q '*' &>/dev/null; then
+ if bsdtar -tf "./$file" -q '*' &>/dev/null; then
cmd="bsdtar"
else
continue
@@ -843,10 +843,10 @@ extract_sources() {
local ret=0
msg2 "$(gettext "Extracting %s with %s")" "$file" "$cmd"
if [[ $cmd = "bsdtar" ]]; then
- $cmd -xf "$file" || ret=$?
+ $cmd -xf "./$file" || ret=$?
else
- rm -f "${file%.*}"
- $cmd -dcf "$file" > "${file%.*}" || ret=$?
+ rm -f -- "${file%.*}"
+ $cmd -dcf "./$file" > "${file%.*}" || ret=$?
fi
if (( ret )); then
error "$(gettext "Failed to extract %s")" "$file"
@@ -974,7 +974,7 @@ tidy_install() {

if [[ $(check_option docs) = "n" && -n ${DOC_DIRS[*]} ]]; then
msg2 "$(gettext "Removing doc files...")"
- rm -rf ${DOC_DIRS[@]}
+ rm -rf -- ${DOC_DIRS[@]}
fi

if [[ $(check_option purge) = "y" && -n ${PURGE_TARGETS[*]} ]]; then
@@ -1001,7 +1001,7 @@ tidy_install() {
find ${MAN_DIRS[@]} -lname "$file" 2>/dev/null |
while read link ; do
rm -f "$link" "${link}.gz"
- ln -s "${file}.gz" "${link}.gz"
+ ln -s -- "${file}.gz" "${link}.gz"
done

# check file still exists (potentially already compressed due to hardlink)
--
1.7.9.3
 

Thread Tools




All times are GMT. The time now is 02:08 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org