Mon Feb 23 13:18:56 2009 UTC ()
Pullup ticket #2706 - requested by adrianp
pdksh: bug fix

Revisions pulled up:
- shells/pdksh/Makefile				1.18
- shells/pdksh/files/c_ulimit.c			1.4
- shells/pdksh/files/lex.c			1.4
---
Module Name:	pkgsrc
Committed By:	tnn
Date:		Sat Feb 21 20:06:30 UTC 2009

Modified Files:
	pkgsrc/shells/pdksh: Makefile
	pkgsrc/shells/pdksh/files: c_ulimit.c lex.c

Log Message:
Merge the following revisions from NetBSD src:
c_ulimit.c 1.9: avoid sign extension problem
lex.c 1.13: bugfix related to nested quotes
Bump PKGREVISION.


(tron)
diff -r1.17 -r1.17.10.1 pkgsrc/shells/pdksh/Makefile
diff -r1.3 -r1.3.10.1 pkgsrc/shells/pdksh/files/c_ulimit.c
diff -r1.3 -r1.3.10.1 pkgsrc/shells/pdksh/files/lex.c

cvs diff -r1.17 -r1.17.10.1 pkgsrc/shells/pdksh/Makefile (expand / switch to unified diff)

--- pkgsrc/shells/pdksh/Makefile 2008/06/19 18:36:51 1.17
+++ pkgsrc/shells/pdksh/Makefile 2009/02/23 13:18:56 1.17.10.1
@@ -1,18 +1,18 @@ @@ -1,18 +1,18 @@
1# $NetBSD: Makefile,v 1.17 2008/06/19 18:36:51 joerg Exp $ 1# $NetBSD: Makefile,v 1.17.10.1 2009/02/23 13:18:56 tron Exp $
2# 2#
3 3
4DISTNAME= pdksh-5.2.14 4DISTNAME= pdksh-5.2.14
5PKGREVISION= 3 5PKGREVISION= 4
6CATEGORIES= shells 6CATEGORIES= shells
7MASTER_SITES= ftp://ftp.cs.mun.ca/pub/pdksh/ \ 7MASTER_SITES= ftp://ftp.cs.mun.ca/pub/pdksh/ \
8 http://gd.tuwien.ac.at/utils/shells/pdksh/ \ 8 http://gd.tuwien.ac.at/utils/shells/pdksh/ \
9 ftp://ftp.lip6.fr/pub/unix/shells/pdksh/ \ 9 ftp://ftp.lip6.fr/pub/unix/shells/pdksh/ \
10 ftp://ftp.demon.net/pub/mirrors/pdksh/ 10 ftp://ftp.demon.net/pub/mirrors/pdksh/
11MASTER_SITES= # maintained locally 11MASTER_SITES= # maintained locally
12DISTFILES= # empty 12DISTFILES= # empty
13 13
14MAINTAINER= schmonz@NetBSD.org 14MAINTAINER= schmonz@NetBSD.org
15HOMEPAGE= http://web.cs.mun.ca/~michael/pdksh/ 15HOMEPAGE= http://web.cs.mun.ca/~michael/pdksh/
16COMMENT= Free clone of the AT&T Korn shell 16COMMENT= Free clone of the AT&T Korn shell
17 17
18PKG_DESTDIR_SUPPORT= user-destdir 18PKG_DESTDIR_SUPPORT= user-destdir

cvs diff -r1.3 -r1.3.10.1 pkgsrc/shells/pdksh/files/c_ulimit.c (expand / switch to unified diff)

--- pkgsrc/shells/pdksh/files/c_ulimit.c 2008/06/15 14:20:08 1.3
+++ pkgsrc/shells/pdksh/files/c_ulimit.c 2009/02/23 13:18:56 1.3.10.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: c_ulimit.c,v 1.3 2008/06/15 14:20:08 tnn Exp $ */ 1/* $NetBSD: c_ulimit.c,v 1.3.10.1 2009/02/23 13:18:56 tron Exp $ */
2 2
3/* 3/*
4 ulimit -- handle "ulimit" builtin 4 ulimit -- handle "ulimit" builtin
5 5
6 Reworked to use getrusage() and ulimit() at once (as needed on 6 Reworked to use getrusage() and ulimit() at once (as needed on
7 some schizophrenic systems, eg, HP-UX 9.01), made argument parsing 7 some schizophrenic systems, eg, HP-UX 9.01), made argument parsing
8 conform to at&t ksh, added autoconf support. Michael Rendell, May, '94 8 conform to at&t ksh, added autoconf support. Michael Rendell, May, '94
9 9
10 Eric Gisin, September 1988 10 Eric Gisin, September 1988
11 Adapted to PD KornShell. Removed AT&T code. 11 Adapted to PD KornShell. Removed AT&T code.
12 12
13 last edit: 06-Jun-1987 D A Gwyn 13 last edit: 06-Jun-1987 D A Gwyn
14 14
@@ -177,27 +177,27 @@ c_ulimit(wp) @@ -177,27 +177,27 @@ c_ulimit(wp)
177 if (!evaluate(wp[0], &rval, KSH_RETURN_ERROR)) 177 if (!evaluate(wp[0], &rval, KSH_RETURN_ERROR))
178 return 1; 178 return 1;
179 /* Avoid problems caused by typos that 179 /* Avoid problems caused by typos that
180 * evaluate misses due to evaluating unset 180 * evaluate misses due to evaluating unset
181 * parameters to 0... 181 * parameters to 0...
182 * If this causes problems, will have to 182 * If this causes problems, will have to
183 * add parameter to evaluate() to control 183 * add parameter to evaluate() to control
184 * if unset params are 0 or an error. 184 * if unset params are 0 or an error.
185 */ 185 */
186 if (!rval && !digit(wp[0][0])) { 186 if (!rval && !digit(wp[0][0])) {
187 bi_errorf("invalid limit: %s", wp[0]); 187 bi_errorf("invalid limit: %s", wp[0]);
188 return 1; 188 return 1;
189 } 189 }
190 val = rval * l->factor; 190 val = (unsigned long)rval * l->factor;
191 } 191 }
192 } 192 }
193 if (all) { 193 if (all) {
194 for (l = limits; l->name; l++) { 194 for (l = limits; l->name; l++) {
195#ifdef HAVE_SETRLIMIT 195#ifdef HAVE_SETRLIMIT
196 if (l->which == RLIMIT) { 196 if (l->which == RLIMIT) {
197 getrlimit(l->gcmd, &limit); 197 getrlimit(l->gcmd, &limit);
198 if (how & SOFT) 198 if (how & SOFT)
199 val = limit.rlim_cur; 199 val = limit.rlim_cur;
200 else if (how & HARD) 200 else if (how & HARD)
201 val = limit.rlim_max; 201 val = limit.rlim_max;
202 } else 202 } else
203#endif /* HAVE_SETRLIMIT */ 203#endif /* HAVE_SETRLIMIT */

cvs diff -r1.3 -r1.3.10.1 pkgsrc/shells/pdksh/files/lex.c (expand / switch to unified diff)

--- pkgsrc/shells/pdksh/files/lex.c 2008/06/15 14:20:09 1.3
+++ pkgsrc/shells/pdksh/files/lex.c 2009/02/23 13:18:56 1.3.10.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lex.c,v 1.3 2008/06/15 14:20:09 tnn Exp $ */ 1/* $NetBSD: lex.c,v 1.3.10.1 2009/02/23 13:18:56 tron Exp $ */
2 2
3/* 3/*
4 * lexical analysis and source input 4 * lexical analysis and source input
5 */ 5 */
6 6
7#include "sh.h" 7#include "sh.h"
8#include <ctype.h> 8#include <ctype.h>
9 9
10 10
11/* Structure to keep track of the lexing state and the various pieces of info 11/* Structure to keep track of the lexing state and the various pieces of info
12 * needed for each particular state. 12 * needed for each particular state.
13 */ 13 */
14typedef struct lex_state Lex_state; 14typedef struct lex_state Lex_state;
@@ -318,61 +318,47 @@ yylex(cf) @@ -318,61 +318,47 @@ yylex(cf)
318 *wp++ = '\0'; 318 *wp++ = '\0';
319 *wp++ = CSUBST; 319 *wp++ = CSUBST;
320 *wp++ = 'X'; 320 *wp++ = 'X';
321 } else { 321 } else {
322 *wp++ = CHAR, *wp++ = '$'; 322 *wp++ = CHAR, *wp++ = '$';
323 ungetsc(c); 323 ungetsc(c);
324 } 324 }
325 break; 325 break;
326 case '`': 326 case '`':
327 PUSH_STATE(SBQUOTE); 327 PUSH_STATE(SBQUOTE);
328 *wp++ = COMSUB; 328 *wp++ = COMSUB;
329 /* Need to know if we are inside double quotes 329 /* Need to know if we are inside double quotes
330 * since sh/at&t-ksh translate the \" to " in 330 * since sh/at&t-ksh translate the \" to " in
331 * "`..\"..`". 331 * "`..\"..`". POSIX also requires this.
332 * This is not done in posix mode (section 332 * An earlier version of ksh misinterpreted
333 * 3.2.3, Double Quotes: "The backquote shall 333 * the POSIX specification and performed
334 * retain its special meaning introducing the 334 * removal of backslash escapes only if
335 * other form of command substitution (see 335 * posix mode was not in effect.
336 * 3.6.3). The portion of the quoted string 
337 * from the initial backquote and the 
338 * characters up to the next backquote that 
339 * is not preceded by a backslash (having 
340 * escape characters removed) defines that 
341 * command whose output replaces `...` when 
342 * the word is expanded." 
343 * Section 3.6.3, Command Substitution: 
344 * "Within the backquoted style of command 
345 * substitution, backslash shall retain its 
346 * literal meaning, except when followed by 
347 * $ ` \."). 
348 */ 336 */
349 statep->ls_sbquote.indquotes = 0; 337 statep->ls_sbquote.indquotes = 0;
350 if (!Flag(FPOSIX)) { 338 Lex_state *s = statep;
351 Lex_state *s = statep; 339 Lex_state *base = state_info.base;
352 Lex_state *base = state_info.base; 340 while (1) {
353 while (1) { 341 for (; s != base; s--) {
354 for (; s != base; s--) { 342 if (s->ls_state == SDQUOTE) {
355 if (s->ls_state == SDQUOTE) { 343 statep->ls_sbquote.indquotes = 1;
356 statep->ls_sbquote.indquotes = 1; 
357 break; 
358 } 
359 } 
360 if (s != base) 
361 break; 
362 if (!(s = s->ls_info.base)) 
363 break; 344 break;
364 base = s-- - STATE_BSIZE; 345 }
365 } 346 }
 347 if (s != base)
 348 break;
 349 if (!(s = s->ls_info.base))
 350 break;
 351 base = s-- - STATE_BSIZE;
366 } 352 }
367 break; 353 break;
368 default: 354 default:
369 *wp++ = CHAR, *wp++ = c; 355 *wp++ = CHAR, *wp++ = c;
370 } 356 }
371 break; 357 break;
372 358
373 case SSQUOTE: 359 case SSQUOTE:
374 if (c == '\'') { 360 if (c == '\'') {
375 POP_STATE(); 361 POP_STATE();
376 *wp++ = CQUOTE; 362 *wp++ = CQUOTE;
377 ignore_backslash_newline--; 363 ignore_backslash_newline--;
378 } else 364 } else