From: gotoken@... (GOTO Kentaro) Date: 2000-01-27T01:08:56+09:00 Subject: [ruby-dev:9029] [1.4.3 BUG] Dir.grab["/*"] --Multipart_Thu_Jan_27_01:08:48_2000-1 Content-Type: text/plain; charset=ISO-2022-JP ごとけんです Dir["/*"] と Dir["/u*"] がともに [] を返します。 extract_path() が "" を返すのが原因です。 --Multipart_Thu_Jan_27_01:08:48_2000-1 Content-Type: application/octet-stream Content-Disposition: attachment; filename="dir.c-patch" Content-Transfer-Encoding: 7bit --- dir.c.orig Wed Nov 24 16:13:50 1999 +++ dir.c Thu Jan 27 01:02:42 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); + char b = *base && !(*base == '/' && !base[1]); - sprintf(fix, "%s%s%s", base, (*base)?"/":"", dp->d_name); + sprintf(fix, "%s%s%s", base, b?"/":"", dp->d_name); if (!m) { (*func)(fix, arg); free(fix); --Multipart_Thu_Jan_27_01:08:48_2000-1--