Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
July 01, 2009 [Issue 3120] New: std.process.execv() pass arguments to programm incorrectly | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=3120 Summary: std.process.execv() pass arguments to programm incorrectly Product: D Version: 2.030 Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: golovanov_alexey@mail.ru Phobos in DMD 2.030 and DMD 1.045 on Windows XP SP3: function std.process.execv(in string pathname, in immutable(char)[][] argv) don't pass argv parameters to executed program correctly. First element of argv not passed (replaced by program name, or removed). Short example - caller.exe should run called.exe with parameters "arg1", "arg2", "arg3", then called.exe should save passed parameters into log file: /*** begin file caller.d */ import std.process; void main() { string[] args = ["arg1", "arg2", "arg3"]; std.process.execv("called.exe", args); } /*** end file caller.d */ /*** begin file called.d */ import std.file; import std.string; void main(string[] args) { string s = std.string.join(args, " "); std.file.write("called.log", s); } /*** end file called.d */ In Windiws XP environment called.log will contain line: "called.exe arg2 arg3" but expected: "called.exe arg1 arg2 arg3" -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 01, 2009 [Issue 3120] std.process.execv() pass arguments to programm incorrectly | ||||
---|---|---|---|---|
| ||||
Posted in reply to golovanov_alexey@mail.ru | http://d.puremagic.com/issues/show_bug.cgi?id=3120 --- Comment #1 from Alexey G <golovanov_alexey@mail.ru> 2009-07-01 04:28:48 PDT --- Created an attachment (id=408) --> (http://d.puremagic.com/issues/attachment.cgi?id=408) caller program using std.process.execv() -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 01, 2009 [Issue 3120] std.process.execv() pass arguments to programm incorrectly | ||||
---|---|---|---|---|
| ||||
Posted in reply to golovanov_alexey@mail.ru | http://d.puremagic.com/issues/show_bug.cgi?id=3120 --- Comment #2 from Alexey G <golovanov_alexey@mail.ru> 2009-07-01 04:29:33 PDT --- Created an attachment (id=409) --> (http://d.puremagic.com/issues/attachment.cgi?id=409) called programm, received parameters -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 09, 2009 [Issue 3120] std.process.execv() pass arguments to programm incorrectly | ||||
---|---|---|---|---|
| ||||
Posted in reply to golovanov_alexey@mail.ru | http://d.puremagic.com/issues/show_bug.cgi?id=3120 --- Comment #3 from Alexey G <golovanov_alexey@mail.ru> 2009-07-09 00:48:35 PDT --- this behaviour repeated in DMD 2.031 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 28, 2010 [Issue 3120] std.process.execv() pass arguments to programm incorrectly | ||||
---|---|---|---|---|
| ||||
Posted in reply to golovanov_alexey@mail.ru | http://d.puremagic.com/issues/show_bug.cgi?id=3120 Masahiro Nakagawa <repeatedly@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |repeatedly@gmail.com --- Comment #4 from Masahiro Nakagawa <repeatedly@gmail.com> 2010-05-28 13:36:35 PDT --- This behavior is caused by dmc(I tested on Windows XP). called.c ----- #include <stdio.h> int main(int argc, char* argv[]) { int i = 0; for (; i < argc; i++) printf("%s ", argv[i]); } ----- caller.c ----- #include <stdlib.h> int main() { const char* const argv[] = {"a1", "a2", "a3", NULL}; execv("called.exe", argv); return 0; } ----- dmc prints "called.exe a2 a3" but gcc prints "a1 a2 a3". I think expected behavior is gcc result(not "called.exe arg1 arg2 arg3"). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation