Menu

#2560 (Windows v5.4.5) Plotting binary data from stdin does not work.

None
closed-out-of-date
nobody
None
2023-03-15
2022-10-29
No

Environment

  • Version: gnuplot 5.4.5 (Windows binary), and 5.5.0-test
  • OS: Windows 10 (22H2) 64-bit

Overview

Plotting binary data read from stdin does not work in gnuplot 5.4.5. Git master [89a9ddc8964a80b42270dd66990c8c0f635f138d] (5.5.0) does not have this problem (works correctly).

How to reproduce the issue

1) Save the following text into file 'test-gnuplot.c'.

#include <stdio.h>

int main()
{
        const int n = 11;
        float x, y;
        printf("set term windows\n");
        printf("plot \"-\" binary record=%d w linesp\n", n);
        for (int i=0; i<n; i++) {
                x = i; y = x*x;
                fwrite(&x, sizeof(float), 1, stdout);
                fwrite(&y, sizeof(float), 1, stdout);
        }
        fflush(stdout);
        getchar();
        return 0;
}

2) Compile 'test-gnuplot.c' with gcc test-gnuplot.c -o test-gnuplot.
3) Run ./test-gnuplot | gnuplot.
4) The graph does not appear with gnuplot 5.4.5.

Related

Commit: [89a9dd]

Discussion

  • Tatsuro MATSUOKA

    I have tested on 5.4.x binaries.
    The graph appears with 5.4.1, and 5.4.2 .
    The graph does not appear with 5.4.3, 5.4.4, and 5.4.5 .

     
  • Tatsuro MATSUOKA

    I cloned the latest stable branch source.
    git clone -b branch-5-4-stable git://git.code.sf.net/p/gnuplot/gnuplot-main

    git log

    commit 7e85bfde2bcfafa09cfb19a6d1603d0b0253f17f (HEAD -> branch-5-4-stable, origin/branch-5-4-stable)
    Author: Bastian Maerkisch <bmaerkisch@web.de>
    Date:   Tue Feb 15 22:44:33 2022 +0100
    

    The graph appears using the above.

     

    Last edit: Tatsuro MATSUOKA 2022-10-29
  • Takashi Yano

    Takashi Yano - 2022-10-30

    Thanks! I also can confirm that the issue is already fixed in branch-5-4-stable (5.4.6 alpha). So, we can expect the issue will most likely not occur in the next release.

     
  • Takashi Yano

    Takashi Yano - 2022-10-30

    Oh, v5.4.5 was not applied the following commit yet.

    commit 780f8bd414e67c6a226efa7952e134d732feb283
    Author: Takashi Yano <tyan0@users.sourceforge.net>
    Date:   Tue Feb 15 22:44:15 2022 +0100
    
        windows console: buffered pipe input
    
        Use read() instead of fgetc() to improve read speed. Avoid mixed access to
        pipe by our pipe reading thread and C file functions to prevent race condition.
    
        Bug #2491
    
        (cherry picked from commit c128262f2f57aa53174d3bb7b672aff6ee3a9b79)
    

    I see.

     
  • Ethan Merritt

    Ethan Merritt - 2023-03-15
    • status: open --> closed-out-of-date
    • Group: -->
    • Priority: -->
     

Log in to post a comment.

MongoDB Logo MongoDB