View Issue Details

IDProjectCategoryView StatusLast Update
0037958FPCRTLpublic2020-10-22 14:39
ReporterWolfgang Helbig Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionno change required 
PlatformimacOSos x 
Product Version3.2.0 
Summary0037958: external data file fails to be assigned in ISO MODE.
DescriptionAccording to the fpc-wiki https://wiki.freepascal.org/File_Handling_In_Pascal files will be assigned to external files if
the external files appear on the command line.
This works for text files but fails for data files.
Steps To Reproduce$ cat >isotest1.pas
program isotest1 (file1, file2);
var
  file1: text;
  file2: file of integer;
begin
  reset(file1);
  readln(file1);
  rewrite(file2);
  write(file2, 5);
end.
$ fpc -Miso isotest1.pas
$ cat >external.txt
a
$ isotest1 external.txt external.dat
$ wc external.dat
wc: external.dat: open: No such file or directory
This file should be created! Text files are created.


TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget-
Attached Files

Activities

jamie philbrook

2020-10-19 16:43

reporter   ~0126415

I don't understand your obsession to find wrong in code that is wrong to begin with, which is your code of course.

you open a file, you need to close it.

The OS automatically closes files and only will you see this with unbuffered io..
Text files have a cache buffer that needs to be purged and that happens with a close within the pascal program not the OS.

personally if I need to bail out early on a program I can use HALT(x) and I don't expect it to attempt to write any more data to file

if that is your way of control style then I think you should first purge the textfile first or at least close it and it will get purged to disk

what ever documentation you are reading about pascal I think is misleading you, this isn't the old mainframe terminal pascal where all the IO was managed remotely..

Wolfgang Helbig

2020-10-19 17:10

reporter   ~0126416

You were completely right about my "obsession". If I'd just want to code a my latest and best pascal program I couldn't care less about the need to close a file or whatever! But what I am doing differs from that task. I want to change pascal sources written in 1982, so they will be accepted by FPC. And I want to have as least changes as possible. And I'll reach that goal, if FPC is as close as possible to ISO-Pascal -- with same extensions needed of course. In standard Pascal there is no close or flush or assign. And if I can get by without these extensions, i'll use it.
By the way, this feature is described in your wiki. See the link in my first note.
By the way, the old Pascal compiler ran on a DEC-System 10 in Stanford. I am working on Donald E. Knuths typesetting system TeX. You might want to google for TeX-FPC.

Wolfgang Helbig

2020-10-19 17:50

reporter   ~0126418

And a third by the way:
Text files are flushed automatically if they are mentioned in the program header and ISO mode is turned on.
So I do not need close or flush or whatever.
And nontext files need no flushing, because they are unbuffered.

Sven Barth

2020-10-20 10:32

manager   ~0126420

I for one applaud Wolfgang Helbig for finding these - more often than not - subtle differences and bugs and it's bug reports like these that help to make mode ISO more correct.

Florian

2020-10-20 22:07

administrator   ~0126433

If you search for corner cases, please test always with trunk. This one is fixed already in trunk.

Wolfgang Helbig

2020-10-22 13:55

reporter   ~0126457

Last edited: 2020-10-22 14:39

View 2 revisions

Hi Florian,
I just try to use all those features of FPC, that make the maintainance of TeX-FPC easier. So I stick with a stable release for the time being. I just don't have the capacity to debug both FPC and TeX. Thanks for answering my questions and for having fixed some of the errors already!

Issue History

Date Modified Username Field Change
2020-10-19 13:36 Wolfgang Helbig New Issue
2020-10-19 16:43 jamie philbrook Note Added: 0126415
2020-10-19 17:10 Wolfgang Helbig Note Added: 0126416
2020-10-19 17:50 Wolfgang Helbig Note Added: 0126418
2020-10-20 10:32 Sven Barth Note Added: 0126420
2020-10-20 22:07 Florian Assigned To => Florian
2020-10-20 22:07 Florian Status new => resolved
2020-10-20 22:07 Florian Resolution open => no change required
2020-10-20 22:07 Florian FPCTarget => -
2020-10-20 22:07 Florian Note Added: 0126433
2020-10-22 13:55 Wolfgang Helbig Note Added: 0126457
2020-10-22 14:39 Wolfgang Helbig Note Edited: 0126457 View Revisions