You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`case_utils.local_uuid` provides a deterministic UUIDv5 generator based
on the execution environment. Unfortunately, its prior implementation
was not behaving correctly when changing environments - a different
operating system, or working in a different rooted directory, would
cause UUID churn.
The issue turned out to be paths embedding in two manners:
1. The prior implementation assumed work happening somewhere under a
user-home directory. This is not always true.
2. The prior implementation did not catch that for a program
`pip`-installed into a virtual environment in editable mode (or,
possibly more generally than that), `sys.argv[0]` is the absolute
path to the installed command in the virtual environment root.
Hence, changing operating systems from macOS to Linux would change
`/Users/me` to `/home/me` within the UUID seeding data.
This patch revises the practice from functionally operating in a
Boolean manner ("Was this special string passed?") to passing an
anchoring directory, preferably the repository's Git-root directory.
Usage of the prior variable `DEMO_UUID_REQUESTING_NONRANDOM` is now
deprecated, raising a warning.
A test is also added to confirm new warnings are raised.
A follow-on patch will regenerate Make-managed files.
Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
"Environment variable DEMO_UUID_REQUESTING_NONRANDOM is deprecated. See case_utils.local_uuid.demo_uuid for usage notes on its replacement, CASE_DEMO_NONRANDOM_UUID_BASE. Proceeding with random UUIDs.",
WARNING: This function was developed for use ONLY for reducing (but not eliminating) version-control edits to identifiers in sample data. It creates UUIDs that are decidedly NOT random, and should remain consistent on repeated calls to the importing script.
41
112
42
-
To prevent accidental non-random UUID usage, an environment variable must be set to an uncommon string, hard-coded in this function.
113
+
To prevent accidental non-random UUID usage, an environment variable must be set to a string provided by the caller. The variable's required value is the path to some directory. The variable's recommended value is the equivalent of the Make variable "top_srcdir" - that is, the root directory of the containing Git repository, some parent of the current process's current working directory.
0 commit comments