Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 535850 - dispatch-conf: 'file exists' on symlinks
Summary: dispatch-conf: 'file exists' on symlinks
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Configuration (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 484436
  Show dependency tree
 
Reported: 2015-01-06 22:16 UTC by Piotr Karbowski
Modified: 2015-02-12 06:12 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Karbowski archtester Gentoo Infrastructure gentoo-dev Security 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 archtester Gentoo Infrastructure gentoo-dev Security 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 gentoo-dev 2015-02-12 06:12:21 UTC
Released in portage-2.2.16