Skip to content

dotenv::GetPathFromArgs matches --env-file* #54255

@avivkeller

Description

@avivkeller

Version

v22.5.1 (and main)

Platform

Linux ... 6.8.11-amd64 #1 SMP PREEMPT_DYNAMIC Kali 6.8.11-1kali2 (2024-05-30) x86_64 GNU/Linux

Subsystem

dotenv

What steps will reproduce the bug?

return strncmp(arg.c_str(), flag.data(), flag.size()) == 0;

The above linked code snippets incorrectly matches any argument beginning with --env-file.

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

$ node --env-file-ABCD env.file                                         
node: bad option: --env-file-ABCD

What do you see instead?

$ node --env-file-ABCD env.file
node: env.file: not found

Additional information

I have a patch for this, see #54237 (comment). I figured I'd open this issue for tracking the bug.

Metadata

Metadata

Assignees

Labels

confirmed-bugIssues with confirmed bugs.dotenvIssues and PRs related to .env file parsing

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions