mirror of
https://github.com/sbopkg/sbopkg
synced 2024-12-31 10:23:25 +01:00
prevent a queue from recursively loading itself
This commit is contained in:
parent
967a185c45
commit
8b3544db4d
1 changed files with 22 additions and 13 deletions
|
@ -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,21 +1777,26 @@ add_item_to_queue() {
|
||||||
APP=${APP:1}
|
APP=${APP:1}
|
||||||
ONOFF=OFF
|
ONOFF=OFF
|
||||||
elif [[ ${APP:0:1} == "@" ]]; then
|
elif [[ ${APP:0:1} == "@" ]]; then
|
||||||
APP=${APP:1}
|
if grep -q "^$APP " $DUPEQUEUE 2> /dev/null; then
|
||||||
FILE="$QUEUEDIR/$APP.sqf"
|
APP=${APP:1}
|
||||||
# FIXME: This next line unset APP is there to apparently fix an
|
FILE="$QUEUEDIR/$APP.sqf"
|
||||||
# issue where a recursive queue with a @ in front of it would
|
# FIXME: This next line unset APP is there to apparently fix an
|
||||||
# finish up and then cut off the first letter of the next package
|
# issue where a recursive queue with a @ in front of it would
|
||||||
# listed in the original queue, i.e. a queue with @foo on line 1
|
# finish up and then cut off the first letter of the next package
|
||||||
# and openbox on line 2, would cut off the first 'o' in openbox
|
# listed in the original queue, i.e. a queue with @foo on line 1
|
||||||
# upon @foo returning from parse_queue.
|
# and openbox on line 2, would cut off the first 'o' in openbox
|
||||||
unset APP
|
# upon @foo returning from parse_queue.
|
||||||
if [[ -r $FILE ]]; then
|
unset APP
|
||||||
parse_queue $FILE
|
if [[ -r $FILE ]]; then
|
||||||
|
parse_queue $FILE
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
echo $APP >> $DUPEQUEUE
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
return 0
|
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue