Hi! On Sun, 2016-01-17 at 18:37:50 +0100, Marc Haber wrote: > 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: > > > 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?
Because these filters have side effects in contrast to find filters for example, and they are used on "streamed data". In dpkg, the filters have no knowledge of what type of objects they are filtering, so you specify a pathname that might be a directory or a file or a symlink, etc. And once the file is being unpacked, it only knows about the current pathname, and not if subsequent entries will also need this one or not. At that point dpkg has to decide if it unpacks the pathname or not, w/o further visibility. Making dpkg aware of futher objects would imply that it needs to do a two-pass over the .deb package to know the full contents of it, instead of unpacking on the fly. > 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. Yes, it should, and that's what's supposed to happen. Here's a session on my system: ,--- # rm -rf /usr/share/zoneinfo # ls -la /usr/share/zoneinfo ls: cannot access /usr/share/zoneinfo: No such file or directory # dpkg --path-exclude='/usr/share/zoneinfo' --path-exclude='/usr/share/zoneinfo/*' --install tzdata_2015g-1_all.deb (Reading database ... 264026 files and directories currently installed.) Preparing to unpack tzdata_2015g-1_all.deb ... Unpacking tzdata (2015g-1) over (2015g-1) ... Setting up tzdata (2015g-1) ... User defined time zone, leaving /etc/localtime unchanged. Local time is now: Mon Jan 18 02:56:22 CET 2016. Universal Time is now: Mon Jan 18 01:56:22 UTC 2016. Run 'dpkg-reconfigure tzdata' if you wish to change it. # ls -la /usr/share/zoneinfols: cannot access /usr/share/zoneinfo: No such file or directory # `--- So there's something else going on here. Could you run the above but by passing «-D333» to dpkg, and send the log? > 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. Sure, and the current glob makes ‘*’ match on any character, so the above should not be necessary. > 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. My comment on the semantics was about making «/foo/bar» exclude any files beneath that pathname, not on the ‘*’ glob semantics, which I think are already sane. > > I can probably add a note about this kind of situations in the man > > page. > > IMO, no need for that. My bad. I think still some things can be clarified, to avoid further confusion. :) Thanks, Guillem