tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: mail/libmilter fails ot build on macOS 10.13



On Dec 15, 20:34, Greg Troxel wrote:
} 
} I just tried to build libmilter on macOS 10.13 (for clamav, and I don't
} actually need milter, but that's not the point).
} 
} It fails to build with:
} 
} [snip]
}
} I see in patch-ap this is patched from _res to sm_res, but the patch
} doesn't have a comment and I didn't find an explanation.  It seems there
} are other patches that introduce this, and I wonder if something was
} missed, although libmilter builds on NetBSD.
} 
} I have not been able to understand the sm_res scheme, but it seems
} conditional on something, and I wonder if the conditionals of providing
} it and using it are out of sync for mac somehow.

     I noted from pkgsrc_bulk that it was a problem on a number of
older systems.  At best guess, those systems don't have gethostbyname2().
On systems that do, the problem code is ifdef'ed out.

} In particular in sm_resolve.c, I see patched
} 
}   +#if NAMED_BIND
}   +extern struct __res_state sm_res;
}   +#endif
} 
} and I don't follow that vs using the _res definition from the system
} resolv.h, unless there's some system that doesn't provide it.  I also
} don't follow why the patch declares sm_res conditionally and appears to
} use it unconditonally.

    Use of _res is not thread safe.  This is well known.  sendmail
itself is not threaded (being rather ancient), but it does get
linked to threaded libraries.  At this point, the use of _res causes
it to go BOOM.  On systems with modern thread safe resolver functions
(res_n*), sm_res points to a variable within sendmail, which is
initalized and passed to the res_n* functions.  On older systems,
it is simply pointed to _res.

     libmilter is a separate library that isn't part of the main
sendmail, so didn't need the sm_res treatment.  Thus I have deleted
it.  I didn't detect the problem before because NetBSD has
gethostbyname2() and nobody had reported this issue.  The interesting
thing is that libmilter is threaded and explicitly says that
everything linked to it needs to be thread safe.  Calling
gethostbyname() or gethostbyname2() isn't thread safe.  Those
functions have internal state.

} As you have set yourself to $OWNER, I'm writing instead of changing

     I did this because it is a rather complex package.

} anything, and would appreciate it if you could fix this by start of
} freeze, expected early next week.
} 
}-- End of excerpt from Greg Troxel


Home | Main Index | Thread Index | Old Index