Bug 1670211 - supermin fails inside docker: Invalid cross-device link
Summary: supermin fails inside docker: Invalid cross-device link
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: supermin
Version: 8.1
Hardware: x86_64
OS: Mac OS
unspecified
medium
Target Milestone: rc
: 8.0
Assignee: Libvirt Maintainers
QA Contact: YongkuiGuo
URL:
Whiteboard:
Depends On: 1670191
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-01-28 22:46 UTC by Richard W.M. Jones
Modified: 2020-11-14 07:55 UTC (History)
7 users (show)

Fixed In Version: supermin-5.1.19-10.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1670191
Environment:
Last Closed: 2019-11-06 07:12:49 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:3723 0 None None None 2019-11-06 07:13:21 UTC

Description Richard W.M. Jones 2019-01-28 22:46:46 UTC
+++ This bug was initially created as a clone of Bug #1670191 +++

Description of problem:

Libguestfs "make" fails with when building inside a docker with

"supermin: error: rename: Directory not empty: supermin.d.ibactpan"

Version-Release number of selected component (if applicable):
libguestfs-1.38.6
supermin-5.1.20

How reproducible:

Happens 100% on my MacOS setup
Happens 10% on my Ubuntu setup


Steps to Reproduce:
1. MacOS High Sierra
2. Docker version 18.09.0, build 4d60db4

Actual results:
"supermin: error: rename: Directory not empty: supermin.d.ibactpan"

Expected results:
Build succeeds

Additional info:

After debugging supermin (building it from source and changing some lines) the actual problem is not here:

  if debug >= 1 then
    printf "supermin: renaming %s to %s\n%!" new_outputdir outputdir;
  rename new_outputdir outputdir;

But actually in the previous rename:

  let old_outputdir =
    try
      let old_outputdir = outputdir ^ "." ^ string_random8 () in
      rename outputdir old_outputdir;
      Some old_outputdir
    with
      Unix_error _ -> None in

It fails with Unix_error: supermin: error: rename: Invalid cross-device link: supermin.d

But it is not propagated.

According to docker with OverlayFS: https://docs.docker.com/storage/storagedriver/overlayfs-driver/

Renaming directories: Calling rename(2) for a directory is allowed only when both the source and the destination path are on the top layer. Otherwise, it returns EXDEV error (“cross-device link not permitted”). Your application needs to be designed to handle EXDEV and fall back to a “copy and unlink” strategy.

Should we handle this to support building libguestfs inside a docker?

--- Additional comment from Richard W.M. Jones on 2019-01-28 22:23 UTC ---

Yes we should handle EXDEV as it suggests.  Could you see if
the attached patch fixes it?  I only compile tested it, and
I'm just guessing that 'mv' works on Docker.

--- Additional comment from Sam on 2019-01-28 22:35:38 UTC ---

That was fast.

Yes, it works perfectly!

--- Additional comment from Richard W.M. Jones on 2019-01-28 22:44:13 UTC ---

Thanks for testing, it's upstream in git now and will appear in supermin >= 5.1.21.

Comment 5 YongkuiGuo 2019-08-29 10:35:21 UTC
The patch has been tested in upstream Bug #1670191. It works fine. Because this issue cannot be reproduced in RHEL product and there is no MAC env from QE side, we just run the sanity testing.

Comment 7 errata-xmlrpc 2019-11-06 07:12:49 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:3723


Note You need to log in before you can comment on or make changes to this bug.