Bug 12551 - dpkg remove (and update) destroys symlinks to directories
Summary: dpkg remove (and update) destroys symlinks to directories
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.33.x
Hardware: All Linux
: P5 major
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-11 10:07 UTC by nolange79
Modified: 2020-06-29 12:07 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nolange79 2020-02-11 10:07:41 UTC
the target installation has a symlink lib -> usr/lib.
The deb archive contains a file './lib/systemd/system/a.service'

When removing (update does remove the old packet as well), dpkg will do the following:

lstat("/.", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
rmdir("/.")                             = -1 EINVAL (Invalid argument)
lstat("/lib", {st_mode=S_IFLNK|0777, st_size=7, ...}) = 0
unlink("/lib")                          = 0
lstat("/lib/systemd", 0x7ffe2f87b8d0)   = -1 ENOENT (No such file or directory)
lstat("/lib/systemd/system", 0x7ffe2f87b8d0) = -1 ENOENT (No such file or directory)

That leads two 2 problems:

1.  the /lib symlink is now gone, rendering the system unusable.
2.  cleanup is done bottom up, means in this case it fails to remove everything else.
Comment 1 Denys Vlasenko 2020-06-29 12:07:06 UTC
Fixed in git.