Skip to content

Refactor DBus Connection Initialization - #9

Merged
overheadhunter merged 9 commits into
cryptomator:developfrom
purejava:fix/6-code-improvement
Jun 7, 2021
Merged

overheadhunter merged 9 commits into
cryptomator:developfrom
purejava:fix/6-code-improvement

Conversation

@purejava

Copy link
Copy Markdown
Contributor

Fixes #6

try {
return DBusConnection.getConnection(DBusConnection.DBusBusType.SESSION);
} catch (RuntimeException e) {
if ("Cannot Resolve Session Bus Address".equals(e.getMessage())) {

@overheadhunter overheadhunter Feb 11, 2021 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is very prone to unnoticed changes in upstream exception handling. If the message changes, the code stops working.

Can we instead add an explicit (checked) exception to DBusConnection?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not possible, see hypfvieh/dbus-java#128.

This issue is already handled in dbus-java (without a new release), but the changed also needs to find its way into kdewallet.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok. Would you say we can wait with this PR until we get an upstream version without the RuntimeException?

@overheadhunter overheadhunter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oh wait, didn't see the pom.xml conflict :D please do a reverse merge first

@purejava

Copy link
Copy Markdown
Contributor Author

I think we need a new version of secret-service first, don't we? 😃

@overheadhunter

Copy link
Copy Markdown
Member

I think we need a new version of secret-service first, don't we? 😃

Do we? The suggested change affects KDE only, so...?

@purejava

Copy link
Copy Markdown
Contributor Author

Do we? The suggested change affects KDE only, so...?

Well, Infeo asked both of us for an update.

And as far as I know you @overheadhunter, having secret-service and kdewallet depend on two different versions of dbus-java would lead to two dbus-java jar files within the AppImage and therefore unneccessarily wasted disc space. 😁😛 (sorry, could not hold back that one)

I wonder if Maven can manage that, but I think so.

@overheadhunter

Copy link
Copy Markdown
Member

Well, Maven will pull in just one version. So as long as the API didn't change, we should be fine.
I'd prefer one PR per implementation. But we better merge both at the same time, just in case.

@swiesend

Copy link
Copy Markdown
Contributor

I released 1.6.1, which depends on dbus-java 3.3.0 and fixes the auto-close behavior for swiesend/secret-service#26, but that should not affect the usage in any way.

@purejava can you also remove the ExceptionInInitializerError | RuntimeException here please:

} catch (IOException | ExceptionInInitializerError | RuntimeException e) {

and I think you have to rebase, too: This branch is 4 commits ahead, 19 commits behind cryptomator:develop.

@purejava

purejava commented Apr 17, 2021 •

Copy link
Copy Markdown
Contributor Author

That should be it.
I did a git pull --rebase cryptomator/integrations-linux develop, changed the catch clause as @swiesend requested and adjusted the dependency versions in the pom. I am pretty confident, that I've chosen the right ones 😅.

On solving the merge conflict in the pom I made a mistake and reverted the removed Bintray entries in the pom. That's the reason for the last commit.

@swiesend

swiesend commented Apr 17, 2021 •

Copy link
Copy Markdown
Contributor

I am pretty confident, that I've chosen the right ones 😅.

Because you have seen what I did in 1.6.0 and nobody would be able to use it?! 😅 I even introduced a regression test to not be able to remove the public keyword from the SimpleCollection constructor again by accident...

@overheadhunter or @infeo sorry for the off-topic: Please, let me know if there are any problems with 1.6.1, as I am currently not able to build a Cryptomator version from master with java 16, that would start properly. The log is fine, but the JavaFX Application does not show up at all. Is this a know issue as I could not find an open one?! The only sensible hint I have is, that my system may need additional GTK libs installed: Gtk-Message: 16:01:43.900: Failed to load module "canberra-gtk-module", but I did that and it still does not work.

@overheadhunter

Copy link
Copy Markdown
Member

I am currently not able to build a Cryptomator version from master with java 16, that would start properly. The log is fine, but the JavaFX Application does not show up at all. Is this a know issue as I could not find an open one?! The only sensible hint I have is, that my system may need additional GTK libs installed: Gtk-Message: 16:01:43.900: Failed to load module "canberra-gtk-module", but I did that and it still does not work.

Nothing that I am aware of. Does the latest AppImage run? If yes, you should be able to --appimage-extract it and simply replace the required jars. Thanks to the service loader api it might even be hot-swappable 😄 (not sure if Cryptomator initializes singleton instances of the keychain stuff, though)

@purejava

purejava commented Apr 18, 2021 •

Copy link
Copy Markdown
Contributor Author

It builds and starts fine on Arch linux:

ralph@fusion main % java -version                    
java version "16" 2021-03-16
Java(TM) SE Runtime Environment (build 16+36-2231)
Java HotSpot(TM) 64-Bit Server VM (build 16+36-2231, mixed mode, sharing)
ralph@fusion main % pwd                              
/home/ralph/git/cryptomator/main
ralph@fusion main % mvn clean install -Plinux,release 
...
[INFO] --- maven-assembly-plugin:3.3.0:single (assemble-linux) @ buildkit ---
[INFO] Reading assembly descriptor: assembly-linux.xml
[INFO] Building zip: /home/ralph/git/cryptomator/main/buildkit/target/buildkit-linux.zip
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ buildkit ---
[INFO] Installing /home/ralph/git/cryptomator/main/buildkit/pom.xml to /home/ralph/.m2/repository/org/cryptomator/buildkit/1.5.14/buildkit-1.5.14.pom
[INFO] Installing /home/ralph/git/cryptomator/main/buildkit/target/buildkit-linux.zip to /home/ralph/.m2/repository/org/cryptomator/buildkit/1.5.14/buildkit-1.5.14.zip
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Cryptomator 1.5.14:
[INFO] 
[INFO] Cryptomator ........................................ SUCCESS [  0.252 s]
[INFO] Cryptomator Commons ................................ SUCCESS [  6.312 s]
[INFO] Cryptomator GUI .................................... SUCCESS [  7.346 s]
[INFO] Cryptomator Launcher ............................... SUCCESS [  3.688 s]
[INFO] Cryptomator Build Kit .............................. SUCCESS [  1.084 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  18.819 s
[INFO] Finished at: 2021-04-18T12:32:53+02:00
[INFO] ------------------------------------------------------------------------
ralph@fusion main % cd buildkit/target 
ralph@fusion target % chmod 0755 launcher-linux.sh
ralph@fusion target % ./launcher-linux.sh

What is your system @swiesend?

@infeo

infeo commented Apr 21, 2021 •

Copy link
Copy Markdown
Member

I'd prefer one PR per implementation. But we better merge both at the same time, just in case.

I second that. Just found an issue in secret-service 1.6.1. @purejava can you revert bumping secret-service dependency?

@purejava

Copy link
Copy Markdown
Contributor Author

I second that. Just found an issue in secret-service 1.6.1. @purejava can you revert bumping secret-service dependency?

Sure. Which one is the right one? Commit 3d5ab97 changed the version from 1.5.0 to 1.6.1. On GitHub, these were the latest versions. On maven central, there are 1.5.0, 1.6.0 and 1.6.1.

What's the best one to choose @swiesend?
Thanks.

@swiesend

swiesend commented Apr 21, 2021 •

Copy link
Copy Markdown
Contributor

If there are problem with 1.6.1 we have to go back to 1.5.0. 1.6.0 was an accident.

Just found an issue in secret-service 1.6.1
I will fix this ASAP.

@swiesend

swiesend commented Apr 21, 2021 •

Copy link
Copy Markdown
Contributor

secret-service 1.6.2 is released and will check for the following services to be present:

org.freedesktop.DBus
org.freedesktop.secrets
org.gnome.keyring

We'll have a separate PR for the secret-service changes
@purejava

Copy link
Copy Markdown
Contributor Author

Hm, after reverting the secret-service dependency to 1.5.0, it cannot find the DBusConnectionException symbol any more, which comes with dbus-java 3.3.0. I don't know, why this happens.

@overheadhunter

Copy link
Copy Markdown
Member

Hm, after reverting the secret-service dependency to 1.5.0, it cannot find the DBusConnectionException symbol any more, which comes with dbus-java 3.3.0. I don't know, why this happens.

because

Maven will pull in just one version

If two dependencies (secret-service and kdewallet) both depend on different versions of the same transitive dependency (dbus-java), Maven will choose either. If said transitive dependency introduces a breaking change, we will run into problems.

@overheadhunter
overheadhunter merged commit 632f89d into cryptomator:develop Jun 7, 2021
@purejava
purejava deleted the fix/6-code-improvement branch July 17, 2024 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor DBus Connection Initialization

4 participants