This is the mail archive of the 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: cygpath hangs from postinstall scripts when called like $(cygpath -S) but not otherwise

> From: Igor Pechtchanski
> Sent: Monday, October 06, 2003 4:40 PM

> On Mon, 6 Oct 2003, Hannu E K Nevalainen wrote:
> > > From: Igor Pechtchanski
> > > Sent: Monday, October 06, 2003 1:44 AM
> >
> > > It would be easy to check if the above was the reason for the hang by
> > > trying to call the following program from a postinstall
> script and seeing
> > > if it also hangs:
> >
> > It doesn't hang. :-I
> Well, so much for that idea...

 Yup. :-7

> 	Igor

I had another idea; look up the postinstall launch code in setup
(, copy it and try to create a "testcase".

This seems to be futile though, at least I've had no luck.

I've got one idea left: recompile setup 2.415-1 by myself and try that. I'll
see how fast that gets done. I'm tired right now.
I've cvs'ed sources as:
 cvs -z3 -d co setup
I assume this is the last available. That cvs invocation worked right out of
the box, it's real nice when it is like that.

Nevertheless I'm sending the code onto the list so that perhaps somebody can
either use them for something worthwhile, or hopefully get an idea that

Therefore, please *do* check them. A warning though: this is my first
attempt at windows-related stuff. It is mostly copied code from elsewhere
though and not very polished (of me) as such.

I created as *.cc as the related source in setup ( is c++.
Though I removed all dependencies in an attempt to make it self contained,
which had the side effect of making it compile as *.c too.
It doesn't seem to make any difference whether *.cc/g++ or *.c/gcc is used
as extension/compiler.
 I didn't succeed in having "\\bin\\sh.exe" as "sh" parameter to the sprintf
call (changing the cygwin root accordingly); the result wouldn't launch the
script. This might be one source of "malfunction" for the intended purpose.

 Judging from this and the fact that strace (w som exceptions) hides the
problem, I'd say that something "goes wrong" inside setup just before the
script gets launched. This "wrong" affects only cygpath as it seems - given
very specific conditions. One of these conditions is that setup must have
been started from Windows (i.e. not bash, at least).

/Hannu E K Nevalainen, B.Sc. EE - 59?16.37'N, 17?12.60'E
-- UTC+01, DST -> UTC+02  --

Intended method of use:
Put in the cygwin root, then change the cygwin root literal in
if it doesn't match your actual root. compile using and run t3.exe
after that.

 -- --
#!/bin/bash -x
g++ -o t3 -mno-cygwin

 -- --
#!/bin/bash -x

TOPFOLDER="`cygpath -A -P`/Cygwin-XFree86"

echo "Hit ENTER"
read cr

 -- --
#include <windows.h>
#include <string.h>
#include <malloc.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <process.h>

WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR xcmdline, int nShow) {

  char cmdline[_MAX_PATH];
  BOOL inheritHandles = FALSE;

//                              sh,       args, file
  sprintf (cmdline, "%s %s %s", "sh.exe", "-c", "/");
  memset (&pi, 0, sizeof (pi));
  memset (&si, 0, sizeof (si));
  si.cb = sizeof (si);
  si.lpTitle = (char *) "Cygwin Setup Post-Install Script";

#if 0
  if (file_out.isValid ())
      inheritHandles = TRUE;
      si.dwFlags |= STARTF_USESTDHANDLES;
      si.hStdInput = GetStdHandle (STD_INPUT_HANDLE);
      si.hStdOutput = file_out.handle ();
      si.hStdError = file_out.handle ();
      si.dwFlags |= STARTF_USESHOWWINDOW;
      si.wShowWindow = SW_HIDE;
      flags = CREATE_NO_WINDOW;  // Note: this is ignored on Win9x

  BOOL createSucceeded = CreateProcess (0, cmdline, 0, 0, inheritHandles,
                                        flags, 0,
                                        // get_root_dir ().cstr_oneuse(),
                                        &si, &pi);

	printf("createSucceeded=%d -> %s\n",createSucceeded,
(createSucceeded)?"started.":"failed to start.");

  if (createSucceeded)
    WaitForSingleObject (pi.hProcess, INFINITE);

	printf("Leaving WinMain\n");


Unsubscribe info:
Problem reports:

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