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

src: allow absolute paths for --env-file #49232

Closed
wants to merge 2 commits into from

Conversation

anonrig
Copy link
Member

@anonrig anonrig commented Aug 18, 2023

Ref: #49148

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/startup

@anonrig anonrig mentioned this pull request Aug 18, 2023
8 tasks
@nodejs-github-bot 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 18, 2023
@anonrig anonrig force-pushed the allow-absolute-paths-for-dotenv branch 3 times, most recently from 430d035 to 6b9587b Compare August 18, 2023 19:40
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 18, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 18, 2023
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 19, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 19, 2023
@nodejs-github-bot
Copy link
Collaborator

Copy link
Contributor

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

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

nit: we could limit the number of "magic strings" by using fixtures.path now that absolute paths are supported. This maybe deserves its own PR to refactor the other tests, so feel free to ignore for this PR.

test/parallel/test-dotenv-edge-cases.js Show resolved Hide resolved
test/parallel/test-dotenv-edge-cases.js Outdated Show resolved Hide resolved
Copy link
Member

@MoLow MoLow left a comment

Choose a reason for hiding this comment

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

LGMT. +1 to the comments

@anonrig
Copy link
Member Author

anonrig commented Aug 21, 2023

@nodejs/build It seems ubuntu 18.04 does not have the proper declarations for std::filesystem. Quick google search recommended: make LDLIBS=-lstdc++fs.

Any suggestions on the correct path to take?

Referencing build logs:

00:07:49.449 node.cc:(.text+0x2ee4): undefined reference to `std::filesystem::__cxx11::path::has_root_directory() const'
00:07:49.482 /home/iojs/build/workspace/node-test-commit-arm/out/Release/obj.target/libnode/src/node_dotenv.o: In function `node::Dotenv::GetPathFromArgs(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)':

@anonrig anonrig force-pushed the allow-absolute-paths-for-dotenv branch from 6b9587b to 127d263 Compare August 21, 2023 15:14
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 21, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 21, 2023
@nodejs-github-bot
Copy link
Collaborator

@anonrig
Copy link
Member Author

anonrig commented Aug 29, 2023

This PR is blocked by the Node.js CI machines having old GCC versions, despite the documentation saying GCC>9 is supported. cc @nodejs/build

@anonrig anonrig added the blocked PRs that are blocked by other issues or PRs. label Aug 29, 2023
@GeoffreyBooth GeoffreyBooth added the cli Issues and PRs related to the Node.js command line interface. label Sep 2, 2023
@benjamingr
Copy link
Member

@nodejs/build any chance anyone can take a look at the GCC version on the buiild machine?

@anonrig
Copy link
Member Author

anonrig commented Sep 5, 2023

Blocked by nodejs/build#3317

@anonrig anonrig force-pushed the allow-absolute-paths-for-dotenv branch from e9fa8c9 to 1e0ca25 Compare October 10, 2023 13:45
@anonrig
Copy link
Member Author

anonrig commented Oct 10, 2023

Fixed conflicts, rebased and force pushed.

@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 10, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 10, 2023
@nodejs-github-bot
Copy link
Collaborator

@anonrig anonrig removed the blocked PRs that are blocked by other issues or PRs. label Oct 10, 2023
@nikelborm
Copy link

Hi! Is there anything blocking this pr from being merged? The feature will be quite useful in scripts.

@anonrig
Copy link
Member Author

anonrig commented Dec 5, 2023

Hi! Is there anything blocking this pr from being merged? The feature will be quite useful in scripts.

gcc 10 support is missing from certain CI machines. waiting for it to land to unblock this PR.

@@ -124,6 +124,7 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <filesystem>
Copy link
Member

Choose a reason for hiding this comment

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

I would recommend adding a comment here that <filesystem> is imported only to support path-processing operations and not actually performing any file system operations (which should always go through libuv)

Comment on lines -861 to +867
std::string path = cwd + kPathSeparator + file_path;
per_process::dotenv_file.ParsePath(path);
if (file_path.is_absolute()) {
per_process::dotenv_file.ParsePath(file_path.string());
} else {
std::string path = cwd + kPathSeparator + file_path.string();
per_process::dotenv_file.ParsePath(path);
}
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a comment explaining why it is necessary to construct an absolute path here?

Copy link
Member

Choose a reason for hiding this comment

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

I don't see why any of this is necessary, so I've opened #51425 as an alternative.

@anonrig
Copy link
Member Author

anonrig commented Jan 12, 2024

Closing in favor of #51425

@anonrig anonrig closed this Jan 12, 2024
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++. cli Issues and PRs related to the Node.js command line interface. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants