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 249287 - Keyring for GNOME (Seahorse) fails, usage of unknown environment variables
Summary: Keyring for GNOME (Seahorse) fails, usage of unknown environment variables
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Keyring (show other bugs)
Version: 8.0.2
Hardware: PC Linux
: P2 normal with 2 votes (vote)
Assignee: Libor Fischmeistr
URL:
Keywords:
: 249874 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-12-11 10:27 UTC by jhoschi
Modified: 2015-04-24 12:39 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
logfile (1.78 KB, text/plain)
2014-12-11 10:27 UTC, jhoschi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jhoschi 2014-12-11 10:27:11 UTC
Created attachment 151038 [details]
logfile

Hello!

I'm using Archlinux with a regular GNOME 3.14, so my keyring is provided through the Login and Seahorse. NetBeans fails, at least since "8.0.0" to use the keyring.

As you can see in the provided logfile, NetBeans tries to use a obsolete or unknown environment variable "GNOME_KEYRING_" to check if Seahorse is active[1]. The usage of the variable(s) in NetBeans just looks like a  addidional sanity check to avoid throwing exceptions[2]. 

I suggest merely removing this lines from the code to fix the issue:
        boolean envVarSet = false;
        for (String key : System.getenv().keySet()) {
            if (key.startsWith("GNOME_KEYRING_")) { // NOI18N
                envVarSet = true;
                break;
            }
        }
        if (!envVarSet) {
            LOG.fine("no GNOME_KEYRING_* environment variable set");
            return false;
        }


As temporary workaround I just exported a the variable "GNOME_KEYRING_":
$ export GNOME_KEYRING_=foobar
$ netbeans # passes now sanity check

Thank you


[1]http://ftp.gnome.org/pub/GNOME/sources/gnome-keyring/3.11/gnome-keyring-3.11.92.changes
[2]http://opensourcejavaphp.net/java/netbeans/org/netbeans/modules/keyring/gnome/GnomeProvider.java.html
Comment 1 mitya 2014-12-20 18:46:35 UTC
According to [1], the GNOME_KEYRING_* variables are not set anymore if XDG_RUNTIME_DIR is present (which is valid for most modern distros). As a workaround, one can export GNOME_KEYRING_CONTROL=$XDG_RUNTIME_DIR/keyring/control before starting NetBeans.
Comment 2 mitya 2014-12-20 19:11:59 UTC
Indeed, it turned out that it's not necessary to set GNOME_KEYRING_CONTROL to anything meaningful. I guess all the actual work is done through libgnome-keyring.so JNA wrapper, which handles everything correctly independently of GNOME_KEYRING_CONTROL not being set.

The only thing we need to do is check that gnome-keyring-daemon is running and "Login" keyring is unlocked. This could be done similarly to KDE Wallet counterpart:

gdbus call --session --dest org.gnome.keyring --object-path /org/freedesktop/secrets/collection/login --method org.freedesktop.DBus.Properties.Get org.freedesktop.Secret.Collection Locked

or:

dbus-send --print-reply --dest=org.gnome.keyring /org/freedesktop/secrets/collection/login org.freedesktop.DBus.Properties.Get string:org.freedesktop.Secret.Collection string:Locked

These invocations should neither fail nor return true.
Comment 3 Ralph Ruijs 2015-01-27 10:33:05 UTC
*** Bug 249874 has been marked as a duplicate of this bug. ***
Comment 4 dilt100 2015-03-14 06:55:41 UTC
Hi,

I'm also effected by this.

My system is...
Product Version = NetBeans IDE 8.0.2 (Build 201411181905) (#8230772f5f18)
  Operating System = Linux version 3.18.8-201.fc21.x86_64 running on amd64
  Java; VM; Vendor = 1.8.0_31; OpenJDK 64-Bit Server VM 25.31-b07; Oracle Corporation
  Runtime = OpenJDK Runtime Environment 1.8.0_31-b13
  Java Home = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.31-5.b13.fc21.x86_64/jre
  System Locale; Encoding = en_US (nb); UTF-8

I tried the suggestion on Comment2 but did not work for me.

On my system both GNOME_KEYRING_CONTROL and GNOME_KEYRING_PID have to be set and should be valid.

So i added below two lines to my .bash_profile,
export GNOME_KEYRING_CONTROL=$XDG_RUNTIME_DIR/keyring/control
export GNOME_KEYRING_PID=`pidof gnome-keyring-daemon`

Dose anyone know when the FIX that is suggested in Comment2 is going to be implemented?

If anyone needs more data for analisys pls let me know.

Thank you.
Comment 5 Libor Fischmeistr 2015-03-16 14:17:49 UTC
Fixed - http://hg.netbeans.org/core-main/rev/7ac3a0c76eec

I would like to ask all interested to verify the fix. I've only removed the check of the GNOME_KEYRING variable - I think it isn't necessary to check it because the library is used and is also checked.

The suggestion from comment 2 would not work, because the keyring can be also unlocked and is still available...
Comment 6 dilt100 2015-03-17 08:10:34 UTC
Sorry to sound like a noob..... But, could someone please tell me how to test this.

I'm not a developer of netbeans. Just a user using it for PHP development.

Thank you.
Comment 7 Libor Fischmeistr 2015-03-17 08:23:31 UTC
(In reply to dilt100 from comment #6)
> Sorry to sound like a noob..... But, could someone please tell me how to
> test this.
> 
> I'm not a developer of netbeans. Just a user using it for PHP development.
> 
> Thank you.

Hi, just try something in IDE that handles password. I usually test it on SVN - only try to checkout some repo and let IDE remember password. If the proper keyring app appears and there is nothing suspicious in the IDE log, you can consider it success. The IDE should not use the default (internal) keyring...

Thanks
Comment 8 dilt100 2015-03-17 08:47:27 UTC
Oops maybe i didn't make my self clear.

I do know how to test if the error gets triggered.

What i was asking for is, how do i apply this FIX? Do i download the latest netbeand? do need to build the latest netbeans from source?

Thank you...
Comment 9 Libor Fischmeistr 2015-03-17 08:52:08 UTC
(In reply to dilt100 from comment #8)
> Oops maybe i didn't make my self clear.
> 
> I do know how to test if the error gets triggered.
> 
> What i was asking for is, how do i apply this FIX? Do i download the latest
> netbeand? do need to build the latest netbeans from source?
> 
> Thank you...

My fault, sorry for misunderstanding.

This patch is not in the daily builds yet. When it is be available, the comment from Quality Engineering will appear here. Then it will be available in the daily build.
Comment 10 dilt100 2015-04-24 11:29:29 UTC
(In reply to Libor Fischmeistr from comment #9)
> (In reply to dilt100 from comment #8)
> > Oops maybe i didn't make my self clear.
> > 
> > I do know how to test if the error gets triggered.
> > 
> > What i was asking for is, how do i apply this FIX? Do i download the latest
> > netbeand? do need to build the latest netbeans from source?
> > 
> > Thank you...
> 
> My fault, sorry for misunderstanding.
> 
> This patch is not in the daily builds yet. When it is be available, the
> comment from Quality Engineering will appear here. Then it will be available
> in the daily build.

Hi again,

Just wanted to check when this patch would be in the daily builds.

It's been more than a month since you patched this.

Thank you...
Comment 11 Libor Fischmeistr 2015-04-24 12:39:40 UTC
(In reply to dilt100 from comment #10)
> Hi again,
> 
> Just wanted to check when this patch would be in the daily builds.
> 
> It's been more than a month since you patched this.
> 
> Thank you...

Hi, should be in daily build now.