Skip Menu | will be shut down on March 1st, 2021.

This queue is for tickets about the PathTools CPAN distribution.

Report information
The Basics
Id: 32296
Status: resolved
Priority: 0/
Queue: PathTools

Owner: Nobody in particular
Requestors: SMPETERS [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Subject: [PATCH] Missing symbols on systems without strlcpy() and strlcat()
Download (untitled) / with headers
text/plain 2.6k
Although using strlcpy() and strlcat() functions has been a big part of Perl 5.10, they aren't available everywhere. The Perl API now has my_strlcpy() and my_strlcat() which will either be a macro over the libc versions or a independent implementation in Perl itself. Recent Devel::PPPort's have it too. So, the patch is a two part process. First, upgrade to a recent Devel::PPPort and run... perl -MDevel::PPPort -wle'Devel::PPPort::WriteFile();' in the PathTools distribution directory. Then, apply the following patch --- Cwd.xs.old 2008-01-14 07:35:49.000000000 -0600 +++ Cwd.xs 2008-01-14 09:08:10.000000000 -0600 @@ -83,14 +83,14 @@ if (path[1] == '\0') return (resolved); resolved_len = 1; - left_len = strlcpy(left, path + 1, sizeof(left)); + left_len = my_strlcpy(left, path + 1, sizeof(left)); } else { if (getcwd(resolved, MAXPATHLEN) == NULL) { - strlcpy(resolved, ".", MAXPATHLEN); + my_strlcpy(resolved, ".", MAXPATHLEN); return (NULL); } resolved_len = strlen(resolved); - left_len = strlcpy(left, path, sizeof(left)); + left_len = my_strlcpy(left, path, sizeof(left)); } if (left_len >= sizeof(left) || resolved_len >= MAXPATHLEN) { errno = ENAMETOOLONG; @@ -147,7 +147,7 @@ * lstat() fails we still can return successfully if * there are no more path components left. */ - resolved_len = strlcat(resolved, next_token, MAXPATHLEN); + resolved_len = my_strlcat(resolved, next_token, MAXPATHLEN); if (resolved_len >= MAXPATHLEN) { errno = ENAMETOOLONG; return (NULL); @@ -198,13 +198,13 @@ symlink[slen] = '/'; symlink[slen + 1] = 0; } - left_len = strlcat(symlink, left, sizeof(left)); + left_len = my_strlcat(symlink, left, sizeof(left)); if (left_len >= sizeof(left)) { errno = ENAMETOOLONG; return (NULL); } } - left_len = strlcpy(left, symlink, sizeof(left)); + left_len = my_strlcpy(left, symlink, sizeof(left)); } } #endif
Download (untitled) / with headers
text/plain 813b
Hi Steve, Thanks for the spot. I've upgraded ppport.h first, and that looks fine. When I try to use the new macros though, I'm getting a failure I can't follow. When I use the Build.PL, the test errors look like this: t/cwd..............ok 1/34dyld: lazy symbol binding failed: Symbol not found: _DPPP_my_my_strlcpy Referenced from: /Users/ken/src/PathTools-svn/blib/arch/auto/Cwd/Cwd.bundle Expected in: dynamic lookup dyld: Symbol not found: _DPPP_my_my_strlcpy Referenced from: /Users/ken/src/PathTools-svn/blib/arch/auto/Cwd/Cwd.bundle Expected in: dynamic lookup When I use the Makefile.PL, the tests pass. So I'm guessing there's some path issue that M::Build isn't doing correctly, but this isn't the first time we've used ppport so I'm not sure why it's only happening now. -Ken
From: ben [...]
Download (untitled) / with headers
text/plain 326b
Could you possibly revert PathTools back to the 3.25 version until the strlcpy/strlcat issue is resolved for Perl <5.10? I see that it's not yet fully updated on all the mirrors. This is going to be a real headache otherwise: symbol lookup error: /usr/lib/perl5/5.8.8/i686-linux/auto/Cwd/ undefined symbol: strlcpy
Download (untitled) / with headers
text/plain 383b
On Mon Jan 14 19:39:46 2008, wrote: Show quoted text
> Could you possibly revert PathTools back to the 3.25 version until the > strlcpy/strlcat issue is resolved for Perl <5.10?
We can't just revert, because there are some painful Cygwin bugs (also <5.10) that would reappear. I think we'll be able to push out a fix for strl(cat|cpy) almost as fast as a reversion anyway. -Ken
Download (untitled) / with headers
text/plain 351b
I figured out the issue, sort of. After building everything, the following fails: perl -Iblib/lib -Iblib/arch t/cwd.t But the following succeeds: PERL_DL_NONLAZY=1 perl -Iblib/lib -Iblib/arch t/cwd.t Turns out if I add: # define NEED_my_strlcpy # define NEED_my_strlcat to the XS file, everything's hunky-dory. So I'll do that. -Ken
Resolved with the 3.27 release. -Ken

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to