unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] test/thread-order: more robust loop exit in case of broken input
@ 2015-03-29 15:30 Tomi Ollila
  2015-04-01  7:09 ` David Bremner
  2015-04-03 23:10 ` David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: Tomi Ollila @ 2015-03-29 15:30 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

When creating $THREADS data it may end of not having 'None' at all
or the numbers in line output yields a loop.

To avoid loop the value in current array index is set to 'None'
so that if the same item is reached again the loop will end.

Also empty string as next array index will end the loop.
---

This is v2 of id:1427310460-15801-1-git-send-email-tomi.ollila@iki.fi

Tested loop termination by setting THREADS='0 0 0 0'


 test/T260-thread-order.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/T260-thread-order.sh b/test/T260-thread-order.sh
index 99f5833..5239bd4 100755
--- a/test/T260-thread-order.sh
+++ b/test/T260-thread-order.sh
@@ -45,9 +45,12 @@ for ((n = 0; n < 4; n++)); do
     while read -a parents; do
         references=""
         parent=${parents[$n]}
-        while [[ $parent != None ]]; do
+        while [[ ${parent:-None} != None ]]; do
             references="<m$parent@t$thread> $references"
+            pp=$parent
             parent=${parents[$parent]}
+            # Avoid looping over broken input (if ever)
+            parents[$pp]="None"
         done
 
         generate_message \
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] test/thread-order: more robust loop exit in case of broken input
  2015-03-29 15:30 [PATCH] test/thread-order: more robust loop exit in case of broken input Tomi Ollila
@ 2015-04-01  7:09 ` David Bremner
  2015-04-03 23:10 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2015-04-01  7:09 UTC (permalink / raw)
  To: Tomi Ollila, notmuch; +Cc: tomi.ollila

Tomi Ollila <tomi.ollila@iki.fi> writes:

> When creating $THREADS data it may end of not having 'None' at all
> or the numbers in line output yields a loop.
>
> To avoid loop the value in current array index is set to 'None'
> so that if the same item is reached again the loop will end.
>
> Also empty string as next array index will end the loop.

lgtm

d

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] test/thread-order: more robust loop exit in case of broken input
  2015-03-29 15:30 [PATCH] test/thread-order: more robust loop exit in case of broken input Tomi Ollila
  2015-04-01  7:09 ` David Bremner
@ 2015-04-03 23:10 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2015-04-03 23:10 UTC (permalink / raw)
  To: Tomi Ollila, notmuch; +Cc: tomi.ollila

Tomi Ollila <tomi.ollila@iki.fi> writes:

> When creating $THREADS data it may end of not having 'None' at all
> or the numbers in line output yields a loop.
>

pushed,

d

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-03 23:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-29 15:30 [PATCH] test/thread-order: more robust loop exit in case of broken input Tomi Ollila
2015-04-01  7:09 ` David Bremner
2015-04-03 23:10 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).