Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004719OCamlOCaml windowspublic2009-02-18 17:032013-06-26 13:52
Reporterbartjacobs 
Assigned Tofrisch 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version3.11.0 
Target VersionFixed in Version4.02.0+dev 
Summary0004719: Sys.executable_name is wrong if executable name contains dots
DescriptionContext: Ocaml 3.11.0 on Windows Vista SP1

mybug.ml:
print_endline Sys.executable_name

> ocamlopt.opt -o mybug.exe mybug.ml
> mybug
C:\test\mybug.exe
> mybug.exe
C:\test\mybug.exe
> ren mybug.exe mybug.foo.exe
> mybug.foo.exe
C:\test\mybug.foo.exe
> mybug.foo
mybug.foo

The last output is wrong.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0008074)
doligez (administrator)
2012-09-15 00:34

Under cygwin and OCaml 4.00.0, all four cases return the file name without the ".exe".
Need to check the other Windows ports.
(0009500)
frisch (developer)
2013-06-14 14:41

Under the MSVC ports, the last case returns "mybug.foo.exe" when called from a Cygwin shell, but "mybug.foo" when called from cmd.exe.
(0009542)
frisch (developer)
2013-06-18 12:23

In the same way, compiling in bytecode with "-custom", with a target containing a dot (foo.bar.exe) makes it impossible to run the program from cmd.exe.

I propose to implement caml_executable_name under Windows using GetModuleFileName(NULL, _, _). (Another option would be to rely on _pgmptr / _get_pgmptr, but its documention on MSDN is quite scary about its semantics when the program is not called from the command line.)
(0009543)
frisch (developer)
2013-06-18 12:25

Commit 13799 on trunk. I'm reluctant to include it in 4.01. If someone really cares about it, please shout!

- Issue History
Date Modified Username Field Change
2009-02-18 17:03 bartjacobs New Issue
2009-04-27 17:19 doligez Status new => acknowledged
2012-07-11 14:57 doligez Target Version => 4.01.0+dev
2012-07-31 13:36 doligez Target Version 4.01.0+dev => 4.00.1+dev
2012-09-15 00:34 doligez Note Added: 0008074
2012-09-15 00:34 doligez Target Version 4.00.1+dev => 4.00.2+dev
2013-06-14 14:41 frisch Note Added: 0009500
2013-06-18 11:06 frisch Assigned To => frisch
2013-06-18 11:06 frisch Status acknowledged => assigned
2013-06-18 12:23 frisch Note Added: 0009542
2013-06-18 12:25 frisch Note Added: 0009543
2013-06-18 12:25 frisch Fixed in Version => 4.02.0+dev
2013-06-18 12:36 frisch Category OCaml general => OCaml windows
2013-06-18 13:22 frisch Target Version 4.00.2+dev =>
2013-06-26 13:52 frisch Status assigned => resolved
2013-06-26 13:52 frisch Resolution open => fixed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker