This is the mail archive of the cygwin-apps@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [setup] [PATCH] Redirect stdin from /dev/null when runningpostinstall scripts


On Tue, 14 Sep 2004, Max Bowsher wrote:

> Igor Pechtchanski wrote:
> > Hi,
> >
> > The patch below redirects stdin from /dev/null when running postinstall
> > scripts, so that installation doesn't hang if a program called from a
> > postinstall script decides to ask the user something.  AFAICS, this is
> > against the CVS HEAD.
> > Igor
> > ==============================================================================
> > ChangeLog:
> > 2004-09-13  Igor Pechtchanski  <pechtcha@cs.nyu.edu>
> >
> > * script.cc (run): Kill stdin when running scripts.
> >
> >
> > Index: script.cc
> > ===================================================================
> > RCS file: /cvs/cygwin-apps/setup/script.cc,v
> > retrieving revision 2.16
> > diff -u -p -r2.16 script.cc
> > --- script.cc   12 Apr 2003 13:35:03 -0000      2.16
> > +++ script.cc   13 Sep 2004 18:06:17 -0000
> > @@ -178,7 +178,7 @@ run (const char *sh, const char *args, c
> >     {
> >       inheritHandles = TRUE;
> >       si.dwFlags |= STARTF_USESTDHANDLES;
> > -      si.hStdInput = GetStdHandle (STD_INPUT_HANDLE);
> > +      si.hStdInput = INVALID_HANDLE_VALUE;
> >       si.hStdOutput = file_out.handle ();
> >       si.hStdError = file_out.handle ();
> >       si.dwFlags |= STARTF_USESHOWWINDOW;
>
> I tried to test this patch, but I wasn't able to reproduce the hang even
> before applying it !?
> Could you explain how to reproduce the hang?

:-)  I never saw the hang, actually.  The patch is just common sense.
However, AFAIU, you need to call a program that reads stdin from the
postinstall script.  Putting in a shell read should be enough, but
apparently isn't -- try different shells, though, as they may be using
different mechanisms for reading stdin.  The best thing to do would be to
look at the texconfig source, and see exactly what *it* is using, as it
definitely blocks.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Happiness lies in being privileged to work hard for long hours in doing
whatever you think is worth doing."  -- Dr. Jubal Harshaw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]