mkgmap minor bug: TYP file is opened in readwrite mode

Hi List! I just accidentally found an issue in mkgmap. When creating a gmapsupp.img with a TYP file, mkgmap throws an exception if this file is readonly. When the TYP file is writable, this exception is not thrown. But I think, that mkgmap should never write to a TYP file, should it? Here is, what current mkgmap (r1273) says if TYP file is write protected:
Exception in thread "main" uk.me.parabola.imgfmt.ReadFailedException: Couldnot open ANHI.TYP at uk.me.parabola.imgfmt.sys.FileImgChannel.<init>(FileImgChannel.java:43) at uk.me.parabola.mkgmap.combiners.GmapsuppBuilder.addFile(GmapsuppBuilder.java:188) at uk.me.parabola.mkgmap.combiners.GmapsuppBuilder.addAllFiles(GmapsuppBuilder.java:161) at uk.me.parabola.mkgmap.combiners.GmapsuppBuilder.onFinish(GmapsuppBuilder.java:110) at uk.me.parabola.mkgmap.main.Main.endOptions(Main.java:361) at uk.me.parabola.mkgmap.CommandArgsReader.readArgs(CommandArgsReader.java:124) at uk.me.parabola.mkgmap.main.Main.main(Main.java:118) Caused by: java.io.FileNotFoundException: ANHI.TYP (Permission denied) at java.io.RandomAccessFile.open(Native Method) at java.io.RandomAccessFile.<init>(RandomAccessFile.java:212) at java.io.RandomAccessFile.<init>(RandomAccessFile.java:98) at uk.me.parabola.imgfmt.sys.FileImgChannel.<init>(FileImgChannel.java:41) ... 6 more
This is only a minor bug, since no real write operations seem to be done to the TYP file. Regards Andre

Hi Andre,
I just accidentally found an issue in mkgmap. When creating a gmapsupp.img with a TYP file, mkgmap throws an exception if this file is readonly. When the TYP file is writable, this exception is not thrown. But I think, that mkgmap should never write to a TYP file, should it?
The attached patch should solve this issue. Steve, shall I commit this? Cheers, Mark

Am Samstag, den 10.10.2009, 15:54 +0100 schrieb Mark Burton:
Hi Andre,
I just accidentally found an issue in mkgmap. When creating a gmapsupp.img with a TYP file, mkgmap throws an exception if this file is readonly. When the TYP file is writable, this exception is not thrown. But I think, that mkgmap should never write to a TYP file, should it?
The attached patch should solve this issue.
Confirmed. This fixed the bug here. Thanks! Andre
participants (3)
-
Andre Hinrichs
-
Mark Burton
-
Steve Ratcliffe