Mail: `iconv` being called with `UTF8//IGNORE` breaks on systems using musl

Created on 13 Jan 2021  Â·  7Comments  Â·  Source: nextcloud/mail

Expected behavior

Mail app loads inboxes of mail accounts

Actual behavior

Mail app shows "Could not open inbox" for every mail account

Description

This is an unfortunate "revival" of the bug fixed here: https://github.com/nextcloud/mail/pull/309
Only this time it's in https://github.com/nextcloud/mail/blob/master/lib/Address.php#L82

Happy to help with a PR, but since it's such a small change it might be faster for an active maintainer to do it 😊 (because I don't know if I have everything set up in regards to commit signing and such...)

Mail app

Mail app version: 1.7.2

Mailserver or service: n/a

Server configuration

Operating system: Alpine

Web server: Nginx

Database: MariaDb

PHP version: 7.4.14

Nextcloud Version: 20.0.4

Client configuration

Browser: n/a

Operating system: n/a

0. to triage bug

All 7 comments

Erm … we had a ticket for this https://github.com/nextcloud/mail/issues/3999 but Github gives me a 404 :open_mouth:

This is an unfortunate "revival" of the bug fixed here: #309

To be honest I'm not sure how much of a "fix" that was. We have the issue now that we store data from IMAP in the database and database don't like non-utf8 strings. That is why we do this filtering.

To be honest I'm not sure how much of a "fix" that was. We have the issue now that we store data from IMAP in the database and database don't like non-utf8 strings. That is why we do this filtering.

Well, for me a good indicator is that it generally works when passing UTF-8 while it doesn't work at all when passing UTF-8//IGNORE 😉 But you might have a point there ...

Same Problem here. The iconv("UTF-8", "UTF-8//IGNORE", $email); call seems to be in getEmail() in lib/Address.php


[PHP] Error: Error: iconv(): Wrong charset, conversion from `UTF-8' to `UTF-8//IGNORE' is not allowed at /var/www/html/custom_apps/mail/lib/Address.php#82 at <<closure>>

0. <<closure>>
   OC\Log\ErrorHandler::onError(8, "iconv(): Wrong  ... d", "/var/www/html/c ... p", 82, {email: "sebasti ... "})
1. /var/www/html/custom_apps/mail/lib/Address.php line 82
   iconv("UTF-8", "UTF-8//IGNORE", "++++++")
2. /var/www/html/custom_apps/mail/lib/Db/MessageMapper.php line 295
   OCA\Mail\Address->getEmail()
3. /var/www/html/custom_apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php line 287
   OCA\Mail\Db\MessageMapper->insertBulk(OCA\Mail\Db\Message {id: null}, OCA\Mail\Db\Message {id: null})
4. /var/www/html/custom_apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php line 215
   OCA\Mail\Service\Sync\ImapToDbSynchronizer->runInitialSync(OCA\Mail\Account {}, OCA\Mail\Db\Mailbox {id: 5}, OC\AppFramework\ScopedPsrLogger {})
5. /var/www/html/custom_apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php line 128
   OCA\Mail\Service\Sync\ImapToDbSynchronizer->sync(OCA\Mail\Account {}, OCA\Mail\Db\Mailbox {id: 5}, OC\AppFramework\ScopedPsrLogger {}, 42, null, false, true)
6. /var/www/html/custom_apps/mail/lib/BackgroundJob/SyncJob.php line 92
   OCA\Mail\Service\Sync\ImapToDbSynchronizer->syncAccount(OCA\Mail\Account {}, OC\AppFramework\ScopedPsrLogger {})
7. /var/www/html/lib/public/BackgroundJob/Job.php line 80
   OCA\Mail\BackgroundJob\SyncJob->run({accountId: 1})
8. /var/www/html/lib/public/BackgroundJob/TimedJob.php line 61
   OCP\BackgroundJob\Job->execute(OC\BackgroundJob\JobList {}, OC\Log {})
9. /var/www/html/cron.php line 127
   OCP\BackgroundJob\TimedJob->execute(OC\BackgroundJob\JobList {}, OC\Log {})

at 2021-01-13T15:00:04+00:00

As far as I know this only happens on Alpine 3.12 and therefor might be an upstream issue. A script can be found here https://github.com/linuxserver/docker-nextcloud/issues/165 that updates the iconv package and prevents that error. There was also a pull request that is unfortunately gone pull#166 (404) where they discussed that and the linuxserver.io/nextcloud devs stated that it should be solved with Alpine 3.13, which is about to be released shortly.

There was also a pull request that is unfortunately gone pull#166 (404)

Ok what is going on?! Our ticket #3999 disappeared as well. It was about this exact issue in Alpine Linux.

As far as I know this only happens on Alpine 3.12 and therefor might be an upstream issue. A script can be found here linuxserver/docker-nextcloud#165 that updates the iconv package and prevents that error. There was also a pull request that is unfortunately gone pull#166 (404) where they discussed that and the linuxserver.io/nextcloud devs stated that it should be solved with Alpine 3.13, which is about to be released shortly.

Sadly 3.13 did not fix the issue. But the script stills works.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StCyr picture StCyr  Â·  4Comments

jancborchardt picture jancborchardt  Â·  4Comments

jancborchardt picture jancborchardt  Â·  5Comments

clem-bcc picture clem-bcc  Â·  4Comments

cheesewizz picture cheesewizz  Â·  5Comments