You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "sid-srini (via GitHub)" <gi...@apache.org> on 2024/10/24 14:27:11 UTC
[PR] Fix NetBeans launch failure on unix shell for arguments with quotes et al [netbeans]
sid-srini opened a new pull request, #7908:
URL: https://github.com/apache/netbeans/pull/7908
**Issue**
When NetBeans is launched on *nix shell with arguments that contain special characters like quotes, spaces, $ and backticks, then it may fail or not receive the arguments correctly.
The launcher scripts are:
- java/java.lsp.server/script/bin/nbcode
- platform/o.n.bootstrap/launcher/unix/nbexec
The cause is due to incomplete escaping of the special characters before quoting the argument.
Examples:
- `--jdkhome "$HOME/openjdk's jdkhome"`
- `--jdkhome '/home/user/tools/jdk "23"'`
- `--jdkhome /c/Program\ Files/Java/jdk`
- `--userdir "/mnt/user's macbook pro/Users/user/Library/Application Support/NetBeans"`
- `-Dnetbeans.extra.dirs="nb-dev\$old/extras/plugin1:nb-dev\$old/extras/plugin2:ext/My Plugins/quo\"'d"`
Further, a discrepancy is created between the argument strings passed on a Windows host (using the launcher exe/dll) and *nix hosts.
**Fix**
1. Ensure that all arguments are quoted before passing forward to the executable launch.
- This is implemented similar to other open-source build tools.
- Example: [ant](https://github.com/apache/ant/blob/master/src/script/ant#L63)
2. Ensure that the special characters ' " $ ` in the argument are escaped according to the quoting being performed.
3. Consistently use `eval` with arguments single-quoted and parameter substitution within it being double-quoted.
- This makes `nbexec` similar to the `nbcode` script
4. Updated the unit test for `nbexec`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Fix NetBeans launch failure on unix shell for arguments with quotes et al [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on PR #7908:
URL: https://github.com/apache/netbeans/pull/7908#issuecomment-4453689074
@sid-srini thanks for your reply. I wanted to ensure that testing was done with the NetBeans IDE. You confirmed that.
I intent to merge this some time next week, so it gets in early in the NB31 cycle and has time to settle should something break.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Fix NetBeans launch failure on unix shell for arguments with quotes et al [netbeans]
Posted by "sid-srini (via GitHub)" <gi...@apache.org>.
sid-srini commented on PR #7908:
URL: https://github.com/apache/netbeans/pull/7908#issuecomment-2466166579
@neilcsmith-net - Please review this PR whenever its possible for you, and provide any suggestions for it. Thank you.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Fix NetBeans launch failure on unix shell for arguments with quotes et al [netbeans]
Posted by "sid-srini (via GitHub)" <gi...@apache.org>.
sid-srini commented on PR #7908:
URL: https://github.com/apache/netbeans/pull/7908#issuecomment-2736522457
I've rebased the PR against the current `master`. Please do trigger CI tests and review this PR. Thank you.
cc: @neilcsmith-net, @mbien, @dbalek, @sdedic.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Fix NetBeans launch failure on unix shell for arguments with quotes et al [netbeans]
Posted by "sid-srini (via GitHub)" <gi...@apache.org>.
sid-srini commented on PR #7908:
URL: https://github.com/apache/netbeans/pull/7908#issuecomment-3265768475
I've rebased the PR against the current master. Please do trigger CI tests and review this PR. Thank you.
cc: @neilcsmith-net, @mbien, @dbalek, @sdedic.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Fix NetBeans launch failure on unix shell for arguments with quotes et al [netbeans]
Posted by "sid-srini (via GitHub)" <gi...@apache.org>.
sid-srini commented on PR #7908:
URL: https://github.com/apache/netbeans/pull/7908#issuecomment-3211676278
I've rebased the PR against the current master. Please do trigger CI tests and review this PR. Thank you.
cc: @neilcsmith-net, @mbien, @dbalek, @sdedic.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Fix NetBeans launch failure on unix shell for arguments with quotes et al [netbeans]
Posted by "sid-srini (via GitHub)" <gi...@apache.org>.
sid-srini commented on PR #7908:
URL: https://github.com/apache/netbeans/pull/7908#issuecomment-4439238139
Hi @matthiasblaesing. Thanks for taking a look at this. Please find my responses below.
> This seems to work for NetBeans IDE. But what makes me nervous is:
>
> * the problems are not reproducible with the NetBeans IDE with an older master build
I do not know which older master build did not have these problems reproducible. I have seen this for releases since the last 2-3 years.
> * the NetBeans IDE launcher is missing from the launcher enumeration
The NetBeans IDE launcher `nb/ide.launcher/unix/netbeans` is essentially invoking the launcher script covered in this PR i.e. `platform/o.n.bootstrap/launcher/unix/nbexec`.
The IDE launcher script is a wrapper that performs basic parsing and addition of some extra platform-specific options to the command-line for `nbexec`. The IDE launcher uses eval with `'"$@"'` that will pass forward the user-input arguments literally.
The IDE launcher also utilizes env variable values defined in the IDE's `netbeans.conf` file which are populated by the build and mostly do not have such problems. A glitch may occur when the user installs NetBeans in a location like the examples given in the PR description, causing basedir to have such a value. Nonetheless, these are more controlled settings unlike the general user input on the command line.
If you prefer similar changes may be added in the wrapper for the default options read from `netbeans.conf`.
> * the problems are not reproduible with the NetBeans IDE with this applied
>
> So what testing was done with the IDE?
The problems are not reproducible with the NetBeans IDE with this fix applied.
The testing up till now has been done via:
- the unit tests for nbexec
- manual tests for launching the IDE on command-line with example test values like those given in the PR description, as well as with some non-problematic values.
One thing to note is that problematic values with only spaces and not any of the other special characters is handled fine by the IDE launch i.e. nbexec, which used to be a problem with the other launcher that has been removed since NB28.
Please let me know what you think. Thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Fix NetBeans launch failure on unix shell for arguments with quotes et al [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing merged PR #7908:
URL: https://github.com/apache/netbeans/pull/7908
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Fix NetBeans launch failure on unix shell for arguments with quotes et al [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on PR #7908:
URL: https://github.com/apache/netbeans/pull/7908#issuecomment-4454843454
please rebase before merge. branch is ~8 month old by now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Fix NetBeans launch failure on unix shell for arguments with quotes et al [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on PR #7908:
URL: https://github.com/apache/netbeans/pull/7908#issuecomment-4467014444
@sid-srini @mbien is right, it makes sense to do a rebase before merging. Could you please do so and update the PR to that state?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Fix NetBeans launch failure on unix shell for arguments with quotes et al [netbeans]
Posted by "sid-srini (via GitHub)" <gi...@apache.org>.
sid-srini commented on PR #7908:
URL: https://github.com/apache/netbeans/pull/7908#issuecomment-4487310205
Thanks @mbien and @matthiasblaesing. I have rebased the branch to the current master which includes the post NB30 sig files etc.
Additional minor changes:
- I have also added an additional unit test for checking `-J` options handling.
- A couple of lines that were missed in the earlier nbexec changes; specifically setting of `netbeans.home` property and in `look_for_new_clusters()`, which would not impact a typical NetBeans IDE installation.
Please re-run the CI tests and re-review this PR before proceeding to merge. Thanks a lot.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Fix NetBeans launch failure on unix shell for arguments with quotes et al [netbeans]
Posted by "sid-srini (via GitHub)" <gi...@apache.org>.
sid-srini commented on PR #7908:
URL: https://github.com/apache/netbeans/pull/7908#issuecomment-2499801436
@neilcsmith-net, @mbien - Please review this PR whenever earliest its possible for you, along with any suggestions for improvement. Thank you.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Fix NetBeans launch failure on unix shell for arguments with quotes et al [netbeans]
Posted by "sid-srini (via GitHub)" <gi...@apache.org>.
sid-srini commented on PR #7908:
URL: https://github.com/apache/netbeans/pull/7908#issuecomment-4512809222
Thanks a lot @matthiasblaesing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists