prevent a queue from recursively loading itself

This commit is contained in:
chess.griffin 2009-06-07 03:22:00 +00:00
parent 967a185c45
commit 8b3544db4d

View file

@ -1459,6 +1459,7 @@ load_user_queue() {
touch $USERQUEUE_LOCK touch $USERQUEUE_LOCK
echo "Reading the queuefile, please be patient..." echo "Reading the queuefile, please be patient..."
parse_queue $FILE parse_queue $FILE
rm -f $SBOPKGTMP/sbopkg-duplicate-queue
if [[ -f $MISSING_LIST_FILE ]]; then if [[ -f $MISSING_LIST_FILE ]]; then
dialog --title "Packages not found" --textbox \ dialog --title "Packages not found" --textbox \
$MISSING_LIST_FILE 0 0 $MISSING_LIST_FILE 0 0
@ -1764,6 +1765,7 @@ add_item_to_queue() {
local APP=$1 local APP=$1
local USERQUEUE_LOCK=$SBOPKGTMP/sbopkg_user_queue.lck local USERQUEUE_LOCK=$SBOPKGTMP/sbopkg_user_queue.lck
local UPDATEQUEUE=$SBOPKGTMP/sbopkg-update-queue local UPDATEQUEUE=$SBOPKGTMP/sbopkg-update-queue
local DUPEQUEUE=$SBOPKGTMP/sbopkg-duplicate-queue
local MISSING_LIST_FILE=$SBOPKGTMP/sbopkg_addall_missing local MISSING_LIST_FILE=$SBOPKGTMP/sbopkg_addall_missing
local FILE ONOFF local FILE ONOFF
@ -1775,6 +1777,7 @@ add_item_to_queue() {
APP=${APP:1} APP=${APP:1}
ONOFF=OFF ONOFF=OFF
elif [[ ${APP:0:1} == "@" ]]; then elif [[ ${APP:0:1} == "@" ]]; then
if grep -q "^$APP " $DUPEQUEUE 2> /dev/null; then
APP=${APP:1} APP=${APP:1}
FILE="$QUEUEDIR/$APP.sqf" FILE="$QUEUEDIR/$APP.sqf"
# FIXME: This next line unset APP is there to apparently fix an # FIXME: This next line unset APP is there to apparently fix an
@ -1790,6 +1793,10 @@ add_item_to_queue() {
return 1 return 1
fi fi
return 0 return 0
else
echo $APP >> $DUPEQUEUE
return 0
fi
else else
ONOFF=ON ONOFF=ON
fi fi
@ -3921,6 +3928,7 @@ else
read ANS read ANS
case $ANS in case $ANS in
q* | Q* ) parse_queue $QUEUEDIR/$PKGBUILD.sqf q* | Q* ) parse_queue $QUEUEDIR/$PKGBUILD.sqf
rm -f $SBOPKGTMP/sbopkg-duplicate-queue
;; ;;
p* | P* ) echo $PKGBUILD >> $TMPQUEUE p* | P* ) echo $PKGBUILD >> $TMPQUEUE
break break
@ -3935,6 +3943,7 @@ else
if [[ -r $QUEUEDIR/$PKGBUILD.sqf ]]; then if [[ -r $QUEUEDIR/$PKGBUILD.sqf ]]; then
# Add an entire queue # Add an entire queue
parse_queue $QUEUEDIR/$PKGBUILD.sqf parse_queue $QUEUEDIR/$PKGBUILD.sqf
rm -f $SBOPKGTMP/sbopkg-duplicate-queue
else else
if search_package $PKGBUILD; then if search_package $PKGBUILD; then
# Add a single package # Add a single package