Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Jul 2008 21:00:50 GMT
From:      "Pedro F. Giffuni" <pfgshield-freebsd@yahoo.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/125348: lang/nawk: support multibyte charsets in tolower/toupper functions
Message-ID:  <200807062100.m66L0oKB036634@www.freebsd.org>
Resent-Message-ID: <200807062110.m66LA9qn027172@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         125348
>Category:       ports
>Synopsis:       lang/nawk: support multibyte charsets in tolower/toupper functions
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 06 21:10:09 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Pedro F. Giffuni
>Release:        6.3-Release
>Organization:
>Environment:
FreeBSD kakumen.cable.net.co 6.3-RELEASE FreeBSD 6.3-RELEASE #10: Sat Jan 19 01:13:55 COT 2008     root@kakumen.cable.net.co:/usr/src/sys/amd64/compile/SMP  amd64

>Description:
Update with patches from NetBSD:

- PR 36394: Add support for multibyte charsets in the "tolower" and "toupper" awk
functions.
- PR 36831: In setfval(), ensure that arithmetic never yields a negative zero
result.
- strdup/strlcat/snprintf changes from Aleksey Cheusov

>How-To-Repeat:
Probably this is also relevant to the base one-true-awk (and upstream).
>Fix:
diff -ruN nawk.orig/files/patch-proto.h nawk/files/patch-proto.h
--- nawk.orig/files/patch-proto.h	1969-12-31 19:00:00.000000000 -0500
+++ nawk/files/patch-proto.h	2008-07-06 15:36:15.000000000 -0500
@@ -0,0 +1,10 @@
+--- proto.h.orig	2003/10/26 11:34:23	1.5
++++ proto.h	2007/11/06 23:07:52	1.5.22.1
+@@ -112,6 +112,7 @@ extern	double	getfval(Cell *);
+ extern	char	*getsval(Cell *);
+ extern	char	*getpssval(Cell *);     /* for print */
+ extern	char	*tostring(const char *);
++extern	char	*tostringN(const char *, size_t n);
+ extern	char	*qstring(const char *, int);
+ 
+ extern	void	recinit(unsigned int);
diff -ruN nawk.orig/files/patch-tran.c nawk/files/patch-tran.c
--- nawk.orig/files/patch-tran.c	1969-12-31 19:00:00.000000000 -0500
+++ nawk/files/patch-tran.c	2008-07-06 15:30:44.000000000 -0500
@@ -0,0 +1,42 @@
+--- tran.c.orig	2005/07/03 15:18:11	1.6
++++ tran.c	2007/11/06 23:07:52	1.9.10.1
+@@ -210,7 +210,10 @@ Cell *setsymtab(const char *n, const cha
+ 	int h;
+ 	Cell *p;
+ 
+-	if (n != NULL && (p = lookup(n, tp)) != NULL) {
++	if (n == NULL)
++		n = "";
++
++	if ((p = lookup(n, tp)) != NULL) {
+ 		   dprintf( ("setsymtab found %p: n=%s s=\"%s\" f=%g t=%o\n",
+ 			p, NN(p->nval), NN(p->sval), p->fval, p->tval) );
+ 		return(p);
+@@ -282,6 +285,7 @@ Awkfloat setfval(Cell *vp, Awkfloat f)	/
+ {
+ 	int fldno;
+ 
++	f += 0.0;		/* normalise negative zero to positive zero */
+ 	if ((vp->tval & (NUM | STR)) == 0) 
+ 		funnyvar(vp, "assign to");
+ 	if (isfld(vp)) {
+@@ -400,7 +404,18 @@ char *tostring(const char *s)	/* make a 
+ {
+ 	char *p;
+ 
+-	p = (char *) malloc(strlen(s)+1);
++	p = strdup(s);
++	if (p == NULL)
++		FATAL("out of space in tostring on %s", s);
++	strcpy(p, s);
++	return(p);
++}
++
++char *tostringN(const char *s, size_t n)	/* make a copy of string s */
++{
++	char *p;
++
++	p = malloc(n);
+ 	if (p == NULL)
+ 		FATAL("out of space in tostring on %s", s);
+ 	strcpy(p, s);


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807062100.m66L0oKB036634>