Re: [PATCH] mount-boot.eclass: do not create /boot/.keep in pkg_prerm

Ionen Wolkens <[email protected]> Thu, 18 Jun 2026 12:41:11 -0400
Newsgroups gmane.linux.gentoo.devel
Message-ID <ajQfp0Z_OQWxmOXH@eversor>
On Thu, Jun 18, 2026 at 12:32:26PM -0400, Ionen Wolkens wrote:
> On Thu, Jun 18, 2026 at 06:03:40PM +0200, Ulrich Müller wrote:
> > >>>>> On Thu, 18 Jun 2026, Mike Gilbert wrote:
> > 
> > >> > +     if [[ -n ${BOOT_EXISTS} && ! -d ${EROOT}/boot ]]; then
> > >> > +             # Recreate /boot in case it got un-merged
> > >> > +             mkdir "${EROOT}"/boot
> > >> >       fi
> > >> 
> > >> That looks like a horrible hack.
> > 
> > > What's so horrible about it? It accomplishes the same goal without
> > > leaving an orphaned file behind. If it will cause problems, please
> > > elaborate.
> > 
> > Sorry, probably I am missing something here. What is the exact scenario
> > where an unmerge can remove the /boot directory, so that it must be
> > recreated?
> 
> Now that you mention it, do we have anything that installs *tracked*
> files in /boot? As-in done in src_install rather than pkg_*

(not really a question, given if any packages did it'd be very broken
with the whole mount business)

> 
> I don't think portage would attempt to remove the directory it didn't
> remove any files from it. Not that a safeguard hurts, but it'll
> probably just be a no-op.
> 
> > 
> > - If /boot is on a separate FS, then the eclass will have made sure that
> >   it is mounted at this point, so rmdir won't succeed (and most likely
> >   the dir won't be empty anyway).
> > - If /boot a normal directory as part of the root FS, then it should
> >   contain a .keep* file owned by baselayout.
> 
> Also, baselayout does not install a .keep* for me? A fresh stage3 does
> not seem to have one either. In the past, vaguely recall the stage3
> did have orphaned .keep files (not made with keepdir) in many
> directories though, but these seem to be gone nowadays.
> 
> > 
> > > On the subject of "hacks":
> > > I would consider .keep files to be a "hack" to work around a design
> > > limitation in the package manager.
> > 
> > Yes, but it may be difficult to do anything about it. For example,
> > recording the "keepdir" property in package metadata would have the
> > problem that dirs can be shared between packages. But we should think
> > about this aspect if we ever try to solve bug 607430 (i.e. if we would
> > store permissions then maybe we could also store the keepdir info).
> > 
> > Ulrich
> 
> 
> 
> -- 
> ionen



-- 
ionen
signature.asc (application/pgp-signature, 525 B)
-----BEGIN PGP SIGNATURE-----

iQFPBAABCAA5FiEEx3SLh1HBoPy/yLVYskQGsLCsQzQFAmo0H6YbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyAAoJELJEBrCwrEM0IYQH/jwpZQ719ypnMT4NL0CF
kS3eNHKvY1SYJQdYlimSOX9YcwnbfZkUhnFuBtMiAJJjqxpGQmmRyhaQvS/sn62F
9Pjgp9hiiJryEYK6QBSXuXF2nlLqShZOcb14bJyN6Cn5jol+UrBoCM2g+inqRJnZ
SqwEnPJDqWAYsuHmCw6OCNadjEnG4IRsutx2JhdT2Xu66bo0YmuxCXhqap1scZ7A
uYNH7AAqz4jEPRJ1zpnraSsQCzTbjtpn4XYd1sDh88uFbblJLDri6OX7Sa8ynFM1
Cir7n3NzGMZQbOVjydZP/kpax+Q5xo3OM6+jKh1XRiVq6VjhS4ZJ2ch8xrXEg0YZ
7bY=
=PQz2
-----END PGP SIGNATURE-----