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

Ulrich Müller <[email protected]> Thu, 18 Jun 2026 18:03:40 +0200
Newsgroups gmane.linux.gentoo.devel
Message-ID <[email protected]>
>>>>> 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?

- 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.

> 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
signature.asc (application/pgp-signature, 544 B)
-----BEGIN PGP SIGNATURE-----

iQFfBAEBCABJFiEEtDnZ1O9xIP68rzDbUYgzUIhBXi4FAmo0Ft0bFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyDxx1bG1AZ2VudG9vLm9yZwAKCRBRiDNQiEFeLt6p
CACQrIrMQpUswV0erh6Cxea9eoHPs1tBKmuvOV4nAnp1BGFEMsXMCa6wLZcYiajw
6xcvYqmk9xDU8bYjgUlhEevw/jfy4z/313gXXu1A+NsO809OcMReCF7IMHyVZykC
NIe0y7nXX1KKyLNoRz+wAyV6AmHB5GKM4T+sumJzSJa2nEtPzk3HNdd8EEbMMK4i
sZNTazqbwNudBJqMGalzipyCq5oKMOGdExC/bgEu041p3wUSzRsi5FV+q1DWLpyc
Exvg54URhtEY6UbEnXoVgxVQP73FcSwA6JaBsbLi4mywytEfqmXk9PDv0OyY87vZ
4tlrrSvBMFrirGDDyNYUXxOS
=qrrN
-----END PGP SIGNATURE-----