bugGNU Octave - Bugs: bug #66161, Strange behaviour of fscanf with...

 
 

bug #66161: Strange behaviour of fscanf with CRLF in text mode

Submitter:  Johannes <johannes>
Submitted:  Mon 02 Sep 2024 08:14:10 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * 9.1.0 Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 04 Sep 2024 08:23:40 AM UTC, comment #2: 

Hello Markus, thanks for your quick answer.

I do not know exactly with which version it worked, but it worked a year ago. My students almost all use Windows, and they had no problems in the period of October 2023 to January 2024. Most of them used the version that was the latest in October/November 2023.

I will try the workaround you proposed.

Johannes <johannes>
Wed 04 Sep 2024 07:17:50 AM UTC, comment #1: 

This seems to depend on CRLF line endings. If I convert the files to LF line endings, all tests pass...
Alternatively,  if the files are opened in binary mode, all tests also pass with CRLF line endings.

Windows does some weird things with the file position when the line endings are converted on-the-fly in text mode. Maybe, the issue is somewhere around that.

For the time being opening the files in binary mode seems to be a work-around. I.e., `fid = fopen(fname, "rb");` or simply `fid = fopen(fname, "r");`.


You marked this as a regression. Do you know in which version of Octave this was still working?

Markus Mützel <mmuetzel>
Group administrator
Mon 02 Sep 2024 08:14:10 AM UTC, original submission:  

Under Windows, fscanf sometimes has problems to read the last number in the line, see attached file bugdemo.m and the comments in the script. All tests of this script work correctly with Linux.

System information:


Gerätename      DESKTOP-VKR568P
Prozessor       Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz   2.90 GHz
Installierter RAM       16,0 GB (15,9 GB verwendbar)

Systemtyp       64-Bit-Betriebssystem, x64-basierter Prozessor
Stift- und Toucheingabe Für diese Anzeige ist keine Stift- oder Toucheingabe verfügbar.

Edition Windows 10 Enterprise
Version 22H2
Installiert am  <200e>23.<200e>05.<200e>2021
Betriebssystembuild     19045.4780
Leistung        Windows Feature Experience Pack 1000.19060.1000.0


Johannes <johannes>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #56403:  bugdemo.m added by johannes (2KiB - text/x-objcsrc)
file #56404:  file2.txt added by johannes (150B - text/plain)
file #56405:  file1.txt added by johannes (149B - text/plain)
file #56406:  file3.txt added by johannes (150B - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by johannes (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-09-04 mmuetzel StatusNone Confirmed
        SummaryStrange behaviour of fscanf Strange behaviour of fscanf with CRLF in text mode
    2024-09-02 johannes Attached File- Added bugdemo.m, #56403
        Attached File- Added file2.txt, #56404
        Attached File- Added file1.txt, #56405
        Attached File- Added file3.txt, #56406

    Back to the top

    Powered by Savane 3.13-8a8d.
    Corresponding source code