[tor-bugs] #18025 [Tor]: test_util_touch_file is racy and *does* fail

Tor Bug Tracker & Wiki blackhole at torproject.org
Sat Jan 9 17:21:50 UTC 2016


#18025: test_util_touch_file is racy and *does* fail
--------------------+------------------------------------
 Reporter:  weasel  |          Owner:  nickm
     Type:  defect  |         Status:  assigned
 Priority:  Medium  |      Milestone:  Tor: 0.2.8.x-final
Component:  Tor     |        Version:  Tor: 0.2.7.6
 Severity:  Normal  |     Resolution:
 Keywords:          |  Actual Points:
Parent ID:          |         Points:
  Sponsor:          |
--------------------+------------------------------------

Comment (by weasel):

 {{{
 <ron> weasel: http://paste.debian.net/363027/  third guess is the charm!
 <ron> the difference between CLOCK_REALTIME and CLOCK_REALTIME_COARSE by
 the look of it.  MONOTONIC is way different.
 <ron> but that's a trivial way to get a now() you can probably use
 }}}

 copy from that paste:
 {{{


 #include <time.h>
 #include <stdio.h>

 int main()
 {
         struct timespec t1, t2, t3;

         clock_gettime(CLOCK_REALTIME, &t1);
         clock_gettime(CLOCK_REALTIME_COARSE, &t2);
         clock_gettime(CLOCK_MONOTONIC, &t3);

         printf("t1: %zu.%zu\n", t1.tv_sec, t1.tv_nsec);
         printf("t2: %zu.%zu\n", t2.tv_sec, t2.tv_nsec);
         printf("t3: %zu.%zu\n", t3.tv_sec, t3.tv_nsec);

         return 0;
 }

 $ ./bad_time
 t1: 1452359862.758024307
 t2: 1452359862.755158473
 t3: 2921765.65971100
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/18025#comment:11>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list