summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2005-03-04 00:05:08 +0000
committerKen Raeburn <raeburn@mit.edu>2005-03-04 00:05:08 +0000
commita316a66d3e73df3cc89089ad01fc8673af6cc31e (patch)
tree7d5a7f89ac245872f40141634e4de6daf5ccdf29 /src
parent3e65c52eb55e0568749c698a312619a3001ceeab (diff)
profile_clear_relation doesn't work, iterator still sees deleted nodes
The "deleted" flag was being checked when writing out the file, but not when iterating through using the profile handle being used to do the deletions. * 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. ticket: new target_version: 1.4.1 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17111 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/util/profile/ChangeLog7
-rw-r--r--src/util/profile/prof_test141
-rw-r--r--src/util/profile/prof_tree.c2
3 files changed, 50 insertions, 0 deletions
diff --git a/src/util/profile/ChangeLog b/src/util/profile/ChangeLog
index 62da771798..8208db91c9 100644
--- a/src/util/profile/ChangeLog
+++ b/src/util/profile/ChangeLog
@@ -1,3 +1,10 @@
+2005-03-03 Ken Raeburn <raeburn@mit.edu>
+
+ * 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 <raeburn@mit.edu>
* 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 2907f7a886..bd4901272d 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 4dec26f389..b014e245d2 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++;