Date: Sat, 10 Jul 2004 17:57:17 +0100 (BST) From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: FreeBSD-gnats-submit@FreeBSD.org Cc: mark@mark-and-erika.com Subject: ports/68896: make search can't be case insensitive under 5.x Message-ID: <200407101657.i6AGvHHF062623@happy-idiot-talk.infracaninophile.co.uk> Resent-Message-ID: <200407101700.i6AH0RhO065823@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 68896 >Category: ports >Synopsis: make search can't be case insensitive under 5.x >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jul 10 17:00:26 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Matthew Seaman >Release: FreeBSD 4.10-STABLE i386 >Organization: Infracaninophile >Environment: System: FreeBSD happy-idiot-talk.infracaninophile.co.uk 4.10-STABLE FreeBSD 4.10-STABLE #78: Mon Jul 5 15:49:39 BST 2004 root@happy-idiot-talk.infracaninophile.co.uk:/usr/obj/usr/src/sys/HAPPY-IDIOT-TALK i386 >Description: Ref: the thread on freebsd-questions@ starting with: http://lists.freebsd.org/pipermail/freebsd-questions/2004-July/051953.html Mark Frank noticed that, contrary to what it says in /usr/ports/CHANGES that 'make search' would not do a case insensitive search. Further investigation showed that this only occured on 5.x systems and was because the awk script in bsd.ports.subdir.mk was using the GNU 'IGNORECASE' extension, which isn't present in the one-true-awk used in 5.x. Under 4.x, which does use gawk, everything works as intended. As I don't have access to a 5.x system, this patch has only been tested under 4.x, but it should work. >How-To-Repeat: On a 5.x system: % cd /usr/ports % make search name=phpmyadmin icase=1 >Fix: --- bsd.port.subdir.mk.diff begins here --- --- bsd.port.subdir.mk.orig Sat Jul 10 17:25:21 2004 +++ bsd.port.subdir.mk Sat Jul 10 17:35:44 2004 @@ -346,24 +346,33 @@ -v rdeps="$$rdeps" -v xrdeps="$$xrdeps" \ -v icase="$${icase:-${PORTSEARCH_IGNORECASE}}" \ -v keylim="$${keylim:-${PORTSEARCH_KEYLIM}}" \ - -v xkeylim="$${xkeylim:-${PORTSEARCH_XKEYLIM}}"\ + -v xkeylim="$${xkeylim:-${PORTSEARCH_XKEYLIM}}" \ -v display="$${display:-${PORTSEARCH_DISPLAY_FIELDS}}" \ 'BEGIN { \ sub(top, "${PORTSDIR}", there); \ - IGNORECASE=icase; \ keylen = length(key); keylim = keylim && keylen; \ if (!keylim && keylen) \ - parms[0] = key; \ + parms[0] = (icase ? tolower(key) : key); \ xkeylen = length(xkey); xkeylim = xkeylim && xkeylen; \ if (!xkeylim && xkeylen) \ - xparms[0] = xkey; \ - if (length(name)) parms[1] = name; if (length(xname)) xparms[1] = xname; \ - if (length(path)) parms[2] = path; if (length(xpath)) xparms[2] = xpath; \ - if (length(info)) parms[4] = info; if (length(xinfo)) xparms[4] = xinfo; \ - if (length(maint)) parms[6] = maint; if (length(xmaint)) xparms[6] = xmaint; \ - if (length(cat)) parms[7] = cat; if (length(xcat)) xparms[7] = xcat; \ - if (length(bdeps)) parms[8] = bdeps; if (length(xbdeps)) xparms[8] = xbdeps; \ - if (length(rdeps)) parms[9] = rdeps; if (length(xrdeps)) xparms[9] = xrdeps; \ + xparms[0] = (icase ? tolower(xkey) : xkey); \ + if (icase) { \ + if (length(name)) parms[1] = tolower(name); if (length(xname)) xparms[1] = tolower(xname); \ + if (length(path)) parms[2] = tolower(path); if (length(xpath)) xparms[2] = tolower(xpath); \ + if (length(info)) parms[4] = tolower(info); if (length(xinfo)) xparms[4] = tolower(xinfo); \ + if (length(maint)) parms[6] = tolower(maint); if (length(xmaint)) xparms[6] = tolower(xmaint); \ + if (length(cat)) parms[7] = tolower(cat); if (length(xcat)) xparms[7] = tolower(xcat); \ + if (length(bdeps)) parms[8] = tolower(bdeps); if (length(xbdeps)) xparms[8] = tolower(xbdeps); \ + if (length(rdeps)) parms[9] = tolower(rdeps); if (length(xrdeps)) xparms[9] = tolower(xrdeps); \ + } else { \ + if (length(name)) parms[1] = name; if (length(xname)) xparms[1] = xname; \ + if (length(path)) parms[2] = path; if (length(xpath)) xparms[2] = xpath; \ + if (length(info)) parms[4] = info; if (length(xinfo)) xparms[4] = xinfo; \ + if (length(maint)) parms[6] = maint; if (length(xmaint)) xparms[6] = xmaint; \ + if (length(cat)) parms[7] = cat; if (length(xcat)) xparms[7] = xcat; \ + if (length(bdeps)) parms[8] = bdeps; if (length(xbdeps)) xparms[8] = xbdeps; \ + if (length(rdeps)) parms[9] = rdeps; if (length(xrdeps)) xparms[9] = xrdeps; \ + } \ fields["name"] = 1; names[1] = "Port"; \ fields["path"] = 2; names[2] = "Path"; \ fields["info"] = 4; names[4] = "Info"; \ @@ -380,17 +389,17 @@ if ($$2 !~ there) \ next; \ for (i in parms) \ - if ($$i !~ parms[i]) \ + if ((icase ? tolower($$i) : $$i) !~ parms[i]) \ next; \ for (i in xparms) \ - if ($$i ~ xparms[i]) \ + if ((icase ? tolower($$i) : $$i) ~ xparms[i]) \ next; \ found = 0; \ for (i = 1; i < 10; i++) \ if (i in disp) { \ - if (xkeylim && $$i ~ xkey) \ + if (xkeylim && (icase ? tolower($$i) : $$i) ~ xkey) \ next; \ - if (!found && keylim && $$i ~ key) \ + if (!found && keylim && (icase ? tolower($$i) : $$i) ~ key) \ found = 1; \ } \ if (keylim && !found) \ --- bsd.port.subdir.mk.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200407101657.i6AGvHHF062623>