Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kmail: fix calling ext. applications #108824

Merged
merged 3 commits into from Jun 18, 2021

Conversation

eliasp
Copy link
Member

@eliasp eliasp commented Jan 9, 2021

KMail relies on quite a few external applications, such as:

  • kaddressbook
  • akonadiimportwizard
  • accountwizard

Without those, quite a few core functionalities of KMail aren't available, such as:

  • adding a new account to KMail
  • using the addressbook for sending a mail
  • importing existing PIM data

By providing QStandardPaths::findExecutable() the store path of said
components, this problem can be circumvented.

Motivation for this change

Make KMail work again

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@eliasp
Copy link
Member Author

eliasp commented Jan 10, 2021

Split it up now into 2 separate commits, so the actual change becomes more clear and is not obscured by the move of kmail.nixkmail/default.nix in 57f182c.

@eliasp
Copy link
Member Author

eliasp commented Mar 13, 2021

Rebased + conflicts solved.

@SuperSandro2000
Copy link
Member

ping @ttuegel

Copy link
Member

@ttuegel ttuegel left a comment

Choose a reason for hiding this comment

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

Usually, we would add the paths in the wrapper. Is there a reason we must patch the source here, instead?

@SuperSandro2000
Copy link
Member

ping @eliasp

@eliasp
Copy link
Member Author

eliasp commented Apr 10, 2021

Usually, we would add the paths in the wrapper. Is there a reason we must patch the source here, instead?

No reason - I just wasn't aware of this way. Fixed that & threw away my little more complicated approach 😄

@ofborg ofborg bot requested a review from ttuegel April 10, 2021 14:29
@SuperSandro2000
Copy link
Member

libsForQt5.kmail: Ask if output path share/doc (5.6M) could be split with outputs = [ ... "doc" ];

@eliasp
Copy link
Member Author

eliasp commented Apr 14, 2021

libsForQt5.kmail: Ask if output path share/doc (5.6M) could be split with outputs = [ ... "doc" ];

See 2e2ab21 - is that what you asked for?

@SuperSandro2000
Copy link
Member

Not sure if bin and lib make sense here. You most likely need them anyway. I think $out and $doc are enough.

KMail relies on quite a few external applications, such as:
- kaddressbook
- akonadiimportwizard
- accountwizard
- akonadiselftest

Without those, quite a few core functionalities of KMail aren't available, such as:
- adding a new account to KMail
- using the addressbook for sending a mail
- importing existing PIM data
- analyzing Akonadi issues

Fixed by adding those components to kmail's wrapper's PATH.
@ofborg ofborg bot removed the request for review from worldofpeace June 4, 2021 23:13
@eliasp
Copy link
Member Author

eliasp commented Jun 5, 2021

Not sure if bin and lib make sense here. You most likely need them anyway. I think $out and $doc are enough.

Makes sense - it's fixed now. Thanks!

@schmittlauch
Copy link
Member

Is this still waiting on something? I can offer to test this on my system, although I cannot promise to hit all use cases that then call external programs.

@eliasp
Copy link
Member Author

eliasp commented Jun 17, 2021

IMHO nothing left to be done for merging here… I addressed all open issues so far.

@github-actions
Copy link
Contributor

Successfully created backport PR #127332 for release-21.05.

@eliasp eliasp deleted the kmail-execution-fix branch June 19, 2021 06:10
@schmittlauch
Copy link
Member

While testing #127332 I discovered that this PR only resolves this issue for KMail when being run via kmail, but not when embedded as a port of kontact.
I could just apply these changes to the kontact derivation as well, but that introduces code redundancy and the need to maintain changes for 2 files.

Any ideas for a cleaner solution? One way would be to expose the external KMail dependencies through a `passthru? attribute and then use these in the kontact derivation. But corrently, kontact does not even use kmail as an input 😕

@eliasp
Copy link
Member Author

eliasp commented Jun 20, 2021

Does Kontact embed KMail as KPart? Then my first approach would probably have made this work.

@schmittlauch
Copy link
Member

Yes, that's how I understand it. The kontact derivation doesn't take kmail as an input, but takes kparts and then probably makes a run-time discovery (yay, impure) of what PIM components are available.

@schmittlauch
Copy link
Member

Yes, it is definitely using KParts to embed KMail: When I just built kontact from the commit specified above (based on unstable), it failed to load the KMail part with this error:

Cannot load part for Mail. Cannot load library /home/spiollinux/.nix-profile/lib/qt-5.15.2/plugins/kmailpart.so: (/nix/store/z3lf066csyma75624syd2vcklry8vqhd-glib-2.68.2/lib/libgobject-2.0.so.0: undefined symbol: g_memdup2)

So for proper testing, I might need to overlay the whole KDE ecosystem. Or backport your changes.

@schmittlauch
Copy link
Member

Even if the patches proposed by @eliasp work, we need to weigh the effort of maintaining them with the drawbacks of the simple wrapper solution and wrapping both kmail and kontact separately.

Do you think your patches also work on other distros and are thus upstreamable? Because then this might be a clear reason to adopt that approach.

@eliasp
Copy link
Member Author

eliasp commented Jun 21, 2021

No, those patches are quite NixOS-specific (hardcoding the binary path for external applications called via QStandardPaths::findExecutable() to their store path), as on all other distros, said external applications should be located dynamically based on the runtime environment's $PATH.

Auto-patching all usages of QStandardPaths::findExecutable() during buildtime (even for all other Qt applications) won't work as well, as there's no proper way to always determine the application to be executed.

So wrapping kmail + kontact seperately seems to be most reasonable approach IMHO.

schmittlauch added a commit to schmittlauch/nixpkgs that referenced this pull request Jun 21, 2021
follow-up to NixOS#108824

It turns out that the wrapping done for each KDE PIM component needs to
be done for the component itself as well as for kontact, which then
aggregates all of these components as KParts.
This commit introuduces specifying these wrapping dependencies in a
separate file to make them available for import from their respective
derivations.
It is designed to be extendable in case other PIM components turn out to
require external executables as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants