-
Notifications
You must be signed in to change notification settings - Fork 263
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
iconv
being called with UTF8//IGNORE
breaks on systems using musl
#4351
Comments
Erm … we had a ticket for this #3999 but Github gives me a 404 😮 |
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 |
Same Problem here. The
|
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. |
According to linuxserver/docker-nextcloud#165 you just have to re-add your accounts, then it whould work without script. |
Confirming. It works now |
For me too, so I guess this Issue can be closed |
I might say that this is not really a solution in my view 😢 |
@te-online Yeah I'm also wondering why that is necessary. Maybe @ChristophWurst can say sth about that? |
I don't get why you have to re-add the account?! after the fix the sync will continue where it previously stopped, no? |
By the way, this fixes only for docker user. I use an LXC container, I updated the mail app and just got stuck with it. I explained everything there: #3908 (comment) and #3908 (comment) . Is there a reason to keep that |
yes, to continue with the valid parts of the string. What else would you suggest to do in the error case? |
Well continuing with the valid parts doesn't make much sense to me. We receive an address, part of which is garbage It all comes down to this: either the address is valid and we accept it, or it is not and we raise an exception instead of trying to fix it with the |
I think you've got a point here but one should look at this in a differentiated way. Replacing this //IGNORE thing by a checkup as you described may be an improvement here that would additionally workaround the issue. But the issue itself is still upstream in systems where iconv does not work properly. Removing //IGNORE would work here but I disagree it being the right fix, as the upstream issue persists and is most likely going to cause trouble elsewhere. |
No there are two issues. Code should not attempt to fix an email address by itself. You could as well try to fix And about the upstream, like explained in my other comment, the musl implementation of iconv is also right. Iconv is a POSIX standard, defined here: https://pubs.opengroup.org/onlinepubs/9699919799/ where there is no mention of But like I said this second issue is not the problem. If input is invalid, you should not try to fix it. Could you give me an example of why you could get a badly encoded address and how automatically fixing it would be better than just signaling an error ? |
Oh that clears things up for me. I totally agree then. Thanks! |
No thank you all for doing all this work and taking the time to listen to me =) |
@te-online @ChristophWurst So I have recovered a backup in order to re-check that "you must re-add your accounts" thing and can say it is not necessary. Maybe it was kind of a misunderstanding or so. @ChristophWurst Nevertheless, as @canatella explained very well, using //IGNORE to "fix" invalid mail addresses seems to be a bad idea anyway. Invalid mail addresses should simply throw an error. Since LXC containers are still affected, a quick fix would be really nice. ;-) |
Today the new images were pushed with alpine 3.13, so I tried again to switch from the main fpm image to the alpine one. In all situations I still get the MailboxLockedError. Whenever I switch back to main fpm, the messages start to load. |
A locked mailbox is the symptom of a previous sync error. Check your logs for the actual cause. |
There was no previous sync action. This is directly after adding the mailbox |
Problem still exists with dockerhub:nextloud 20.0.7-fpm-alpine with php:7.4-fpm-alpine3.13 |
@AlterDepp You could try building your FROM nextcloud:fpm-alpine
RUN set -ex; \
\
apk add --no-cache \
gnu-libiconv \
php7-iconv \
;
ENV LD_PRELOAD=/usr/lib/preloadable_libiconv.so |
We use the PHP Docker image. php7-iconv pulls the PHP packages from the Alpine repo. See also: |
so what does that mean for Mail? are we doomed? |
@ChristophWurst : nope, like I explained before, you could just remove the "//IGNORE" and still be as robust and secure. Please read my above comment if you don't see why. |
in that case #4453 should help. |
I'm still wondering about the logic behind using valid parts of a malformed e-mail address. After //IGNORE charset maybe valid again, but the address is still invalid. In fact //IGNORE means ignoring a fatal error. The pull request does not address this logic issue. |
that is try. we just try to recover from the issue. what would you suggest instead? we had the "solution" where the app just fails hard on such data. this wasn't ideal either. |
An invalid charset of email address means that the address itself is invalid as well. The affected email is not going to reach it's destination. A hard failing app is of course a bad thing. But an app that tries to ignore the error is not better at all. As mentioned above //IGNORE statement is not even a part of the Iconv POSIX standard. Doing non-standardized things is always critical and error-prone. That is why we are here. If you want to keep the logic of ignoring the issue, just do it without using //IGNORE. Better way would be to soft fail. Abort the action and show an error message so that the user is informed that something went wrong. |
wait. the email value sanitization is used for the messages that we read from IMAP, not new message sent by the user. |
Ah I see. Sorry for the confusion. But there is still the problem of using non-standard code that fails in some environments. The pull request just avoids the error for well-formed addresses. It does not solve this issue. It just makes the issue happen not so often. |
That's true, @HannesJo0139. It avoid the issue if possible but in extreme cases it will still show. |
Hello, I can confirm that this error still persists. But as soon as i or an user tries to open the mail interface, the nextcloud log is spammed with So how can i fix this? I remember, this problem persists since the nc 20 release, when i'm right. Thank your, |
@AlexCloudDev The patch is likely coming with 1.8.4. You can also apply it manually (https://patch-diff.githubusercontent.com/raw/nextcloud/mail/pull/4483.patch). Unfortunately it won't solve all cases where the issue occurs. In rare cases of mal-formed encoding it is still going to occur. But the mail app should be usable again. |
Okay, thx, sound good. regards |
Version 1.9.1 works for me, thanks |
Version 1.9.1 works for me, too. Thank you very much for your time and effort. |
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: #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
The text was updated successfully, but these errors were encountered: