Ticket #171 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

Uninstall activities that use symlinks

Reported by: erikos Owned by: erikos
Priority: major Milestone:
Component: sugar Version: Git as of bugdate
Severity: Keywords: r+
Cc: tomeu Distribution/OS:
Bug Status:

Description

This is a follow up on #95. The activity bundle  http://dev.laptop.org/~bemasc/ACBLSCOR-1.xo contains symlinks that point to a directory and are therefore returned by os.walk as directories. As the directories are removed in any case we must remove the symlink.


diff --git a/src/sugar/bundle/bundle.py b/src/sugar/bundle/bundle.py
index ed0360d..a1b2686 100644
--- a/src/sugar/bundle/bundle.py
+++ b/src/sugar/bundle/bundle.py
@@ -191,5 +191,9 @@ class Bundle(object):
             for name in files:
                 os.remove(os.path.join(root, name))
             for name in dirs:
-                os.rmdir(os.path.join(root, name))
+                path = os.path.join(root, name)
+                if os.path.islink(path):
+                    os.remove(path)
+                else:
+                    os.rmdir(path)
         os.rmdir(install_path)

Change History

Changed 4 years ago by erikos

  • cc tomeu added

Changed 4 years ago by erikos

  • owner changed from marcopg to erikos
  • status changed from new to assigned

Changed 4 years ago by tomeu

  • keywords r+ added; r? removed

Sounds good to me.

Changed 4 years ago by erikos

  • status changed from assigned to closed
  • resolution set to fixed

Thanks for the review - pushed to git sugar-toolkit

Note: See TracTickets for help on using tickets.