ports/68072: fix make search when $PORTSDIR contains ERE metacharacters
Roman Neuhauser
neuhauser at chello.cz
Fri Jun 18 08:31:12 UTC 2004
>Number: 68072
>Category: ports
>Synopsis: fix make search when $PORTSDIR contains ERE metacharacters
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Jun 18 08:30:26 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator: Roman Neuhauser
>Release: FreeBSD 4.10-STABLE i386
>Organization:
>Environment:
System: FreeBSD isis.wad.cz 4.10-STABLE FreeBSD 4.10-STABLE #0: Thu Jun 10 23:39:22 CEST 2004 root at isis.wad.cz:/usr/obj/usr/src/sys/FREEPUPPY2_6 i386
>Description:
I broke the search target (ports/40699) in situations where ${PORTSDIR} is
a symlink to a directory with extended regular expression metacharacters.
the fix is to use string comparisons instead of regex matching.
the problem was reported here:
http://lists.freebsd.org/pipermail/freebsd-ports/2004-June/thread.html#13324
>How-To-Repeat:
mv /usr/ports /var/break+me
ln -s /var/break+me /usr/ports
cd /usr/ports
make search name=whatever
>Fix:
--- Mk::bsd.port.subdir.mk.search-PORTSDIR-metachars.patch begins here ---
Index: Mk/bsd.port.subdir.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.subdir.mk,v
retrieving revision 1.54
diff -u -r1.54 bsd.port.subdir.mk
--- Mk/bsd.port.subdir.mk 10 Jun 2004 07:30:19 -0000 1.54
+++ Mk/bsd.port.subdir.mk 15 Jun 2004 15:20:31 -0000
@@ -349,7 +349,9 @@
-v xkeylim="$${xkeylim:-${PORTSEARCH_XKEYLIM}}"\
-v display="$${display:-${PORTSEARCH_DISPLAY_FIELDS}}" \
'BEGIN { \
- sub(top, "${PORTSDIR}", there); \
+ if (substr(there, 1, length(top)) == top) \
+ there = "${PORTSDIR}" substr(there, 1 + length(top)); \
+ therelen = length(there); \
IGNORECASE=icase; \
keylen = length(key); keylim = keylim && keylen; \
if (!keylim && keylen) \
@@ -377,7 +379,7 @@
} \
} \
{ \
- if ($$2 !~ there) \
+ if (substr($$2, 1, therelen) != there) \
next; \
for (i in parms) \
if ($$i !~ parms[i]) \
--- Mk::bsd.port.subdir.mk.search-PORTSDIR-metachars.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list