[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #49864] fscanf incomplete read with popen
From: |
Denis Sbragion |
Subject: |
[Octave-bug-tracker] [bug #49864] fscanf incomplete read with popen |
Date: |
Fri, 16 Dec 2016 14:37:28 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (Windows NT 5.1; rv:50.0) Gecko/20100101 Firefox/50.0 |
URL:
<http://savannah.gnu.org/bugs/?49864>
Summary: fscanf incomplete read with popen
Project: GNU Octave
Submitted by: dsbragion
Submitted on: Fri 16 Dec 2016 02:37:27 PM GMT
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: fscanf, popen
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.2.0
Operating System: Microsoft Windows
_______________________________________________________
Details:
Hello,
the attacched script and test file could be used to reproduce the bug. The
script simply performs the same file read both through a standard file and a
popen pipe:
pp = fopen('testfile.txt','rt');
size(fscanf(pp,'%f;%f'))
fclose(pp);
pp = popen('type testfile.txt','r');
size(fscanf(pp,'%f;%f'))
pclose(pp);
The two sections of the script of course should provide the same output.
"testfile.txt" is just a sequence of comma separated numbers, nothing
special.
With Octave 4.0.3 the result is correct:
octave:7> fscanfbug
ans =
3240 1
ans =
3240 1
With Octave 4.2.0 I get the following output:
octave:4> fscanfbug
Il processo ha tentato di scrivere in una pipe non esistente.
ans =
3240 1
ans =
4 1
The error message at the top translated means "The process tried to write to a
non existant pipe".
It looks like fscanf stops reading before the "type" command finishes to write
its output, so the following pclose closes the pipe and then the error.
Thanks in advance for your attention.
Bye,
Denis Sbragion
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Fri 16 Dec 2016 02:37:27 PM GMT Name: fscanfbug.m Size: 144B By:
dsbragion
Test script and sample input file
<http://savannah.gnu.org/bugs/download.php?file_id=39251>
-------------------------------------------------------
Date: Fri 16 Dec 2016 02:37:27 PM GMT Name: testfile.txt Size: 17kB By:
dsbragion
Test script and sample input file
<http://savannah.gnu.org/bugs/download.php?file_id=39252>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?49864>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #49864] fscanf incomplete read with popen,
Denis Sbragion <=