Yes, the fix is acceptable and it will be in the next ksh93 update.  Also,
I increased PRISIZE from 160 to 256.



On Mon, Jan 6, 2014 at 1:52 PM, Tomas Klacko <[email protected]>wrote:

> Hi,
>
> This causes segfault:
>
> user@host:~$ ksh
> :/home/user 1 $ set -o emacs
> :/home/user 2 $ . ./ps1.env
> __  warn [GTS]prompt:/home/tklacko # Segmentation Fault (core dumped)
> user@host:~$
>
>
> The ps1.env contents:
>
> e="$(echo "\033")"
> a="$(echo "\007")"
>
> TERM_FG="$e]10;#FFFFd7$a"
> TERM_BG="$e]11;#121212$a"
> TERM_TITLE="$e]0;xterm title$a"
> BG_RED="$e[41m"
> FG_WHITE="$e[37m"
> BOLD="$e[1m"
> UNDERLINE="$e[4m"
> RESETCOL="$e[0m"
> BG256_BLACK="$e[48;5;233m"
> FG256_OLDLACE="$e[38;5;230m"
>
> PS1="$TERM_FG$TERM_BG$TERM_TITLE$BG_RED$FG_WHITE$BOLD${UNDERLINE}__$RESETCOL$BG_RED
> $RESETCOL$BG256_BLACK$FG256_OLDLACE$FG_WHITE$BG_RED warn
> $BG256_BLACK$FG256_OLDLACE$BOLD[GTS]prompt$RESETCOL$
> BG256_BLACK$FG256_OLDLACE:$PWD$FG256_OLDLACE # "
>
>
> I found this to be the fix:
>
> --- a/src/cmd/ksh93/edit/edit.c
> +++ b/src/cmd/ksh93/edit/edit.c
> @@ -651,7 +651,8 @@ void        ed_setup(register Edit_t *ep, int fd, int
> reedit)
>                          {
>                                 int skip=0;
>                                 ep->e_crlf = 0;
> -                               *pp++ = c;
> +                               if (pp < ppmax)
> +                                       *pp++ = c;
>                                 for(n=1; c = *last++; n++)
>                                 {
>                                         if(pp < ppmax)
>
> It prevents the ed_setup() function from writing past the ep->e_prompt.
> ep->e_prompt is set to the local char prompt[PRSIZE] variable in
> ed_emacsread().
>
> Is the fix acceptable?
>
> Tomas Klacko
> _______________________________________________
> ast-developers mailing list
> [email protected]
> http://lists.research.att.com/mailman/listinfo/ast-developers
>
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to