From owner-freebsd-stable@FreeBSD.ORG Thu Apr 14 09:52:02 2011 Return-Path: Delivered-To: stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A44AA1065674; Thu, 14 Apr 2011 09:52:02 +0000 (UTC) (envelope-from jhellenthal@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 5462A8FC14; Thu, 14 Apr 2011 09:52:02 +0000 (UTC) Received: by iwn33 with SMTP id 33so1670098iwn.13 for ; Thu, 14 Apr 2011 02:52:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:date:message-id:to:subject:from:reply-to :cc:x-send-pr-version:x-gnats-notify; bh=MO0/g7oPtTpiYnusVJZO2T42gWm1+S//667G1S1QvaY=; b=XD1M/0pkl+QkGx8ExWYKHw4rBpjvVQfUOCiYZuK3i5iT3AUrCLmUilyZ8Ky+fivqpO U7haDcSWP08cusDqgUb2hXnB+g/g2qtJmRS4uieYPdr+FpxnKiWXPfn6tc9Olnb/L9w/ pMrTyuL/XhTvMJ9W7n0bcEpheb7uCnF5lX9zw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:message-id:to:subject:from:reply-to:cc :x-send-pr-version:x-gnats-notify; b=k6U2Zqd9n4V+otHyRVzruayz+lh0ORNa4bRWFZFm+oRNXjdAo3yIFCCQ7550qLlfjB 5sPqTjd2KiQ+iBneSnQYvawbM99LLjEDD56YZe2iSHU8uxcbqEGx1pn0jm3+U7OwnBaE +iAJpOeVdtDM/fdcqLXuLW1zlZP7rrHIV1hM4= Received: by 10.42.123.15 with SMTP id p15mr764314icr.93.1302772927118; Thu, 14 Apr 2011 02:22:07 -0700 (PDT) Received: from DataIX.net ([99.19.43.8]) by mx.google.com with ESMTPS id wo11sm1007110icb.20.2011.04.14.02.22.04 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 14 Apr 2011 02:22:05 -0700 (PDT) Sender: "J. Hellenthal" Received: from DataIX.net (localhost [127.0.0.1]) by DataIX.net (8.14.4/8.14.4) with ESMTP id p3E9M2Ta053053 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 14 Apr 2011 05:22:02 -0400 (EDT) (envelope-from jhell@DataIX.net) Received: (from jhell@localhost) by DataIX.net (8.14.4/8.14.4/Submit) id p3E9M246053052; Thu, 14 Apr 2011 05:22:02 -0400 (EDT) (envelope-from jhell) Date: Thu, 14 Apr 2011 05:22:02 -0400 (EDT) Message-Id: <201104140922.p3E9M246053052@DataIX.net> To: FreeBSD-gnats-submit@freebsd.org From: "J. Hellenthal" X-send-pr-version: 3.113 X-GNATS-Notify: Cc: stable@freebsd.org Subject: Make 220.backup-pkgdb cd(1) and backup only the package database. X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "J. Hellenthal" List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Apr 2011 09:52:02 -0000 >Submitter-Id: current-users >Originator: J. Hellenthal >Organization: >Confidential: no >Synopsis: Make 220.backup-pkgdb cd(1) and backup only the package database. >Severity: non-critical >Priority: medium >Category: conf >Class: change-request >Release: FreeBSD 8.2-STABLE i386 >Environment: System: FreeBSD 8.2-STABLE #0 r220564M Tue Apr 12 10:02:17 EDT 2011 i386 >Description: Currently the backup script archives a full path starting from '/' and then strips the leading slash off of the path which is correct. Upon extraction that full path without the leading slash is extracted in the current directory as var/db/pkg/ with the first two and possibly more directories left empty. If a user has a different PKG_DBDIR as designated by ports(7) that is larger this can lead to frustration with the length of emptiness in the archive with the leading paths. >How-To-Repeat: Run ( /etc/periodic/daily/220.backup-pkgdb ) and extract the archive located in /var/backups/ >Fix: This patch makes 220.backup-pkgdb respectifully cd to where the pkgdb is located and create the archive from the relative path so there is only the pkgdb directory and contents upon extraction. http://patches.jhell.googlecode.com/hg/220.backup-pkgdb_cd.patch?r=f60df831e62d64fd336b6c6612a6619eaf17a17f diff -r aa37d382121b -r 3fbae1ba29a4 etc/periodic/daily/220.backup-pkgdb --- a/etc/periodic/daily/220.backup-pkgdb +++ b/etc/periodic/daily/220.backup-pkgdb @@ -33,7 +33,8 @@ new_bak_file=`mktemp ${bak_file}-XXXXX` - if tar -cjf "${new_bak_file}" "$pkg_dbdir"; then + cd $pkg_dbdir/.. + if tar -cjf "${new_bak_file}" "$(basename $pkg_dbdir)"; then chmod 644 "${new_bak_file}" if [ -e "${bak_file}.2" -a -e "${bak_file}" ]; then