Hi Sam,

while debugging the mysterious ``Can't call method "close" on an undefined
value at Filter.pm line 299?? bug that caused Courier::Filter to fail
starting up on some platforms, I wrote the following message in
correspondence with Michael Carmack:

Julian Mehnle wrote:
> Courierfilters must close the pipe that is attached to file
> descriptor #3 after they have finished their initialization to
> signal Courier that they're ready to process messages.
> Courier::Filter "opens" fd #3 using Perl'S "&=$FD" syntax in
> order to be able to close it using the close() command.  I
> ignorantly designed C:F to open the fd in *read* mode.  As this
> seems to work on most systems including mine, I hadn't noticed
> until now that Courier's `courierfilter` executable actually
> attaches the pipe's *write* end to fd #3 before forking off the
> various filters.  This isn't documented in the courierfilter
> documentation, though.
>
> Although the read/write mode shouldn't actually have any
> meaning with the "&=$FD" syntax because all it does is
> associating the existing file descriptor to a Perl I/O handle,
> it still seems to make a difference on some systems.

Now I fixed the bug in my code, I suggest clarifying the "courierfilter"
documentation.  I would submit a patch if I knew what the authoritative
instance of the doc is -- there's at least a manpage and an HTML file.
Well, I guess you can easily apply the fix to the correct document, so
here's my suggestion as a pseudo-diff:

|  After initializing the socket, the mail filter must then close its file
|  descriptor #3. File descriptor 3 is inherited by every mail filter
|  that's executed by the courierfilter start command.
| +The mail filter's file descriptor 3 is connected to the <em>write</em>
| +end of a pipe, which may be relevant to certain ways of implementing
| +the closing of the file descriptor, for instance in Perl where you may
| +be forced to pseudo-open the descriptor (in write mode) before closing
| +it.
|  The courierfilter start command will not exit until every started mail
|  filter closes its file descriptor 3. This allows for all mail filters
|  to orderly initialize themselves before courierfilter start command
|  returns.



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to