fix bug in bash v5 when allocating new ids
This commit is contained in:
parent
4c29f1a4a0
commit
db20b09954
14
t.sh
14
t.sh
|
@ -143,10 +143,17 @@ function getuid() {
|
|||
|
||||
function updatenextid() {
|
||||
local nextid2=1
|
||||
local db=0
|
||||
nextid2=1
|
||||
if [[ $b5 -eq 1 ]]; then
|
||||
while [[ " ${i_idmap[@]}" == *\ $nextid2* ]]; do
|
||||
nextid2=$((nextid2 + 1))
|
||||
done
|
||||
else
|
||||
while [[ " ${taskid[@]}" == *\ $nextid2* ]]; do
|
||||
nextid2=$((nextid2 + 1))
|
||||
done
|
||||
fi
|
||||
nextid=$nextid2
|
||||
}
|
||||
|
||||
|
@ -175,6 +182,7 @@ function loadids() {
|
|||
id=${LINE#*:}
|
||||
#uid=$(echo "$LINE" | sed 's/:.*$//g')
|
||||
#id=$(echo "$LINE" | sed 's/^.*://g')
|
||||
|
||||
addidmap $id $uid
|
||||
if [[ -z $uid || -z $id ]]; then
|
||||
error "invalid idmapping line: '$LINE'"
|
||||
|
@ -318,6 +326,7 @@ function confirm() {
|
|||
function loadtask() {
|
||||
local uid sum checked folded desc file id parent res i cats
|
||||
local blockreason
|
||||
local didalloc=0
|
||||
#local re
|
||||
|
||||
#if iscached "$1"; then
|
||||
|
@ -341,7 +350,7 @@ dblog "process token '${tok[$i]}'"
|
|||
if [[ -z $id ]]; then
|
||||
id=$nextid
|
||||
addidmap $nextid $uid
|
||||
updatenextid
|
||||
didalloc=1
|
||||
needsave=1
|
||||
fi
|
||||
elif [[ ${tok[$i]} == "sum" ]]; then
|
||||
|
@ -388,6 +397,9 @@ dblog "process token '${tok[$i]}'"
|
|||
[[ $id -gt $maxid ]] && maxid=$id
|
||||
[[ ${#sum} -gt $taskwid ]] && taskwid=${#sum}
|
||||
[[ ${#desc} -gt $taskwid ]] && taskwid=${#desc}
|
||||
|
||||
[[ $didalloc -eq 1 ]] && updatenextid
|
||||
|
||||
if [[ -z $uid ]]; then
|
||||
error "task has no uid:"
|
||||
echo "$res"
|
||||
|
|
Loading…
Reference in New Issue