From owner-svn-src-stable-11@freebsd.org Sat Dec 22 07:46:03 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6BC813495D2; Sat, 22 Dec 2018 07:46:02 +0000 (UTC) (envelope-from Andre.Albsmeier@siemens.com) Received: from thoth.sbs.de (thoth.sbs.de [192.35.17.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "thoth.sbs.de", Issuer "Siemens Issuing CA Internet Server 2017" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 548B6753FD; Sat, 22 Dec 2018 07:46:00 +0000 (UTC) (envelope-from Andre.Albsmeier@siemens.com) Received: from mail1.siemens.de (mail1.siemens.de [139.23.33.14]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id wBM7XeXf022795 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 22 Dec 2018 08:33:40 +0100 Received: from curry.mchp.siemens.de (curry.mchp.siemens.de [139.25.40.130]) by mail1.siemens.de (8.15.2/8.15.2) with ESMTP id wBM7Xeeu023236; Sat, 22 Dec 2018 08:33:40 +0100 Received: (from user@localhost) by curry.mchp.siemens.de (8.15.2/8.15.2) id wBM7Xe8u093619; Date: Sat, 22 Dec 2018 08:33:40 +0100 From: Andre Albsmeier To: Eugene Grosbein Cc: Ian Lepore , Andre Albsmeier , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r341794 - stable/11/etc/periodic/weekly Message-ID: <20181222073340.GA27107@bali> References: <201812101424.wBAEOgbC053582@repo.freebsd.org> <20181215090926.GA33682@bali> <1544893102.76088.70.camel@freebsd.org> <3a15a5aa-913a-88eb-a072-86526ef4899e@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3a15a5aa-913a-88eb-a072-86526ef4899e@freebsd.org> User-Agent: Mutt/1.7.2 (2016-11-26) X-Rspamd-Queue-Id: 548B6753FD X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of Andre.Albsmeier@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=Andre.Albsmeier@siemens.com X-Spamd-Result: default: False [-1.80 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.95)[-0.953,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+exists:192.35.17.2.spf.siemens.com]; NEURAL_HAM_LONG(-0.97)[-0.973,0]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[siemens.com]; NEURAL_SPAM_SHORT(0.44)[0.443,0]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[meleagros.siemens.com,hylas.siemens.com,paxos.siemens.com,hephaistos.siemens.com,gordi.siemens.com,zetes.siemens.com,balduin.siemens.com]; RCPT_COUNT_SEVEN(0.00)[7]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; ASN(0.00)[asn:15465, ipnet:192.35.16.0/22, country:DE]; RCVD_IN_DNSWL_HI(-0.50)[2.17.35.192.list.dnswl.org : 127.0.13.3]; IP_SCORE(-0.00)[country: DE(-0.01)] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2018 07:46:03 -0000 On Sun, 16-Dec-2018 at 06:47:04 +0700, Eugene Grosbein wrote: > 15.12.2018 23:58, Ian Lepore wrote: > > > It uses sysrc, which sources in /usr/share/bsdconfig/common.subr; this > > is the first reference to sysrc in any periodic script, so it does > > establish a new dependency, requiring sysrc to be installed on any > > system that runs periodic scripts. > > Thanks, I've re-implemented this without sysrc. > > > A safer way to extract the root path of all running jails might be > > something like: > > > > if which -s jls; then > > allpaths="$(jls -d path)" > > for onepath in ${allpaths}; do > > # do whatever with ${onepath} here > > done > > fi > > This needs to check for all configured full-blown jails including maybe not running at the moment. > sysrc is handy but is not really necessary. > > Andre, this should fix it for your case, please test: > > fetch -o /tmp/noid.diff 'https://svnweb.freebsd.org/base/head/usr.sbin/periodic/etc/weekly/340.noid?view=patch&r1=342141&r2=342140&pathrev=342141' > cd /etc/periodic/weekly && patch -p5 < /tmp/noid.diff Yes, that fixes it, thanks. But please note that I don't use jails and don't have jail(8) installed at all (WITHOUT_JAIL). Also, maybe we should check if jail(8) exists before running $(jail ...) or even the whole "if" expression. The result will probably be the same but one can clearly see that it depends on jail(8) and maybe one can then even leave out the 2>/dev/null so errors can come through (no idea if this is something that can happen). Something like (bad indenting to be ignored): --- 340.noid.ORI 2018-12-22 08:26:24.515158000 +0100 +++ 340.noid 2018-12-22 08:27:51.985887000 +0100 @@ -21,6 +21,7 @@ # of this script. exclude='' +if [ -x /usr/sbin/jail ]; then if [ $(sysctl -n security.jail.jailed) = 0 ]; then # For jail_conf . /etc/rc.subr @@ -29,7 +30,7 @@ sep=: OIFS="$IFS" IFS="$sep" - for param in $(jail -f "$jail_conf" -e "$sep" 2>/dev/null) + for param in $(jail -f "$jail_conf" -e "$sep") do case "$param" in path=*) @@ -44,6 +45,7 @@ done IFS="$OIFS" fi +fi rc=$(find -H ${weekly_noid_dirs:-/} \ \( $exclude ! -fstype local -prune -or -name \* \) -and \ (Or replace the -x by some which(1) construct...) Sorry for the late reply but I was on holidays (and had to wait for the weekly run anyway).