From owner-freebsd-bugs@FreeBSD.ORG Thu Feb 6 13:10:01 2014 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1AB6DCEB for ; Thu, 6 Feb 2014 13:10:01 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E875212E7 for ; Thu, 6 Feb 2014 13:10:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id s16DA0is061407 for ; Thu, 6 Feb 2014 13:10:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s16DA0Qx061403; Thu, 6 Feb 2014 13:10:00 GMT (envelope-from gnats) Resent-Date: Thu, 6 Feb 2014 13:10:00 GMT Resent-Message-Id: <201402061310.s16DA0Qx061403@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Oliver Fromme Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F16CBC6 for ; Thu, 6 Feb 2014 13:08:16 +0000 (UTC) Received: from grabthar.secnetix.de (grabthar.secnetix.de [IPv6:2a01:170:102f::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 125B012CD for ; Thu, 6 Feb 2014 13:08:15 +0000 (UTC) Received: from grabthar.secnetix.de (localhost [127.0.0.1]) by grabthar.secnetix.de (8.14.7/8.14.7) with ESMTP id s16D8BZk005008; Thu, 6 Feb 2014 14:08:12 +0100 (CET) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by grabthar.secnetix.de (8.14.7/8.14.7/Submit) id s16D8BCC005007; Thu, 6 Feb 2014 14:08:11 +0100 (CET) (envelope-from olli) Message-Id: <201402061308.s16D8BCC005007@grabthar.secnetix.de> Date: Thu, 6 Feb 2014 14:08:11 +0100 (CET) From: Oliver Fromme To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.114 Subject: bin/186510: [PATCH] Latest BIND port triggers problem in portsnap Cc: olli@secnetix.de X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: Oliver Fromme List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Feb 2014 13:10:01 -0000 >Number: 186510 >Category: bin >Synopsis: [PATCH] Latest BIND port triggers problem in portsnap >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Feb 06 13:10:00 UTC 2014 >Closed-Date: >Last-Modified: >Originator: Oliver Fromme >Release: FreeBSD 9.2 i386 >Organization: secnetix GmbH & Co. KG http://www.secnetix.de/bsd >Environment: $ pkg_info | grep bind bind99-base-9.9.5 $ grep BASE\$ /var/db/ports/dns_bind99/options OPTIONS_FILE_SET+=REPLACE_BASE The problem only affects FreeBSD 9 and earlier. FreeBSD 10+ is not affected by the problem because BIND was removed from the base system, so the "replace base" option of the port isn't supported anymore. NB: I decided to set the priority "high" for this PR, because the problem prevents affected users from updating the ports collection. It's also trivial to fix. >Description: Since I updated to the latest BIND 9.9.5 port, portsnap fails with this message: Looking up portsnap.FreeBSD.org mirrors... none found. It turns out that the reason for this is the fact that the output from the host(1) command changed with the latest BIND update. Before the update, the lines looked tlike this: _http._tcp.portsnap.FreeBSD.org has SRV record x y z ... With the new version, they look like this: _http._tcp.portsnap.freebsd.org has SRV record x y z ... That is, the names being looked up on the left are converted to lower case. The portsnap script contains a sed command that tries to match the lines with the host name. That match now fails because of the upper/lower case difference. This means that no mirrors are found. >How-To-Repeat: On a FreeBSD 9 machine, install the latest dns/bind99 port with the option "replace base" set, so that /usr/bin/host comes from the BIND port. Then try to use portsnap. >Fix: The fix is trivial: Add the "I" flag to the sed command in order to make it case-insensitive. The fix should be applied on all branches, including HEAD and FreeBSD 10, even though they are not affected by this particular problem. DNS names are generally case-insensitive, so a script should never rely on the case of output produced by a program. Therefore, when matching host names, it should *always* be done in a case-insensitive manner. PS: I'm sorry, I had to copy&paste the diff, so I probably broke the tab characters. But the patch is sufficiently trivial so the patch(1) command isn't really required. @@ -348,7 +348,7 @@ # "$name server selection ..."; we allow either format. MLIST="_http._tcp.${SERVERNAME}" host -t srv "${MLIST}" | - sed -nE "s/${MLIST} (has SRV record|server selection) //p" | + sed -nE "s/${MLIST} (has SRV record|server selection) //Ip" | cut -f 1,2,4 -d ' ' | sed -e 's/\.$//' | sort > serverlist_full >Release-Note: >Audit-Trail: >Unformatted: