[erlang-questions] A potential fix for escript on Windows

Pierre Rouleau <>
Sun Jun 5 00:33:46 CEST 2011


OK, I think I know why escript is not accepting scrips unless it's invoked
as escript.exe.

I took a look at erts/etc/common/escript.c which I believe is the source for
escript.

I think one of the problem under Windows is the fact that when  escript's
main() is looking for the escript basename, it does not consider that, under
Windows, it could very well be escript (just as much as escript.exe).  If
the invocation line is "escript the_scrip_file.erl arguments", then escript
thinks the argv[0] is the name of the script (instead of escript executable)
and appends ".escript" to it.

One way to solve this problem under Windows, from what I can tell so far,
would be to check for escript.exe as well as escript under Windows, as the
following patch to escript does (from the R14B03 source taken at erlang.org
):


@@ -377,7 +377,8 @@
     last_opt = argv;

 #ifdef __WIN32__
-    if (_stricmp(basename, "escript.exe") == 0) {
+    if ( (_stricmp(basename, "escript.exe") == 0)
+       ||(_stricmp(basename, "escript") == 0)) {
 #else
     if (strcmp(basename, "escript") == 0) {
 #endif


I have not yet tested that patch (I am still downloading Cygwin's
development package to be able to build Erlang from source on the Windows
box).

If I get it working, should I (and where should I) submit a patch to
escript.c?

Also, is there a bug tracker for Erlang where one can browse through bug
reports, submit one and identify patches or is everything done through the
mailing lists?  I did not see links to a bug tracker in the erlang.org site
except for a mention about submitting patches via github.

And finally, is there a documented process for development?

Thanks

-- Pierre Rouleau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110604/f5558d0e/attachment.html>


More information about the erlang-questions mailing list