Description of problem: mock doesn't create /etc/hosts because the following code that would build the path to /etc/hosts and write it inside the chroot-ed environment for key in filedict: p = os.path.join(self.rootdir, key) if not os.path.exists(p): # write file refers to /etc/hosts from the host environment, not to /etc/hosts from the chroot-ed environment. I learned that os.path.join ignores the arguments that appear before absolute paths. In this case 'key' contains the value '/etc/hosts', so self.rootdir is ignored and the path returned is /etc/hosts. Version-Release number of selected component (if applicable): mock-0.7.4-1.fc7 How reproducible: Always Steps to Reproduce: 1. mock -r fedora-7-i386 init Actual results: $ ls -l /var/lib/mock/fedora-7-i386/root/etc/hosts ls: cannot access /var/lib/mock/fedora-7-i386/root/etc/hosts: No such file or directory Expected results: $ ls -l /var/lib/mock/fedora-7-i386/root/etc/hosts -rw-rw-r-- 1 rpmb mock 49 2007-08-21 03:05 /var/lib/mock/fedora-7-i386/root/etc/hosts Additional info: A workaround is to use config_opts['files']['etc/hosts'], but even mock uses '/etc/hosts' when it sets the default. Although I don't know Python, I found that the code be changed to work in both cases, when either '/etc/hosts' or 'etc/hosts' is used.
Created attachment 161936 [details] make mock create /etc/hosts or other files that use an absolute path
Thanks for the bug report. Fix pushed to main git repo. What does this affect. Need to know if this breaks any builds and if I need to schedule a new release for fedora soon.
Some packages that need to use 'localhost' or 'localhost.localdomain' during build will not be built if the nameserver specified in /etc/resolv.conf is not available or is not configured to serve the 'localhost' zone. I've seen this problem in the past with some perl packages, but currently I cannot remember their name.