Ralf Becker
2009-Jul-06 07:47 UTC
[Dovecot] Unable to (un)subscribe mbox with AIX, NFS and netapp filer
Hi Timo, dovecot 1.2.0 is great! Faster and more stable on mboxes that 1.1.x by far... good job :-) Today I stumbled over a strange problem when I tried to subscribe an existing Mailbox (mbox), which doesn't work. Thunderbird IMAP log -------------------- 9932[4124558]: 40f3498:imap.fh-trier.de:A:SendData: 11 subscribe "Mail/Archiv/1998" 9932[4124558]: ReadNextLine [stream=403f280 nb=108 needmore=0] 9932[4124558]: 40f3498:imap.fh-trier.de:A:CreateNewLineFromSocket: 11 NO [SERVERBUG] Internal error occurred. Refer to server log for more information. [2009-07-06 08:14:32] Server log ---------- Jul 6 08:14:32 trevi mail:info dovecot: IMAP(beckerr): Namespace Mail/: Using permissions from /u/f0/rzuser/beckerr/Mail: mode=0700 gid=-1 Jul 6 08:14:32 trevi mail:err|error dovecot: IMAP(beckerr): fchown(/u/f0/rzuser/beckerr/Mail/.subscriptions.lock, -1, -1) failed: Invalid argument Jul 6 08:14:32 trevi mail:err|error dovecot: IMAP(beckerr): file_dotlock_open() failed with subscription file /u/f0/rzuser/beckerr/Mail/.subscriptions: Invalid argument The error just appears on NFS mounted shared and I'm not sure if AIX or netapp is the cause. So to determine the real problem is not easy, but to fix it is: While uid and gid are both -1 the call could be suppressed, because nothing is really changed: --- ./lib/file-dotlock.c.org 2009-07-06 09:25:14.000000000 +0200 +++ ./lib/file-dotlock.c 2009-07-06 09:24:48.000000000 +0200 @@ -780,7 +780,7 @@ fd = file_dotlock_open(set, path, flags, &dotlock); umask(old_mask); - if (fd != -1) { + if (fd != -1 && (uid != -1 || gid != -1)) { if (fchown(fd, uid, gid) < 0) { if (errno == EPERM && uid == (uid_t)-1) { i_error("%s", eperm_error_get_chgrp("fchown", Ralf -- ______________________________________________________________________ Dipl.-Inform. (FH) Ralf Becker Rechenzentrum (r/ft) der FH Trier (Network|Mail|Web|Firewall) University of applied sciences Administrator Schneidershof, D-54293 Trier Mail: beckerr at fh-trier.de Fon: +49 651 8103 499 Web: http://www.fh-trier.de/~beckerr Fax: +49 651 8103 214 PubKey: http://www.fh-trier.de/~beckerr Crypto: GnuPG, S/MIME ______________________________________________________________________ Wenn Gott gewollt haette, dass E-Mail in HTML geschrieben wuerden, endeten Gebete traditionell mit </amen>. (Tom Listen) -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 6074 bytes Desc: S/MIME Cryptographic Signature Url : http://dovecot.org/pipermail/dovecot/attachments/20090706/13e55b50/attachment-0001.bin
Axel Luttgens
2009-Jul-06 11:30 UTC
[Dovecot] Unable to (un)subscribe mbox with AIX, NFS and netapp filer
Le 6 juil. 09 ? 09:47, Ralf Becker a ?crit :> [...] > > Jul 6 08:14:32 trevi mail:err|error dovecot: IMAP(beckerr): > fchown(/u/f0/rzuser/beckerr/Mail/.subscriptions.lock, -1, -1) > failed: Invalid argument > > [...] > > The error just appears on NFS mounted shared and I'm not sure if > AIX or netapp is the cause.According to the posix specification, fchown may return EINVAL when the owner or group ID is not a value supported by the implementation, or when the fildes argument refers to a pipe or socket or an fattach()- ed STREAM and the implementation disallows execution of fchown() on a pipe. Wouldn't it be worth to check what kind of entity gets created under your environment? I ask because I wouldn't exclude without further investigations the possibility of encountering other side effects wrt files throughout the code.> So to determine the real problem is > not easy, but to fix it is: > > While uid and gid are both -1 the call could be suppressed, because > nothing is really changed: > > --- ./lib/file-dotlock.c.org 2009-07-06 09:25:14.000000000 +0200 > +++ ./lib/file-dotlock.c 2009-07-06 09:24:48.000000000 +0200 > @@ -780,7 +780,7 @@ > fd = file_dotlock_open(set, path, flags, &dotlock); > umask(old_mask); > > - if (fd != -1) { > + if (fd != -1 && (uid != -1 || gid != -1)) { > if (fchown(fd, uid, gid) < 0) { > if (errno == EPERM && uid == (uid_t)-1) { > i_error("%s", eperm_error_get_chgrp("fchown",Alternatively, perhaps could you write a small c program so as to test a fchown(fd,-1,-1) operation on a "regular" file as see whether it fails or not. HTH, Axel