FS#60533 - [netbeans] Looking for netbeans.clusters file in wrong directory

Attached to Project: Community Packages
Opened by Michael (lanternglow) - Monday, 22 October 2018, 15:48 GMT
Last edited by Santiago Torres (sangy) - Tuesday, 23 October 2018, 04:18 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Santiago Torres (sangy)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
netbeans fails to start because it is looking for the netbeans.clusters file in //etc/netbeans.clusters
but the file is actually installed to /usr/etc/netbeans.clusters

Additional info:
* package version(s): netbeans-9.0-1-any
* config and/or log files etc.


Steps to reproduce:
I upgraded from netbeans-8.2-1-any and was unable to launch netbeans after that.
This task depends upon

Closed by  Santiago Torres (sangy)
Tuesday, 23 October 2018, 04:18 GMT
Reason for closing:  Upstream
Comment by Santiago Torres (sangy) - Monday, 22 October 2018, 15:58 GMT
Hmm, interesting. I can't seem to reproduce on certain setups.

I could you share more information about your setup from netbeans 8.2.1. Also, could you try installing netbeans 9.0-2 from community-testing?
Comment by Michael (lanternglow) - Monday, 22 October 2018, 23:43 GMT
With netbeans 8.2 installed, I have netbeans.conf files in both /usr/share/netbeans/etc/netbeans.conf and ~/.netbeans/8.2/etc/netbeans.conf. Both of them look like mostly comments.

Here is the non-comment version of the global netbeans.conf

$ grep -v '^#' /usr/share/netbeans/etc/netbeans.conf
netbeans_default_userdir="${DEFAULT_USERDIR_ROOT}/8.2"
netbeans_default_cachedir="${DEFAULT_CACHEDIR_ROOT}/8.2"
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true"


Once I upgrade to netbeans 9.0, I find that I no longer have /usr/share/netbeans/etc/netbeans.conf.

$ ls /usr/share/netbeans/etc/netbeans.conf
ls: cannot access '/usr/share/netbeans/etc/netbeans.conf': No such file or directory

Downgrading back to 8.2 re-creates the /usr/share/netbeans/etc/netbeans.conf file.

I will try installing 9.0-2 shortly. (have to look up the instructions for adding community-testing for one package. BRB)

If you need any more specific information on the configuration of my computer, let me know.
Comment by Santiago Torres (sangy) - Tuesday, 23 October 2018, 00:02 GMT
if you get a chance, could you run:

`
bash -x $(which netbeans)
`

I believe that for some reason the new launcher isn't setting ${basedir} in all cases...
Comment by Michael (lanternglow) - Tuesday, 23 October 2018, 00:38 GMT
Updating to netbeans 9.0-2 did not help. Still missing /usr/share/netbeans/etc/netbeans.conf and still getting the 'Cannot read cluster file: //etc/netbeans.clusters' error.

I also notice that I am missing the entire /usr/share/netbeans directory, not just the netbeans.conf file.

I also found the netbeans.conf file in /usr/lib/netbeans/etc/netbeans.conf. I am not sure if it is supposed to be in both places or not.

# find / -name netbeans.conf 2> /dev/null
/usr/lib/netbeans/etc/netbeans.conf
~/.netbeans/8.2/etc/netbeans.conf
Comment by Michael (lanternglow) - Tuesday, 23 October 2018, 00:42 GMT
$ bash -x $(which netbeans)
+ PRG=/bin/netbeans
+ '[' -h /bin/netbeans ']'
++ dirname /bin/netbeans
+ progdir=/bin
++ pwd
+ old=/home/mike
+ cd /bin/..
++ pwd
+ basedir=/
+ cd /home/mike
+ case "`uname`" in
++ uname
+ DEFAULT_USERDIR_ROOT=/home/mike/.netbeans
+ DEFAULT_CACHEDIR_ROOT=/home/mike/.cache/netbeans
+ '[' -f //etc/netbeans.conf ']'
+ export DEFAULT_USERDIR_ROOT
+ userdir=
+ cachedir=
+ founduserdir=
+ foundcachedir=
+ '[' -f /etc/netbeans.conf ']'
+ '[' '!' -f //etc/netbeans.clusters ']'
+ echo Cannot read cluster file: //etc/netbeans.clusters
Cannot read cluster file: //etc/netbeans.clusters
+ exit 1
Comment by Santiago Torres (sangy) - Tuesday, 23 October 2018, 01:05 GMT
ha, so that's why. It uses the current binary name to figure out where the clusters file is located (for some reason that's beyond me). The binary is installed to /usr/bin/netbeans, so it should find it on /usr/etc/netbeans.clusters.

Your binary is resolving to /bin/netbeans for some reason, which ends up with this screwup. It appears they made code to follow symlinks in the binary name, but not in the parent directories.

I'm not entirely sure as to what's the best way to fix this issue on the packaging side though. One temporal solution would be to run as /usr/bin/netbeans...
Comment by Michael (lanternglow) - Tuesday, 23 October 2018, 01:26 GMT
Which is really crazy since on Arch Linux /bin is just a symlink to /usr/bin.

And yes, running
$ /usr/bin/netbeans
works just fine.

Thanks much. I will use the workaround until I figure out how to fix my problem with the path resolution.
Comment by Eli Schwartz (eschwartz) - Tuesday, 23 October 2018, 01:28 GMT
On Linux distributions that have implemented the https://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge/ you should *NOT* have /bin in your $PATH

Loading...