Avoid overriding _FORTIFY_SOURCE if already set#455
Avoid overriding _FORTIFY_SOURCE if already set#455ranisalt merged 2 commits intoranisalt:masterfrom
Conversation
09e5b17 to
22bb42d
Compare
0ef86b0 to
4bbdadc
Compare
2b9a3f9 to
8332a8d
Compare
|
@ranisalt I confirmed that the regression test works as intended: https://github.com/ranisalt/node-argon2/actions/runs/14639636754/job/41078770309?pr=455 The fix (based on your suggestion with the Regex) is now pushed as well. I did a few tweaks, but so far it fails to run on Windows. I'll have to test this on an actual Windows build machine to find the correct incantation. |
8332a8d to
6de3406
Compare
If the environment defines flags other than `_FORTIFY_SOURCE=2` (e.g. on Arch Linux, which sets it to 3), compilation fails because the flag cannot be re-defined. ``` make: Entering directory '/tmp/node-argon2/build' CC(target) Release/obj.target/libargon2/argon2/src/opt.o <command-line>: warning: "_FORTIFY_SOURCE" redefined <command-line>: note: this is the location of the previous definition CC(target) Release/obj.target/libargon2/argon2/src/argon2.o <command-line>: warning: "_FORTIFY_SOURCE" redefined <command-line>: note: this is the location of the previous definition CC(target) Release/obj.target/libargon2/argon2/src/blake2/blake2b.o <command-line>: warning: "_FORTIFY_SOURCE" redefined <command-line>: note: this is the location of the previous definition CC(target) Release/obj.target/libargon2/argon2/src/core.o <command-line>: warning: "_FORTIFY_SOURCE" redefined <command-line>: note: this is the location of the previous definition CC(target) Release/obj.target/libargon2/argon2/src/encoding.o <command-line>: warning: "_FORTIFY_SOURCE" redefined <command-line>: note: this is the location of the previous definition CC(target) Release/obj.target/libargon2/argon2/src/thread.o <command-line>: warning: "_FORTIFY_SOURCE" redefined <command-line>: note: this is the location of the previous definition rm -f Release/obj.target/argon2.a Release/obj.target/argon2.a.ar-file-list; mkdir -p `dirname Release/obj.target/argon2.a` ar crs Release/obj.target/argon2.a @Release/obj.target/argon2.a.ar-file-list COPY Release/argon2.a CXX(target) Release/obj.target/argon2/argon2.o <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror] <command-line>: note: this is the location of the previous definition cc1plus: all warnings being treated as errors make: *** [argon2.target.mk:138: Release/obj.target/argon2/argon2.o] Error 1 make: Leaving directory '/tmp/node-argon2/build' ``` By only setting it conditionally, we can avoid this issue.
6de3406 to
003fe87
Compare
|
Finally! Finding a string that works equally on Posix and Windows was quite tough. I had to remove the dollar template strings, because the dollar would get interpreted as a variable by bash when enclosed with double quotes, but single quotes aren't supported by Windows. The final solution is a bit less nice, but seems to work. The two remaining checks are due to permission errors, and no merge blockers, from what I can tell. |
|
Thanks!
That's never simple 😆 |
If the environment defines flags other than
_FORTIFY_SOURCE=2(e.g. on Arch Linux, which sets it to 3), compilation fails because the flag cannot be re-defined.By only setting it conditionally, we can avoid this issue.
Fixes #454.