Comment 29 for bug 6903

Revision history for this message
In , Stefan Hornburg (Racke) (racke) wrote : Courier Debian Packaging Problem (IMAP + FAM)

Hello,

I need your help and advice for the courier packaging problem described
below. Please read on.

Situation:
Courier can be compiled with or without FAM support. If FAM support is
included but FAM isn't running, this message is repeatedly written to
syslog:

Jul 10 23:31:44 turtle imaplogin: Failed to create cache file: maildirwatch (<email address hidden>)
Jul 10 23:31:44 turtle imaplogin: Error: Input/output error
Jul 10 23:31:44 turtle imaplogin: Check for proper operation and configuration
Jul 10 23:31:44 turtle imaplogin: of the File Access Monitor daemon (famd).

This is fine for source builds, but leads to problems for packagers.
Either we need to depend on the FAM daemon package or logs get filled
with the messages above. Both scenarios doesn't have a great appeal to me
(see also Debian bugs #191007, #204405, #206626, #238990, #242837
for reference).

Steve Langasek was so kind to write a patch to cope with this situation,
but unfortunately this patch leads to memory corruption like that:

Program received signal SIGSEGV, Segmentation fault.
0x400d2219 in malloc () from /lib/libc.so.6
(gdb) backtrace
#0 0x400d2219 in malloc () from /lib/libc.so.6
#1 0x400d2074 in malloc () from /lib/libc.so.6
#2 0x0806cd0a in maildir_info_imap_find (info=0xbfffb2ac, path=0x81872e0 "INBOX.Trash",
    myId=0xbffffebe "<email address hidden>") at maildirinfo.c:179
#3 0x0804d02b in decode_valid_mailbox (p=0x81872e0 "INBOX.Trash", autosubscribe=1) at imapd.c:327
#4 0x0804d651 in parse_mailbox_error (tag=0xbfffb5b8 "19", curtoken=0x8182780, ok_hierarchy=0,
    autosubscribe=1) at imapd.c:572
#5 0x080538d2 in do_imap_command (tag=0xbfffb5b8 "19") at imapd.c:4773
#6 0x0805eae3 in mainloop () at mainloop.c:93
#7 0x08056516 in main (argc=2, argv=0xbffff6a4) at imapd.c:6354

See Debian bugs #253304, #254731, #255069, #256460, #257006, #258445 for reference.

Solution:

1. Resolve the memory corruption in the patch (see attachment). If you want to
   compile for debugging with the debian/rules file,
   change CFLAGS=-lcrypt to LDFLAGS=-lcrypt and uncomment dh_strip

2. New scenario to solve the problem:

   * test whether FAM is available in the courier-imap init script
  and set an environment variable accordingly (like FAMIGNORE)

   * change the source code to test this environment variable and
  skip FAM access if environment variable if set

Any advice or further help would be appreciated immensely.

With regards
 Racke

--
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team