Re: now this is weird
John Reppy <[email protected]> Mon, 13 Oct 2008 18:37:31 +0100
| Newsgroups | gmane.comp.lang.sml.smlnj |
|---|---|
| Message-ID | <[email protected]> |
How do you create the pathname? It looks like the null termination of
the string is missing. The SML string operations are always supposed to
maintain a nul byte at the end of a string, but there may be some case
where this invariant has been broken.
- John
On Oct 13, 2008, at 2:54 PM, brian wrote:
> John,
>
>
> Sorry, that was a lousy bug report.
>
> On Oct 13, 2008, at 12:18 AM, John Reppy wrote:
>
>> I missing some context here.
>>
>> 1) what version of SML/NJ aree you using?
>>
>
> 110.67
>
>> 2) what OS are you running on?
>
> Mac OS X 10.4.11
>
>>
>> 3) what are Writers.binXWriter/binYWriter doing?
>>
>
> _very_ simple routines to write binary files. I use them everywhere,
> I only have a problem here and only when I remove the print statement
> which precedes the first write.
>
> I put trace prints in and verified that it is the open that failed
> using that very reasonable looking filename (which did not get
> corrupted according to the prints).
>
> Then I got tricky and used ktrace :-)
>
> Yeah verily the file name is being corrupted when the print is not
> present !!
>
>
> 16188 run.ppc-darwin GIO fd 1 wrote 39 bytes
> "writeBinVector 'data/sync_103_mag.bin'
> "
> 16188 run.ppc-darwin RET write 39/0x27
> 16188 run.ppc-darwin CALL open(0xbe6cc,0x601,0x1b6)
> 16188 run.ppc-darwin NAMI "data/sync_103_mag.bin^O<FF><FF>"
>
> Notice how the print of the filename is ok and yet the open fails
> with a corrupt filename. the print occurs THE LINE BEFORE OPEN:
>
> fun writeBinVector formatter =
> fn (filename, v) =>
> let val _ = print ("writeBinVector '"^filename^"'\n")
> val ostr = BinIO.openOut(filename)
> val _ = print ("file open\n")
>
> !!!
>
> Brian
>
> P.S. is there a good way to write reals out as binary values (either
> as floats or doubles) ? I tried using blastWrite to do a binary
> conversion but it failed on my 800k length vector :-(
> PackReal doesn't seem to exist.
>
>>
>> On Oct 13, 2008, at 7:01 AM, brian wrote:
>>
>>>
>>> changing my code from :
>>>
>>> print ("i="^Int.toString(i)^"\n");
>>> Writers.binXWriter("data/sync_"^Int.toString(i)^"_mag.bin", fft);
>>> Writers.binYWriter("data/sync_"^Int.toString(i)^"_phase.bin",
>>> fft);
>>>
>>> to :
>>> Writers.binXWriter("data/sync_"^Int.toString(i)^"_mag.bin", fft);
>>> Writers.binYWriter("data/sync_"^Int.toString(i)^"_phase.bin",
>>> fft);
>>>
>>>
>>> makes the program go from "works fine", to:
>>>
>>> uncaught exception Io [Io: openOut failed on "data/sync_52_mag.bin",
>>> Invalid argument]
>>> raised at: Basis/Implementation/IO/bin-io-fn.sml:620.25-620.72
>>> -
>>>
>>> That's right, I just remove the print statement.
>>>
>>> WTF ?
>>>
>>> That's just gotta be a bug in the compiler.
>>>
>>> Brian
>>>
>>>
>>> ---------------------------------------------------------------------
>>> ----
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>> challenge
>>> Build the coolest Linux based applications with Moblin SDK & win
>>> great prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in
>>> the world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> _______________________________________________
>>> Smlnj-list mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/smlnj-list
>>>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Smlnj-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/smlnj-list
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/