Package: dpkg
Version: 1.18.4
Severity: normal

I am trying to checkout the --path-exclude option of dpkg in a test
chroot by first removing /usr/share/zoneinfo and then trying to
install the tzdata package. I have found the following issues:

root@fan:/# dpkg --install --path-exclude=/usr/share/zoneinfo 
/var/cache/apt/archives/tzdata_2015g-1_all.deb
(Reading database ... 9271 files and directories currently installed.)
Preparing to unpack .../tzdata_2015g-1_all.deb ...
Unpacking tzdata (2015g-1) over (2015g-1) ...
dpkg: error processing archive /var/cache/apt/archives/tzdata_2015g-1_all.deb 
(--install):
 unable to create '/usr/share/zoneinfo/leap-seconds.list.dpkg-new' (while 
processing './usr/share/zoneinfo/leap-seconds.list'): No such file or directory
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/tzdata_2015g-1_all.deb
root@fan:/#

In this case, dpkg should not try to unpack leap-seconds.list since it
is in the excluded directory.

root@fan:/# dpkg --install --path-exclude=/usr/share/zoneinfo/* 
/var/cache/apt/archives/tzdata_2015g-1_all.deb
(Reading database ... 9271 files and directories currently installed.)
Preparing to unpack .../tzdata_2015g-1_all.deb ...
Unpacking tzdata (2015g-1) over (2015g-1) ...
dpkg: error processing archive /var/cache/apt/archives/tzdata_2015g-1_all.deb 
(--install):
 error creating directory './usr/share/zoneinfo/right/Etc': No such file or 
directory
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/tzdata_2015g-1_all.deb
root@fan:/#

In this case, dpkg should not try to create the
/usr/share/zoneinfo/right/Etc directory since it is in the excluded
path.

A third case needed a removed and excluded /usr/share/man:

root@fan:/# dpkg --install --path-exclude=/usr/share/man/man1/sh.1.gz 
var/cache/apt/archives/dash_0.5.7-4+b1_amd64.deb
(Reading database ... 6927 files and directories currently installed.)
Preparing to unpack .../dash_0.5.7-4+b1_amd64.deb ...
ln: failed to create symbolic link '/usr/share/man/man1/sh.1.gz.tmp': No such 
file or directory
dpkg: error processing archive var/cache/apt/archives/dash_0.5.7-4+b1_amd64.deb 
(--install):
 subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
 var/cache/apt/archives/dash_0.5.7-4+b1_amd64.deb
root@fan:/#

The error message is the same regardless whether the excluded path is
/usr/share/man/man1/*, /usr/share/man/*/*,
/usr/share/man/* or /usr/share/man. In this case, dpkg should honor
excluded paths even for symlinks.

In any case, dpkg probably should not error out but try to create the
parent directories first. In the case of --path-exclude, dpkg should
handle excluded directories recursively, e.g. not try to create
/usr/share/zoneinfo/right/Etc if the excluded path is
/usr/share/zoneinfo/*.

Greetings
Marc

Reply via email to