On 06/04/2010 15:15, Christopher Faylor wrote:
> On Tue, Apr 06, 2010 at 07:55:19AM -0400, George Barrick wrote:
>> What I am suggesting is that the new cygwin.dll has difficulties
>> implementing the kind of pipe that octave uses to send its graphing
>> commands to gnuplot.  The specific details of the pipe that serves as
>> an example of this can be seen in the __gnuplot_get_var__.m script
>> inside the GNU Octave package.
> 
> Sorry but unless someone can narrow this down to a test case which
> does not requier installing gnuplot I don't intend on investigating
> this.

  Here ya go.  I took a look at the octave module, and narrowed it down to the
equivalent C testcase attached, which appears to reproduce the same failure
mode for me:

> $ ./tfifo.exe
> Got name /tmp/t1150.0
> mkfifo returns 0 (errno 2)
> Open for read returns file 0x0 (errno is 13)
> 
> $ ls -lart /tmp/t1150.0
> prw------- 1 DKAdmin None 0 2010-04-06 16:05 /tmp/t1150.0
> 
> $

  errno 13 = EACCES = permission denied.  Haven't run through into the DLL to
look at why it's failing yet, and am about to go AFK for a while.
Possibly-relevant information after the failure:

> $ getfacl /tmp/t1150.0
> # file: /tmp/t1150.0
> # owner: DKAdmin
> # group: None
> user::rw-
> group::rw-
> other:rw-
> mask:rwx
> 
> 
> $ cacls `cygpath -w /tmp/t1150.0`
> F:\cygwin-1.7\tmp\t1150.0.lnk UBIK\DKAdmin:F
>                               BUILTIN\Administrators:F
>                               NT AUTHORITY\SYSTEM:F
> 
> 
> $


    cheers,
      DaveK

#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <sys/stat.h>

/* C code to perform the same operations as this chunk of
   octave code from the __gnuplot_get_var__.m module:

  if (use_mkfifo)
    gpin_name = tmpnam ();

    ## Mode: 6*8*8 ==  0600
    [err, msg] = mkfifo (gpin_name, 6*8*8);

    if (err != 0)
      error ("__gnuplot_get_var__: Can not make fifo (%s)", msg);
    endif
  endif

  gp_var_name = strtrim (gp_var_name);
  n = min (strfind (gp_var_name, " "), strfind (gp_var_name, ",")) - 1;
  if (isempty (n))
    n = numel (gp_var_name);
  endif

  unwind_protect

    ## Notes: Variables may be undefined if user closes gnuplot by "q"
    ## or Alt-F4. Further, this abrupt close also requires the leading
    ## "\n" on the next line.
    if (use_mkfifo)
      fprintf (ostream, "\nset print \"%s\";\n", gpin_name);
      fflush (ostream);
      [gpin, err] = fopen (gpin_name, "r");
      if (err != 0)
        ## Try a second time, and then give an error.
        [gpin, err] = fopen (gpin_name, "r");
      endif
      if (err != 0)
        error ("__gnuplot_get_var__: Can not open fifo.");
      endif

*/


int main (int argc, const char **argv)
{
  const char *gpin_name;
  int rv;
  FILE *f;

  gpin_name = tmpnam (0);
  printf ("Got name %s\n", gpin_name);

  rv = mkfifo (gpin_name, 0600);
  printf ("mkfifo returns %d (errno %d)\n", rv, errno);

  f = fopen (gpin_name, "r");
  printf ("Open for read returns file %p (errno is %d)\n", f, errno);

  if (f)
    fclose (f);

  return 0;
}

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to