Skip to content

Change local_uuid setup parameter #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 11, 2022

Conversation

ajnelson-nist
Copy link
Member

No description provided.

This flag was a useful development aid, and its presence in the Make
command lines impacts generated UUID5s.  However, at the end of the
patch series adding this output, all of the debug statements will be
disabled.

A follow-on patch (at the end of the series) will regenerate
Make-managed files.

Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
`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>
Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
Copy link
Member

@kchason kchason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are several commented lines of code in that file similar to the one marked.

@kchason kchason merged commit 83ece60 into develop May 11, 2022
@kchason kchason deleted the change_local_uuid_setup_parameter branch May 11, 2022 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants