Accepting request 161265 from shells

Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/161265
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ksh?expand=0&rev=91
This commit is contained in:
Stephan Kulow 2013-03-26 18:48:08 +00:00 committed by Git OBS Bridge
commit 92a7b8927e
5 changed files with 104 additions and 50 deletions

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Tue Mar 19 16:48:37 UTC 2013 - werner@suse.de
- Add patch ksh93-typedef.dif as found during debugging
-------------------------------------------------------------------
Tue Mar 19 15:14:00 UTC 2013 - werner@suse.de
- Make Shift_JIS patch more reliable as requestef from upstream
- Drop remaining part of the patch ksh93-zerofill.dif for zerofilled
variables (bnc#785360 as the first part of the patch is upstream
together with an other change. This fix a side effect of cutting
variables if TMOUT is used (bnc#808956)
-------------------------------------------------------------------
Thu Feb 28 13:10:09 UTC 2013 - werner@suse.de

View File

@ -114,8 +114,8 @@ Patch24: ksh93-builtin.dif
Patch27: astksh_builtin_poll20120806_001.diff
# PATCH-FIX-UPSTREAM ksh93-env.dif [bnc#785266, bnc#803613]
Patch28: ksh93-env.dif
# PATCH-FIX-UPSTREAM ksh93-zerofill.dif [bnc#785360]
Patch29: ksh93-zerofill.dif
# PATCH-FIX-UPSTREAM ksh93-typedef.dif
Patch29: ksh93-typedef.dif
# PATCH-EXTEND-UPSTREAM ksh93-pathtemp.dif [bnc#786134]
# the fix is part of ksh93u+ 2012-06-28
# nevertheless the /dev/shm extension is useful
@ -389,7 +389,7 @@ fi
fi
done
MEMORY="-s 128 ${MEMORY:+-e ${MEMORY}}"
RPM_OPT_FLAGS=$(echo "${RPM_OPT_FLAGS}"|sed -r 's/[[:blank:]]+-g[0-9]?/ -g2/g')
RPM_OPT_FLAGS=$(echo "${RPM_OPT_FLAGS}"|sed -r 's/([[:blank:]]+)-g[[:digit:]]+/\1-g2/g;s/([[:blank:]]+)-g([[:blank:]]+|$)/\1-g2\2/g')
UNIVERSE=att
LDFLAGS="-lm"
LDSOFLG=""

View File

@ -116,7 +116,7 @@
else
{
--- src/cmd/ksh93/sh/macro.c
+++ src/cmd/ksh93/sh/macro.c 2013-02-07 13:26:07.897952986 +0000
+++ src/cmd/ksh93/sh/macro.c 2013-03-19 17:16:46.062074381 +0100
@@ -54,6 +54,7 @@
#if SHOPT_MULTIBYTE
# undef isascii
@ -125,7 +125,7 @@
#else
# define mbchar(p) (*(unsigned char*)p++)
#endif /* SHOPT_MULTIBYTE */
@@ -2026,6 +2027,10 @@ static void comsubst(Mac_t *mp,register
@@ -2026,6 +2027,11 @@ static void comsubst(Mac_t *mp,register
struct _mac_ savemac;
int savtop = stktell(stkp);
char lastc=0, *savptr = stkfreeze(stkp,0);
@ -133,33 +133,46 @@
+ const Lc_t *lc=lcinfo(LC_CTYPE)->lc;
+ wchar_t lastw=0;
+#endif /* SHOPT_MULTIBYTE */
+ ssize_t len;
int was_history = sh_isstate(SH_HISTORY);
int was_verbose = sh_isstate(SH_VERBOSE);
int was_interactive = sh_isstate(SH_INTERACTIVE);
@@ -2209,6 +2214,17 @@ static void comsubst(Mac_t *mp,register
@@ -2127,7 +2133,7 @@ static void comsubst(Mac_t *mp,register
num = lseek(fd, (off_t)0, SEEK_CUR);
goto out_offset;
}
- if(!(sp=mp->shp->sftable[fd]))
+ if(!(sp=mp->shp->sftable[fd]) || (sffileno(sp)!=fd &&!(sfset(sp,0,0)&SF_STRING)))
sp = sfnew(NIL(Sfio_t*),(char*)malloc(IOBSIZE+1),IOBSIZE,fd,SF_READ|SF_MALLOC);
type = 3;
}
@@ -2209,17 +2215,36 @@ static void comsubst(Mac_t *mp,register
}
else if(lastc)
{
- mac_copy(mp,&lastc,1);
+ char mb[8];
+ mb[0] = lastc;
+ len = 1;
+#if SHOPT_MULTIBYTE
+ if(lastw)
+ {
+ int n;
+ char mb[8];
+ n = mbconv(mb, lastw);
+ mac_copy(mp,mb,n);
+ lastw = 0;
+ }
+ else
+ len = mbconv(mb, lastw);
+ lastw = 0;
+#endif /* SHOPT_MULTIBYTE */
mac_copy(mp,&lastc,1);
lastc = 0;
+ mac_copy(mp,mb,len);
}
@@ -2220,6 +2236,17 @@ static void comsubst(Mac_t *mp,register
ssize_t len = 1;
newlines = nextnewlines;
if(++c < bufsize)
str[c] = 0;
else
{
- ssize_t len = 1;
+ len = 1;
/* can't write past buffer so save last character */
+#if SHOPT_MULTIBYTE
+ if ((len = mbsize(str))>1 && !(lc->flags & LC_utf8))
+ if ((lc->flags & LC_utf8)==0 && (len = mbsize(str))>1)
+ {
+ len = mb2wc(lastw,str,len);
+ if (len < 0)
@ -172,25 +185,25 @@
c -= len;
lastc = str[c];
str[c] = 0;
@@ -2240,6 +2267,17 @@ static void comsubst(Mac_t *mp,register
@@ -2240,8 +2265,16 @@ static void comsubst(Mac_t *mp,register
}
if(lastc)
{
- mac_copy(mp,&lastc,1);
+ char mb[8];
+ mb[0] = lastc;
+ len = 1;
+#if SHOPT_MULTIBYTE
+ if(lastw)
+ {
+ int n;
+ char mb[8];
+ n = mbconv(mb, lastw);
+ mac_copy(mp,mb,n);
+ lastw = 0;
+ }
+ else
+ len = mbconv(mb, lastw);
+ lastw = 0;
+#endif /* SHOPT_MULTIBYTE */
mac_copy(mp,&lastc,1);
lastc = 0;
+ mac_copy(mp,mb,len);
}
@@ -2340,13 +2378,13 @@ static void mac_copy(register Mac_t *mp,
sfclose(sp);
return;
@@ -2340,13 +2373,13 @@ static void mac_copy(register Mac_t *mp,
if(mp->pattern)
{
char *sp = "&|()";
@ -228,7 +241,7 @@
int len;
--- src/cmd/ksh93/tests/sjis.sh
+++ src/cmd/ksh93/tests/sjis.sh 2011-05-20 15:11:29.000000000 +0000
@@ -0,0 +1,67 @@
@@ -0,0 +1,77 @@
+########################################################################
+# #
+# Copyright (c) 2007 SuSE Linux Products GmbH, Nuernberg, Germany #
@ -295,6 +308,16 @@
+ print -u2 -n "\t"
+ print -u2 -r ${0##*/}[$LINENO]: "Shift-JIS encoding failed"
+fi
+
+LANG=POSIX
+typeset -r utf8_euro_char1=$'\u[20ac]'
+typeset -r utf8_euro_char2=$'\342\202\254'
+(( (${#utf8_euro_char1} == 1) && (${#utf8_euro_char2} == 1) )) || export LC_ALL='en_US.UTF-8'
+if [[ "$(printf '\u[20ac]')" != $'\342\202\254' ]] ; then
+ : err_exit
+ print -u2 -n "\t"
+ print -u2 -r ${0##*/}[$LINENO]: "Locale overrride failed."
+fi
+exit $err
--- src/lib/libast/comp/setlocale.c
+++ src/lib/libast/comp/setlocale.c 2007-12-20 17:50:28.000000000 +0000

37
ksh93-typedef.dif Normal file
View File

@ -0,0 +1,37 @@
--- src/cmd/ksh93/bltins/typeset.c
+++ src/cmd/ksh93/bltins/typeset.c 2013-03-19 17:21:08.667413362 +0100
@@ -461,6 +461,7 @@ static void print_value(Sfio_t *iop, Nam
{
char *name;
int aflag=tp->aflag;
+ Namval_t *table;
if(nv_isnull(np))
{
if(!np->nvflag)
@@ -504,7 +505,9 @@ static void print_value(Sfio_t *iop, Nam
sfwrite(iop,"}\n",2);
return;
}
+ table = tp->sh->last_table;
sfputr(iop,nv_name(np),aflag=='+'?'\n':'=');
+ tp->sh->last_table = table;
if(aflag=='+')
return;
if(nv_isarray(np) && nv_arrayptr(np))
@@ -675,6 +678,7 @@ static int setall(char **argv,regist
{
if(comvar || (shp->last_root==shp->var_tree && (tp->tp || (!shp->st.real_fun && (nvflags&NV_STATIC)) || (!(flag&(NV_EXPORT|NV_RDONLY)) && nv_isattr(np,(NV_EXPORT|NV_IMPORT))==(NV_EXPORT|NV_IMPORT)))))
{
+ if((flag&(NV_HOST|NV_INTEGER))!=NV_HOST)
_nv_unset(np,0);
}
}
@@ -790,7 +794,7 @@ static int setall(char **argv,regist
else
{
char *oldname=0;
- int len=strlen(name);
+ size_t len=strlen(name);
if(tp->argnum==1 && newflag==NV_INTEGER && nv_isattr(np,NV_INTEGER))
tp->argnum = 10;
if(np->nvfun && !nv_isarray(np) && name[len-1]=='.')

View File

@ -1,20 +0,0 @@
--- src/cmd/ksh93/bltins/typeset.c
+++ src/cmd/ksh93/bltins/typeset.c 2012-10-19 14:56:49.000000000 +0000
@@ -756,6 +756,7 @@ static int setall(char **argv,regist
}
if (tp->aflag == '-')
{
+ int oldnum;
if((flag&NV_EXPORT) && (strchr(name,'.') || nv_isvtree(np)))
errormsg(SH_DICT,ERROR_exit(1),e_badexport,name);
#if SHOPT_BSH
@@ -774,6 +775,9 @@ static int setall(char **argv,regist
else if(!(flag&NV_LJUST))
newflag &= ~NV_LJUST;
}
+ oldnum = nv_size(np);
+ if (oldnum > 0)
+ tp->argnum = oldnum;
}
else
{