make-w32
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: make 3.81 MinGW port and testsuite working with MSYS


From: J. Grant
Subject: Re: make 3.81 MinGW port and testsuite working with MSYS
Date: Sun, 27 Feb 2005 01:06:37 +0000
User-agent: Mozilla/5.0 (X11; U; GNU/Linux i686; en; rv:1.5.0; hi) Gecko/20030604

Hi Paul, Eli,

on the 26/02/05 16:04, Paul D. Smith wrote:
%% "Eli Zaretskii" <address@hidden> writes:

  ez> Thanks.  I have a few comments:

I'm interested in answers to Eli's questions but just a note or two; I
didn't actually apply the exact patches that Jonathan sent.

Unless there is a reason it can't be done, I would like to see all the
different handling of Windows/DOS/OS2/MINGW/etc. consolidated as much as
possible.  It seems to me that in this particular case they should all
be doing basically the same thing, and it should be wrapped in the
HAVE_DOS_FILENAMES or whatever... no?

Good points.

I have attached a patch which merges the code with the DOS/EMX/etc
part.  I moved the .exe cropping code to the second part of the shared
code. I revised the .exe cropping to apply to all different cases of
".exe" on these platforms.

(In my view I do not think we should not include .exe as part of the
program output string. The other ports only display "make" or "gmake" etc.)

2448 bytes md5sum:
a94fd2e7b29aea0c7492c083a0e6f8b0  win32_jg_safe_exe_crop-00.patch

  ez> Anyway, the patch is not very reliable in what it tries to do: it
  ez> doesn't handle the "d:make.exe" case,

I fixed this before applying the patch; it will not die in this
case (although it doesn't strip the "d:" prefix, it won't dereference a
null pointer and will strip the .exe).

My attatched patch fixes this behavior, sorry for missing that one.

  ez> and it will fail if it gets something like "C:\foo\bar\MAKE.EXE"
  ez> (i.e., if ".EXE" is in upper case).

I thought about that, too, but left it as-is.

I guess I was assuming that ARGV[0] would be provided by the OS in some
sanitized format where some of these checks were not necessary.  If
that's not so we definitely should m

I just replicated running make.EXe and it came through like that.

  >> -  print "Comparing Output ........ " if $debug;
  >> +  print "Comparing Output ........\n" if $debug;
  >> +  print "logfile: $logfile\n" if $debug;
  >> +
  >> +  # All reference output is LF format, so convert CRLF to LF if we are 
testing W32
  >> +  if ($osname =~ /MINGW32/i)
  >> +  {
  >> +     print "mingw matched, will run dos2unix on output log\n" if($debug);
  >> +     run_command("dos2unix $logfile");
  >> +  }

  ez> This assumes the availability of the dos2unix program, which is
  ez> not part of the standard Windows tools.  If running dos2unix is
  ez> the only way to solve this problem, the requirement to have
  ez> dos2unix installed should be mentioned in README.W32, at the very
  ez> least.

I didn't add this patch anyway; there's no reason to require an extra
application like that when Perl can quite trivially make this change
itself.

I wonder if you locally implemented this CR stripping functionality? (I
could not see it in CVS version of test_driver.pl)

I still think the right way to manage this is by translating the output
to remove the extra characters.

I am using MSYS perl which I believe will create LF format text files.
Then testing mingw native win32 exe which outputs CRLF

Only 24 tests fail now with MinGW build. (many of these are shell and
path issues) 20 fail on MSVC build. I have not tested on EMX or DOS.

I will work through these and submit fixes over the coming days/weeks.
What are your thoughts regarding waiting for further MinGW/MSVC patches
to be merged in before the 3.81 release?

Kind regards
JG
Index: main.c
===================================================================
RCS file: /cvsroot/make/make/main.c,v
retrieving revision 1.197
diff -u -r1.197 main.c
--- main.c      26 Feb 2005 01:41:48 -0000      1.197
+++ main.c      27 Feb 2005 00:53:46 -0000
@@ -1012,7 +1012,7 @@
 #else
       program = strrchr (argv[0], '/');
 #endif
-#if defined(__MSDOS__) || defined(__EMX__)
+#if defined(__MSDOS__) || defined(__EMX__) || defined(WINDOWS32)
       if (program == 0)
        program = strrchr (argv[0], '\\');
       else
@@ -1023,32 +1023,47 @@
          if (p && p > program)
            program = p;
        }
+      /* Take care of special situation, i.e.  d:make.exe */
       if (program == 0 && argv[0][1] == ':')
-       program = argv[0] + 1;
-#endif
-#ifdef WINDOWS32
-      if (program == 0)
-        {
-          /* Extract program from full path */
-          int argv0_len;
-          char *p = strrchr (argv[0], '\\');
-          if (!p)
-            p = argv[0];
-          argv0_len = strlen(p);
-          if (argv0_len > 4
-              && streq (&p[argv0_len - 4], ".exe"))
-            {
-              /* Remove .exe extension */
-              p[argv0_len - 4] = '\0';
-              /* Increment past the initial '\' */
-              program = p + 1;
-            }
+           program = argv[0] + 1;
+
+    /* Case independent comparison for all different case combinations of .exe.
+       Extension is cropped in all cases if identified. */
+       {
+       char * p = NULL;
+       int argv0_len;
+       if (program == 0)
+         p = argv[0];
+       else
+         p = program;
+
+       argv0_len = strlen(p);
+       if (argv0_len > 4)
+       {
+        if(p[argv0_len - 4] == '.' &&
+           ((p[argv0_len - 3] == 'e') || (p[argv0_len - 3] == 'E')) &&
+            ((p[argv0_len - 2] == 'x' || p[argv0_len - 2] == 'X')) &&
+             ((p[argv0_len - 1] == 'e') || (p[argv0_len - 1] == 'E')))
+          {
+            /* Remove .exe extension */
+            p[argv0_len - 4] = '\0';
+            program = p;
+           }
         }
+      }
 #endif
       if (program == 0)
        program = argv[0];
       else
-       ++program;
+      {
+        /* Increment past the initial '\', if there is another character 
after. */
+        if(program[0] == '/' || program[0] == '\\')
+         {
+                  int str_len_p = strlen(program);
+           if(str_len_p > 1)
+                ++program;
+         }
+      }
     }
 
   /* Set up to access user data (files).  */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]