Re: UPDATE: lang/lua bugfix

2012-03-06 Thread David Coppa
On Tue, Mar 6, 2012 at 8:49 AM, David Coppa dco...@gmail.com wrote:
 On Tue, Mar 6, 2012 at 3:38 AM, Piotr Sikora piotr.sik...@frickle.com wrote:

 Attached patch fixes this, but to be honest I would consider completely
 dropping our fix from the port .

 me too would prefer the latter.

Can you prepare a diff for this?



Re: UPDATE: lang/lua bugfix

2012-03-06 Thread Brad Smith

On 06/03/12 2:49 AM, David Coppa wrote:

On Tue, Mar 6, 2012 at 3:38 AM, Piotr Sikorapiotr.sik...@frickle.com  wrote:


Attached patch fixes this, but to be honest I would consider completely
dropping our fix from the port .


me too would prefer the latter.
Other opinions?


Drop the patches.

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



Re: UPDATE: lang/lua bugfix

2012-03-06 Thread Stuart Henderson
On 2012/03/06 03:11, Brad Smith wrote:
 On 06/03/12 2:49 AM, David Coppa wrote:
 On Tue, Mar 6, 2012 at 3:38 AM, Piotr Sikorapiotr.sik...@frickle.com  
 wrote:
 
 Attached patch fixes this, but to be honest I would consider completely
 dropping our fix from the port .
 
 me too would prefer the latter.
 Other opinions?
 
 Drop the patches.

OKs?

Index: Makefile
===
RCS file: /cvs/ports/lang/lua/Makefile,v
retrieving revision 1.43
diff -u -p -r1.43 Makefile
--- Makefile4 Dec 2011 21:12:19 -   1.43
+++ Makefile6 Mar 2012 10:05:37 -
@@ -3,7 +3,7 @@
 COMMENT=   powerful, light-weight programming language
 
 DISTNAME=  lua-5.1.4
-REVISION=  3
+REVISION=  4
 CATEGORIES=lang
 
 MASTER_SITES=  http://www.lua.org/ftp/ \
Index: patches/patch-src_lobject_c
===
RCS file: patches/patch-src_lobject_c
diff -N patches/patch-src_lobject_c
--- patches/patch-src_lobject_c 29 Oct 2007 20:30:32 -  1.3
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,65 +0,0 @@
-$OpenBSD: patch-src_lobject_c,v 1.3 2007/10/29 20:30:32 espie Exp $
 src/lobject.c.orig Fri Feb 10 18:43:52 2006
-+++ src/lobject.c  Mon Oct 29 21:26:20 2007
-@@ -142,7 +142,7 @@ const char *luaO_pushvfstring (lua_State *L, const cha
-   }
-   case 'p': {
- char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' 
*/
--sprintf(buff, %p, va_arg(argp, void *));
-+snprintf(buff, sizeof(buff), %p, va_arg(argp, void *));
- pushstr(L, buff);
- break;
-   }
-@@ -180,35 +180,33 @@ const char *luaO_pushfstring (lua_State *L, const char
- 
- 
- void luaO_chunkid (char *out, const char *source, size_t bufflen) {
--  if (*source == '=') {
--strncpy(out, source+1, bufflen);  /* remove first char */
--out[bufflen-1] = '\0';  /* ensures null termination */
--  }
-+  if (*source == '=')
-+strlcpy(out, source+1, bufflen);  /* remove first char */
-   else {  /* out = source, or ...source */
- if (*source == '@') {
--  size_t l;
-+  size_t l, m;
-   source++;  /* skip the `@' */
--  bufflen -= sizeof( '...' );
-   l = strlen(source);
--  strcpy(out, );
--  if (l  bufflen) {
--source += (l-bufflen);  /* get last part of file name */
--strcat(out, ...);
-+  m = bufflen - sizeof( '...' );
-+  strlcpy(out, , bufflen);
-+  if (l  m) {
-+source += (l-m);  /* get last part of file name */
-+  strlcat(out, ..., bufflen);
-   }
--  strcat(out, source);
-+  strlcat(out, source, bufflen);
- }
- else {  /* out = [string string] */
--  size_t len = strcspn(source, \n\r);  /* stop at first newline */
--  bufflen -= sizeof( [string \...\] );
--  if (len  bufflen) len = bufflen;
--  strcpy(out, [string \);
-+  size_t pos = strcspn(source, \n\r);  /* stop at first newline */
-+  size_t len = bufflen - sizeof( [string \...\] );
-+  if (pos  len) pos = len;
-+  strlcpy(out, [string \, bufflen);
-   if (source[len] != '\0') {  /* must truncate? */
--strncat(out, source, len);
--strcat(out, ...);
-+strlcat(out, source, len);
-+strlcat(out, ..., bufflen);
-   }
-   else
--strcat(out, source);
--  strcat(out, \]);
-+strlcat(out, source, bufflen);
-+  strlcat(out, \], bufflen);
- }
-   }
- }
Index: patches/patch-src_lstrlib_c
===
RCS file: patches/patch-src_lstrlib_c
diff -N patches/patch-src_lstrlib_c
--- patches/patch-src_lstrlib_c 25 Aug 2011 07:02:42 -  1.4
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,55 +0,0 @@
-$OpenBSD: patch-src_lstrlib_c,v 1.4 2011/08/25 07:02:42 jasper Exp $
 src/lstrlib.c.orig Wed Aug 24 22:24:32 2011
-+++ src/lstrlib.c  Wed Aug 24 22:24:32 2011
-@@ -746,10 +746,9 @@ static const char *scanformat (lua_State *L, const cha
- 
- static void addintlen (char *form) {
-   size_t l = strlen(form);
--  char spec = form[l - 1];
--  strcpy(form + l - 1, LUA_INTFRMLEN);
--  form[l + sizeof(LUA_INTFRMLEN) - 2] = spec;
--  form[l + sizeof(LUA_INTFRMLEN) - 1] = '\0';
-+  char spec[3] = { 'l', form[l - 1], '\0' };
-+  form[l - 1] = '\0';
-+  strlcat(form, spec, MAX_FORMAT);
- }
- 
- 
-@@ -774,22 +773,24 @@ static int str_format (lua_State *L) {
-   strfrmt = scanformat(L, strfrmt, form);
-   switch (*strfrmt++) {
- case 'c': {
--  sprintf(buff, form, (int)luaL_checknumber(L, arg));
-+  snprintf(buff, sizeof(buff), form, (int)luaL_checknumber(L, arg));
-   break;
- }
- case 'd':  case 'i': {
-   addintlen(form);
--  sprintf(buff, form, (LUA_INTFRM_T)luaL_checknumber(L, arg));
-+  snprintf(buff, sizeof(buff), form,
-+  (LUA_INTFRM_T)luaL_checknumber(L, arg));
-   break;
- 

Re: UPDATE: lang/lua bugfix

2012-03-06 Thread David Coppa
On Tue, Mar 6, 2012 at 11:06 AM, Stuart Henderson s...@spacehopper.org wrote:
 On 2012/03/06 03:11, Brad Smith wrote:
 On 06/03/12 2:49 AM, David Coppa wrote:
 On Tue, Mar 6, 2012 at 3:38 AM, Piotr Sikorapiotr.sik...@frickle.com  
 wrote:
 
 Attached patch fixes this, but to be honest I would consider completely
 dropping our fix from the port .
 
 me too would prefer the latter.
 Other opinions?

 Drop the patches.

 OKs?

Sure. Ok for me

cheers
David



Re: UPDATE: lang/lua bugfix

2012-03-06 Thread Piotr Sikora

Hi,


Drop the patches.


OKs?


I was thinking more about dropping only the smart patches (see: attached 
patch), because changing sprintf() to snprintf() shouldn't hurt, but I'm OK 
with both choices.


Best regards,
Piotr Sikora  piotr.sik...@frickle.com 


lua-5.1.4p4-cleanup.patch
Description: Binary data


Re: UPDATE: lang/lua bugfix

2012-03-06 Thread Brad Smith

On 06/03/12 9:14 AM, Piotr Sikora wrote:

Hi,


Drop the patches.


OKs?


I was thinking more about dropping only the smart patches (see:
attached patch), because changing sprintf() to snprintf() shouldn't
hurt, but I'm OK with both choices.


Local patches of these kind are frowned upon. Work with the upstream
community to get the patches integrated.

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



Re: UPDATE: lang/lua bugfix

2012-03-06 Thread Piotr Sikora

Hi,


I was thinking more about dropping only the smart patches (see:
attached patch), because changing sprintf() to snprintf() shouldn't
hurt, but I'm OK with both choices.


Local patches of these kind are frowned upon. Work with the upstream
community to get the patches integrated.


Then commit sthen@'s patch, like I said, I'm fine with either of them.

Best regards,
Piotr Sikora  piotr.sik...@frickle.com 



Re: UPDATE: lang/lua bugfix

2012-03-05 Thread David Coppa
On Tue, Mar 6, 2012 at 3:38 AM, Piotr Sikora piotr.sik...@frickle.com wrote:

 Attached patch fixes this, but to be honest I would consider completely
 dropping our fix from the port .

me too would prefer the latter.
Other opinions?

 Best regards,
 Piotr Sikora  piotr.sik...@frickle.com 

ciao,
David