Re: bug when redirecting mingw32-make output (w32/sub_proc/sub_proc.c)

2011-06-07 Thread itoken
Hi Eli-san,

Is this issue fixed in 3.82?

 Thanks for the report and the patch, but could you please post a
 minimal recipe to reproduce the bug?



___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


Re: bug when redirecting mingw32-make output (w32/sub_proc/sub_proc.c)

2011-06-07 Thread Eli Zaretskii
 From: itoken 110.keni...@gmail.com
 Date: Mon, 6 Jun 2011 07:56:37 + (UTC)
 
 Hi Eli-san,
 
 Is this issue fixed in 3.82?

No, it isn't.  The suggested patch looked dangerous to me, because it
would cause NULL to be passed process_init_fd, which would then use
it.  I asked for an easily reproduced recipe, but all I got was an
example in C#, which I don't use and don't have installed.

If you have a short example to reproduce the problem with only a C
compiler, I could try looking into this.

Can you describe the situation where you bumped into this problem?

___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


Antwort: Re: bug when redirecting mingw32-make output (w32/sub_proc/sub_proc.c)

2006-06-06 Thread Roland Puntaier

The buggy behaviour turned up, when starting mingw32-make
from an application with the mingw32-make output redirected to that application.
I made a minimal application to reproduce the behaviour.
The code was in C# and I included that code in my previous mail.

But using CreateProcess with standard output redirection
in C++ should lead to the same behaviour. 
There is an example in msdn (search for CreateProcess redirection),
where one might replace the child application with mingw32-make.

As makefile you can use anything that lets mingw32-make
start a new console application.



  From: Roland Puntaier [EMAIL PROTECTED]
  Date: Fri, 2 Jun 2006 17:36:00 +0200
  
  process_easy: DuplicateHandle(In) failed is issued,
when redirecting the 
  mingw32-make output from a parent process.
  
  GetStdHandle returns 0, which is not an error, but also no handle
to be 
  duplicated.
 
 Thanks for the report and the patch, but could you please post a
 minimal recipe to reproduce the bug?
 
___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make


bug when redirecting mingw32-make output (w32/sub_proc/sub_proc.c)

2006-06-03 Thread Roland Puntaier

process_easy: DuplicateHandle(In)
failed is issued, when redirecting the mingw32-make output from a
parent process.

GetStdHandle returns 0, which is not
an error, but also no handle to be duplicated.

Example parent process code leading
to error (in C#):

static
StringBuilder
myOutput=null;

private
static
void
MyOutputDataHandler(object
sendingProcess, 

 DataReceivedEventArgs
line)
{

 if
(!String.IsNullOrEmpty(line.Data))

 {

   myOutput.Append(Environment.NewLine
+ out: 
 + line.Data);

 }
}

private
static
void
MyErrorDataHandler(object
sendingProcess, 

 DataReceivedEventArgs
line)
{

 if
(!String.IsNullOrEmpty(line.Data))

 {

   myOutput.Append(Environment.NewLine
+ err: 
 + line.Data);

 }
}


private
void
button1_Click(object
sender, EventArgs
e)
{

 Process
myprocess = new
Process();

 myprocess.StartInfo.FileName = mingw32-make.exe;

 myprocess.StartInfo.Arguments = -f
C:/test/main.mak;


 myprocess.StartInfo.UseShellExecute = false;


 myprocess.StartInfo.RedirectStandardOutput = true;

 myprocess.OutputDataReceived += new
DataReceivedEventHandler(MyOutputDataHandler);

 myprocess.StartInfo.RedirectStandardError = true;

 myprocess.ErrorDataReceived += new
DataReceivedEventHandler(MyErrorDataHandler);


 myOutput = new
StringBuilder();

 myprocess.Start();


 myprocess.BeginOutputReadLine();

 myprocess.BeginErrorReadLine();


 myprocess.WaitForExit();


 if
(myOutput.Length  0)

 {

   System.Windows.Forms.MessageBox.Show(myOutput.ToString(),
Hello);

 }


 myprocess.Close();
}



Patch that helped:
HANDLE
process_easy(
char
**argv,
char
**envp)
{
 HANDLE hIn=0;
 HANDLE hOut=0;
 HANDLE hErr=0;
 HANDLE hProcess;

 HANDLE processPseudo;
 HANDLE tmpIn,tmpOut,tmpErr;

 processPseudo=GetCurrentProcess();
 tmpIn=GetStdHandle(STD_INPUT_HANDLE);
 tmpOut=GetStdHandle(STD_OUTPUT_HANDLE);
 tmpErr=GetStdHandle(STD_ERROR_HANDLE);
 fprintf(stdout, Handles:
%d,%d,%d\n,tmpIn,tmpOut,tmpErr);

 if
(tmpIn  DuplicateHandle(processPseudo,

  tmpIn,

  processPseudo,

  hIn,

  0,

  TRUE,

  DUPLICATE_SAME_ACCESS) == FALSE)
{
  fprintf(stderr,

 process_easy:
DuplicateHandle(In) failed (e=%d)\n,

 GetLastError());
  return
INVALID_HANDLE_VALUE;
 }
 if
(tmpOut  DuplicateHandle(processPseudo,

  tmpOut,

  processPseudo,

  hOut,

  0,

  TRUE,

  DUPLICATE_SAME_ACCESS) == FALSE)
{
  fprintf(stderr,

process_easy:
DuplicateHandle(Out) failed (e=%d)\n,

GetLastError());
  return
INVALID_HANDLE_VALUE;
 }
 if
(tmpErr  DuplicateHandle(processPseudo,

  tmpErr,

  processPseudo,

  hErr,

  0,

  TRUE,

  DUPLICATE_SAME_ACCESS) == FALSE)
{
  fprintf(stderr,

 process_easy:
DuplicateHandle(Err) failed (e=%d)\n,

 GetLastError());
  return
INVALID_HANDLE_VALUE;
 }

 hProcess = process_init_fd(hIn,
hOut, hErr);

 if
(process_begin(hProcess, argv, envp, argv[0], NULL)) {
  fake_exits_pending++;
  ((sub_process*) hProcess)-exit_code
= process_last_err(hProcess);

  /*
close up unused handles */
  CloseHandle(hIn);
  CloseHandle(hOut);
  CloseHandle(hErr);
 }

 process_register(hProcess);

 return
hProcess;
}

___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make


Re: bug when redirecting mingw32-make output (w32/sub_proc/sub_proc.c)

2006-06-03 Thread Eli Zaretskii
 From: Roland Puntaier [EMAIL PROTECTED]
 Date: Fri, 2 Jun 2006 17:36:00 +0200
 
 process_easy: DuplicateHandle(In) failed is issued, when redirecting the 
 mingw32-make output from a parent process.
 
 GetStdHandle returns 0, which is not an error, but also no handle to be 
 duplicated.

Thanks for the report and the patch, but could you please post a
minimal recipe to reproduce the bug?


___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make