Bug 2272376

Summary: Contact import produces VCF parsing error
Product: [Fedora] Fedora Reporter: Vsevolod <tsilvs>
Component: gnome-contactsAssignee: Yaakov Selkowitz <yselkowi>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 40CC: gnome-sig, harrymichal, kalev, klember, yselkowi
Target Milestone: ---Keywords: Desktop, UserExperience
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-12-14 03:27:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Vsevolod 2024-03-31 13:17:08 UTC
When I'm trying to import contacts from a .vcf file, Contacts app always produces parsing error with a message in the modal window:

```
Error reading file
An error occured reading the file 'test-contacts.vcf'
```

Other than that, there's also always this error message in the logs:

```
contacts-app.vala:390: Couldn't parse file: Child process exited with code 127
/app/libexec/gnome-contacts/gnome-contacts-parser: error while loading shared libraries: libfolks.so.26: cannot open shared object file: No such file or directory
```

Here are the exact test-contacts.vcf text:

```
BEGIN:VCARD
VERSION:3.0
UID:pas-id-3aeb536de133021e9946eba143ce48f69c5e6ee5
TEL;TYPE=CELL;X-EVOLUTION-E164=0200100900,"+30":+300200100900
FN:Test Person
N:Person;Test;;;
X-EVOLUTION-FILE-AS:Person\, Test
EMAIL;TYPE=PERSONAL:test001
REV:2024-03-31T12:54:41Z
END:VCARD

BEGIN:VCARD
VERSION:3.0
UID:pas-id-2060233ed586e12d2954dc7576ac414d635e934f
TEL;TYPE=CELL;X-EVOLUTION-E164=00900200300,"+1":+100900200300
FN:Test Person 2
N:2;Test;Person;;
X-EVOLUTION-FILE-AS:2\, Test
EMAIL;TYPE=PERSONAL:test002
REV:2024-03-31T12:55:18Z
END:VCARD
```

Reproducible: Always

Steps to Reproduce:
1. Open GNOME Contacts
2. Open Main Menu
3. Choose "Import From File..."
4. Choose any valid .vcf file
5. Observe error message "Error reading file" in modal window

Actual Results:  
.vcf is not parsed, no new contacts are added to the list.

Expected Results:  
.vcf is parsed, new contacts are added to the list.

OS: Fedora Silverblue 39
Shell: GNOME 45.5
Contacts version: 45
App packaging: Flatpak
Repository: fedora

```
$ flatpak list --system --app --columns=name,application,origin | grep Contacts
Contacts	org.gnome.Contacts	fedora
```

Comment 1 Vsevolod 2024-03-31 21:50:59 UTC
`flathub` repository version doesn't have this malfunction, so the issue should be with the build in `fedora` Flatpak repo.

@harrymichal are you still the maintainer of this package?

Comment 2 Ondřej Míchal 2024-05-02 21:10:27 UTC
I only really built the original flatpak and have not been involved with it ever since. Looking at the git history, @klember or @yselkowi could know a bit more.

Comment 3 Yaakov Selkowitz 2024-07-19 17:08:12 UTC
Confirmed, but cause still unclear.

Comment 4 Yaakov Selkowitz 2024-12-10 23:23:54 UTC
The cause is the use of LD_LIBRARY_PATH for adding flatpak directories to the linker search path.  When loading a .vcf file, Contacts passes this to another process (presumably in order to avoid the app itself crashing in the case of invalid input) but does not pass the environment (specifically LD_LIBRARY_PATH) to it, and as that binary depends on libfolks (which is in /app), it fails to launch.

The solution is to not rely on LD_LIBRARY_PATH and instead use dynamic ld.so.cache generation as in Flathub flatpaks.

https://src.fedoraproject.org/rpms/flatpak-runtime-config/c/641ea400561c1c79405c4e88aa248c8add914e19?branch=f41
https://src.fedoraproject.org/flatpaks/flatpak-runtime/c/1fc0fa62adcf01ee11fede5889416fbe4a24637d?branch=f41

The fix will end up being in an updated runtime, which will have this bug attached when ready.

Comment 5 Fedora Update System 2024-12-10 23:39:25 UTC
FEDORA-FLATPAK-2024-947f40556a (flatpak-runtime-f41-17 and flatpak-sdk-f41-14) has been submitted as an update to Fedora 41 Flatpaks.
https://bodhi.fedoraproject.org/updates/FEDORA-FLATPAK-2024-947f40556a

Comment 6 Fedora Update System 2024-12-11 02:47:00 UTC
FEDORA-FLATPAK-2024-947f40556a has been pushed to the Fedora 41 Flatpaks testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-FLATPAK-2024-947f40556a

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2024-12-14 03:27:14 UTC
FEDORA-FLATPAK-2024-947f40556a (flatpak-runtime-f41-17 and flatpak-sdk-f41-14) has been pushed to the Fedora 41 Flatpaks stable repository.
If problem still persists, please make note of it in this bug report.