Skip to content

Support non-UTF-8 in environment variable dependency tracking #133699

Open
@madsmtm

Description

@madsmtm
Contributor

ParseSess::env_depinfo stores Symbol instead of OsStr.

While we're at it, might make sense to actually not store the environment variable value at all, and instead fetch it inside write_out_deps? (which assumes that the variable won't change during execution of the compiler, but it probably won't).

See also #130883 (comment).

Activity

added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Dec 1, 2024
bjorn3

bjorn3 commented on Dec 1, 2024

@bjorn3
Member

Cargo expects the dep-info file to be valid UTF-8 and parse_rustc_dep_info returns an error when it isn't. As the env var value is included in the dep-info file, this implies that the env var value itself has to be UTF-8 too.

petrochenkov

petrochenkov commented on Dec 1, 2024

@petrochenkov
Contributor

In the original PR introducing the env depinfo we discussed support for non UTF-8, and the outcome was to postpone it until there's a sufficient motivation, it can always be done with some new directive, # env-dep-escaped or something (#71858 (comment)).

#130883 (comment) merely suggests moving the recovery point for non-UTF-8 env vars to fn write_out_deps.

added
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Dec 1, 2024
added
C-discussionCategory: Discussion or questions that doesn't represent real issues.
and removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Dec 2, 2024
madsmtm

madsmtm commented on Dec 3, 2024

@madsmtm
ContributorAuthor

#130883 (comment) merely suggests moving the recovery point for non-UTF-8 env vars to fn write_out_deps.

Sorry, I misunderstood, then. Still, I think keeping it separate from that PR is valuable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-discussionCategory: Discussion or questions that doesn't represent real issues.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @petrochenkov@madsmtm@bjorn3@lolbinarycat@jieyouxu

        Issue actions

          Support non-UTF-8 in environment variable dependency tracking · Issue #133699 · rust-lang/rust