octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #48326] test printd fails in Win-7


From: Philip Nienhuis
Subject: [Octave-bug-tracker] [bug #48326] test printd fails in Win-7
Date: Sun, 10 Jul 2016 21:44:18 +0000 (UTC)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0 SeaMonkey/2.40

Follow-up Comment #10, bug #48326 (project octave):

(Edited by hand)

>> edit printd
>> test printd
debug: supposedly writing to output file 217 bytes
numbytes =  217
debug: after writing to temp file oct-FJAr0M, size = 224 bytes
debug: after copying to dest file test_p.txt, size = 224 bytes
debug: after closing temp file oct-FJAr0M, size = 224 bytes
debug: just before returning, output file test_p.txt, size = 224 bytes
***** test
:
<snip>
:
ASSERT errors for:  assert (r4,r2)
:
<snip>
:
   Strings don't match
>>


Again I tried the debug option at L.47 (.....mkstemp....)

address@hidden /c/tmp
### Just after the fprintf line: file seems empty
$ ls -l oct-*
-rw-r--r-- 1 philip Administrators 0 Jul 10 23:13 oct-X5WOJL

address@hidden /c/tmp
$ cat oct-X5WOJL

### Indeed, empty. Then, after the fclose() stmt:
address@hidden /c/tmp
$ ls -l oct-*
-rw-r--r-- 1 philip Administrators 224 Jul 10 23:14 oct-X5WOJL

address@hidden /c/tmp


Apparently there's write caching going on.
As the C: drive is on an SSD, I repeated it on drive X: which is on a HDD with
rotating platters; but I got the same results.


But I think something else is going on here.
I removed your patch from comment #9 and inserted an fread() stmt after
frewind:
tstscr = fread (pf, Inf,'char=>char")';
numel (tstscr):

That gave 217 bytes, so my conclusion is that file (pf) (made by mkstemp) is
written fine.

Then I added similar fread/numel statements after the copy in the "txt" switch
clause, after the "system (enscr)" statement:


frewind (pf)
tstscr = fread (pf, Inf,'char=>char")';
numel (tstscr)
fid = fopen (filename);
tstscr2 = fread (fid,  Inf,'char=>char")';
numel (tstscr2)


and the answers I got:
217
224

so it *appears* to be the MSYS "cp" command that adds the CR characters.

But in a separate MSYS shell:

$ ls -l
total 990735
:
-rw-r--r-- 1 philip Administrators       224 Jul 10 23:27 oct-jfiupM
-rw-r--r-- 1 philip Administrators       224 Jul 10 23:30 test_p.txt
:


so MSYS thinks both files are 224 bytes, in spite of Octave's fread() results
mentioned earlier.

Really enigmatic.

(sorry bed time, work week starts tomorrow)

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?48326>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]