digitalmars.D.bugs - [Issue 6709] New: execvp eats two bytes of its first argument.
- d-bugmail puremagic.com (30/30) Sep 21 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6709
- d-bugmail puremagic.com (20/20) Feb 24 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6709
- d-bugmail puremagic.com (9/9) Feb 24 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6709
http://d.puremagic.com/issues/show_bug.cgi?id=6709 Summary: execvp eats two bytes of its first argument. Product: D Version: D2 Platform: x86 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: rivercheng gmail.com --- Comment #0 from Cheng Wei <rivercheng gmail.com> 2011-09-21 19:44:36 PDT --- #import std.process void main() { execvp("ip", "route"); } result: Object "ute" is unknown, try "ip help". That is the first two bytes are lost Adding two spaces works: #import std.process void main() { execvp("ip", " route"); } Version 2.055, linux, 32bit Thanks. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 21 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6709 hsteoh quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hsteoh quickfur.ath.cx --- Comment #1 from hsteoh quickfur.ath.cx 2012-02-24 19:41:34 PST --- You're calling execvp with the wrong arguments. You need to call it like this: execvp("ip", ["ip", "route"]); because argv[0] is supposed to be the name of the program, and argv[1]... are the program arguments. As for the actual bug (first two characters get eaten), it's not a Phobos bug, it's a bug in /bin/ip. To prove this, try this (from your home directory): ln -s /bin/ip ./route ./route You'll get the same error message, because argv in this case = ["ip"]. It appears that /bin/ip is doing something strange when argv[0] is not equal to "ip", but there's not much Phobos can do about it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 24 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6709 hsteoh quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 24 2012