From owner-freebsd-hackers@FreeBSD.ORG Mon Apr 26 07:59:12 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C23741065672; Mon, 26 Apr 2010 07:59:12 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from mail-qy0-f181.google.com (mail-qy0-f181.google.com [209.85.221.181]) by mx1.freebsd.org (Postfix) with ESMTP id 5D81F8FC18; Mon, 26 Apr 2010 07:59:12 +0000 (UTC) Received: by qyk11 with SMTP id 11so14656032qyk.13 for ; Mon, 26 Apr 2010 00:59:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=8zLr6oPxvMmYeldOSqyd69tagbGuhSkD2CCTHyzEYVo=; b=N/Xa24LSVSd+qPVeJHwvfKup6GjBFo8JWUPd34x0ZXSwhgj13phLJKLVpCWr9RLNDT 10lzUX4I1xTd/tjsmXNGVoeCnV1JNkUl//G6e37auWBaATZmI7MJ7rtnQb1cKVk8kK7V RG/t4x8onRdYo9AUB6PMvUoDyDPfPH9P3WVZQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=LWGzapWrN5RrZZtANLf5mUsSGzEDCOTYsmbogIs7BwlP3IjThCW/8nyT27GgQWVS26 ncOMRTaWg8P6RSdpGyHEFRe+axYfshhchmM7nFFDXl+ZMoMN1AeWs4k6+Y9I20HBQA4J RmTadW1mkJlAaSqU2xknExQXk4SovrKM0z/rg= MIME-Version: 1.0 Received: by 10.229.228.83 with SMTP id jd19mr4486708qcb.72.1272268742956; Mon, 26 Apr 2010 00:59:02 -0700 (PDT) Received: by 10.229.233.11 with HTTP; Mon, 26 Apr 2010 00:59:02 -0700 (PDT) In-Reply-To: <4BD5009C.20300@FreeBSD.org> References: <4BCE5ECC.6070202@gmail.com> <20100422111758.GA39338@ei.bzerk.org> <4BD07F2D.3030809@FreeBSD.org> <4BD07FCB.4030604@FreeBSD.org> <4BD5009C.20300@FreeBSD.org> Date: Mon, 26 Apr 2010 00:59:02 -0700 Message-ID: From: Garrett Cooper To: Doug Barton Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org, Eitan Adler , "Aryeh M. Friedman" , Ruben de Groot , =?ISO-8859-1?Q?Trond_Endrest=F8l?= Subject: Re: regenerating /var/db/pkg X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Apr 2010 07:59:12 -0000 2010/4/25 Doug Barton : > On 04/25/10 19:44, Garrett Cooper wrote: >> On Thu, Apr 22, 2010 at 10:05 AM, Eitan Adler = wrote: >>> Same as before - if all is good I'll send a PR >>> >>> #!/bin/sh >>> # >>> # $FreeBSD: src/etc/periodic/daily/210.backup-aliases,v 1.6.36.1.2.1 >>> 2009/10/25 01:10:29 kensmith Exp $ >>> # >>> >>> # If there is a global system configuration file, suck it in. >>> # >>> if [ -r /etc/defaults/periodic.conf ] >>> then >>> =A0 =A0. /etc/defaults/periodic.conf >>> =A0 =A0source_periodic_confs >>> fi >>> >>> bak=3D/var/backups >>> db_loc=3D$(/usr/bin/make -f/usr/share/mk/bsd.port.mk -V PKG_DBDIR 2>/de= v/null) >>> bk_loc=3D"$bak/pkgdb.bak.tar.bz2" >>> >>> case "$daily_backup_pkgdb_enable" in >>> =A0 =A0[Yy][Ee][Ss]) >> >> This could be done via rc.subr's checkyesno function. > > It's periodic, not rc.d. =A0:) It would be nice if some of the more usable functions got moved out of rc.subr though :(... It would cure 20 lines of duplicate code here and elsewhere outside of rc land... >>> =A0 =A0 =A0 =A0if [ ! -d $db_loc ] >> >> Please quote the string. > > I generally do quote the string as a matter of paranoia, however the > practical result is likely to be the same. Yes, and you're assuming that users won't do: PKG_DBDIR :=3D /my /super /special/ directory with spaces Granted, a lot of things probably won't work that way, but just compounding to the issue of not quoting variables seems like a silly mistake to make :/. Thanks, -Garrett