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
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Configuration (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
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: ---


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/ to /etc/config-archive/etc/init.d/ [Errno 17] File exists: '/etc/config-archive/etc/init.d/'; fatal

sabre ~ # ls -l /etc/config-archive/etc/init.d/  
lrwxrwxrwx 1 root root 25 Jan  6 22:09 /etc/config-archive/etc/init.d/ -> /lib64/rc/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:

I've posted it for review here:
Comment 5 Zac Medico gentoo-dev 2015-01-12 09:15:46 UTC
This is in the master branch now:
Comment 6 Brian Dolbec gentoo-dev 2015-02-12 06:12:21 UTC
Released in portage-2.2.16