From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 44B34138334 for ; Fri, 6 Dec 2019 14:46:11 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B996AE088C; Fri, 6 Dec 2019 14:46:07 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 61609E0883 for ; Fri, 6 Dec 2019 14:46:07 +0000 (UTC) Received: from a1i15 (a1i15.kph.uni-mainz.de [134.93.134.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: ulm) by smtp.gentoo.org (Postfix) with ESMTPSA id A724134D844; Fri, 6 Dec 2019 14:46:05 +0000 (UTC) From: Ulrich Mueller To: =?utf-8?B?TWljaGHFgiBHw7Nybnk=?= Cc: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] [PATCH] mount-boot.eclass: Check if /boot is sane, but don't try to mount it. References: Date: Fri, 06 Dec 2019 15:45:57 +0100 In-Reply-To: (=?utf-8?Q?=22Micha=C5=82_G=C3=B3rny=22's?= message of "Fri, 06 Dec 2019 15:03:42 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) 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 X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Archives-Salt: 6b24df2c-2ae6-4df3-8ba5-af87f1beeeb1 X-Archives-Hash: 835c41a079b98245edf17ffa15e47a33 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >>>>> On Fri, 06 Dec 2019, Micha=C5=82 G=C3=B3rny wrote: >> reaching pkg_pretend() at all. Furthermore, with the "mount-sandbox" > Did you mean: pkg_preinst? Of course. >> - if [[ "${ROOT:-/}" !=3D "/" ]] ; then >> + if [[ ${ROOT:-/} !=3D "/" ]] ; then > I suppose you can unquote RHS too since it doesn't contain any pattern > characters, if you are already touching quoting. Quotes dropped (globally). >> +# Check if /boot is sane, i.e., mounted read/write if on a separate >> +# partition. Return 0 if conditions are fulfilled, otherwise die. > I don't think there's a point in explicitly defining the return value > if there is no alternative. Fixed. >> + local fstabstate=3D$(awk '!/^[[:blank:]]*#|^\/dev\/BOOT/ && $2 =3D=3D = "/boot" \ >> + {print $2}' /etc/fstab) > The 'print' here is used as a boolean... why not use a boolean output > instead? Changed, it's printing a 1 now. >> + local procstate=3D$(awk '$2 =3D=3D "/boot" \ >> + {print gensub(/^(.*,)?(ro|rw)(,.*)?$/, "\\2", 1, $4)}' /proc/mounts) > Shouldn't this use /proc/self/mounts? I haven't actually changed this, it was /proc/mounts before (which is a symlink to self/mounts). Maybe we should keep it as-is for backwards compatibility? (But TBH, I have no idea with which kernel version /proc/self/mounts appeared.) >> + mount-boot_check_status >> + if ! ( shopt -s failglob; : "${ROOT}"/boot/.keep* ) 2>/dev/null ; then > EROOT? Hm, we mount /boot, not ${EROOT}/boot. I've added an additional test for [[ ${EROOT:-/} =3D=3D / ]] before touching the file. Patch v2 will follow. Ulrich --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEZlHkP3TnuTbxrN0HwwkGhRxhwnMFAl3qaaUACgkQwwkGhRxh wnPwrgf9G00WVNYxQPZX0aD1FIYPlfjX+3e1knafELUmSgX+KuiptHe2fAMYgb4F Atx701LNakpECDvZY9aYIvRorrOnJtPrUX0ZESYhx/giUwoLgcwfQ7CCkQKu03ZO nhFy9AH9m+AtyymC06BkpopoiVD1/M7GM3xsMS4iKqUL6DMcM0i/iY9tqYFO0yME I/UfD6LsgwAGK9wRsXK9WiQfWOV6CXo742ZOLVxL67nYhpgpcVM+fmUgT0EadgAb wFSLgUTc3fwywu4iVPTb13t8O6QzWiIiK774JJwllaLupi0Vu/oX/TFX1/moy04/ tRdz6JrB72y72J+mTYQ60VWD/X/u1g== =Y/zZ -----END PGP SIGNATURE----- --=-=-=--