public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Ulrich Mueller <ulm@gentoo.org>
To: "Michał Górny" <mgorny@gentoo.org>
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.
Date: Fri, 06 Dec 2019 15:45:57 +0100	[thread overview]
Message-ID: <w6g4kyd5x7e.fsf@kph.uni-mainz.de> (raw)
In-Reply-To: <f519f9d2926045b498642fc2ba7fa77f18a34991.camel@gentoo.org> ("Michał Górny"'s message of "Fri, 06 Dec 2019 15:03:42 +0100")

[-- Attachment #1: Type: text/plain, Size: 1601 bytes --]

>>>>> On Fri, 06 Dec 2019, Michał Górny wrote:

>> reaching pkg_pretend() at all. Furthermore, with the "mount-sandbox"

> Did you mean: pkg_preinst?

Of course.

>> -	if [[ "${ROOT:-/}" != "/" ]] ; then
>> +	if [[ ${ROOT:-/} != "/" ]] ; 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=$(awk '!/^[[:blank:]]*#|^\/dev\/BOOT/ && $2 == "/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=$(awk '$2 == "/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:-/} == / ]] before touching the file.

Patch v2 will follow.

Ulrich

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

  reply	other threads:[~2019-12-06 14:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-06 13:11 [gentoo-dev] [PATCH] mount-boot.eclass: Check if /boot is sane, but don't try to mount it Ulrich Müller
2019-12-06 14:03 ` Michał Górny
2019-12-06 14:45   ` Ulrich Mueller [this message]
2019-12-06 15:04     ` Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=w6g4kyd5x7e.fsf@kph.uni-mainz.de \
    --to=ulm@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=mgorny@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox