question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Latest version overwrites more environment than necessary

See original GitHub issue

Version 1.7 only set environment variables that matched certain patterns. Version 1.8 sets all variables set by vcvarsall. This caused a failure on my application because the earlier code wouldn’t set the PLATFORM variable, but the new code does (it would set it in a case-insensitive system, since “Platform” was one of the extracted variables).

I’m not sure that the new way is worse, but I’m leaving this here in case someone else is scratching their head trying to figure out what’s up.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
ilammycommented, May 13, 2021

@abellgithub, uhh… Yeah, I have not foreseen such issue. I’m sorry for breaking your build. I believe you can work around this issue for now by using the 1.7 version, right?

@pzhlkj6612, on Windows environment variables are case-insensitive. So if the build already defines PLATFORM for its own unrelated purpose then msvc-dev-cmd would overwrite that value when it tries to set Platform because vcvarsall.bat wants that. And this will make the build upset.


Well, I guess what could be useful is to have a way to give users some control over what variables this action may or may not overwrite and set. For example, like this:

- uses: ilammy/msvc-dev-cmd@v1
  with:
    set-only-these-variables:
      - PATH
      - INCLUDE
      - LIBDIR

or like this:

- uses: ilammy/msvc-dev-cmd@v1
  with:
    never-touch-these-variables:
      - PLATFORM

(with variable names matched case-insensitively).

That way if one needs only some variables, they can ask only for them. If one already uses some variables and would not want MSVC to overwrite them, they could achieve that too.

1reaction
ilammycommented, May 13, 2021

@pzhlkj6612, thanks for your analysis.

It slipped my mind that Platform was in the original list of exported variables. So it’s just pure luck that PLATFORM did not get overwritten in v1.7 – if I had not forgotten about case-insensitivity of the variables and coded it ‘correctly’ then it would have still been overwritten. What a weird quirk.

I’m sorry that I didn’t fully understand the code and asked some silly questions

There’s nothing to be sorry for. That’s how people learn. And you point out things that other people miss.

By the way, would you be interested in cooking a patch that lets the users to include/exclude certain variables? I think it wouldn’t hurt to have this feature, just in case. And it could be a nice exercise to implement.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrade or update a solution - Power Apps - Microsoft Learn
An update must have a higher major, minor, build, or revision number than the parent solution. For example, for a base solution version...
Read more >
What's Wrong With The Docker :latest Tag? - vsupalov.com
Latest is Easily Overwritten By Default​​ Latest is however the default value, which makes it both vulnerable to human mistakes and concurrent usage...
Read more >
Deployment safety - GitLab Documentation
Deployment jobs are a specific kind of CI/CD job. They can be more sensitive than other jobs in a pipeline, and might need...
Read more >
Managing application versions - AWS Elastic Beanstalk
Elastic Beanstalk creates an application version whenever you upload source code. This usually occurs when you create an environment or upload and deploy ......
Read more >
How do I tell Maven to use the latest version of a dependency?
If a dependency on that artifact is required, you have the following ... Declare the version as LATEST (will resolve to 2.0.0) (removed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found