This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 179662 - unsupported switch passed to Sun's grep
Summary: unsupported switch passed to Sun's grep
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Launchers&CLI (show other bugs)
Version: 6.x
Hardware: All All
: P2 normal (vote)
Assignee: Jaroslav Tulach
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-19 04:29 UTC by Thomas Preisler
Modified: 2010-03-19 20:53 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
platform/lib/boot.jar (329.91 KB, application/octet-stream)
2010-02-02 23:57 UTC, Jaroslav Tulach
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Preisler 2010-01-19 04:29:41 UTC
Originally 6917708:

When running the /.../100101/inst/intel-S2/ build on opensolaris b130/x86 I noticed the below messages in the command line suggesting Sun grep is called instead of gnu grep somewhere.
I am not aware what action trigerred these messages though. I was running the GUI, browsing various C++ sources.


$ sunstudio
/bin/grep: illegal option -- q
Usage: grep -hblcnsviw pattern file . . .
/bin/grep: illegal option -- q
Usage: grep -hblcnsviw pattern file . . .
*** (#1 of 1): 2010-01-18 05:03:04 PST pavel heimlich
Comment 1 Thomas Preisler 2010-01-19 04:30:51 UTC
No clear who is running this command. Making it a P2 until we know and understand what feature may be affected.
Comment 2 Thomas Preisler 2010-01-19 06:13:01 UTC
It may come from Netbean's startup code nbexec:

d-spblab-32-168[567] pwd
/Users/thp/netbeans-dev/cnd-main/nbbuild/netbeans/platform11/lib
d-spblab-32-168[568] grep "grep -q" *
nbexec:        if /bin/grep -q 'ProxyType=1' "$kioslaverc" ; then
nbexec:            if /bin/grep -q 'ProxyType=0' "$kioslaverc" ; then
nbexec:    if /usr/bin/grep -q "ProxyAuto.*: *1" ${scutil_out} >/dev/null ; then
nbexec:    if /usr/bin/grep -q "HTTPEnable *: *1" ${scutil_out} ; then
Comment 3 Peter Pis 2010-01-22 02:00:35 UTC
Reassigning to platform for further evaluation.
Comment 4 Jaroslav Tulach 2010-02-02 23:41:18 UTC
platform/lib/nbexec contains -q. Please suggest replacement.
Comment 5 Jaroslav Tulach 2010-02-02 23:57:39 UTC
Created attachment 93783 [details]
platform/lib/boot.jar
Comment 6 Victor Vasilyev 2010-02-03 07:28:25 UTC
A suggestion for the portable shell scripts is described here:
http://www.gnu.org/software/grep/manual/grep.html#General-Output-Control

"... 
Portability note: unlike gnu grep, 7th Edition Unix grep did not conform to posix, because it lacked ‘-q’ and its ‘-s’ option behaved like gnu grep's ‘-q’ option.
...
Portable shell scripts should avoid both ‘-q’ and ‘-s’ and should redirect standard and error output to /dev/null instead. (‘-s’ is specified by posix.) 
"
Comment 7 Jaroslav Tulach 2010-02-03 11:01:14 UTC
OK, thanks for the hint. I tried: core-main#177373b33a05. Works for me on Linux, Thomas shall however test it on Solaris.
Comment 8 Quality Engineering 2010-02-03 21:50:00 UTC
Integrated into 'main-golden', will be available in build *201002040200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/177373b33a05
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #179662: Sending output to /dev/null, instead of using grep -q
Comment 9 Thomas Preisler 2010-02-04 13:17:05 UTC
The code change looks good, but not sure I know how to test it. I didn't report the problem and I have never noticed it myself. The report came from Sun's internal bug report system as CR 6917708.
Comment 10 dlipin 2010-02-05 04:26:39 UTC
Victor, could you please check on your OpenSolaris system? Thanks.
Comment 11 Victor Vasilyev 2010-02-08 07:01:29 UTC
Dmitry,

I've tested behavior of the statements that are used in the script on OpenSolaris. 
As expected the redirecting of output to the /dev/null instead of the '-q' option is working well for a non-GNU version of the grep command.

But, unfortunately I can't help with full testing of the use cases. 

There are at least two use cases (i.e. environments) where the fixed statements will be used:

1. OpenSolaris + KDE
2. Mac OS

I have not such environments installed.

Full testing should also rely on launch of the script from sunstudio, but not netbeans.
Comment 12 hajma 2010-02-08 08:10:26 UTC
Hi,
if the fix consists in applying the changeset to 
/opt/sunstudio12.1/netbeans/platform9/lib/nbexec
and
/opt/sunstudio12.1/prod/nb-dbxtool/platform9/lib/nbexec

then I can do that for KDE/opensolaris
Comment 13 Thomas Preisler 2010-02-16 08:55:47 UTC
Please also provide a patch for this fix in 6.8. Sun Studio is based on 6.8 and mainly used on Solaris.
Comment 14 pgebauer 2010-03-02 13:52:32 UTC
Could QE verify this issue in the trunk in order that it can be ported into the release68_fixes branch?
Comment 15 rbalada 2010-03-09 09:58:35 UTC
Notes related to the patch:
#1 Looks good and passed my eye-review
#2 Due to the nature of the launcher for release68_fixes repository it *must* be accompanied by a patch to o.n.bootstrap/nbproject/project.properties to add a line "nbm.is.global=true" to enforce installation in <installdir> instead of <userdir>. IDE launcher does not look for Platform launcher in <userdir>.
#3 It's explicitly *forbidden* to set hard dependency on this new version of o.n.bootstrap module as it could cause cascaded unsatisfied dependency issues when it would not be possible to install this update due to insufficient permissions to modify <installdir>'s filesystem (so called root-user scenario).

#4 Little nitpicking - choose either /bin/grep or /usr/bin/grep and use just that one
Comment 16 pgebauer 2010-03-12 10:30:35 UTC
The whiteboard 68patch-candidate has been removed based on the internal discussion. The issue is fixed in the trunk and it will be part of upcoming IDE release. There are no plans to port the fix into the NetBeans IDE 6.8.