On Mon, Jun 28, 2010 at 03:24:54PM +0200, Werner Fink wrote:
> On Fri, May 28, 2010 at 02:27:26PM +0200, Werner Fink wrote:
> > On Fri, May 28, 2010 at 02:00:36PM +0200, Werner Fink wrote:
> > > /suse/werner> ksh -c 'echo ${.sh.version}'
> > > Version JM 93t+ 2010-05-24
> > > /suse/werner> ksh ksh93/src/cmd/ksh93/tests/sjis.sh
> > >         sjis.sh[61]: Shift-JIS encoding failed
> > > 
> > > it seems that the `test' builtin fails on the characters
> > > 
> > >   \x81\x5c
> > >   \x81\x7c
> > > 
> > > the scriptlet for testing this can be found in the
> > > attachment.
> > > 
> > > 
> > >      Werner
> > 
> > Beside this I've found that the program pty does not exit
> > and that timetype.sh may missing an
> > 
> >          export LC_TIME=en_US
> > 
> > or similar as
> > 
> >  test timetype.sh begins at 2010-05-28+11:01:48
> >          timetype.sh[61]: tt[0] is not 2pm
> >          timetype.sh[75]: tt[2pm] is not 2pm
> > 
> > does fail as well.
> 
> A few facts:
> 
>      * the error occurs only on line using the external
>        /usr/bin/printf program and does not happen if
>        the builtin is used.
> 
>      * if set
> 
>             set -o noglob
> 
>        the error also does not happen.
> 
>     * For /usr/bin/printf '\x81\x5c' the result depends
>       on how the variables are handled. That is that
> 
>        test $($printf "\x81\x$second") != ${mbchar}
>        test $(${printf} "\x81\x$second") != ${mbchar}
>        test $($printf "\x81\x${second}") != ${mbchar}
>        test $(${printf} "\x81\x${second}") != ${mbchar}
>        test $($printf "\x81\x$second") != ${mbchar}
> 
>       show different results.
> 
> Werner

Now it looks like that this change cause the trouble:

 --- ksh93.2010-03-09/src/cmd/ksh93/sh/macro.c   2007-12-20 18:50:28.000000000 
+0100
 +++ ksh93.2010-05-27/src/cmd/ksh93/sh/macro.c   2007-12-20 18:50:28.000000000 
+0100
 [...]
 @@ -2022,7 +2052,7 @@ static void comsubst(Mac_t *mp,register
         /* read command substitution output and put on stack or here-doc */
         sfpool(sp, NIL(Sfio_t*), SF_WRITE);
         sh_offstate(SH_INTERACTIVE);
 -       while((str=(char*)sfreserve(sp,SF_UNBOUND,0)) && (c = sfvalue(sp))>0)
 +       while((str=(char*)sfreserve(sp,SF_UNBOUND,0)) && 
(c=bufsize=sfvalue(sp))>0)
         {
  #if SHOPT_CRNL
                 /* eliminate <cr> */

... that is that sfvalue() sometimes returns the value 2 or 3 which
then cause to switch into the boolean

                if(++c < bufsize)
                        str[c] = 0;
                else
                {
                        [...]

of comsubst() in ksh93/sh/macro.c and now the multi byte character
is splitted which is a problem for Shift_JIS as now the second
byte seems to be handled as a single byte (that is that 0x5c and 0x7c
aka `\' and `|') and maybe are detected as special shell characters.

Changing the `++c' into `c++' seems to avoid the split and does
solve the problem.  The question rises if this is correct?


     Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to