New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
win32 bug (long command line) OCaml 3.06 #7975
Comments
Comment author: administrator
The 4000 comes from NT/XP, indeed.
You meant "subarg1 subarg2 subarg3" (with the quotes) on the last
That's an option, and we could even handle the generation of the @file
Another user pointed out this issue, but suggested a much simpler fix: Thanks for your input,
|
Comment author: administrator Fxied 2003-03-24 by XL. @responsefiles now handled in Caml, function |
Original bug ID: 1500
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Hello,
I try compile ocaml 3.06 from source on my Windows98 platform (msvc6 +
cygwin), but make exit with error when comile tcl/tk caml libraies. I
look to source code and found what in byterun/winr2.c, function
win32_system:
suppose max command line length is 4000, I don't know about NT or XP
windows, but in win <= 98, max command line is 1024;
not properly handle key "/nologo" for cl.exe and link.exe, /nologo
must present directly in command line, not in @-file;
not properly handle quoted string for long command line. For ex.:
cl.exe arg1 arg2 arg3 arg4 "subarg1 subarg2 subargr3" .....
translate to
arg1
arg2
arg3
arg4
"subarg1
subarg2
subarg3"
but right way, do it:
it's very important for argument passed to linker.
I also think what good idea is separate win32_system function, to two
function. One for internal use to call linker and compiler, they work properly
with '@file' in command line, and second for external use in application,
if user call it function with command line > 1024, exception will be
raised, for example Invalid_argument "system: line too long". Now if
user call system with long command line it's has unexpected and
undocumented behaviour.
Next trouble I found in asmcomp/asmlink.ml and /bytecomp/bytelink.ml,
files. Args passed from cl.exe to link.exe, must be in end line after
other args passed to cl.exe. It's not important for gcc, but for MS cl.exe
it's important.
Best regards
Artem Prisyaznuk
tema@sit.kiev.ua
diff -ru ocaml-3.06/asmcomp/asmlink.ml G:\cygwin\home\tema\ocaml\ocaml-3.06/asmcomp/asmlink.ml
--- ocaml-3.06/asmcomp/asmlink.ml Mon Jul 22 08:07:26 2002
+++ G:\cygwin\home\tema\ocaml\ocaml-3.06/asmcomp/asmlink.ml Thu Dec 12 11:13:08 2002
@@ -248,7 +248,27 @@
(Ccomp.quote_files (List.rev file_list))
| "msvc" ->
if not !Clflags.output_c_object then
@@ -258,7 +278,10 @@
(List.rev_map Ccomp.expand_libname !Clflags.ccobjs))
(Filename.quote runtime_lib)
c_lib
diff -ru ocaml-3.06/bytecomp/bytelink.ml G:\cygwin\home\tema\ocaml\ocaml-3.06/bytecomp/bytelink.ml
--- ocaml-3.06/bytecomp/bytelink.ml Tue Jul 2 16:13:12 2002
+++ G:\cygwin\home\tema\ocaml\ocaml-3.06/bytecomp/bytelink.ml Thu Dec 12 11:13:08 2002
@@ -442,10 +442,30 @@
(Ccomp.quote_files (List.rev !Clflags.ccobjs))
Config.bytecomp_c_libraries)
| "msvc" ->
@@ -454,7 +474,11 @@
(List.rev_map Ccomp.expand_libname !Clflags.ccobjs))
(Filename.quote (Ccomp.expand_libname "-lcamlrun"))
Config.bytecomp_c_libraries
diff -ru ocaml-3.06/byterun/win32.c G:\cygwin\home\tema\ocaml\ocaml-3.06/byterun/win32.c
--- ocaml-3.06/byterun/win32.c Wed Jul 24 03:22:38 2002
+++ G:\cygwin\home\tema\ocaml\ocaml-3.06/byterun/win32.c Thu Dec 12 11:13:08 2002
@@ -314,24 +314,39 @@
char * tempfile;
FILE * fd;
int len, i, j, k, retcode;
char its_quote = '\0';
char cur;
len = strlen(cmdline);
return system(cmdline);
} else {
/ Skip initial blanks, if any /
for (i = 0; cmdline[i] != 0 && isspace(cmdline[i]); i++) /nothing/;
/ Copy command name to buffer, stop at first blank */
for (j = 0; cmdline[i] != 0 && ! isspace(cmdline[i]); i++) {
if (j < MAX_CMD_LENGTH) cmd[j++] = cmdline[i];
}
/* Save remainder of command line to temp file */
strcpy(template, "cmXXXXXX");
tempfile = mktemp(template);
fd = fopen(tempfile, "w");
if (fd == NULL) return -1;
fclose(fd);
/* Add " @tempfile" to the command line */
sprintf(cmd + j, " @%s", tempfile);
The text was updated successfully, but these errors were encountered: