-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Crashes when --env-file=file does not have a newline at the end #55925
Comments
a few questions: |
Interestingly enough, it indeed did not happen on Ubuntu x86_64 VM: It also did not happen on Termux: ...nor did it happen on my old Raspberry Pi 3: vignette@raspberrypi:/tmp $ printf 'API_KEY="inaaa"' > .env
vignette@raspberrypi:/tmp $ xxd .env
00000000: 4150 495f 4b45 593d 2269 6e61 6161 22 API_KEY="inaaa"
vignette@raspberrypi:/tmp $ node -v
v22.11.0
vignette@raspberrypi:/tmp $ node --env-file=.env
Welcome to Node.js v22.11.0.
Type ".help" for more information.
>
vignette@raspberrypi:/tmp $ uname -a
Linux raspberrypi 6.6.51+rpt-rpi-v7 #1 SMP Raspbian 1:6.6.51-1+rpt3 (2024-10-08) armv7l GNU/Linux |
A) Can't currently get my hands on v22.11.0 on my Arch machine, however it does still occur on v23.1.0 $ node -v
v23.1.0
$ printf 'API_KEY="inaaa"' > .env
$ xxd .env
00000000: 4150 495f 4b45 593d 2269 6e61 6161 22 API_KEY="inaaa"
$ node --env-file=.env
/usr/include/c++/14.2.1/string_view:297: constexpr void std::basic_string_view<_CharT, _Traits>::remove_prefix(size_type) [with _CharT = char; _Traits = std::char_traits<char>; size_type = long unsigned int]: Assertion 'this->_M_len >= __n' failed.
[1] 83922 IOT instruction (core dumped) node --env-file=.env B) From the looks of it, is should be a valid ASCII file, even to the C) Appending a
|
Maybe it's Fedora specific? |
It also happened on Arch Linux, on NodeJs 22.10.0 and 23.1.0. |
The presence of __glibcxx_assert_fail suggests that the build was likely compiled with _GLIBCXX_ASSERTIONS enabled. However, it's puzzling that the stack trace lines differ from mine.
|
Just did build on that specific commit and a quick test, and it seems it no longer crashes on the repro example and my projects. Thank you all for the hard work! |
Refs: nodejs#55925 PR-URL: nodejs#55982 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Refs: nodejs#55925 PR-URL: nodejs#55982 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Refs: nodejs#55925 PR-URL: nodejs#55982 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Refs: nodejs#55925 PR-URL: nodejs#55982 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Refs: nodejs#55925 PR-URL: nodejs#55982 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Refs: nodejs#55925 PR-URL: nodejs#55982 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Version
v22.10.0
Platform
Subsystem
No response
What steps will reproduce the bug?
printf 'API_KEY="inaaa"' > .env
)node --env-file=.env
How often does it reproduce? Is there a required condition?
Always, if the
--env-file
file has no newline at the end, and if the value before it is surrounded with quotes.What is the expected behavior? Why is that the expected behavior?
For node to not crash, and for it to parse the value into
process.env
.What do you see instead?
Additional information
No response
The text was updated successfully, but these errors were encountered: