Re: git: b6e33f0cd536 - main - rc.d/mountcritlocal: Make sure zpools are imported for legacy ZFS

From: Cy Schubert <Cy.Schubert_at_cschubert.com>
Date: Tue, 17 Jun 2025 14:17:09 UTC
In message <aFFXogrkD32X6WVr@freefall.freebsd.org>, Lexi Winter writes:
> Cy Schubert:
> > In message <240137891.21754.1749997280448@localhost>, Ronald Klop writes:
> [...]
> > > > +       if [ "$vfstype" =3D "zfs" -a "$a" !=3D "#" ]; then
> > >
> > > Does this mean that a comment # must always be folllowed by a whitespac=
> e?
>
> > Yes. It's a hack but it's the only way without grep (when /usr may not be=
> =20
> > mounted). In the very worst case rc.d/zpool will be needlessly executed.
>
> could you not check for a comment using the # variable expansion operator?
> i.e. if [ "${a#\#}" !=3D "$a" ] then the variable starts with a # character:
>
> $ echo $line1
> #Foo bar
> $ echo $line2
> Foo bar
> $ echo $line3
> Foo # bar
> $ [ "${line1#\#}" =3D "$line1" ] || echo comment
> comment
> $ [ "${line2#\#}" =3D "$line2" ] || echo comment
> $ [ "${line3#\#}" =3D "$line3" ] || echo comment
> $

Looks like this works!

I learn something new every day. Thank you.

I will do a couple of reboots with it before committing your recommended 
fix.

Thanks.


-- 
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  https://FreeBSD.org
NTP:           <cy@nwtime.org>    Web:  https://nwtime.org

			e**(i*pi)+1=0