From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QCcEA-0003wH-H1 for garchives@archives.gentoo.org; Wed, 20 Apr 2011 18:34:14 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 742051C0B2; Wed, 20 Apr 2011 18:34:02 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 727381C04A for ; Wed, 20 Apr 2011 18:33:26 +0000 (UTC) Received: from pomiocik.lan (213-238-104-108.adsl.inetia.pl [213.238.104.108]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 65DA61B4026; Wed, 20 Apr 2011 18:33:24 +0000 (UTC) Date: Wed, 20 Apr 2011 20:33:27 +0200 From: =?UTF-8?B?TWljaGHFgiBHw7Nybnk=?= To: gentoo-dev@lists.gentoo.org Cc: williamh@gentoo.org Subject: Re: [gentoo-dev] rfc: openrc use flag Message-ID: <20110420203327.36ae5c7d@pomiocik.lan> In-Reply-To: <20110420182253.GA12829@linux1> References: <20110420172419.GC12411@linux1> <1303322561.22688.9.camel@tablet> <20110420182253.GA12829@linux1> Organization: Gentoo X-Mailer: Claws Mail 3.7.9 (GTK+ 2.24.3; x86_64-pc-linux-gnu) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/L7vJ_.18nR/mykcS/FZZd3d"; protocol="application/pgp-signature" X-Archives-Salt: X-Archives-Hash: 5300fa316bc00645a2a3f41b8447fd98 --Sig_/L7vJ_.18nR/mykcS/FZZd3d Content-Type: multipart/mixed; boundary="MP_/9b7+VuH/ocMzxlqWKQThiQp" --MP_/9b7+VuH/ocMzxlqWKQThiQp Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Wed, 20 Apr 2011 13:22:53 -0500 William Hubbs wrote: > On Wed, Apr 20, 2011 at 10:02:41PM +0400, Peter Volkov wrote: > > =D0=92 =D0=A1=D1=80=D0=B4, 20/04/2011 =D0=B2 12:24 -0500, William Hubbs= =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > > > The author of the bug feels that the way to fix this is for us to > > > put a check in openrc that makes it refuse to run services if it > > > was not used in the boot process. > >=20 > > This is good idea to have in any case since I remember my system > > went crazy after I've tried to start some service inside chroot. >=20 > My concern about it though is prefix installs. If I implement > something like this, will it not break openrc on prefix systems? I'm attaching the patch I suggested to fix the issue. It is based on the assumption that in order to run cleanly, OpenRC needs to do some cleanup in ${RC_SVCDIR} (e.g. to mark all services stopped). It assumes that the basic effect of a running OpenRC is a determined runlevel stored in ${RC_SVCDIR}/softlevel file. I tested that approach with clean OpenRC and systemd installs, and it doesn't create any issues. I'd appreciate if someone with Prefix system could test it as well. --=20 Best regards, Micha=C5=82 G=C3=B3rny --MP_/9b7+VuH/ocMzxlqWKQThiQp Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0001-Add-a-check-for-softlevel-when-running-init.d-script.patch =46rom ac70101ad50348fee636cea36cefcd473ee45690 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Micha=3DC5=3D82=3D20G=3DC3=3DB3rny?=3D Date: Wed, 20 Apr 2011 15:34:08 +0200 Subject: [PATCH] Add a check for softlevel when running init.d scripts. ${RC_SVCDIR}/softlevel should be a good file to check for before running a OpenRC script. This should fix http://bugs.gentoo.org/show_bug.cgi?id=3D3= 64159. --- src/rc/runscript.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/rc/runscript.c b/src/rc/runscript.c index 0eca487..b7cc810 100644 --- a/src/rc/runscript.c +++ b/src/rc/runscript.c @@ -1112,6 +1112,11 @@ runscript(int argc, char **argv) exit(EXIT_FAILURE); } =20 + if (!exists(RC_SVCDIR "/softlevel")) { + fprintf(stderr, "OpenRC is not running\n"); + exit(EXIT_FAILURE); + } + if (stat(argv[1], &stbuf) !=3D 0) { fprintf(stderr, "runscript `%s': %s\n", argv[1], strerror(errno)); --=20 1.7.5.rc1 --MP_/9b7+VuH/ocMzxlqWKQThiQp-- --Sig_/L7vJ_.18nR/mykcS/FZZd3d Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) iEYEARECAAYFAk2vJvsACgkQnGSe5QXeB7vVAQCaAj0ml17t2jb6peIqizNL7/Qm buUAniRgAc53Qm10PCrftlI18SdrawFV =0Y0u -----END PGP SIGNATURE----- --Sig_/L7vJ_.18nR/mykcS/FZZd3d--