Skip to content

bug: plain-text output does not work after call to FSTAT on open logical unit #2220

Description

@ChristerSandin

Using the following code snippet, I've found a problem with PRINTF that occurs after calling FSTAT.

Here is a code example that shows the problem using as few commands as possible.

pro gdl_test

  ;; Test routine showing that output using
  ;; PRINTF does not work after calling FSTAT.
  
  openw, unit, 'test_GDL.txt', /get_lun
  printf, unit, 'Print output'

  ;; After the following line, writing doesn't work anymore...
  tmp = fstat(unit)

  printf, unit, 'No output anymore!'

  help,tmp

  free_lun, unit

end

Using IDL (8.8.3), the output becomes:

IDL> gdl_test     
% Compiled module: GDL_TEST.
** Structure FSTAT, 17 tags, length=72, data length=68:
   UNIT            LONG               100
   NAME            STRING    'test_GDL.txt'
   OPEN            BOOLEAN   true (1)
   ISATTY          BOOLEAN   false (0)
   ISAGUI          BOOLEAN   false (0)
   INTERACTIVE     BOOLEAN   false (0)
   XDR             BOOLEAN   false (0)
   COMPRESS        BOOLEAN   false (0)
   READ            BOOLEAN   true (1)
   WRITE           BOOLEAN   true (1)
   ATIME           LONG64                1787598960
   CTIME           LONG64                1787599006
   MTIME           LONG64                1787599006
   TRANSFER_COUNT  LONG                 1
   CUR_PTR         LONG                13
   SIZE            LONG                13
   REC_LEN         LONG                 0
IDL> $cat test_GDL.txt
Print output
No output anymore!
IDL> 

Using GDL instead, the output is:

christer@kasper 0 ~ $ gdl
  GDL - GNU Data Language, Version v1.1.3-39-gef2d0aec-dirty
- For basic information type HELP,/INFO
- Using WxWidgets as graphics library (windows and widgets).
- No startup file read (GDL_STARTUP/IDL_STARTUP env. var. not set). 
- Please report bugs, feature or help requests and patches at: https://github.com/gnudatalanguage/gdl

GDL> gdl_test
% Compiled module: GDL_TEST.
** Structure FSTAT, 17 tags,memsize =88, data length=64/64:
   UNIT            LONG               100
   NAME            STRING    'test_GDL.txt'
   OPEN            BYTE         1
   ISATTY          BYTE         0
   ISAGUI          BYTE         0
   INTERACTIVE     BYTE         0
   XDR             BYTE         0
   COMPRESS        BYTE         0
   READ            BYTE         1
   WRITE           BYTE         1
   ATIME           LONG64                1787599136
   CTIME           LONG64                1787599136
   MTIME           LONG64                1787599136
   TRANSFER_COUNT  LONG                 0
   CUR_PTR         LONG                13
   SIZE            LONG                13
   REC_LEN         LONG                 0
GDL> $cat test_GDL.txt
Print output
GDL>

That is, the second call to PRINTF does not add any output to the text file using GDL, while this is the case using IDL.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingregressionSomething that used to work does not work anymore

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions