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
echo "Reading the queuefile, please be patient..."
parse_queue $FILE
rm -f $SBOPKGTMP/sbopkg-duplicate-queue
if [[ -f $MISSING_LIST_FILE ]]; then
dialog --title "Packages not found" --textbox \
$MISSING_LIST_FILE 0 0
@ -1764,6 +1765,7 @@ add_item_to_queue() {
local APP=$1
local USERQUEUE_LOCK=$SBOPKGTMP/sbopkg_user_queue.lck
local UPDATEQUEUE=$SBOPKGTMP/sbopkg-update-queue
local DUPEQUEUE=$SBOPKGTMP/sbopkg-duplicate-queue
local MISSING_LIST_FILE=$SBOPKGTMP/sbopkg_addall_missing
local FILE ONOFF
@ -1775,21 +1777,26 @@ add_item_to_queue() {
APP=${APP:1}
ONOFF=OFF
elif [[ ${APP:0:1} == "@" ]]; then
APP=${APP:1}
FILE="$QUEUEDIR/$APP.sqf"
# FIXME: This next line unset APP is there to apparently fix an
# issue where a recursive queue with a @ in front of it would
# finish up and then cut off the first letter of the next package
# listed in the original queue, i.e. a queue with @foo on line 1
# and openbox on line 2, would cut off the first 'o' in openbox
# upon @foo returning from parse_queue.
unset APP
if [[ -r $FILE ]]; then
parse_queue $FILE
if grep -q "^$APP " $DUPEQUEUE 2> /dev/null; then
APP=${APP:1}
FILE="$QUEUEDIR/$APP.sqf"
# FIXME: This next line unset APP is there to apparently fix an
# issue where a recursive queue with a @ in front of it would
# finish up and then cut off the first letter of the next package
# listed in the original queue, i.e. a queue with @foo on line 1
# and openbox on line 2, would cut off the first 'o' in openbox
# upon @foo returning from parse_queue.
unset APP
if [[ -r $FILE ]]; then
parse_queue $FILE
else
return 1
fi
return 0
else
return 1
echo $APP >> $DUPEQUEUE
return 0
fi
return 0
else
ONOFF=ON
fi
@ -3921,6 +3928,7 @@ else
read ANS
case $ANS in
q* | Q* ) parse_queue $QUEUEDIR/$PKGBUILD.sqf
rm -f $SBOPKGTMP/sbopkg-duplicate-queue
;;
p* | P* ) echo $PKGBUILD >> $TMPQUEUE
break
@ -3935,6 +3943,7 @@ else
if [[ -r $QUEUEDIR/$PKGBUILD.sqf ]]; then
# Add an entire queue
parse_queue $QUEUEDIR/$PKGBUILD.sqf
rm -f $SBOPKGTMP/sbopkg-duplicate-queue
else
if search_package $PKGBUILD; then
# Add a single package