delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/10/07/13:21:43

From: "Laurynas Biveinis" <lauras AT softhome DOT net>
Date: Sun, 7 Oct 2001 19:14:48 +0200
To: djgpp-workers AT delorie DOT com
Subject: Bug & fix for bash
Message-ID: <20011007191448.A206@svyturys>
Mail-Followup-To: djgpp-workers AT delorie DOT com
Mime-Version: 1.0
User-Agent: Mutt/1.3.22i
Reply-To: djgpp-workers AT delorie DOT com

With bash 2.05, autoconf 2.50 testsuite reports 225 failures out
of 252 tests (!), because virtually every configure scripts outputs
an extra '/dev/null: not a regular file' line to stderr. I found
the reason: broken test -f. It should check if file exists and is 
regular. However, bash does not check the later under DJGPP. My
patch fixes that, autoconf testsuite looking much better now.

Note that I've replaced access with stat, so further tweaking might
be welcome, if performance is an issue.

Laurynas

--- test.c.orig	Sun May 13 20:25:06 2001
+++ test.c	Sun Oct  7 19:07:20 2001
@@ -638,14 +638,15 @@
       if (test_stat (arg, &stat_buf) < 0)
 	return (FALSE);
 #else
-      if (access (arg, F_OK) == 0 && (access (arg, D_OK) != 0))
-        return TRUE;
-      if (test_finds_exe)
-        {
-          const char *path = find_one_extension (arg, "exe");
-          return (path != NULL);
-        }
-      return FALSE;
+      if (test_stat (arg, &stat_buf) < 0)
+      {
+        if (test_finds_exe)
+          {
+            const char *path = find_one_extension (arg, "exe");
+            return (path != NULL);
+          }
+        return (FALSE);
+      }
 #endif
       /* -f is true if the given file exists and is a regular file. */
 #if defined (S_IFMT)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019