On Wed, Jan 19, 2011 at 06:46:54PM +0100, Stefan Peter wrote:
> This error message has been emitted by gnu make. Now, the error message
> itself seems to originate from echo, a small utility you find as
> /bin/echo in most unix systems.

Or as a builtin in most shells. As make calls the shell for shell
expansions, it's likely that actually the shell interprets and
executes it (if your /bin/sh is advanced enough to have the echo
command builtin. It's an optional performance enhancement, as
/bin/echo works just as well!)

The error is explained in the write system call manual page: 

       EBADF  fd is not a valid file descriptor or is not open for writing.

So standard output apparently isn't connected anywhere. (but as the
error message DOES come through, the stderr IS!!!)

> Inspecting the <panoname>.pto.mk generated by hugin shows that echo is
> used to provide feedback concerning the progress and eventual errors.
> When using the "Stitch now" button in hugin, a window is opened that
> will be used to display these messages.



> The sole purpose of this echo utility is to display text in a console.
> Could it be possible that, probably only this one special version from
> mac os 10.5.4 has a problem emitting text not to a physical console, but
> a wx console widget (or whatever it is called)?
> 
> Some tests may clarify this
> o Try to send your project to the batch processor (I hope this
>   does exist in the mac version of hugin, too). Make sure
>   you have disabled the "Verbose output" option
> o Open a shell, change to the project directory, and use
>   "make -f <projectname>.pto.mk"
>   to start the stitching

These are sensible tests. When that works, it is increasingly likely
that the hugin gui program is doing something wrong with setting up
the environment for executing make. I've just spent ten minutes trying
to search for where this happens, but couldn't find it. I expect that
a "pipe" or "dup" call is failing. UPDATE: Ok found it by searching
for the "pipe" call... 

It seems to be: 

        src/hugin_base/makefilelib/test_util.cpp

(which is unlogical because it isn't in any test-code anymore, and I
think this is the actual code used, because I can't find any other
pipe calls.

Anyway, on first inspection I'd say that the code looks good. On 
the other hand, code like: 


     if(dup2(fdmakein[0], 0) == -1 || dup2(fdmakeout[1], 1) == -1 || 
dup2(fdmakeerr[1], 2) == -1) {
        std::cerr << "Failed to switch std stream" << std::endl;
        exit(-1);
     }

should be rewritten as: 

   stdinfd = dup2 (fdmakein[0], 0);
   if (stdinfd != 0) {
      //  can't dup2 stdinfd... 
   }
   ... 

so that we'll find where things go wrong. On the other hand, the hint
is that nothing DOES go wrong, because already in the original code
the obvious errors should be caught.

Adding some debug code in this file will also help finding the
culprit.... 

(the "echo" command per-se will probably not be the culprit. The
echo command is something as simple as:
  int main (int argc, char **argv)
  {
     int i;
     for (i=0;i<argc;i++)
        printf ("%s%s", i?" ":"", argv[i]);
     exit (0);
  }

Not much can go wrong there... The echo command is reporting that
there is something wrong with its stdout (1) file descriptor. Possibly
the reader on the pipe has been closed or something. (not likely the
error code should be EPIPE and not EBADF)...  )


        Roger. 

-- 
** [email protected] ** http://www.BitWizard.nl/ ** +31-15-2600998 **
**    Delftechpark 26 2628 XH  Delft, The Netherlands. KVK: 27239233    **
*-- BitWizard writes Linux device drivers for any device you may have! --*
Q: It doesn't work. A: Look buddy, doesn't work is an ambiguous statement. 
Does it sit on the couch all day? Is it unemployed? Please be specific! 
Define 'it' and what it isn't doing. --------- Adapted from lxrbot FAQ

-- 
You received this message because you are subscribed to the Google Groups 
"Hugin and other free panoramic software" group.
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/hugin-ptx

Reply via email to