Hi,

On Sun, Jan 17, 2016 at 05:27:06PM +0100, Guillem Jover wrote:
> On Sun, 2016-01-17 at 13:10:42 +0100, Marc Haber wrote:
> > 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:
> 
> Ok, let's see. :)

Thanks for considering that fast.

> > 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.
> 
> Actually, in this case given how the filters work, ideally, the exclusion
> should be ignored. What you actually requested was:
> 
>   exclude /usr/share/zoneinfo
>   include /usr/share/zoneinfo/*

Why?

However, excluding both leads to the second problem:

root@fan:/# dpkg --install --path-exclude='/usr/share/zoneinfo' 
--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:/#

dpkg should not try to unpack files in a directory that was excluded.

I don't think that it would be helpful to exclude
/usr/share/zoneinfo/*/* and /usr/share/zoneinfo/*/*/* as well, since
one never knows whether in the future, the directory tree will grow
another level.

If you absolutely want to keep the current semantics and don't agree
that this is a bug, I'd like to suggest a rsync-like syntax like
--path-exclude=/usr/share/zoneinfo/** to specify a recursive exclude.

> > 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.
> 
> This works for me, and I cannot reproduce.

See above, same with quoted path.

>  Did you happen to try that with a (partially-)populated
>  /usr/share/zoneinfo/? Try instead quoting the argument like
>  «--path-exclude='/usr/share/zoneinfo/*'» to avoid the shell expanding
>  the glob.

Ouch, idiot me, but that was not the issue since my
/usr/share/zoneinfo didn't even exist.

> > 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.
> 
> That's not dpkg's fault, that's the maintainer script not coping with
> an excluded path. If this needs to be fixed it is in dash itself:
> 
>   $ dpkg-query --control-show dash preinst

Yes, you're right. I was confused since the package actually contains
the symlink as well par its debian/rules and didn't search and further.

> I can probably add a note about this kind of situations in the man
> page.

IMO, no need for that. My bad.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany    |  lose things."    Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature |  How to make an American Quilt | Fax: *49 6224 1600421

Reply via email to