[cfe-dev] Broken "not" and platform file paths

John Thompson john.thompson.jtsoftware at gmail.com
Wed Mar 16 11:40:55 PDT 2011


Sorry, I should have looked into it further, but I didn't want to start
hacking yet.  The real problem is that the path doesn't have the .exe
suffix, which if checked by adding this hack, seems to work:

Index: utils/not/not.cpp
===================================================================
--- utils/not/not.cpp (revision 127522)
+++ utils/not/not.cpp (working copy)
@@ -15,6 +15,11 @@
 int main(int argc, const char **argv) {
   sys::Path Program = sys::Program::FindProgramByName(argv[1]);

+#if defined(_MSC_VER)
+  if (strstr(Program.c_str(), ".exe") == NULL)
+    Program.appendSuffix("exe");
+#endif
+
   std::string ErrMsg;
   int Result = sys::Program::ExecuteAndWait(Program, argv + 1, 0, 0, 0, 0,
                                             &ErrMsg);
What should the real fix be?  Is it a problem of something higher in the
test system or cmake not passing in the .exe extension, or should something
inside Program be doing it?

Without the extension, the canExecute call in Program.inc fails, and
commenting that out, other stuff does too.

-John

On Wed, Mar 16, 2011 at 2:26 AM, Csaba Raduly <rcsaba at gmail.com> wrote:

> Hi John,
>
> On Wed, Mar 16, 2011 at 12:43 AM, John Thompson  wrote:
> > I'm trying to figure out why a bunch of tests are failing on Windows, and
> > the first thing I see is that the "not" program from utils/not reports
> that
> > the path given to it is not executable, which is because of forward
> slashes
> > in the Path object passed around, which nearly every Windows call that
> takes
> > a path will choke on.
>
> That is not quite true. The Windows _API_ can cope just fine with
> forward slashes. It is cmd.exe which uses forward slashes for options
> and therefore requires backslashes in the paths.
>
>
> Csaba
> --
> GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
> The Tao of math: The numbers you can count are not the real numbers.
> Life is complex, with real and imaginary parts.
> "Ok, it boots. Which means it must be bug-free and perfect. " -- Linus
> Torvalds
> "People disagree with me. I just ignore them." -- Linus Torvalds
>



-- 
John Thompson
John.Thompson.JTSoftware at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110316/82fcb5e7/attachment.html>


More information about the cfe-dev mailing list