FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

src: fix dotenv parsing commented env by climba03003 · Pull Request #52363 · nodejs/node · GitHub

/ node Public

src: fix dotenv parsing commented env - #52363

Closed
climba03003 wants to merge 3 commits into
nodejs:mainfrom
climba03003:fix-dotenv
Closed

src: fix dotenv parsing commented env#52363
climba03003 wants to merge 3 commits into
nodejs:mainfrom
climba03003:fix-dotenv

Conversation

climba03003 commented Apr 4, 2024
edited
Loading

Copy link
Copy Markdown
Contributor

Fixes #52084
Fixes #52362

nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Apr 4, 2024
Comment thread src/node_dotenv.cc
"\\s*(?:export\\s+)?([\\w.-]+)(?:\\s*=\\s*?|:\\s+?)(\\s*'(?:\\\\'|[^']"
")*'|\\s*\"(?:\\\\\"|[^\"])*\"|\\s*`(?:\\\\`|[^`])*`|[^#\r\n]+)?\\s*(?"
":#.*)?"); // NOLINT(whitespace/line_length)
"(?:^|^)\\s*(?:export\\s+)?([\\w.-]+)(?:\\s*=\\s*?|:\\s+?)(\\s*'(?"

climba03003 Apr 4, 2024
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The previous implementation is copied from dotenv but the regexp is missing the beginning part (?:^|^).

So, it cannot determine the commented env properly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Seems like it is removed because std::regex::multiline is not supported.
The current workflow using C++11 only and that required C++17

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'm not sure that (?:^|^) part is makes much sense, and can be simplified just to (?:^)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

After testing, it can be simplified to (?:^).
Due the problem of std::regex::multiline not supported in some environment.
I believe the option of just changing the regex is a no-go.

climba03003 commented Apr 4, 2024
edited
Loading

Copy link
Copy Markdown
Contributor Author

After searching around #52120 also solve the issue.

anonrig left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

We should move away from regexp implementation due to Windows limitations.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Comments in .env aren't ignored by loadEnvFile() --env-file parser overrides variables with commented out values

4 participants


Back | FazBrowse Home | New Git URL