On Thu, Jul 25, 2013 at 1:37 AM, Roland Mainz <[email protected]> wrote:
> Hi!
>
> ----
>
> Below is a small fix to prevent ast-ksh.2013-07-19 from closing the
> pwdfd. We've hit this when running the ksh93 test suite:
> -- snip --
> diff -r -u build_i386_64bit_debug/src/cmd/ksh93/sh/xec.c
> build_i386_64bit_debug_cdfixes/src/cmd/ksh93/sh/xec.c
> --- src/cmd/ksh93/sh/xec.c       2013-07-18 20:35:53.000000000 +0200
> +++ src/cmd/ksh93/sh/xec.c       2013-07-23 05:42:49.025713788 +0200
> @@ -1351,7 +1351,7 @@
>                                                         /* do close-on-exec */
>                                                         int fd;
>                                                         for(fd=0; fd <
> shp->gd->lim.open_max; fd++)
> -
> if((shp->fdstatus[fd]&IOCLEX)&&fd!=shp->infd)
> +
> if((shp->fdstatus[fd]&IOCLEX) && (fd!=shp->infd) && (fd!=shp->pwdfd))
>
>  sh_close(fd);
>                                                 }
>                                                 if(argn)
> -- snip --

Roland, thank you for catching that *BASTARD* of a bug. We've finally
figured that this was causing some weird failures if a builtin was the
last one in a command sequence (before the shell exits) and used
shp->pwdfd. Gave us a wonderful view of EBADF for no good reason.

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

Reply via email to