Looks like there exist design bug at epatch() in *.ebuild files. As far as I understand, epatch() try to find suitable value for -p param by trying --dry-run with -p0, -p1, etc. until success. In some cases this algorithm may fail. Here is example how this may happens in djbdns-1.05-r12. (`--dry-run -p0` will success because filename in patch use absolute pathname /etc/dnsroots.global, but `-p0` will fail (probably because user "portage" can't change /etc/dnsroots.global); but anyway this patch should be executed with `-p2` instead of `-p0`.) Reproducible: Always Steps to Reproduce: 1. Extract file dnsroots.global from /usr/portage/distfiles/djbdns-1.05.tar.gz and copy it into /etc/ directory (backup your current /etc/dnsroots.global first, if any). 2. emerge =net-dns/djbdns-1.05-r12 Actual Results: Calculating dependencies >>> Unpacking source... >>> Unpacking djbdns-1.05.tar.gz to /var/tmp/portage/djbdns-1.05-r12/work QA Notice: USE Flag 'ipv6arpa' not in IUSE for net-dns/djbdns-1.05-r12 * Applying 1.05-errno.patch ... [ ok ] * Applying headtail.patch ... [ ok ] * Applying dnsroots.patch ... * A dry-run of patch command succeeded, but actually * applying the patch failed! * Failed Patch: dnsroots.patch! * * Include in your bugreport the contents of: * * /var/tmp/portage/djbdns-1.05-r12/temp/dnsroots.patch-5352.out !!! ERROR: net-dns/djbdns-1.05-r12 failed. !!! Function epatch, Line 402, Exitcode 0 !!! Failed Patch: dnsroots.patch! !!! If you need support, post the topmost build error, NOT this status message. --------------------------- ACCESS VIOLATION SUMMARY +-------------------------- LOG FILE = "/tmp/sandbox-net-dns_-_djbdns-1.05-r12-5351.log" rename: /etc/dnsroots.global -------------------------------------------------------------------------------- ...done! Expected Results: * Applying dnsroots.patch ... [ ok ]
it's a bug in the ebuild, not epatch
So, your think it's okay to patch file in /etc/ using epatch()? How about sandbox for epatch()? I don't think ebuild-script should be able to patch any files outside /var/tmp/portage/PKG/work/ directory...
the patch is wrong because it refers to /etc/dnsroots.global instead of just 'dnsroots.gobal' or perhaps 'djbdns/dnsroots.global' it is NOT a bug in epatch
Even though I could not recreate the bug at first I found the bug based on another bug report. Closing. Please reopen if you continue to have problems.