Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 535850

Summary: dispatch-conf: 'file exists' on symlinks
Product: Portage Development Reporter: Piotr Karbowski (RETIRED) <slashbeast>
Component: Core - ConfigurationAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal Keywords: InVCS
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 484436    

Description Piotr Karbowski (RETIRED) gentoo-dev 2015-01-06 22:16:28 UTC
It seems that dispatch-conf have some issues handling symlinks.

The error is reproducable, just put -config-protect-if-modified and rebuild openrc, then run dispatch-conf.

sabre ~ # dispatch-conf 
dispatch-conf: Error copying /etc/init.d/functions.sh to /etc/config-archive/etc/init.d/functions.sh: [Errno 17] File exists: '/etc/config-archive/etc/init.d/functions.sh'; fatal

sabre ~ # ls -l /etc/config-archive/etc/init.d/functions.sh  
lrwxrwxrwx 1 root root 25 Jan  6 22:09 /etc/config-archive/etc/init.d/functions.sh -> /lib64/rc/sh/functions.sh



Reproducible: Always
Comment 1 Zac Medico gentoo-dev 2015-01-10 17:38:37 UTC
What version of sys-apps/portage do you have?
Comment 2 Piotr Karbowski (RETIRED) gentoo-dev 2015-01-10 17:39:38 UTC
That would be sys-apps/portage-2.2.15.
Comment 3 Zac Medico gentoo-dev 2015-01-10 22:26:00 UTC
When I added symlink support for bug 485598, I didn't account for the fact that os.symlink fails if the destination file exists. For regular files, it uses shutil.copy2, which can also fail if the destination is a symlink. So, we should have it first remove the destination file regardless of the file type.
Comment 4 Zac Medico gentoo-dev 2015-01-11 08:53:45 UTC
I have a patch in the following branch:

	https://github.com/zmedico/portage/tree/bug_535850

I've posted it for review here:

	http://thread.gmane.org/gmane.linux.gentoo.portage.devel/5064
Comment 5 Zac Medico gentoo-dev 2015-01-12 09:15:46 UTC
This is in the master branch now:

https://github.com/gentoo/portage/commit/79eb7417454220f04def35e428b876b97fdaabf4
Comment 6 Brian Dolbec (RETIRED) gentoo-dev 2015-02-12 06:12:21 UTC
Released in portage-2.2.16