NetBSD Problem Report #49764

From www@NetBSD.org  Fri Mar 20 07:16:20 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id E040BA6553
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 20 Mar 2015 07:16:19 +0000 (UTC)
Message-Id: <20150320071618.9FB00A65B7@mollari.NetBSD.org>
Date: Fri, 20 Mar 2015 07:16:18 +0000 (UTC)
From: bnjf+netbsd@bnjf.id.au
Reply-To: bnjf+netbsd@bnjf.id.au
To: gnats-bugs@NetBSD.org
Subject: net/wget won't build on Solaris
X-Send-Pr-Version: www-1.0

>Number:         49764
>Category:       pkg
>Synopsis:       net/wget won't build on Solaris
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    solaris-pkg-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 20 07:20:00 +0000 2015
>Last-Modified:  Fri Mar 20 08:20:00 +0000 2015
>Originator:     Brad Forschinger
>Release:        2014Q4
>Organization:
>Environment:
>Description:
uses strcasestr(), which doesn't exist in Solaris
>How-To-Repeat:

>Fix:

(lifted from http://notmuchmail.org/pipermail/notmuch/2010/002232.html)

--- iri.c.orig  Fri Mar 20 18:11:43 2015
+++ iri.c       Fri Mar 20 18:14:17 2015
@@ -46,6 +46,21 @@

 /* Note: locale encoding is kept in options struct (opt.locale) */

+#ifdef __sun
+static char *
+strcasestr(char *a, char *b)
+{
+  size_t l;
+  char f[3];
+  
+  snprintf(f, sizeof(f), "%c%c", tolower(*b), toupper(*b));
+  for (l = strcspn(a, f); l != strlen(a); l += strcspn(a + l + 1, f) + 1)
+    if (strncasecmp(a + l, b, strlen(b)) == 0)
+      return a + l;
+  return NULL;
+}
+#endif
+
 /* Given a string containing "charset=XXX", return the encoding if found,
    or NULL otherwise */
 char *

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->solaris-pkg-people
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Fri, 20 Mar 2015 07:33:47 +0000
Responsible-Changed-Why:
Solaris pkgsrc problem.

Which Solaris version are you using, exactly?


From: Brad Forschinger <bnjf@bnjf.id.au>
To: gnats-bugs@netbsd.org
Cc: solaris-pkg-people@netbsd.org, pkg-manager@netbsd.org, 
	pkgsrc-bugs@netbsd.org, gnats-admin@netbsd.org, wiz@netbsd.org, 
	bnjf+netbsd@bnjf.id.au
Subject: Re: pkg/49764 (net/wget won't build on Solaris)
Date: Fri, 20 Mar 2015 18:37:39 +1100

 Solaris 10.  Doing it in a branded zone, that's why the KJP doesn't
 show up in the uname.

From: Richard PALO <richard@netbsd.org>
To: gnats-bugs@NetBSD.org, pkgsrc-bugs@netbsd.org
Cc: 
Subject: Re: pkg/49764: net/wget won't build on Solaris
Date: Fri, 20 Mar 2015 09:13:49 +0100

 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1

 Le 20/03/15 08:20, bnjf+netbsd@bnjf.id.au a écrit :
 >> Number:         49764
 >> Category:       pkg
 >> Synopsis:       net/wget won't build on Solaris
 >> Confidential:   no
 >> Severity:       non-critical
 >> Priority:       low
 >> Responsible:    pkg-manager
 >> State:          open
 >> Class:          sw-bug
 >> Submitter-Id:   net
 >> Arrival-Date:   Fri Mar 20 07:20:00 +0000 2015
 >> Originator:     Brad Forschinger
 >> Release:        2014Q4
 >> Organization:
 >> Environment:
 >> Description:
 > uses strcasestr(), which doesn't exist in Solaris
 >> How-To-Repeat:
 > 
 >> Fix:
 > 
 > (lifted from http://notmuchmail.org/pipermail/notmuch/2010/002232.html)
 > 
 > --- iri.c.orig  Fri Mar 20 18:11:43 2015
 > +++ iri.c       Fri Mar 20 18:14:17 2015
 > @@ -46,6 +46,21 @@
 >  
 >  /* Note: locale encoding is kept in options struct (opt.locale) */
 >  
 > +#ifdef __sun
 > +static char *
 > +strcasestr(char *a, char *b)
 > +{
 > +  size_t l;
 > +  char f[3];
 > +  
 > +  snprintf(f, sizeof(f), "%c%c", tolower(*b), toupper(*b));
 > +  for (l = strcspn(a, f); l != strlen(a); l += strcspn(a + l + 1, f) + 1)
 > +    if (strncasecmp(a + l, b, strlen(b)) == 0)
 > +      return a + l;
 > +  return NULL;
 > +}
 > +#endif
 > +
 >  /* Given a string containing "charset=XXX", return the encoding if found,
 >     or NULL otherwise */
 >  char *
 > 
 > 

 This seems dangerous as strcasestr is in Solaris since:
 > commit 23a1ccea6aac035f084a7a4cdc968687d1b02daf
 > Author: Roger A. Faulkner <Roger.Faulkner@Oracle.COM>
 > Date:   Thu Aug 12 14:55:22 2010 -0700
 > 
 >     PSARC 2010/299 GNU/Linux/BSD compatibility functions
 >     6960818 add get_nprocs(), getline(), strdupa(), strndup() to libc
 >     6901783 strndup would be nice
 >     6824404 libc should provide ffsl() & ffsll()
 >     6793969 RFE: Add|stpcpy|to libc
 >     6735446 Want a __progname symbol for BSD-style source compatibility
 >     6421095 Solaris should provide strcasestr
 >     6275498 Provide string compare functions wcscasecmp,wcsncasecmp in solaris like linux


 Perhaps the following sort of guard is safer:
 >#if defined(__sun) && !defined(HAVE_RAW_DECL_STRCASESTR)
 > ...
 >#endif


 - -- 
 Richard PALO

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

 iQEcBAEBAgAGBQJVC9a8AAoJECAB22fHtp27qvsIALiHbCcl9o94fMz17psmFAOA
 jmHJyQ8MTRsnyQdrUjbEu0693+zVGSS+mfEnMr+NRvz3J7gGCCKoiJI7isZTe8xV
 f84pYqLpFexCCwPwHDKW8ZdU6kI1od7qHLuIFL393hgiMbEmGWTWgAJzT3Jq4qhD
 /nf53Mu5Kjdt2UoSIF/KroMjaGCrRXrQ5MnrfhTXvqm8q9kEqvBy1zDpHdWIL92j
 Oj6GlFqMupD5MOQp4E5E0bvzJvzwOrL+5M8XYbUwit6JX0u6yL2QD+0gpnmPk/qj
 laILR/HD1QA87OzVKfk+wLOZqgwZtsCN+DctUBhrSebXp135BwGKpdHTelMf+d8=
 =9sNs
 -----END PGP SIGNATURE-----

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.