From: gotoken@... (GOTO Kentaro) Date: 2000-01-27T01:32:45+09:00 Subject: [ruby-dev:9030] Re: [1.4.3 BUG] Dir.grab["/*"] --Multipart_Thu_Jan_27_01:32:37_2000-1 Content-Type: text/plain; charset=ISO-2022-JP ごとけんです In message "[ruby-dev:9029] [1.4.3 BUG] Dir.grab["/*"]" on 00/01/27, GOTO Kentaro writes: >Dir["/*"] と Dir["/u*"] がともに [] を返します。 >extract_path() が "" を返すのが原因です。 しまった、マクロが良かったかも ZZzzz.... --Multipart_Thu_Jan_27_01:32:37_2000-1 Content-Type: application/octet-stream Content-Disposition: attachment; filename="dir.c-patch" Content-Transfer-Encoding: 7bit --- ruby-1.4.3/dir.c.orig Wed Nov 24 16:13:50 1999 +++ ruby-1.4.3/dir.c Thu Jan 27 01:27:10 2000 @@ -510,7 +510,7 @@ len = pend - p; alloc = ALLOC_N(char, len+1); memcpy(alloc, p, len); - if (len > 0 && pend[-1] == '/') { + if (len > 1 && pend[-1] == '/') { alloc[len-1] = 0; } else { @@ -579,8 +579,9 @@ for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) { if (fnmatch(magic, dp->d_name, FNM_PERIOD|FNM_PATHNAME) == 0) { char *fix = ALLOC_N(char, strlen(base)+NAMLEN(dp)+2); + #define BASE (*base && !(*base == '/' && !base[1])) - sprintf(fix, "%s%s%s", base, (*base)?"/":"", dp->d_name); + sprintf(fix, "%s%s%s", base, (BASE)?"/":"", dp->d_name); if (!m) { (*func)(fix, arg); free(fix); --Multipart_Thu_Jan_27_01:32:37_2000-1--