PathTools 3.26 issues

Julian Field MailScanner at
Wed Jan 16 22:23:29 GMT 2008

Hash: SHA1

I've done a diff of the code changes between 3.2501 (which works) and 
3.26 (which doesn't).
The change is basically 1 line that calls a function which uses 
"strlcpy()" several times.
In 3.2501, this line is not compiled, with the result that all the 
strlcpy() code is totally optimised out by the compiler and then the linker.
In 3.26, this line is used, so all the strlcpy() code is compiled and 
linked in.

Unfortunately, strlcpy() is not included in the GNU C library. According 
to a Mac, strlcpy() does this:
     The strlcpy() and strlcat() functions copy and concatenate strings
     respectively.  They are designed to be safer, more consistent, and less
     error prone replacements for strncpy(3) and strncat(3).  Unlike those
     functions, strlcpy() and strlcat() take the full size of the buffer 
     just the length) and guarantee to NUL-terminate the result (as long as
     size is larger than 0 or, in the case of strlcat(), as long as there is
     at least one byte free in dst).  Note that you should include a 
byte for
     the NUL in size.  Also note that strlcpy() and strlcat() only 
operate on
     true ``C'' strings.  This means that for strlcpy() src must be 
     nated and for strlcat() both src and dst must be NUL-terminated.

     The strlcpy() function copies up to size - 1 characters from the 
     minated string src to dst, NUL-terminating the result.

But Linux, for example, does not include strlcpy(). Oops.

There is no simple work-around that I can write in MailScanner to avoid 
calling this code. The Perl function 'cwd' (read the current working 
directory) now doesn't work in 3.26, and will cause Perl to bomb out 
with this error:

/usr/bin/perl: symbol lookup error: 
undefined symbol: strlcpy

I really do need to read the current working directory once in a while. 
So until the author of PathTools (File::Spec) chooses to include source 
for strlcpy() in his module source code, this is going to stay broken. 
Sorry, but that's it. He broke it.

I would be grateful if someone could contact the author of PathTools and 
ask him to fix his code so that it works on rather more systems than it 
does now (which is not many).


- -- 
Julian Field MEng CITP CEng
Buy the MailScanner book at

MailScanner customisation, or any advanced system administration help?
Contact me at Jules at Jules.FM

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
PGP public key:

Version: PGP Desktop 9.7.0 (Build 1012)
Comment: Use Thunderbird's Enigmail add-on to verify this message
Charset: ISO-8859-1


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

More information about the MailScanner mailing list