From owner-freebsd-bugs@FreeBSD.ORG Mon Sep 15 04:10:16 2008 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E7441065672 for ; Mon, 15 Sep 2008 04:10:16 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from mail-gx0-f17.google.com (mail-gx0-f17.google.com [209.85.217.17]) by mx1.freebsd.org (Postfix) with ESMTP id 29C6C8FC0A for ; Mon, 15 Sep 2008 04:10:10 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: by gxk10 with SMTP id 10so22500209gxk.19 for ; Sun, 14 Sep 2008 21:10:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=bT0R7y3jmQP+WLlTDfYuc5t+kL5KWmeyzQZhmIcmxB8=; b=RC2+ha3y4zJBO2FschMfQg/jq/40H2pYg9ZZnrZWYSmJGTFLaJMBjPOBGvtGUKQlh4 wCP39CQfEyFZtQJb5C2QJC4blBgi/GMvDQZS/dom/ul7kKgMVfy+5LC+gRjFRnXKpHJC b1UXx7NJ0X5XS0eXxLBJ+Sguk5zKAg/IGgZDg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=i/xZUWWddNWl1cD8GhK/PWg40KnviQNDJ7zL/7PIZhhm4HbnaMJ96bgKXbk+OHZHkR 1Os+SiOpvFZZJHuToDuTnWu3E2q3oJonJT8nmhWTvGc5K9VVRAauNVILVqaWkUBDQDmP WVVZF5hM1etFPJdidezFt+6MdQrou+REGOfQM= Received: by 10.86.92.7 with SMTP id p7mr5509646fgb.72.1221451809501; Sun, 14 Sep 2008 21:10:09 -0700 (PDT) Received: by 10.86.62.14 with HTTP; Sun, 14 Sep 2008 21:10:09 -0700 (PDT) Message-ID: <7d6fde3d0809142110x1d28e40fm4e976f93ae507852@mail.gmail.com> Date: Sun, 14 Sep 2008 21:10:09 -0700 From: "Garrett Cooper" To: "Bruce Cran" In-Reply-To: <7d6fde3d0809112324l5d99c157n1d5f23efbb32f3bf@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200807241348.m6ODmVNe090621@www.freebsd.org> <7d6fde3d0807241118x122c25dbjad0e6f7b98f789d7@mail.gmail.com> <20080909212343.58886989@tau.draftnet> <7d6fde3d0809112324l5d99c157n1d5f23efbb32f3bf@mail.gmail.com> Cc: freebsd-bugs@freebsd.org, bug-followup@freebsd.org Subject: Re: bin/125932: pkg_add(1) doesn't prompt for root credentials and then fails badly 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: Mon, 15 Sep 2008 04:10:16 -0000 On Thu, Sep 11, 2008 at 11:24 PM, Garrett Cooper wrote: > On Tue, Sep 9, 2008 at 1:23 PM, Bruce Cran wrote: >> On Thu, 24 Jul 2008 11:18:31 -0700 >> "Garrett Cooper" wrote: >> >>> On Thu, Jul 24, 2008 at 6:48 AM, Bruce Cran wrote: >>> >>How-To-Repeat: >>> > Run pkg_add -r as a non-root user. >>> >>Fix: >>> >>> The issue isn't the fact that you're running as non-root; it's that >>> someone's not checking to see whether or not a fetch init succeeded >>> (filehandle's open, writing's being done) before continuing. >>> >>> I'll fix this later on tonight when I get back from San Jose. >>> >> >> Did you make any progress with this? > > I thought I made a comment about this earlier, but apparently I didn't > send it out or it wasn't recorded: > > Symptom: > > The issue is caused by tar in the PUSHOUT macro in add/extract.c as > identified below, during the extract. If and when the tar stuff is > replaced with libarchive, this issue will fail sooner (and this should > be done because this would save a lot of time and resources when > extracting large packages like openoffice): > > #define PUSHOUT(todir) /* push out string */ \ > if (where_count > (int)sizeof(STARTSTRING)-1) { \ > strcat(where_args, "|/usr/bin/tar --unlink -xpPf - -C "); \ > strcat(where_args, todir); \ > if (system(where_args)) { \ /*** XXX: FAILS HERE ***/ > cleanup(0); \ > errx(2, "%s: can not invoke %ld byte tar pipeline: %s", \ > __func__, (long)strlen(where_args), where_args); \ > } \ > > Real problem: > > The actual problem is that the master and slave pkg_add processes > aren't communicating properly with one another, s.t. the slave > instances aren't breaking the master execution at the first sign of > failure. > > HTH, > -Garrett Here's a proposed patch for the first set of cleanup to pkg_install: , and some fixing to alleviate the issue in bin/125932. Rather than biting off more than I can chew with the perforce project, I'm going to work off the changes Anders has made and incrementally polish pkg_install (like I should have done last year -_-...) This patch causes pkg_install to error out at the first sign of install failure (which could take a while as it's still using tar(1) to extract archives in add/extract.c), BUT in getFileByURL I've completely replaced the tar requirement in lib/url.c with archive(3)'s, quite handy hooks for writing to files. So don't be alarmed when you see that the file has grown 4 times ;)... This patch hasn't gotten much mileage, other than a few failure and success cases, so if others could please take a look at this and provide comments I'd much appreciate it. Cheers, -Garrett PS Packages might not be dumped in the correct spot -- I just chose /var/tmp, but if someone could point me to the "industry standard" location that portupgrade uses for instance, I'd be more than happy to point there.