[tor-bugs] #18025 [Tor]: test_util_touch_file is racy and *does* fail
Tor Bug Tracker & Wiki
blackhole at torproject.org
Sat Jan 9 09:30:06 UTC 2016
#18025: test_util_touch_file is racy and *does* fail
------------------------+--------------------------
Reporter: weasel | Owner:
Type: defect | Status: new
Priority: Medium | Milestone:
Component: Tor | Version: Tor: 0.2.7.6
Severity: Normal | Keywords:
Actual Points: | Parent ID:
Points: | Sponsor:
------------------------+--------------------------
Tor's master has a broken test:
https://jenkins.torproject.org/job/tor-debian-master-nightly-
binaries/630/ARCHITECTURE=i386,SUITE=wily/console
{{{
00:30:38 util/get_avail_disk_space: OK
00:30:38 util/touch_file:
00:30:38 FAIL ../src/test/test_util.c:4615: assert(st.st_mtime OP_GE
now): 1452299437 vs 1452299438
00:30:38 [touch_file FAILED]
00:30:38 util/pwdb: [forking] OK
}}}
from test_util.c:
{{{
const time_t now = time(NULL);
struct stat st;
write_bytes_to_file(fname, "abc", 3, 1);
tt_int_op(0, OP_EQ, stat(fname, &st));
tt_i64_op(st.st_mtime, OP_GE, now);
}}}
The test is flawed to begin with, there's no guarantee for how much or
little time is between the time() call and the write().
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/18025>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list