| Summary: | 220.backup-pkgdb on RELENG_7 emits tar leading slash warning | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Jeremy Chadwick <freebsd> |
| Component: | conf | Assignee: | Doug Barton <dougb> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | CC: | dougb |
| Priority: | Normal | ||
| Version: | 8.2-STABLE | ||
| Hardware: | Any | ||
| OS: | Any | ||
State Changed From-To: open->patched Responsible Changed From-To: freebsd-ports-bugs->dougb My problem. Author: dougb Date: Thu May 5 02:35:11 2011 New Revision: 221475 URL: http://svn.freebsd.org/changeset/base/221475 Log: 1. If PKG_DBDIR cannot be determined from make, set the default 2. Add the -H flag to tar in case /var/db/pkg itself is a symlink 3. Direct stderr to /dev/null to suppress the leading slash warning [1] PR: ports/156810 [1] Submitted by: Jeremy Chadwick <freebsd@jdc.parodius.com> [1] Modified: head/etc/periodic/daily/220.backup-pkgdb Modified: head/etc/periodic/daily/220.backup-pkgdb ============================================================================== --- head/etc/periodic/daily/220.backup-pkgdb Thu May 5 02:04:56 2011 (r221474) +++ head/etc/periodic/daily/220.backup-pkgdb Thu May 5 02:35:11 2011 (r221475) @@ -18,7 +18,8 @@ case "$daily_backup_pkgdb_enable" in bak="${daily_backup_pkgdb_dir:-/var/backups}" bak_file="${bak}/pkgdb.bak.tbz" - pkg_dbdir=`make -f/usr/share/mk/bsd.port.mk -V PKG_DBDIR 2>/dev/null` + pkg_dbdir=`make -f/usr/share/mk/bsd.port.mk -V PKG_DBDIR 2>/dev/null` || + pkg_dbdir=/var/db/pkg if [ ! -d "$bak" ] then @@ -33,7 +34,7 @@ case "$daily_backup_pkgdb_enable" in new_bak_file=`mktemp ${bak_file}-XXXXX` - if tar -cjf "${new_bak_file}" "$pkg_dbdir"; then + if tar -cjHf "${new_bak_file}" "$pkg_dbdir" 2>/dev/null; then chmod 644 "${new_bak_file}" if [ -e "${bak_file}.2" -a -e "${bak_file}" ]; then _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" State Changed From-To: patched->closed MFC complete. |
First, please note the above Release and Environment statements are not from a RELENG_7 box (obviously :-) ). The issue I'm describing is specific to RELENG_7's version of tar, which differs from RELENG_8. RELENG_7 tar spits out a warning when attempting to tar something with a leading slash: Backing up package db directory: tar: Removing leading '/' from member names RELENG_8 tar has different logic in util.c, causing it not to output said warning. I'm not sure if there's any effort underway to backport RELENG_8's tar to RELENG_7. Fix: There's multiple ways to fix this, but I think the easiest is to simply redirect stderr to /dev/null like so (diff): - if tar -cjf "${new_bak_file}" "$pkg_dbdir"; then + if tar -cjf "${new_bak_file}" "$pkg_dbdir" 2>/dev/null; then I've tested this on a RELENG_7 (7.4-STABLE) box dated 2011/04/30 and it does work. How-To-Repeat: Run /etc/periodic/daily/220.backup-pkgdb on a present-day RELENG_7 box.