Package: wicd
Version: 1.7.2.4-4.1
Severity: wishlist
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu trusty ubuntu-patch

Dear Maintainer,

Wicd fails to start if /etc/resolv.conf is a broken sysmlink

Traceback (most recent call last):
  File "/usr/share/wicd/daemon/wicd-daemon.py", line 1859, in <module>
    main(sys.argv)
  File "/usr/share/wicd/daemon/wicd-daemon.py", line 1708, in main
    os.symlink(dest, backup_location)
OSError: [Errno 17] File exists

When wicd-daemon.py checks if it has backed this file up, it uses
"os.path.exists" on the backup location. os.path.exists returns False
for broken symlinks. The location "../run/resolvconf/resolv.conf" (for
Ubuntu) does not exist relative to the backup location.  Thus
wicd-daemon.py assumes there is nothing there and tries to write to it,
when in fact there is a (correctly backed up, but broken) symlink there.

Even when Debian doesn't ship a broken symlink on
/etc/resolv.conf_backup you may be affected if it happens in the future.

The attached patch could be integrated to:

http://anonscm.debian.org/gitweb/?p=collab-maint/wicd.git;a=blob;f=debian/patches/04-fix_resolv.conf_backup-restore.patch;h=25903d6cfdeee3dced21608c451272dfcfb65ce6;hb=HEAD

Which is related

*** /tmp/tmpzaB8yn/bug_body
In Ubuntu, the attached patch was applied to achieve the following:

## fix /etc/resolv.conf resolution when it's a relative sysmlink

  * debian/patches/34-fix-resolv.conf_backup-restore-broken-link.patch:
    allow wicd-daemon to start when /etc/resolv.conf is a broken link
    (LP: #1132529)

Thanks for considering the patch.


-- System Information:
Debian Release: wheezy/sid
  APT prefers precise-updates
  APT policy: (500, 'precise-updates'), (500, 'precise-security'), (500, 
'precise'), (100, 'precise-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 3.12.1-ck1-ck (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
=== modified file 'debian/changelog'

=== modified file 'debian/control'

=== added file 'debian/patches/34-fix-resolv.conf_backup-restore-broken-link.patch'
--- debian/patches/34-fix-resolv.conf_backup-restore-broken-link.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/34-fix-resolv.conf_backup-restore-broken-link.patch	2013-12-20 21:15:22 +0000
@@ -0,0 +1,15 @@
+## Description: fix /etc/resolv.conf resolution when it's a relative sysmlink
+## Forwarded: yes https://code.launchpad.net/~chilicuil/ubuntu/trusty/wicd/fix-1132529/+merge/197998
+## Bug: https://bugs.launchpad.net/wicd/+bug/1193856
+## Author: Tommy (mesilliac)
+--- a/wicd/wicd-daemon.py
++++ b/wicd/wicd-daemon.py
+@@ -1702,7 +1702,7 @@ def main(argv):
+         backup_location = wpath.varlib + 'resolv.conf.orig'
+         # don't back up if .orig exists, probably there cause
+         # wicd exploded
+-        if not os.path.exists(backup_location):
++        if not os.path.exists(backup_location) and not os.path.islink(backup_location):
+             if os.path.islink('/etc/resolv.conf'):
+                 dest = os.readlink('/etc/resolv.conf')
+                 os.symlink(dest, backup_location)

=== modified file 'debian/patches/series'
--- debian/patches/series	2013-06-07 18:42:23 +0000
+++ debian/patches/series	2013-12-20 21:15:22 +0000
@@ -5,3 +5,4 @@
 26-support_etc-network_scripts.patch
 32-prefer_gksu.patch
 33-focus_property.patch
+34-fix-resolv.conf_backup-restore-broken-link.patch

Reply via email to