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: add initial support for single executable applications #45038

Commits on Feb 17, 2023

  1. src: add initial support for single executable applications

    Compile a JavaScript file into a single executable application:
    
    ```console
    $ echo 'console.log(`Hello, ${process.argv[2]}!`);' > hello.js
    
    $ cp $(command -v node) hello
    
    $ npx postject hello NODE_JS_CODE hello.js \
        --sentinel-fuse NODE_JS_FUSE_fce680ab2cc467b6e072b8b5df1996b2
    
    $ npx postject hello NODE_JS_CODE hello.js \
        --sentinel-fuse NODE_JS_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \
        --macho-segment-name NODE_JS
    
    $ ./hello world
    Hello, world!
    ```
    
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    6559b90 View commit details
    Browse the repository at this point in the history
  2. test: fix 'node': No such file or directory error on CI

    `node` does not exist on some of the CI systems.
    
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    444ca79 View commit details
    Browse the repository at this point in the history
  3. test: fix Cannot find module '../common' error on Jenkins CI

    This happened because we set NODE_TEST_DIR=/Users/iojs/node-tmp on
    Jenkins CI.
    
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    a30e3fc View commit details
    Browse the repository at this point in the history
  4. test: skip test on failing platforms

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    5caad76 View commit details
    Browse the repository at this point in the history
  5. test: make sure that double backslashes in Windows paths aren't removed

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    1c5968d View commit details
    Browse the repository at this point in the history
  6. src: move argv replacement to another function

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    290d69f View commit details
    Browse the repository at this point in the history
  7. doc: fix info about using notes on ELF

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    da1b134 View commit details
    Browse the repository at this point in the history
  8. test: test code signing on Windows

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    f08ca63 View commit details
    Browse the repository at this point in the history
  9. lib,test: emit experimental warning

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    afc5d75 View commit details
    Browse the repository at this point in the history
  10. fixup! src: move argv replacement to another function

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    da74406 View commit details
    Browse the repository at this point in the history
  11. test: skip on debug builds on Linux

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    412d592 View commit details
    Browse the repository at this point in the history
  12. test: skip on shared builds

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    10b0fcd View commit details
    Browse the repository at this point in the history
  13. test: skip on --without-ssl and --shared-openssl

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    3addc19 View commit details
    Browse the repository at this point in the history
  14. test: skip on test-ibm-rhel8-s390x-1

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    232ece5 View commit details
    Browse the repository at this point in the history
  15. test: skip on smartos

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    f24e37c View commit details
    Browse the repository at this point in the history
  16. test: skip when cross-compiling

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    8126bb3 View commit details
    Browse the repository at this point in the history
  17. src: speed up case where no resource is present

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    3c5c2cd View commit details
    Browse the repository at this point in the history
  18. src: use custom fuse string

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    b47b68d View commit details
    Browse the repository at this point in the history
  19. test: do not skip on asan builds

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    2fe91c6 View commit details
    Browse the repository at this point in the history
  20. src,doc,test: remove :0 from sentinel fuse string

    Imports
    nodejs/postject@6da6e04.
    
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    e0a9af3 View commit details
    Browse the repository at this point in the history
  21. test: skip on asan builds

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    665e5f8 View commit details
    Browse the repository at this point in the history
  22. src: change segment name from __POSTJECT to NODE_JS on macOS

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    fe6d488 View commit details
    Browse the repository at this point in the history
  23. test: only run test on Ubuntu for Linux

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    8c5ba96 View commit details
    Browse the repository at this point in the history
  24. test: skip on non-x64 Linux archictectures

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    2855679 View commit details
    Browse the repository at this point in the history
  25. test: add back ubuntu check for linux

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    9daeaf0 View commit details
    Browse the repository at this point in the history
  26. src: call IsSingleExecutable() before FindSingleExecutableCode()

    This also serves as a workaround for nodejs/postject#70.
    
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    bf4e519 View commit details
    Browse the repository at this point in the history
  27. lib: expose require without fs access

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    a4ac355 View commit details
    Browse the repository at this point in the history
  28. src: wrap macho_segment_name assignment into a pre-processor for macOS

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    13dd503 View commit details
    Browse the repository at this point in the history
  29. test: detect Ubuntu by parsing '/etc/os-release'

    `os.version()` might contain the `Ubuntu` substring.
    
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    ea4a139 View commit details
    Browse the repository at this point in the history
  30. test: set utf8 encoding while reading

    Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
    RaisinTen and aduh95 committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    5664222 View commit details
    Browse the repository at this point in the history
  31. fixup! test: detect Ubuntu by parsing '/etc/os-release'

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    3a42a29 View commit details
    Browse the repository at this point in the history
  32. Apply suggestions from code review

    Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
    RaisinTen and aduh95 committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    0eb3dee View commit details
    Browse the repository at this point in the history
  33. test: fix lint error

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    925775c View commit details
    Browse the repository at this point in the history
  34. doc: use "node binary" instead of just "binary"

    Refs: https://github.com/nodejs/node/pull/45038/files#r1099874091
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    e841b26 View commit details
    Browse the repository at this point in the history
  35. doc: add note about linux support

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    aca1db7 View commit details
    Browse the repository at this point in the history
  36. src: use external string

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    e51708d View commit details
    Browse the repository at this point in the history
  37. src: move all SEA code to per_process::sea in node_sea.cc

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    2ad8e30 View commit details
    Browse the repository at this point in the history
  38. src: add TODO for non-ASCII character inputs

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    2c6bb38 View commit details
    Browse the repository at this point in the history
  39. src: create sea binding

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    eceb1f7 View commit details
    Browse the repository at this point in the history
  40. src: add a TODO to reuse LoadEnvironment

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    732b4e0 View commit details
    Browse the repository at this point in the history
  41. src: use UnionBytes insteda of extending from ExternalOneByteStringSi…

    …ngleExecutableCode
    
    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    a1b2643 View commit details
    Browse the repository at this point in the history
  42. src: avoid storing sea statics globally

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    b62393b View commit details
    Browse the repository at this point in the history
  43. doc: move the second para above the first one

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    4d118cf View commit details
    Browse the repository at this point in the history
  44. doc: nodejs#45038 (comment)

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    b040491 View commit details
    Browse the repository at this point in the history
  45. doc: nodejs#45038 (comment)

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    b4ab7f0 View commit details
    Browse the repository at this point in the history
  46. build: add TODO comment to node.gyp

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    17a019d View commit details
    Browse the repository at this point in the history
  47. doc: nodejs#45038 (comment)

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    ec052a1 View commit details
    Browse the repository at this point in the history
  48. test: skip asan build only on linux

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    c3c1ace View commit details
    Browse the repository at this point in the history
  49. test: move sea script to test/fixtures

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    2aee17f View commit details
    Browse the repository at this point in the history
  50. test: use execFileSync instead of execSync

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    d711de1 View commit details
    Browse the repository at this point in the history
  51. Update test/parallel/test-single-executable-application.js

    Co-authored-by: Anna Henningsen <github@addaleax.net>
    RaisinTen and addaleax committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    e8819fb View commit details
    Browse the repository at this point in the history
  52. Apply suggestions from code review

    Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>
    RaisinTen and joyeecheung committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    5c7bdfd View commit details
    Browse the repository at this point in the history
  53. src: remove per_process nesting for the sea namespace

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    44930d7 View commit details
    Browse the repository at this point in the history
  54. fixup! Apply suggestions from code review

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    1747349 View commit details
    Browse the repository at this point in the history
  55. doc: move technical details below

    Refs: https://github.com/nodejs/node/pull/45038/files#r1102129105
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    308418e View commit details
    Browse the repository at this point in the history
  56. src: fix bug from UnionBytes going out of scope

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    daa8f4d View commit details
    Browse the repository at this point in the history
  57. src: add TODO for using 1 byte strings for ASCII-only sources

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    132bfcd View commit details
    Browse the repository at this point in the history
  58. Update doc/api/single-executable-applications.md

    Co-authored-by: Rich Trott <rtrott@gmail.com>
    RaisinTen and Trott committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    a0117da View commit details
    Browse the repository at this point in the history
  59. Update doc/api/single-executable-applications.md

    Co-authored-by: Rich Trott <rtrott@gmail.com>
    RaisinTen and Trott committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    dfa4272 View commit details
    Browse the repository at this point in the history
  60. Update doc/api/single-executable-applications.md

    Co-authored-by: Rich Trott <rtrott@gmail.com>
    RaisinTen and Trott committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    aef7e26 View commit details
    Browse the repository at this point in the history
  61. Update doc/api/single-executable-applications.md

    Co-authored-by: Rich Trott <rtrott@gmail.com>
    RaisinTen and Trott committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    d63ebf1 View commit details
    Browse the repository at this point in the history
  62. Update doc/api/single-executable-applications.md

    Co-authored-by: Rich Trott <rtrott@gmail.com>
    RaisinTen and Trott committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    6f6b7c0 View commit details
    Browse the repository at this point in the history
  63. Update doc/api/single-executable-applications.md

    Co-authored-by: Rich Trott <rtrott@gmail.com>
    RaisinTen and Trott committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    04842d0 View commit details
    Browse the repository at this point in the history
  64. fixup! Update doc/api/single-executable-applications.md

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    aaa4b1b View commit details
    Browse the repository at this point in the history
  65. Update doc/api/single-executable-applications.md

    Co-authored-by: Rich Trott <rtrott@gmail.com>
    RaisinTen and Trott committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    0ad4016 View commit details
    Browse the repository at this point in the history
  66. doc: add explanation to clarify the steps

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    7ebf905 View commit details
    Browse the repository at this point in the history
  67. build: use postect-api.h from deps

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    eecf141 View commit details
    Browse the repository at this point in the history
  68. Apply suggestions from code review

    Co-authored-by: Colin Ihrig <cjihrig@gmail.com>
    RaisinTen and cjihrig committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    8201ef9 View commit details
    Browse the repository at this point in the history
  69. fixup! Apply suggestions from code review

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    c276f2e View commit details
    Browse the repository at this point in the history
  70. doc: clarify platform support

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    7fff038 View commit details
    Browse the repository at this point in the history
  71. test: use fixtures helper for postject CLI path

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    824945b View commit details
    Browse the repository at this point in the history
  72. src: explain POSTJECT_SENTINEL_FUSE macro

    Refs: nodejs#45038 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    b4a22ba View commit details
    Browse the repository at this point in the history
  73. test: skip on --with-intl=system-icu

    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    e454d1b View commit details
    Browse the repository at this point in the history