Skip to content
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

Make the passenv environment setting case sensitive #1718

Closed
wants to merge 1 commit into from

Conversation

gnikonorov
Copy link
Contributor

Description

Make the passenv environment setting case sensitive. Before this change it was including all environment variables that matched in a case insensitive fashion ( FOO included FOO, fOo, and foo for example )

Closes #1534

Contribution checklist:

(also see CONTRIBUTING.rst for details)

  • wrote descriptive pull request text
  • added/updated test(s)
  • updated/extended the documentation - Not applicable in this case
  • added relevant issue keyword
    in message body
  • added news fragment in changelog folder
    • fragment name: <issue number>.<type>.rst for example (588.bugfix.rst)
    • <type> is must be one of bugfix, feature, deprecation,breaking, doc, misc
    • if PR has no issue: consider creating one first or change it to the PR number after creating the PR
    • "sign" fragment with "by :user:<your username>"
    • please use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files - by :user:superuser."
    • also see examples
  • added yourself to CONTRIBUTORS (preserving alphabetical order)

@asottile
Copy link
Contributor

asottile commented Oct 25, 2020

at least on posix this is correct, A and a are two separate environment variables:

$ a=1 A=2 env | grep -i '^a='
A=2
a=1

@asottile
Copy link
Contributor

on windows however, a and A are the same variable:

C:\Users\Anthony>set A=1

C:\Users\Anthony>set a=2

C:\Users\Anthony>echo %A% %a%
2 2

@gnikonorov
Copy link
Contributor Author

on windows however, a and A are the same variable:

C:\Users\Anthony>set A=1

C:\Users\Anthony>set a=2

C:\Users\Anthony>echo %A% %a%
2 2

Thank you @asottile. I forgot about Windows. I'll add an exclusion for it.

@asottile
Copy link
Contributor

I'm 50/50 on whether we should change this, or whether we should just document it as case insensitive

@gnikonorov
Copy link
Contributor Author

gnikonorov commented Oct 25, 2020

Since this is my first time opening a PR in this repo, I'll defer to more experienced committers. Thoughts @gaborbernat ( since we spoke on the linked issue ) ?

FWIW I think it would be easy and clean enough to just uppercase name and spec if platform.system() == "Windows":

Copy link
Member

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

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

FWIW I think it would be easy and clean enough to just uppercase name and spec if platform.system() == "Windows":

Yeah, on Windows we need to be the case insensitive.

@asottile
Copy link
Contributor

On second thought, changing this behaviour is likely to break a lot of people even tox itself

I'm leaning more towards not changing the behaviour and just documenting the case insensitivity

@gnikonorov
Copy link
Contributor Author

On second thought, changing this behaviour is likely to break a lot of people even tox itself

I'm leaning more towards not changing the behaviour and just documenting the case insensitivity

At the very least, it sounds like a major version bump

@gaborbernat
Copy link
Member

Ok. Let's not address here in the code. But document the behavior.

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

Successfully merging this pull request may close these issues.

passenv=FOO passes on foo
3 participants