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

[JVSC-300] Remove quoting in nbcode launch arguments #301

Merged

Conversation

sid-srini
Copy link
Member

  • The nbcode executable is launched from the ts/js extension using Node's child_process.spawn function.
    • This function directly launches the command in a new process. It does NOT create a shell to execute it; unlike child_process.exec.
  • Therefore, quoting the arguments passed to prevent shell splitting is not required.
    • In fact, due to the presence of extra quotes, it may lead to incorrect splitting of arguments with spaces in them.
    • This is the cause for the initialization failure of the extension nbls when the project folder opened contains spaces in its path.
  • Fixed nbcode.ts to remove the extra quotes added for some of the option values.

Closes #300

- The nbcode executable is launched from the ts/js extension using Node's
  `child_process.spawn` function.
    - This function directly launches the command in a new process. It does
      NOT create a shell to execute it.
- Therefore, quoting the arguments passed to prevent shell splitting is
  not required.
    - In fact, due to the presence of extra quotes, it may lead to incorrect
      splitting of arguments with spaces in them.
    - This is the cause for the initialization failure of the extension
      nbls when the project folder opened contains spaces in its path.
- Fixed *nbcode.ts* to remove the extra quotes added for some of the
  option values.

Closes oracle#300

Signed-off-by: Siddharth Srinivasan <siddharth.srinivasan@oracle.com>
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 24, 2024
Copy link
Member

@Achal1607 Achal1607 left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks

@sid-srini sid-srini merged commit dfb7612 into oracle:main Oct 25, 2024
3 checks passed
@sid-srini sid-srini deleted the jvsc300_remove_quoting_in_nbcode_launch_args branch October 25, 2024 05:43
@sid-srini sid-srini added this to the JVSC 23.0.1 milestone Oct 25, 2024
@sid-srini sid-srini linked an issue Oct 29, 2024 that may be closed by this pull request
sid-srini added a commit to sid-srini/javavscode that referenced this pull request Oct 30, 2024
…t al

Backporting Netbeans PR #7908 (still under review) in order for the LSP
server launch to work for launch arguments including the project path
containing special characters like quotes, spaces, backticks and $.

This is an interim patch to mitigate the effect on user experience,
while the upstream PR is under review. It will be updated to the
approved patch, as and when it is made available.

This is partially related to oracle#301, which only fixes for spaces in
arguments.

Additionally, the same diff is applied to script/bin/nbcode which is a
copy of the netbeans java.lsp.server module's copy.

Signed-off-by: Siddharth Srinivasan <siddharth.srinivasan@oracle.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
2 participants