Skip to content

Rename TPM2TOOLS_TCTI to RUST_TPM2_CLI_TCTI#6

Merged
hyperfinitism merged 1 commit intomainfrom
feature/rename-tcti-env-var
Mar 15, 2026
Merged

Rename TPM2TOOLS_TCTI to RUST_TPM2_CLI_TCTI#6
hyperfinitism merged 1 commit intomainfrom
feature/rename-tcti-env-var

Conversation

@hyperfinitism
Copy link
Owner

This PR renames the TPM2TOOLS_TCTI environment variable to RUST_TPM2_CLI_TCTI to avoid unintended conflicts with tpm2-tools. This is a breaking API change.

@hyperfinitism hyperfinitism self-assigned this Mar 15, 2026
@hyperfinitism hyperfinitism added the enhancement New feature or request label Mar 15, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a potential naming conflict by standardizing the environment variable used for TCTI configuration within the project. The change improves clarity and avoids unintended interactions with external tools, ensuring a more robust and isolated configuration mechanism. Users will need to adjust their existing setups to accommodate this update.

Highlights

  • Environment Variable Renaming: The TPM2TOOLS_TCTI environment variable has been renamed to RUST_TPM2_CLI_TCTI to prevent potential conflicts with tpm2-tools.
  • Breaking API Change: This renaming constitutes a breaking API change, requiring users to update their environment variable configurations.
  • Documentation and Code Updates: All instances of the old environment variable, including in documentation, CLI argument parsing, TCTI configuration logic, and test helpers, have been updated to reflect the new name.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • README.md
    • Updated example usage for setting the TPM device path.
    • Updated example usage for setting up swtpm.
  • src/cli.rs
    • Changed the environment variable name used for TCTI configuration in the GlobalOpts struct.
    • Updated the comment for the TCTI configuration to reflect swtpm instead of mssim.
  • src/raw_esys.rs
    • Updated the environment variable name used as a fallback for TCTI configuration in RawEsysContext::new.
  • src/tcti.rs
    • Updated the environment variable name in the parse_tcti function and its documentation.
    • Updated the environment variable name in the extract_device_path function.
  • tests/helpers.sh
    • Updated the environment variable name in the start_swtpm function and its descriptive comment.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Generative AI Prohibited Use Policy, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly renames the TPM2TOOLS_TCTI environment variable to RUST_TPM2_CLI_TCTI across the codebase, including documentation, command-line argument parsing, and internal logic. This change effectively avoids potential conflicts with tpm2-tools. The changes are consistent and well-executed. I have a couple of suggestions to improve code maintainability by reducing duplication and removing a magic string.

Comment on lines 20 to 23
let tcti_str = match tcti {
Some(s) => s.to_owned(),
None => std::env::var("TPM2TOOLS_TCTI").unwrap_or_else(|_| DEFAULT_TCTI.to_owned()),
None => std::env::var("RUST_TPM2_CLI_TCTI").unwrap_or_else(|_| DEFAULT_TCTI.to_owned()),
};

Choose a reason for hiding this comment

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

medium

This logic for resolving the TCTI string is duplicated in extract_device_path on lines 31-34. To improve maintainability, consider extracting this block into a private helper function within this module. This would also be beneficial for raw_esys.rs which has similar logic.

Copy link
Owner Author

Choose a reason for hiding this comment

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

The proposed refactoring looks good to me, while it is irrelevant to this PR. It will likely be implemented during a future refactoring phase.

To prevent unintended conflicts between rust-tpm2-cli and tpm2-tools,
rename the TCTI environment variable across the project.

Signed-off-by: Takuma IMAMURA <209989118+hyperfinitism@users.noreply.github.com>
@hyperfinitism hyperfinitism force-pushed the feature/rename-tcti-env-var branch from 0415f68 to 175b14c Compare March 15, 2026 12:17
@hyperfinitism hyperfinitism merged commit 0a19030 into main Mar 15, 2026
22 checks passed
@hyperfinitism hyperfinitism deleted the feature/rename-tcti-env-var branch March 15, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant