On Wed, Feb 05, 2014 at 04:03:17PM -0600, Nathan Weeks wrote:
> ksh 2014-01-14 fails to compile on OS X 10.7.5 (Xcode 4.6.1) due to the
> following error:
> 
> ========================================
> /tmp/ast-ksh.2014-01-14/src/lib/libcmd/ls.c:1260:3: error: non-void
> function 'ls' should return a value [-Wreturn-type]
>                 return;
>                 ^
> /tmp/ast-ksh.2014-01-14/src/lib/libcmd/ls.c:1268:3: error: non-void
> function 'ls' should return a value [-Wreturn-type]
>                 return;
>                 ^
> /tmp/ast-ksh.2014-01-14/src/lib/libcmd/ls.c:1273:3: error: non-void
> function 'ls' should return a value [-Wreturn-type]
>                 return;
>                 ^
> ========================================
> 
> The fix is straightforward:
> 
> ========================================
> --- ./src/lib/libcmd/ls.c.orig  2013-12-08 01:24:57.000000000 -0600
> +++ ./src/lib/libcmd/ls.c       2014-02-04 08:34:10.000000000 -0600
> @@ -1257,7 +1257,7 @@
>         if (!VISIBLE(state, ent))
>         {
>                 fts_set(NiL, ent, FTS_SKIP);
> -               return;
> +               return 0;
>         }
>         switch (ent->fts_info)
>         {
> @@ -1265,12 +1265,12 @@
>                 if (ent->fts_parent->fts_info == FTS_DNX)
>                         break;
>                 error(2, "%s: not found", ent->fts_path);
> -               return;
> +               return 0;
>         case FTS_DC:
>                 if (state->lsflags & LS_DIRECTORY)
>                         break;
>                 error(2, "%s: directory causes cycle", ent->fts_path);
> -               return;
> +               return 0;
>         case FTS_DNR:
>                 if (state->lsflags & LS_DIRECTORY)
>                         break;
> ========================================

Indeed I've similar found, also some hard crashes.

Also if one tries to add the $PWD/arch/linux.i386-64/bin to the PATH
to run the test suite with SHCOMP=$PWD/arch/linux.i386-64/bin/shcomp
and SHELL=$PWD/arch/linux.i386-64/bin/ksh the test suite crash a way.

All not enabled builtins will be found in the path $PWD/arch/linux.i386-64/bin/
even if not there.  Guess: the .paths in the bin directory does not work well
with path_absolute() in src/cmd/ksh93/sh/path.c.

Also the `set -k' problem is there as the alias/hash builtins are not set 
BLT_DCL,
the crash with the line

  ksh -c 'trap "exit 0" EXIT; typeset -T X=(typeset x; function x.get { :; }); 
X -a xs=((x=yo) (x=jo))'

still exists.  On all architectures I see

 test io(shcomp) failed at 2014-02-21+13:58:17 with exit code 269 [ 99 tests 
269 errors ]

where `269' is not the number of the errors but a crash.  The test scripts
treemove.sh and namespace.sh do not work with shcomp.  The locale.sh script
cause the ksh to show a fortify message of the glibc

    test locale begins at 2014-02-20+14:50:33
    *** stack smashing detected ***: /tmp/ksh-build.LszUgz/bin/ksh terminated
    ======= Backtrace: =========
    /lib64/libc.so.6(__fortify_fail+0x38)[0x3fffd30b03c]
    /lib64/libc.so.6(+0x10a002)[0x3fffd30b002]
    /tmp/ksh-build.LszUgz/bin/ksh[0x8010f2fc]
    /tmp/ksh-build.LszUgz/bin/ksh[0x8010f394]
    /tmp/ksh-build.LszUgz/bin/ksh[0x801128d0]
    /tmp/ksh-build.LszUgz/bin/ksh[0x80112cc0]
    /tmp/ksh-build.LszUgz/bin/ksh[0x8010f6fa]
    /tmp/ksh-build.LszUgz/bin/ksh[0x8010a3f8]
    /tmp/ksh-build.LszUgz/bin/ksh[0x8010ac7e]
    /tmp/ksh-build.LszUgz/bin/ksh[0x800115f8]
    /tmp/ksh-build.LszUgz/bin/ksh[0x80010490]
    /lib64/libc.so.6(__libc_start_main+0x114)[0x3fffd2221d8]
    /tmp/ksh-build.LszUgz/bin/ksh[0x8001039a]
    ======= Memory map: ========
    80000000-801e7000 r-xp 00000000 fc:00 629644                             
/tmp/ksh-build.LszUgz/bin/ksh
    801e7000-801fa000 r--p 001e6000 fc:00 629644                             
/tmp/ksh-build.LszUgz/bin/ksh
    801fa000-80202000 rw-p 001f9000 fc:00 629644                             
/tmp/ksh-build.LszUgz/bin/ksh
    80202000-80229000 rw-p 00000000 00:00 0                                  
[heap]
    10051b87000-10051f87000 rw-p 00000000 00:00 0 
    3fffd1ec000-3fffd1fd000 r-xp 00000000 fc:00 1079395                      
/lib64/libgcc_s.so.1
    3fffd1fd000-3fffd1fe000 r--p 00010000 fc:00 1079395                      
/lib64/libgcc_s.so.1
    3fffd1fe000-3fffd1ff000 rw-p 00011000 fc:00 1079395                      
/lib64/libgcc_s.so.1
    3fffd1ff000-3fffd201000 rw-p 00000000 00:00 0 
    3fffd201000-3fffd37e000 r-xp 00000000 fc:00 1079240                      
/lib64/libc-2.11.3.so
    3fffd37e000-3fffd382000 r--p 0017c000 fc:00 1079240                      
/lib64/libc-2.11.3.so
    3fffd382000-3fffd384000 rw-p 00180000 fc:00 1079240                      
/lib64/libc-2.11.3.so
    3fffd384000-3fffd388000 rw-p 00000000 00:00 0 
    3fffd388000-3fffd38a000 r-xp 00000000 fc:00 1079274                      
/lib64/libutil-2.11.3.so
    3fffd38a000-3fffd38b000 r--p 00002000 fc:00 1079274                      
/lib64/libutil-2.11.3.so
    3fffd38b000-3fffd38c000 rw-p 00003000 fc:00 1079274                      
/lib64/libutil-2.11.3.so
    3fffd38c000-3fffd38f000 r-xp 00000000 fc:00 1079246                      
/lib64/libdl-2.11.3.so
    3fffd38f000-3fffd390000 r--p 00002000 fc:00 1079246                      
/lib64/libdl-2.11.3.so
    3fffd390000-3fffd391000 rw-p 00003000 fc:00 1079246                      
/lib64/libdl-2.11.3.so
    3fffd391000-3fffd392000 rw-p 00000000 00:00 0 
    3fffd392000-3fffd42a000 r-xp 00000000 fc:00 1079248                      
/lib64/libm-2.11.3.so
    3fffd42a000-3fffd42b000 r--p 00097000 fc:00 1079248                      
/lib64/libm-2.11.3.so
    3fffd42b000-3fffd42c000 rw-p 00098000 fc:00 1079248                      
/lib64/libm-2.11.3.so
    3fffd42f000-3fffd432000 rw-p 00000000 00:00 0 
    3fffd432000-3fffd434000 r-xp 00000000 00:00 0                            
[vdso]
    3fffd434000-3fffd454000 r-xp 00000000 fc:00 1079374                      
/lib64/ld-2.11.3.so
    3fffd454000-3fffd455000 r--p 00020000 fc:00 1079374                      
/lib64/ld-2.11.3.so
    3fffd455000-3fffd456000 rw-p 00021000 fc:00 1079374                      
/lib64/ld-2.11.3.so
    3fffd456000-3fffd457000 rw-p 00000000 00:00 0 
    3fffff6f000-3fffff90000 rw-p 00000000 00:00 0                            
[stack]
    locale.sh: line 199: 18381: Abort
    locale.sh[200]: join test script failed -- exit code 262
    locale.sh: line 202: out: cannot open [No such file or directory]
    locale.sh[203]: LC_ALL test script failed -- expected 'f1', got ''
    locale.sh: line 199: 18381: Abort
    locale.sh[200]: join test script failed -- exit code 262
    locale.sh: line 202: out: cannot open [No such file or directory]
    locale.sh[203]: LC_ALL test script failed -- expected 'f1', got ''
    test locale failed at 2014-02-20+14:50:35 with exit code 2 [ 38 tests 2 
errors ]
    test locale(shcomp) begins at 2014-02-20+14:50:35
    /tmp/ksh-build.LszUgz/tmp1hPOkPV.PUU/shcomp-locale.ksh: line 199: 18440: 
Memory fault
    shcomp-locale.ksh[200]: join test script failed -- exit code 267
    /tmp/ksh-build.LszUgz/tmp1hPOkPV.PUU/shcomp-locale.ksh: line 202: out: 
cannot open [No such file or directory]
    shcomp-locale.ksh[203]: LC_ALL test script failed -- expected 'f1', got ''
    shcomp-locale.ksh[249]: 'LANG=C;cd _not_found_;(LANG=debug;cd 
_not_found_);cd _not_found_;:' failed -- exit status 260
    shcomp-locale.ksh[261]: 'LANG=C;cd _not_found_;(LANG=debug;cd 
_not_found_);cd _not_found_;:' failed -- expected '121', got '1'
    test locale(shcomp) failed at 2014-02-20+14:50:36 with exit code 4 [ 38 
tests 4 errors ]

Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr
--- src/cmd/ksh93/bltins/typeset.c
+++ src/cmd/ksh93/bltins/typeset.c	2014-02-18 15:57:51.077469326 +0000
@@ -549,7 +549,7 @@ static int     setall(char **argv,regist
 	}
 	else if(*shp->prefix==0)
 		shp->prefix = 0;
-	if(*argv[0]=='+')
+	if(*argv && *argv[0]=='+')
 		nvflags |= NV_NOADD;
 	flag &= ~(NV_NOARRAY|NV_NOSCOPE|NV_VARNAME|NV_IDENT|NV_STATIC|NV_COMVAR|NV_IARRAY);
 	if(argv[1])
--- src/cmd/ksh93/data/builtins.c
+++ src/cmd/ksh93/data/builtins.c	2014-02-19 11:05:51.494209208 +0000
@@ -85,8 +85,8 @@ const struct shtable3 shtab_builtins[] =
 #if _bin_newgrp || _usr_bin_newgrp
 	"newgrp",	NV_BLTIN|BLT_ENV|BLT_SPC,	Bltin(login),
 #endif	/* _bin_newgrp || _usr_bin_newgrp */
-	"alias",	NV_BLTIN|BLT_SPC,		bltin(alias),
-	"hash",		NV_BLTIN|BLT_SPC,		bltin(alias),
+	"alias",	NV_BLTIN|BLT_SPC|BLT_DCL,	bltin(alias),
+	"hash",		NV_BLTIN|BLT_SPC|BLT_DCL,	bltin(alias),
 	"eval",		NV_BLTIN|BLT_ENV|BLT_SPC|BLT_EXIT,bltin(eval),
 	"exit",		NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(return),
 	"fc",		NV_BLTIN|BLT_ENV|BLT_EXIT,	bltin(hist),
--- src/cmd/ksh93/sh/xec.c
+++ src/cmd/ksh93/sh/xec.c	2011-07-04 15:42:21.000000000 +0000
@@ -4041,7 +4041,8 @@ int sh_funscope_20120720(int argn, char *argv[],i
 	shp->st.var_local = shp->var_tree;
 	if(!fun)
 	{
-		shp->st.filename = fp->node->nvalue.rp->fname;
+		if (fp->node->nvalue.rp)
+			shp->st.filename = fp->node->nvalue.rp->fname;
 		shp->st.funname = nv_name(fp->node);
 		shp->last_root = nv_dict(DOTSHNOD);
 		nv_putval(SH_PATHNAMENOD,shp->st.filename,NV_NOFREE);
--- src/cmd/ksh93/edit/vi.c
+++ src/cmd/ksh93/edit/vi.c	2014-02-17 15:53:10.873464619 +0000
@@ -396,6 +396,8 @@ int ed_viread(void *context, int fd, reg
 
 	if(!yankbuf)
 		yankbuf = (genchar*)malloc(MAXLINE*CHARSIZE);
+	if (!vp->lastline)
+		vp->lastline = (genchar*)malloc(MAXLINE*CHARSIZE);
 	if( vp->last_cmd == '\0' )
 	{
 		/*** first time for this shell ***/
@@ -405,6 +407,8 @@ int ed_viread(void *context, int fd, reg
 		vp->lastmotion = '\0';
 		vp->lastrepeat = 1;
 		vp->repeat = 1;
+		if (!yankbuf)
+			return(-1);
 		*yankbuf = 0;
 	}
 
@@ -1132,7 +1136,7 @@ static void cdelete(Vi_t *vp,register in
 
 		/*** save characters to be deleted ***/
 
-		if( mode != 'c' )
+		if( mode != 'c' && yankbuf )
 		{
 			i = cp[nchars];
 			cp[nchars] = 0;
@@ -2165,6 +2169,9 @@ static void save_last(register Vi_t* vp)
 {
 	register int i;
 
+	if (vp->lastline == NULL)
+		return;
+
 	if( (i = cur_virt - first_virt + 1) > 0 )
 	{
 		/*** save last thing user typed ***/
@@ -2414,6 +2421,11 @@ static int textmod(register Vi_t *vp,reg
 		p = yankbuf;
 	}
 
+	if (!p)
+	{
+		return(BAD);
+	}
+
 addin:
 	switch( c )
 	{
@@ -2686,6 +2698,8 @@ yankeol:
 		vp->lastmotion = c;
 		if( c == 'y' )
 		{
+			if (!yankbuf)
+				return(BAD);
 			gencpy(yankbuf, virtual);
 		}
 		else if(!delmotion(vp, c, 'y'))

Attachment: pgp6VRxMWdB21.pgp
Description: PGP signature

_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to