There is a problem, I think it was introduced in 2012-02-14 but I'm not 
absolutely certain.

bin> ./ksh --version
  version         sh (AT&T Research) 93u+ 2012-05-31
bin> echo foo\\\\bar | read baz
bin> echo $baz
foo

Adding a

was_escape = 1

to the skip: block in read.c fixes this, but this may cause problems for 
S_QUOTE which jumps into that block for some reason. My suggested fix is the 
below, which seems to work, but I haven't tested all possibilities

Thanks,

Anders

--- read.c.orig 2012-06-04 09:57:22.371712955 +0200
+++ read.c      2012-06-04 09:58:53.848644056 +0200
@@ -570,7 +570,13 @@ int sh_readline(register Shell_t *shp,ch
                    case S_QUOTE:
                        c = shp->ifstable[*cp++];
                        inquote = !inquote;
-                       goto skip;
+                       if(val)
+                       {
+                               stakputs(val);
+                               use_stak = 1;
+                               *val = 0;
+                       }
+                       continue;
                    case S_ESC:
                        /* process escape character */
                        if((c = shp->ifstable[*cp++]) == S_NL)
@@ -582,6 +588,7 @@ int sh_readline(register Shell_t *shp,ch
                        {
                                stakputs(val);
                                use_stak = 1;
+                               was_escape = 1;
                                *val = 0;
                        }
                        continue;


_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to