[Dovecot] Unable to (un)subscribe mbox with AIX, NFS and netapp filer
Ralf Becker
beckerr at fh-trier.de
Tue Jul 7 00:07:22 EEST 2009
Hello Axel,
>> attached is a small tool to test fchown on a freshly created file:
>> <<t.c>>
>
> Damn... didn't go through... ;-)
>
ok... maybe i missed it... let's do it inline:
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
main(int argc, char **argv)
{
int f = open(argv[1],O_CREAT|O_TRUNC);
printf("fchown returns %i\n",fchown(f,-1L,-1L));
if (errno) printf("errno=%i (%s)\n", errno, strerror(errno));
close(f);
unlink(argv[1]);
}
> As a result, I'm not sure whether entirely hiding the log message is a
> good idea; perhaps just change the logging level would be better, so
> that one keeps the ability to track possibly problematic file systems...
It's not just the log message. If you have a look on the entire
function, you'll see that it fails if fchown fails:
static int
file_dotlock_open_mode_full(<...>,uid_t uid, gid_t gid,<...>)
{
<...>
if (fd != -1) {
if (fchown(fd, uid, gid) < 0) {
if (errno == EPERM && uid == (uid_t)-1) {
i_error("%s", eperm_error_get_chgrp("fchown",
file_dotlock_get_lock_path(dotlock),
gid, gid_origin));
} else {
i_error("fchown(%s, %ld, %ld) failed: %m",
file_dotlock_get_lock_path(dotlock),
(long)uid, (long)gid);
}
file_dotlock_delete(&dotlock);
return -1;
}
}
*dotlock_r = dotlock;
return fd;
}
While this function seems to create all dotlock files (not just for
the .subscribtions file) this means that on same NFS(4) file systems
dotlocking is actually not working.
The linux man page of chown(3) (in place of fchown(3)) says:
-----------------------------8<--------------------------------
If owner or group is specified as ( uid_t)-1 or ( gid_t)-1,
respectively, the corresponding ID of the file shall not be changed.
If both owner and group are -1, the times need not be updated.
Upon successful completion, chown() shall mark for update the st_ctime
field of the file.
------------------->8------------------------------------------
Is my understanding of these sentences correct?
"If owner and group are -1, nothing is done?"
In this case it should be save to skip the call, shouldn't it?
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/e8e58059/attachment.bin
More information about the dovecot
mailing list