[Kst] piping into kst doesn't work when the data aren't immediately available (cvs)

Melchior FRANZ mfranz at aon.at
Fri Aug 18 16:12:48 CEST 2006


Hi,

I'm trying to pipe parameters from the FlightGear flight simulator to
kst, but kst pretends it doesn't get them:

Without kst:

  $ fgfs 2>&1|awk '/^PLOT /{print $2" "$3}'
  0 0
  -0.1337611319280886 0.007272025540730625
  -0.2561434318269669 0.01379001860331006
  -0.3686914478850064 0.01977834585224873

With kst:

  $ fgfs 2>&1|awk '/^PLOT /{print $2" "$3}'|kst -y 1 -y 2 stdin

kst doesn't display any values, but shows these error messages in Help->Debug:

  2006-08-18 15:15 Scanning for data-source plugins.
  2006-08-18 15:15 Scanning for data-source plugins.
  2006-08-18 15:15 Failed to create vector '1' from file '/var/tmp/kde-m/kst35qw2b.tmp'.
  2006-08-18 15:15 Failed to create vector '2' from file '/var/tmp/kde-m/kst35qw2b.tmp'.

Although:

  $ cat /var/tmp/kde-m/kst35qw2b.tmp|head -6
  0 0
  -0.01323574580242756 0.0003760895743354528
  0.1135443046247044 0.003692261393952344
  -0.01553333299043959 0.006143402530971649
  -0.1346441966183734 0.0125242307963074
  -0.2450952428048158 0.01865438721941841

That is: the file exists, contains valid data, and grows and grows. But the file
only appears after around one minute. This is what I get on the command line:

  kst: ERROR: No data in file stdin.  Trying to continue...
  kst: Update plots
  kst: Posting UpdateDataDialogs
  kst: Dialogs updated in 0ms
  kst: Update plots
  kst: Posting UpdateDataDialogs
  kst: Update plots
  kst: Posting UpdateDataDialogs
  ...

but even after minutes no plot appears in kst. Looks like kst only checks
twice for the file and then doesn't bother any more. This is all I get about
the file in the strace log:

  open("/var/tmp/kde-m/kst35qw2b.tmp", O_RDWR|O_CREAT|O_EXCL, 0600) = 16
  ...
  access("/var/tmp/kde-m/kst35qw2b.tmp", F_OK) = 0

So the file is there, but ...

  open("/var/tmp/kde-m/kst35qw2b.tmp", O_RDONLY|O_LARGEFILE) = 17
  fstat64(17, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
  fstat64(17, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
  mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7045000
  read(17, "", 4096)                      = 0
  fstat64(17, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
  fstat64(17, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
  close(17)                               = 0
  munmap(0xb7045000, 4096)                = 0
  access("/var/tmp/kde-m/kst35qw2b.tmp", F_OK) = 0
  stat64("/var/tmp/kde-m/kst35qw2b.tmp", {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
  stat64("/var/tmp/kde-m/kst35qw2b.tmp", {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
  open("/var/tmp/kde-m/kst35qw2b.tmp", O_RDONLY|O_LARGEFILE) = 17
  fstat64(17, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
  fstat64(17, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
  mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7045000
  read(17, "", 4096)                      = 0
  _llseek(17, 0, [0], SEEK_SET)           = 0
  close(17)                               = 0

... still empty at this time. And kst already starts to prepare the error message.
It doesn't query for that file again. (Reload when the file is there and contains
data doesn't help either.)

The documentation implies that kst is able to read from a file as it grows?!
("Monitor live streaming data using Kst's real-time plotting capabilities.")
But apparently that's not the case. Misunderstanding on my part? Does live
update not work with pipes (like "tail" or "less").

Piping into a fifo and feeding that into kst when first data were available
worked, so I've got a usable workaround. 

But apart from this problem I'm very impressed. kst is definitely one of KDE's
jewels, and very underrepresented in the KDE buzz.  :-)

m.


System:
  Linux 2.6.17  (P4)
  libc 2.4 (20060428)
  gcc 4.1.0 (SUSE Linux)
  KDE CVS/HEAD from around two weeks ago
  kst CVS/HEAD from a few days ago


More information about the Kst mailing list