On Sun, 18 Sep 2022 16:15:28 +0200 Helmut Grohne <hel...@subdivi.de> wrote:
[usrmerge on overlayfs]
> 
> I recommend turning the check around. First actually attempt to perform
> the conversion. If that happens to fails, check for overlayfs and
> conditionally emit the helpful message. That way, conversion actually is
> performed when it can be performed. When it cannot be performed, we
> cannot do anything about it anyway.

What fails in the rename in `convert_directory`; see section "renaming
directories" in linux' Documentation/filesystems/overlayfs.rst. That
happens after some conversion steps are already performed. So I don't
think we should drop the check entirely.

As a compromise one could:

a) Require an environment variable to be set to disable the check.

b) If overlayfs is detected, try calling rename in the check, e.g.,
   perl -e '
       rename("/sbin", "/sbin~usrmerge~");
       rename("/sbin~usrmerge~", "/sbin");
   '
   Plus some error handling for:
   - overlayfs specific problem when this fails with EXDEV
     (i.e., what the check is supposed to catch)
   - any other reason this fails.

   Maybe also use some other directory instead of /sbin, but
   it has to exist on the underlaying filesystem, not the overlay to
   catch the problem we want to catch.

Ansgar

Reply via email to