From owner-freebsd-bugs@FreeBSD.ORG Tue Oct 25 23:00:24 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7252A106566C for ; Tue, 25 Oct 2011 23:00:24 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id E65C68FC14 for ; Tue, 25 Oct 2011 23:00:19 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p9PN0JpK064270 for ; Tue, 25 Oct 2011 23:00:19 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p9PN0JcU064268; Tue, 25 Oct 2011 23:00:19 GMT (envelope-from gnats) Resent-Date: Tue, 25 Oct 2011 23:00:19 GMT Resent-Message-Id: <201110252300.p9PN0JcU064268@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, Michael G Schwern Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 934B9106566B for ; Tue, 25 Oct 2011 22:51:40 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 826688FC13 for ; Tue, 25 Oct 2011 22:51:40 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p9PMpe0s047434 for ; Tue, 25 Oct 2011 22:51:40 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p9PMpeUc047433; Tue, 25 Oct 2011 22:51:40 GMT (envelope-from nobody) Message-Id: <201110252251.p9PMpeUc047433@red.freebsd.org> Date: Tue, 25 Oct 2011 22:51:40 GMT From: Michael G Schwern To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/162016: BSDPAN::ExtUtils::Packlist->get_dir_list can go into an infinite loop X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Oct 2011 23:00:24 -0000 >Number: 162016 >Category: misc >Synopsis: BSDPAN::ExtUtils::Packlist->get_dir_list can go into an infinite loop >Confidential: no >Severity: non-critical >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Oct 25 23:00:19 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Michael G Schwern >Release: 8.2 >Organization: >Environment: 8.2-RELEASE i386 (I can't cut & paste from my virtual machine) >Description: See https://rt.cpan.org/Ticket/Display.html?id=70232#txn-991950 for the upstream report. BSDPAN::ExtUtils::Packlist can be put into an infinite loop if write() is given a packlist like "../.packlist". This happens in the ExtUtils-MakeMaker tests, specifically t/INSTALL_BASE.t, and was causing hangs. I have worked around this in MakeMaker's tests by having them set one of the magic environment variables it recognizes to disable BSDPAN registration. It's a bit distressing that test modules were being registered. Perhaps BDSPAN should check that the module in question is being installed into an official location before registering? I don't know how the BSDPAN stuff works. >How-To-Repeat: cd Some-CPAN-Module (ExtUtils-MakeMaker works) perl Makefile.PL (to generate a Makefile) Then run the following Perl program. use ExtUtils::Packlist; my $packlist = ExtUtils::Packlist->new; $packlist->{"Bar.pm"} = 1; $packlist->write("../.packlist"); It will enter an infinite loop. >Fix: get_dir_list() is the problem. It's written in an unsafe fashion. Instead of hacking off bits of the filepath with a regex and breaking out of an infinite loop, it is safer and simpler to pull the filepath apart into a list with File::Spec->splitpath and iterate through it. >Release-Note: >Audit-Trail: >Unformatted: