delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/01/11/05:26:36

Date: Mon, 11 Jan 1999 12:25:06 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Laszlo Molnar <laszlo DOT molnar AT eth DOT ericsson DOT se>
cc: DJGPP Workers List <djgpp-workers AT delorie DOT com>
Subject: Re: djgpp 2.02 + perl + glob
In-Reply-To: <19990111094726.F29345@duna54>
Message-ID: <Pine.SUN.3.91.990111121821.14237A-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

On Mon, 11 Jan 1999, Laszlo Molnar wrote:

> djdev202, I've found a problem. Perl failed on some of its self tests
> which use glob(). But when I linked the executable with libc.a from
> djdev201, it worked fine. So I guess, there may be a bug in glob() in
> 2.02.

The diffs between glob.c in v2.01 and v2.02 are appended.  I don't see 
anything that seems like a bug here.  Do you?

Maybe Perl is counting on the behavior in case globbing failed, which now 
requires a special flag (see the last hunk of changes below)?

Of course, some of the functions that `glob' calls might be the cause.

> I didn't have the time to debug the problem yet, but I'll do it
> asap.

Please do.

*** glob1.c	Mon Jan 11 12:20:00 1999
--- glob2.c	Mon Jan 11 12:19:38 1999
***************
*** 1,3 ****
--- 1,5 ----
+ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
+ /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  #include <libc/stubs.h>
***************
*** 105,111 ****
    {
      char short_name[13];
  
!     if ((ff.ff_name[0] != '.') && (ff.ff_attrib & FA_DIREC))
      {
        int i;
        char *tp;
--- 107,114 ----
    {
      char short_name[13];
  
!     if ((ff.ff_attrib & FA_DIREC)
! 	&& (strcmp(ff.ff_name, ".") && strcmp(ff.ff_name, "..")))
      {
        int i;
        char *tp;
***************
*** 287,293 ****
    {
      int i;
      char fshort[13];
!     if (ff.ff_name[0] != '.')
      {
        /* Long filenames are never lower-cased!  */
        if (lower
--- 290,297 ----
    {
      int i;
      char fshort[13];
!     if ((ff.ff_attrib & FA_DIREC) == 0
! 	|| (strcmp(ff.ff_name, ".") && strcmp(ff.ff_name, "..")))
      {
        /* Long filenames are never lower-cased!  */
        if (lower
***************
*** 333,339 ****
  static int
  str_compare(const void *va, const void *vb)
  {
!   return strcmp(*(char * const *)va, *(char * const *)vb);
  }
  
  int
--- 337,343 ----
  static int
  str_compare(const void *va, const void *vb)
  {
!   return strcmp(*(const char * const *)va, *(const char * const *)vb);
  }
  
  int
***************
*** 352,357 ****
--- 356,368 ----
    preserve_case = _preserve_fncase();
    slash = '/';
  
+   if (!(_flags & GLOB_APPEND)) 
+     {
+       _pglob->gl_pathc = 0;
+       _pglob->gl_pathv = NULL;
+       if (!(flags & GLOB_DOOFFS))
+         _pglob->gl_offs = 0;
+     }
    if (glob2(_pattern, pathbuf, preserve_case ? 0 : 1, preserve_case ? 0 : 1) == GLOB_NOSPACE)
      {
        return GLOB_NOSPACE;

- Raw text -


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