Bug 971474

Summary: mock: --copyout fails on directory trees with broken symlinks
Product: [Fedora] Fedora Reporter: Florian Weimer <fweimer>
Component: mockAssignee: Miroslav Suchý <msuchy>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: mebrown, msuchy, williams
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: mock-1.2.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-12 21:18:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Florian Weimer 2013-06-06 15:32:25 UTC
I get this error when calling mock --copyout:

INFO: copying /var/lib/mock/fedora-19-x86_64/root/builddir/build/BUILD to agg-2.5-16.fc19
ERROR: [('/var/lib/mock/fedora-19-x86_64/root/builddir/build/BUILD/agg-2.5/config.guess', 'agg-2.5-16.fc19/agg-2.5/config.guess', "[Errno 2] No such file or directory: '/var/lib/mock/fedora-19-x86_64/root/builddir/build/BUILD/agg-2.5/config.guess'"), ('/var/lib/mock/fedora-19-x86_64/root/builddir/build/BUILD/agg-2.5/install-sh', 'agg-2.5-16.fc19/agg-2.5/install-sh', "[Errno 2] No such file or directory: '/var/lib/mock/fedora-19-x86_64/root/builddir/build/BUILD/agg-2.5/install-sh'"), ('/var/lib/mock/fedora-19-x86_64/root/builddir/build/BUILD/agg-2.5/missing', 'agg-2.5-16.fc19/agg-2.5/missing', "[Errno 2] No such file or directory: '/var/lib/mock/fedora-19-x86_64/root/builddir/build/BUILD/agg-2.5/missing'"), ('/var/lib/mock/fedora-19-x86_64/root/builddir/build/BUILD/agg-2.5/config.sub', 'agg-2.5-16.fc19/agg-2.5/config.sub', "[Errno 2] No such file or directory: '/var/lib/mock/fedora-19-x86_64/root/builddir/build/BUILD/agg-2.5/config.sub'")]
Traceback (most recent call last):
  File "/usr/sbin/mock", line 561, in <module>
    def do_buildsrpm(config_opts, chroot, options, args):
  File "/usr/sbin/mock", line 925, in main
    shutil.copytree(src, dest)
  File "/usr/lib64/python2.7/shutil.py", line 206, in copytree
    raise Error, errors
Error: [('/var/lib/mock/fedora-19-x86_64/root/builddir/build/BUILD/agg-2.5/config.guess', 'agg-2.5-16.fc19/agg-2.5/config.guess', "[Errno 2] No such file or directory: '/var/lib/mock/fedora-19-x86_64/root/builddir/build/BUILD/agg-2.5/config.guess'"), ('/var/lib/mock/fedora-19-x86_64/root/builddir/build/BUILD/agg-2.5/install-sh', 'agg-2.5-16.fc19/agg-2.5/install-sh', "[Errno 2] No such file or directory: '/var/lib/mock/fedora-19-x86_64/root/builddir/build/BUILD/agg-2.5/install-sh'"), ('/var/lib/mock/fedora-19-x86_64/root/builddir/build/BUILD/agg-2.5/missing', 'agg-2.5-16.fc19/agg-2.5/missing', "[Errno 2] No such file or directory: '/var/lib/mock/fedora-19-x86_64/root/builddir/build/BUILD/agg-2.5/missing'"), ('/var/lib/mock/fedora-19-x86_64/root/builddir/build/BUILD/agg-2.5/config.sub', 'agg-2.5-16.fc19/agg-2.5/config.sub', "[Errno 2] No such file or directory: '/var/lib/mock/fedora-19-x86_64/root/builddir/build/BUILD/agg-2.5/config.sub'")]

Some of the offending symbolic links look like this:

lrwxrwxrwx. 1 root root 37 Jun  6 17:23 /var/lib/mock/fedora-19-x86_64/root/builddir/build/BUILD/agg-2.5/config.guess -> /usr/share/automake-1.13/config.guess
lrwxrwxrwx. 1 root root 35 Jun  6 17:23 /var/lib/mock/fedora-19-x86_64/root/builddir/build/BUILD/agg-2.5/config.sub -> /usr/share/automake-1.13/config.sub

I think mock --copyout should not try to resolve symlinks, or at least be more clever about it (e.g., resolve them inside the chroot).

This is with mock-1.1.32-1.fc18.

Comment 1 Fedora End Of Life 2013-12-21 13:53:44 UTC
This message is a reminder that Fedora 18 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 18. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '18'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 18's end of life.

Thank you for reporting this issue and we are sorry that we may not be 
able to fix it before Fedora 18 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior to Fedora 18's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 2 Florian Weimer 2013-12-23 16:52:44 UTC
Still present in Fedora 19 AFACIT.

Comment 3 Miroslav Suchý 2014-10-01 20:18:57 UTC
Fixed in msuchy-work branch in commit 8b435e4.

Not this address only copyout.
Copyin does not have too much sense as it would require validaiton of symlinks and can be easily overengineered.

Comment 4 Miroslav Suchý 2014-10-12 21:18:22 UTC
Fixed in mock-1.2.0, which just landed in rawhide.