On 6/01/12 02:22, James Linder wrote:
>
> On 06/01/2012, at 5:07 AM, fink-beginners-requ...@lists.sourceforge.net wrote:
>
>> I have found of a problem of gnuplot under Mac OS X 10.6.
>>
>> I can't use a "load" command which read data thru a pipe more than once.
>>
>> For example, following code does not work;
>>
>> load "<  echo 'plot sin(x)'"
>> load "<  echo 'plot cos(x)'"
>>
>> After executing above code, the plot window for 'cos(x)' should remain.
>> But 'cos(x)' will not be plotted and the plotting of 'sin(x)' will stay
>> on the display.
>>
>> The gnuplot 4.4.x under Mac OS X 10.5 does not have such problem.
>>
>> Does anyone know the way to avoid this problem.
>
> linux version does work as expected, except you need to
> set term x11 persist
> for the window to remain open. Thus this is a mac-build and not a source-code 
> issue (assuming
[]

My bet is that this is a gnuplot bug. In the load command, it uses 
popen() to open a pipe for reading the output of the given shell 
command, but it closes it using fclose() instead of pclose(), which is a 
bug. This works purely by chance on linux and on MacOSX 10.5, but 
doesn't work on MacOSX 10.6 and 10.7.

On MacOSX 10.5, where it 'works', if you issue several of these
load "<  echo 'plot sin(x)'"
commands in gnuplot, you will see as many /bin/sh processes running. 
They only quit when you quit gnuplot.

There is a simple patch that makes this work, but I don't know if it 
interferes with other uses of the "load" command:

costabel% diff -U1 src/misc.c{~,}
--- src/misc.c~ 2012-01-06 12:34:07.000000000 +0100
+++ src/misc.c  2012-01-06 12:34:57.000000000 +0100
@@ -303,3 +303,3 @@
             */
-          (void) fclose(lf->fp);
+          if (pclose(lf->fp)) (void) fclose(lf->fp);
        }

-- 
Martin






------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Fink-beginners mailing list
Fink-beginners@lists.sourceforge.net
List archive:
http://news.gmane.org/gmane.os.apple.fink.beginners
Subscription management:
https://lists.sourceforge.net/lists/listinfo/fink-beginners

Reply via email to