develooper Front page | perl.perl5.porters | Postings from August 2012

minor daftness deep in Cwd.xs?

Thread Next
From:
Nicholas Clark
Date:
August 31, 2012 08:49
Subject:
minor daftness deep in Cwd.xs?
Message ID:
20120831154859.GG9583@plum.flirble.org
Somewhere deep in one of TonyC's logs I spotted this:

Cwd.xs:200:50: warning: size argument in 'strlcat' call appears to be size of the source; expected the size of the destination [-Wstrlcpy-strlcat-size]
                                        left_len = my_strlcat(symlink, left, sizeof(left));
                                                                             ~~~~~~~^~~~~
Cwd.xs:200:43: note: change size argument to be the size of the destination
                                        left_len = my_strlcat(symlink, left, sizeof(left));
                                                                             ^~~~~~~~~~~~
                                                                             sizeof(symlink)
1 warning generated.

"It's a fair cop 'guv", in that yes, I'm pretty sure that clang is right

git shows this culprit:

commit c7304ea2604337d29c746515db4570520e6a66ca
Author: Nicholas Clark <nick@ccl4.org>
Date:   Mon Oct 27 20:29:54 2008 +0000

    Upgrade Cwd.xs to the Cwd.xs in PathTools 3.26_01:
    
    - abs_path() on Unix(ish) platforms has been upgraded to a much later
      version of the underlying C code from BSD. [Michael Schwern]
    
    - If strlcpy() and strlcat() aren't available on the user's system,
      we now use ppport.h to provide them, so our C code works. [Steve
      Peters]
    
    This unwinds change 32710 (consting from Robin Barker of the old code)
    
    p4raw-id: //depot/perl@34606


But the actual change appears to be between 3.25 and 3.26, suggest by this:

https://metacpan.org/diff/release/KWILLIAMS/PathTools-3.2501/KWILLIAMS/PathTools-3.26#Cwd.xs

and that also has this:

@@ -10,9 +10,8 @@
 #   include <unistd.h>
 #endif
  
-/* The realpath() implementation from OpenBSD 2.9 (realpath.c 1.4)
+/* The realpath() implementation from OpenBSD 3.9 to 4.2 (realpath.c 1.13)
  * Renamed here to bsd_realpath() to avoid library conflicts.
- * --jhi 2000-06-20
  */


so

a) was this an upstream bug in OpenBSD?
b) how do we easily find out if they fixed it?
c) where can we grab the fix from?

Nicholas Clark

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About