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

src: use `for` loop in `Dotenv::GetPathFromArgs` by avivkeller · Pull Request #54385 · nodejs/node · GitHub

/ node Public

src: use for loop in Dotenv::GetPathFromArgs - #54385

Closed
avivkeller wants to merge 2 commits into
nodejs:mainfrom
avivkeller:patch-93
Closed

src: use for loop in Dotenv::GetPathFromArgs#54385
avivkeller wants to merge 2 commits into
nodejs:mainfrom
avivkeller:patch-93

Conversation

avivkeller commented Aug 14, 2024
edited
Loading

Copy link
Copy Markdown
Member

This PR replaces the old while loop with a newer for loop.

Fixes the following edge cases:

node script.js --env-file .env
node --env-file-ABCD .env
node -- --env-file .env
node -invalid --env-file .env # this will error, but the env file is still processed

Unfortunately, this introduces an edge case where some argument parameters, such as --eval <...> cause any future --env-file arguments to be ignored.

node --eval "1+1" --env-file notparsed.env

Fixes #54255
Fixes #54232
Related to #54237

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 Aug 14, 2024
avivkeller added dotenv Issues and PRs related to .env file parsing commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Aug 14, 2024

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

Can you add a cc test for testing only this function and every edge case you're targeting?

Comment thread src/node_dotenv.cc Outdated
avivkeller requested a review from anonrig August 15, 2024 01:45
Comment thread test/parallel/test-dotenv-edge-cases.js Outdated
avivkeller requested a review from anonrig August 15, 2024 17:07

avivkeller commented Aug 15, 2024
edited
Loading

Copy link
Copy Markdown
Member Author

@anonrig would you mind restarting the Github CI now that #54391 landed?

Actually I'm going to rebase for it.

Comment thread src/node_dotenv.cc Outdated

codecov Bot commented Aug 15, 2024
edited
Loading

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 87.07%. Comparing base (2c14615) to head (35c4dae).
Report is 268 commits behind head on main.

Files with missing lines Patch % Lines
src/node_dotenv.cc 80.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #54385      +/-   ##
==========================================
- Coverage   87.08%   87.07%   -0.01%     
==========================================
  Files         648      648              
  Lines      182341   182338       -3     
  Branches    34982    34981       -1     
==========================================
- Hits       158783   158773      -10     
- Misses      16831    16833       +2     
- Partials     6727     6732       +5     
Files with missing lines Coverage Δ
src/node_dotenv.cc 81.36% <80.00%> (-0.35%) ⬇️

... and 24 files with indirect coverage changes

Comment thread src/node_dotenv.cc
avivkeller requested a review from anonrig August 23, 2024 18:57

Copy link
Copy Markdown
Member Author

@anonrig Do you think this should land (eventually), or it should be held-off, and a redone GetPathFromArgs would be better, one that doesn't have these edge cases?

Copy link
Copy Markdown
Member Author

Closing in favor of #54913

avivkeller closed this Sep 12, 2024
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++. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. dotenv Issues and PRs related to .env file parsing needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dotenv::GetPathFromArgs matches --env-file* Script argument --env-file is wrongly used as node option

3 participants


Back | FazBrowse Home | New Git URL