From: Tom Yu Date: Fri, 4 Mar 2005 23:41:59 +0000 (+0000) Subject: pullup from trunk X-Git-Tag: krb5-1.4.3-beta1~86 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=5dadcdd5a9ab49a58c32b743f9dfb404737f0084;p=krb5.git pullup from trunk ticket: 2950 version_fixed: 1.4.1 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-4@17116 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/util/profile/ChangeLog b/src/util/profile/ChangeLog index 7a95a18da..1c9a04f37 100644 --- a/src/util/profile/ChangeLog +++ b/src/util/profile/ChangeLog @@ -1,3 +1,10 @@ +2005-03-03 Ken Raeburn + + * prof_tree.c (profile_node_iterator): After checking skip_num + counter, also skip over deleted nodes. + * prof_test1 (test3): New proc. + (top level): Run it. + 2005-02-23 Ken Raeburn * prof_tree.c (profile_node_iterator): Check that the root node diff --git a/src/util/profile/prof_test1 b/src/util/profile/prof_test1 index 2907f7a88..bd4901272 100644 --- a/src/util/profile/prof_test1 +++ b/src/util/profile/prof_test1 @@ -1,3 +1,6 @@ +# To do: Should run all tests and return a useful exit status, not +# punt on the first failure. + set wd [pwd] set verbose 0 @@ -107,7 +110,45 @@ proc test2 {} { puts "OK: test2: Modifications don't corrupt existing open handles" } +proc test3 {} { + # lxs said: Start with a relation in the file. Open, delete + # relation, add relation back, list relations. In 1.4 release + # code, got two back. + + global wd verbose + + exec cp $wd/test2.ini $wd/test1c.ini + set p [profile_init_path $wd/test1c.ini] + set sect {{test section 1} quux} + + set v [profile_get_values $p $sect] + set v1 [lindex $v 0] + if $verbose { puts "Old values: $v" } + profile_clear_relation $p $sect + if $verbose { puts "Cleared." } + # profile_get_values raises an exception if no data is there; so if + # it succeeds, the test fails. + catch { + set v [profile_get_values $p $sect] + if $verbose { puts "New values: $v" } + puts stderr "Error: test3: Clearing relation didn't get rid of all values." + exit 1 + } + if $verbose { puts "Adding back $v1 ..." } + profile_add_relation $p $sect $v1 + set v [profile_get_values $p $sect] + if $verbose { puts "New values: $v" } + if [llength $v]!=1 { + puts stderr "Error: test3: Adding one entry after clearing relation leaves [llength $v] entries." + exit 1 + } + profile_abandon $p + file delete $wd/test1c.ini + puts "OK: test3: Clearing relation and adding one entry yields correct count." +} + test1 test2 +test3 exit 0 diff --git a/src/util/profile/prof_tree.c b/src/util/profile/prof_tree.c index 4dec26f38..b014e245d 100644 --- a/src/util/profile/prof_tree.c +++ b/src/util/profile/prof_tree.c @@ -574,6 +574,8 @@ get_new_file: skip_num--; continue; } + if (p->deleted) + continue; break; } iter->num++;