fixup LINENO in eval and alias; patch and initial testcase
From: Martijn Dekker <martijn@inlv.org>
This commit is contained in:
24
check.t
24
check.t
@@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.764 2017/03/19 22:31:24 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.765 2017/03/22 00:20:39 tg Exp $
|
||||||
# -*- mode: sh -*-
|
# -*- mode: sh -*-
|
||||||
#-
|
#-
|
||||||
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
# (2013/12/02 20:39:44) http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date
|
# (2013/12/02 20:39:44) http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date
|
||||||
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R54 2017/03/19
|
@(#)MIRBSD KSH R54 2017/03/21
|
||||||
description:
|
description:
|
||||||
Check version of shell.
|
Check version of shell.
|
||||||
stdin:
|
stdin:
|
||||||
@@ -39,7 +39,7 @@ name: KSH_VERSION
|
|||||||
category: shell:legacy-no
|
category: shell:legacy-no
|
||||||
---
|
---
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)LEGACY KSH R54 2017/03/19
|
@(#)LEGACY KSH R54 2017/03/21
|
||||||
description:
|
description:
|
||||||
Check version of legacy shell.
|
Check version of legacy shell.
|
||||||
stdin:
|
stdin:
|
||||||
@@ -5232,6 +5232,24 @@ expected-stdout:
|
|||||||
line <6>
|
line <6>
|
||||||
expected-exit: 1
|
expected-exit: 1
|
||||||
---
|
---
|
||||||
|
name: lineno-eval-alias
|
||||||
|
description:
|
||||||
|
Check if LINENO is trapped in eval and aliases
|
||||||
|
stdin:
|
||||||
|
${ZSH_VERSION+false} || emulate sh; echo $LINENO
|
||||||
|
echo $LINENO
|
||||||
|
eval ' echo $LINENO
|
||||||
|
echo $LINENO
|
||||||
|
echo $LINENO'
|
||||||
|
echo $LINENO
|
||||||
|
expected-stdout:
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
6
|
||||||
|
---
|
||||||
name: unknown-trap
|
name: unknown-trap
|
||||||
description:
|
description:
|
||||||
Ensure unknown traps are not a syntax error
|
Ensure unknown traps are not a syntax error
|
||||||
|
3
funcs.c
3
funcs.c
@@ -38,7 +38,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.330 2017/03/19 20:59:25 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.331 2017/03/22 00:20:41 tg Exp $");
|
||||||
|
|
||||||
#if HAVE_KILLPG
|
#if HAVE_KILLPG
|
||||||
/*
|
/*
|
||||||
@@ -2373,6 +2373,7 @@ c_eval(const char **wp)
|
|||||||
return (1);
|
return (1);
|
||||||
s = pushs(SWORDS, ATEMP);
|
s = pushs(SWORDS, ATEMP);
|
||||||
s->u.strv = wp + builtin_opt.optind;
|
s->u.strv = wp + builtin_opt.optind;
|
||||||
|
s->line = current_lineno;
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* The following code handles the case where the command is
|
* The following code handles the case where the command is
|
||||||
|
3
lex.c
3
lex.c
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.230 2017/03/12 02:04:14 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.231 2017/03/22 00:20:43 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* states while lexing word
|
* states while lexing word
|
||||||
@@ -1063,6 +1063,7 @@ yylex(int cf)
|
|||||||
s->start = s->str = p->val.s;
|
s->start = s->str = p->val.s;
|
||||||
s->u.tblp = p;
|
s->u.tblp = p;
|
||||||
s->flags |= SF_HASALIAS;
|
s->flags |= SF_HASALIAS;
|
||||||
|
s->line = source->line;
|
||||||
s->next = source;
|
s->next = source;
|
||||||
if (source->type == SEOF) {
|
if (source->type == SEOF) {
|
||||||
/* prevent infinite recursion at EOS */
|
/* prevent infinite recursion at EOS */
|
||||||
|
Reference in New Issue
Block a user