--env-file parser overrides variables with commented out valuesΒ #52084
Copy link
Copy link
Closed
Labels
c++Issues and PRs that require attention from people who are familiar with C++.Issues and PRs that require attention from people who are familiar with C++.dotenvIssues and PRs related to .env file parsing.Issues and PRs related to .env file parsing.
Description
Activity
I can reproduce the bug, I believe that the regression may have been introduced by this #51289
I will fix it asapReacted by Egor Egorov, Toni Villena, Polys Georgiou and nickk- addedc++Issues and PRs that require attention from people who are familiar with C++.Issues and PRs that require attention from people who are familiar with C++.
on Mar 15, 2024 - addeddotenvIssues and PRs related to .env file parsing.Issues and PRs related to .env file parsing.
on Mar 15, 2024 @anonrig could you please close this ?
Metadata
Metadata
Assignees
Labels
c++Issues and PRs that require attention from people who are familiar with C++.Issues and PRs that require attention from people who are familiar with C++.dotenvIssues and PRs related to .env file parsing.Issues and PRs related to .env file parsing.
Version
v21.7.1
Platform
Darwin gray.local 23.4.0 Darwin Kernel Version 23.4.0: Wed Feb 21 21:45:49 PST 2024; root:xnu-10063.101.15~2/RELEASE_ARM64_T6020 arm64
Subsystem
env parser
What steps will reproduce the bug?
Create
.env:Run the testcase:
node --env-file=.env -e 'console.log(process.env.VAR)'The output is
secondinstead offirst.Adding a non-commented variable after
# SOMETHINGmakes the parser work correctly.How often does it reproduce? Is there a required condition?
100% reproduction
What is the expected behavior? Why is that the expected behavior?
Commented-out line of
.envis ignored.What do you see instead?
Commented-out part is parsed and the variable value is overwritten.
Additional information
env parser works correctly in 21.6.2, emitting
firstin console.