From owner-freebsd-bugs@FreeBSD.ORG Thu Apr 14 10:00:20 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 B8C24106564A for ; Thu, 14 Apr 2011 10:00:02 +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 07C618FC0C for ; Thu, 14 Apr 2011 10:00:02 +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 p3EA01q3000233 for ; Thu, 14 Apr 2011 10:00:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p3EA015R000232; Thu, 14 Apr 2011 10:00:01 GMT (envelope-from gnats) Resent-Date: Thu, 14 Apr 2011 10:00:01 GMT Resent-Message-Id: <201104141000.p3EA015R000232@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, "J. Hellenthal" 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) 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) 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) Message-Id: <201104140922.p3E9M246053052@DataIX.net> Date: Thu, 14 Apr 2011 05:22:02 -0400 (EDT) From: "J. Hellenthal" Sender: "J. Hellenthal" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: stable@FreeBSD.org Subject: conf/156396: Make 220.backup-pkgdb cd(1) and backup only the package database. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "J. Hellenthal" List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Apr 2011 10:00:21 -0000 >Number: 156396 >Category: conf >Synopsis: Make 220.backup-pkgdb cd(1) and backup only the package database. >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Apr 14 10:00:01 UTC 2011 >Closed-Date: >Last-Modified: >Originator: J. Hellenthal >Release: FreeBSD 8.2-STABLE i386 >Organization: >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 >Release-Note: >Audit-Trail: >Unformatted: