Open Bug 1879463 Opened 2 years ago Updated 2 years ago

Intermittent Assertion failed: (mPath.length() > 0), function ScopedUniqueDirectory, file ../../gtests/common/util.h, line 65.

Categories

(NSS :: Test, defect, P5)

Tracking

(Not tracked)

People

(Reporter: intermittent-bug-filer, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: assertion, good-first-bug, intermittent-failure)

Attachments

(1 obsolete file)

This has been a perma failure on our mac workers for a while. I just ran into it on Linux and tracked it down. It happens because we use an (unseeded) call to rand() to choose a name for a temporary directory.

Here's a (not very serious) patch. Doing something more robust here would be a good first bug for someone.

diff --git gtests/common/util.h gtests/common/util.h
--- gtests/common/util.h
+++ gtests/common/util.h
@@ -13,6 +13,7 @@
 #include <iostream>
 #include <sstream>
 #include <sys/stat.h>
+#include <time.h>
 #include <vector>
 #if defined(_WIN32)
 #include <windows.h>
@@ -90,7 +91,9 @@ class ScopedUniqueDirectory {
     std::stringstream ss;
     ss << prefix;
     // RAND_MAX is at least 32767.
-    ss << std::setfill('0') << std::setw(4) << std::hex << rand() << rand();
+    ss << std::setfill('0') << std::setw(4) << std::hex;
+    ss << time(nullptr);
+    ss << rand();
     // This will overwrite the value of prefix. This is a little inefficient,
     // but at least it makes the code simple.
     ss >> prefix;
Keywords: good-first-bug
Attachment #9389730 - Attachment is obsolete: true

Hm, there must be multiple ways to cause this same error, because the patch didn't work in try.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: