From owner-svn-src-all@freebsd.org Sun Jun 19 00:06:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A5CFA79BB9; Sun, 19 Jun 2016 00:06:37 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E9B4216E0; Sun, 19 Jun 2016 00:06:36 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id EQFvbNWpVN9d0EQFwb3vwr; Sat, 18 Jun 2016 18:06:29 -0600 X-Authority-Analysis: v=2.2 cv=QZUkhYTv c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=pD_ry4oyNxEA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=6bjs4j2-ulXUaOp-ORUA:9 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 0479913752; Sat, 18 Jun 2016 17:06:27 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id u5J06Qk6009591; Sat, 18 Jun 2016 17:06:26 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201606190006.u5J06Qk6009591@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Niclas Zeising cc: Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288291 - head/etc In-Reply-To: Message from Niclas Zeising of "Sun, 19 Jun 2016 00:06:32 +0200." <2171b966-35c7-2dad-2c0f-f23061cb677a@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 18 Jun 2016 17:06:26 -0700 X-CMAE-Envelope: MS4wfNEk94othDyAawdxAUUBXXWjvvMz70gz8uaG1KddphgPc9DOGr+uUBu8MUpaxq2X6PrqyQHlS0rDO865IGakQubgFFtuGkxuyOqLI5cTCwM6r8xiiY0h zh3m+w1pFLMSVG2kYBOj/KCEgIbdqVM+yvyRG7tK97iBDsFKMFraFCMqc2OPTpf+V1mwuLrvOkgWRrp+7sGCtkHPjxS7eF8voPqcW2j56rt2SOfygPcwG3XG A5X5hrUaeOWyNAtI+gF6JU78K7Hl5Jfyke8viTnj9gekkr9NV1sOTanODa3nNPJri6OqeWiL9n/kIHwEDQmNYA== X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 00:06:37 -0000 In message <2171b966-35c7-2dad-2c0f-f23061cb677a@freebsd.org>, Niclas Zeising w rites: > On 09/27/15 06:03, Adrian Chadd wrote: > > Author: adrian > > Date: Sun Sep 27 04:03:11 2015 > > New Revision: 288291 > > URL: https://svnweb.freebsd.org/changeset/base/288291 > > > > Log: > > Enforce consistent limits of daemons run from rc.subr: > > > > * Allow the user to configure the login class to use in rc.conf > > by using {daemon}_login_class, which; > > * Use the daemon class by default; > > * .. and then use 'limits' to set the login class so it works both > > via init at startup (which runs this in 'daemon' class) and via > > whichever root environment (eg command line, other daemons, etc.) > > > > Reviewed by: dteske > > Differential Revision: https://reviews.freebsd.org/D3630 > > > > Modified: > > head/etc/rc.subr > > > > Modified: head/etc/rc.subr > > =========================================================================== > === > > --- head/etc/rc.subr Sun Sep 27 03:46:55 2015 (r288290) > > +++ head/etc/rc.subr Sun Sep 27 04:03:11 2015 (r288291) > > @@ -768,6 +768,8 @@ check_startmsgs() > > # > > # ${name}_prepend n Command added before ${command}. > > # > > +# ${name}_login_class n Login class to use, else "daemon". > > +# > > # ${rc_arg}_cmd n If set, use this as the method when invoked; > > # Otherwise, use default command (see below) > > # > > @@ -942,7 +944,7 @@ run_rc_command() > > _nice=\$${name}_nice _user=\$${name}_user \ > > _group=\$${name}_group _groups=\$${name}_groups \ > > _fib=\$${name}_fib _env=\$${name}_env \ > > - _prepend=\$${name}_prepend > > + _prepend=\$${name}_prepend _login_class=\${${name}_login_class:-da > emon} > > > > if [ -n "$_user" ]; then # unset $_user if running as that user > > if [ "$_user" = "$(eval $IDCMD)" ]; then > > @@ -1050,6 +1052,9 @@ $command $rc_flags $command_args" > > fi > > fi > > > > + # Prepend default limits > > + _doit="limits -C $_login_class $_doit" > ^^^^^^^^^^ > > + > > # run the full command > > # > > if ! _run_rc_doit "$_doit"; then > > Apologies for waking so late. > This breaks the start of scripts running before file systems are > mounted, for example /etc/rc.d/ddb, if / and /usr are on separate > partitions. The issue is that limits is /usr/bin/limits, and for > obvious reasons can't be found before /usr is mounted. > I suggest either move /usr/bin/limits to /bin/limits or avoid using it > altogether. > Do you want me to open a PR to track this issue? > Regards! A simple solution might be, Index: rc.subr =================================================================== --- rc.subr (revision 302001) +++ rc.subr (working copy) @@ -1071,8 +1071,13 @@ fi fi + # Before we prepend limits, test if limits is + # available (/usr is mounted) so that limits can + # be run. + if limits >/dev/null 2>&1; then # Prepend default limits - _doit="limits -C $_login_class $_doit" + _doit="limits -C $_login_class $_doit" + fi # run the full command # -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few.