Gentoo Archives: gentoo-dev

From: Ulrich Mueller <ulm@g.o>
To: "Michał Górny" <mgorny@g.o>
Cc: gentoo-dev@l.g.o
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 14:46:11
Message-Id: w6g4kyd5x7e.fsf@kph.uni-mainz.de
In Reply to: Re: [gentoo-dev] [PATCH] mount-boot.eclass: Check if /boot is sane, but don't try to mount it. by "Michał Górny"
1 >>>>> On Fri, 06 Dec 2019, Michał Górny wrote:
2
3 >> reaching pkg_pretend() at all. Furthermore, with the "mount-sandbox"
4
5 > Did you mean: pkg_preinst?
6
7 Of course.
8
9 >> - if [[ "${ROOT:-/}" != "/" ]] ; then
10 >> + if [[ ${ROOT:-/} != "/" ]] ; then
11
12 > I suppose you can unquote RHS too since it doesn't contain any pattern
13 > characters, if you are already touching quoting.
14
15 Quotes dropped (globally).
16
17 >> +# Check if /boot is sane, i.e., mounted read/write if on a separate
18 >> +# partition. Return 0 if conditions are fulfilled, otherwise die.
19
20 > I don't think there's a point in explicitly defining the return value
21 > if there is no alternative.
22
23 Fixed.
24
25 >> + local fstabstate=$(awk '!/^[[:blank:]]*#|^\/dev\/BOOT/ && $2 == "/boot" \
26 >> + {print $2}' /etc/fstab)
27
28 > The 'print' here is used as a boolean... why not use a boolean output
29 > instead?
30
31 Changed, it's printing a 1 now.
32
33 >> + local procstate=$(awk '$2 == "/boot" \
34 >> + {print gensub(/^(.*,)?(ro|rw)(,.*)?$/, "\\2", 1, $4)}' /proc/mounts)
35
36 > Shouldn't this use /proc/self/mounts?
37
38 I haven't actually changed this, it was /proc/mounts before (which is a
39 symlink to self/mounts). Maybe we should keep it as-is for backwards
40 compatibility? (But TBH, I have no idea with which kernel version
41 /proc/self/mounts appeared.)
42
43 >> + mount-boot_check_status
44 >> + if ! ( shopt -s failglob; : "${ROOT}"/boot/.keep* ) 2>/dev/null ; then
45
46 > EROOT?
47
48 Hm, we mount /boot, not ${EROOT}/boot. I've added an additional test for
49 [[ ${EROOT:-/} == / ]] before touching the file.
50
51 Patch v2 will follow.
52
53 Ulrich

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies