Control: block 728427 with -1

Hi Guillem,

On 2013-12-09 10:48, Guillem Jover wrote:
> On Mon, 2013-12-09 at 09:40:22 +0100, Guillem Jover wrote:
>> On Mon, 2013-12-09 at 07:03:41 +0100, Andreas Beckmann wrote:
...
>>> I think the following is happen during the installation of foo 2.0:
>>>
>>> * the preinst moves /usr/foo/ aside
verified
>>> * the package gets unpacked, creating /usr/foo -> foobar
verified
>>> * the obsolete files from foo 1.0 that are no longer in foo 2.0 get
>>>   deleted, this finds /usr/foo/foo.dat which exists, but is actually
>>>   /usr/foobar/foo.dat, but gets deleted anyway.
verified
>>
>> In theory that should be covered by the checks performed and the
>> installation aborted.

Why? The dir-to-become-a-symlink contained only things (non-conffiles)
owned by foo, so it should be a valid candidate for conversion.
What else would be a prerequisite for doing the conversion?

> Here's a functional test for the scenario above, but it does not
> trigger the issue you report, because it bails out before any
> problematic unpack. Please could you modify it to show what's the
> problem?
> 
> It's against <git://anonscm.debian.org/git/dpkg/pkg-tests.git>.

there are not any conffiles involved ... I first made them regular files,
but d-m-h fails anyway:

# dpkg -i -D133 pkg-dir-foo-1.deb > dpkg.debuglog 2>&1
# cat dpkg.debuglog
D000001: ensure_diversions: new, (re)loading
D000001: ensure_statoverrides: new, (re)loading
D000010: ensure_pathname_nonexisting '/var/lib/dpkg/tmp.ci'
D000001: process_archive oldversionstatus=installed
D000002: maintscript_fallback nonexistent prerm 
'/var/lib/dpkg/info/pkg-dir-foo.prerm'
D000002: fork/exec /var/lib/dpkg/tmp.ci/preinst ( upgrade 0 )
subcommand: line 6: return: can only `return' from a function or sourced script
subcommand: line 6: return: can only `return' from a function or sourced script
dpkg-maintscript-helper: error: directory '/test-path' contains files not owned 
by package pkg-dir-foo:all, cannot switch to symlink
dpkg: error processing archive pkg-dir-foo-1.deb (--install):
 subprocess new pre-installation script returned error exit status 1
D000001: ensure_diversions: same, skipping
D000002: fork/exec /var/lib/dpkg/tmp.ci/postrm ( abort-upgrade 0 )
D000001: ensure_diversions: same, skipping
D000002: vmaintscript_installed nonexistent postinst
D000010: ensure_pathname_nonexisting '/var/lib/dpkg/tmp.ci'
D000010: ensure_pathname_nonexisting running rm -rf '/var/lib/dpkg/tmp.ci'
D000010: ensure_pathname_nonexisting '/var/lib/dpkg/reassemble.deb'

# dpkg -S /test-path*/*
pkg-dir-foo: /test-path/file
pkg-dir-foobar: /test-pathdir/file

As I don't want to debug d-m-h (btw, is there some way to make it verbose?),
I'll "fix" the preinst to do

#!/bin/sh
set -e
#if dpkg-maintscript-helper supports dir_to_symlink; then
#    dpkg-maintscript-helper dir_to_symlink /test-path test-pathdir 0 -- "$@"
#fi
# WTH? dpkg-maintscript-helper: error: directory '/test-path' contains files 
not owned by package pkg-dir-foo:all, cannot switch to symlink
# do it manually ...
# the preinst checks if the directory exists, does not contain conffiles, 
pathnames owned by other packages, or locally created pathnames, if not then 
it's left in place, otherwise it's renamed to  pathname.dpkg-backup
if [ ! -h /test-path ] && [ -d /test-path ]; then
        mv /test-path /test-path.dpkg-backup
fi

Now installation succeeds, pasting only the start of the debug log:

D000001: ensure_diversions: new, (re)loading
D000001: ensure_statoverrides: new, (re)loading
D000010: ensure_pathname_nonexisting '/var/lib/dpkg/tmp.ci'
D000001: process_archive oldversionstatus=installed
D000002: maintscript_fallback nonexistent prerm 
'/var/lib/dpkg/info/pkg-dir-foo.prerm'
D000002: fork/exec /var/lib/dpkg/tmp.ci/preinst ( upgrade 0 )
D000001: ensure_diversions: same, skipping
D000010: tarobject ti->name='.' mode=40755 owner=10001:10001 type=53(d) 
ti->linkname='' namenode='/.' flags=2 instead='<none>'
D000100: setupvnamevbs main='/.' tmp='/..dpkg-tmp' new='/..dpkg-new'
D000100: tarobject already exists
D000100: tarobject directory exists
D000010: tarobject ti->name='./test-path' mode=120777 owner=10001:10001 
type=50(l) ti->linkname='test-pathdir' namenode='/test-path' flags=2 
instead='<none>'
D000100: setupvnamevbs main='/test-path' tmp='/test-path.dpkg-tmp' 
new='/test-path.dpkg-new'
D000100: tarobject nonexistent
D000010: ensure_pathname_nonexisting '/test-path.dpkg-new'
D000010: ensure_pathname_nonexisting '/test-path.dpkg-tmp'
D000100: tarobject symlink creating
D000100: tarobject new - no backup
D000100: tarobject done and installation deferred
D000010: deferred extract of '/.'
D000010: deferred extract of '/test-path'
D000100: setupvnamevbs main='/test-path' tmp='/test-path.dpkg-tmp' 
new='/test-path.dpkg-new'
D000100: deferred extract needs rename
D000100: deferred extract done and installed
D000002: maintscript_fallback nonexistent postrm 
'/var/lib/dpkg/info/pkg-dir-foo.postrm'
D000010: process_archive: checking //test-path/file for same files on 
upgrade/downgrade
D000010: removing obsolete /test-path/file   <== *** dpkg debug output added by 
me ***
D000001: process_archive updating info directory
D000002: process_archive info unlinked /var/lib/dpkg/info/pkg-dir-foo.md5sums
D000002: process_archive tmp.ci script/file '.' contains dot
D000002: process_archive tmp.ci script/file '..' contains dot
D000002: process_archive tmp.ci script/file '/var/lib/dpkg/tmp.ci/preinst' 
installed as '/var/lib/dpkg/info/pkg-dir-foo.preinst'
D000002: process_archive tmp.ci script/file '/var/lib/dpkg/tmp.ci/control' is 
control
D000002: process_archive tmp.ci script/file '/var/lib/dpkg/tmp.ci/postrm' 
installed as '/var/lib/dpkg/info/pkg-dir-foo.postrm'
D000002: process_archive tmp.ci script/file '/var/lib/dpkg/tmp.ci/postinst' 
installed as '/var/lib/dpkg/info/pkg-dir-foo.postinst'
D000001: generating infodb hashfile
[...]

# find /test-path* -ls
2281552798    0 lrwxrwxrwx   1 10001    10001          12 Dec  9 14:08 
/test-path -> test-pathdir
2273205674    0 drwxr-xr-x   2 10001    10001          60 Dec  9 14:22 
/test-path.dpkg-backup
2273205675    0 -rw-r--r--   1 10001    10001           0 Dec  9 14:08 
/test-path.dpkg-backup/file
2273212043    0 drwxr-xr-x   2 10001    10001          40 Dec  9 14:55 
/test-pathdir

* /test-path symlink installed
* /test-pathdir/file deleted
* /test-path.dpkg-backup not cleaned up 

>>> Observed while debugging the piuparts failures of python-babel on
>>> upgrades from jessie to sid.
>>
>> This is with a local package right? Because the one in the archive
>> does not contain any dir_to_symlink code.

packages in the archive use some ugly find --delete magic (and previous package 
did rm -rf),
so I expected this to be the culprit. converted it to d-m-h dir_to_symlink
but it still failed - so d-m-h did not abort in the "real" case.

After I noticed that not all files were missing in 
/usr/share/python-babel-localedata
- only the files already existing in the jessie version are missing -
I started suspecting dpkg. I did further tests with the packges from the archive
since the outcome of the preinst should be equivalent: the directory to be 
replaced
by a symlink should be gone.

> Could it be it's something else in the packaging, to try to overcome
> the abort from dpkg-maintscript-helper?

no suspicious output at all from the piuparts log:
(this was an wheezy->sid upgrade test of the d-m-h converted packages)

  Selecting previously unselected package python-babel-localedata.
  Preparing to unpack .../python-babel-localedata_1.3+dfsg.1-3_all.deb ...
  Unpacking python-babel-localedata (1.3+dfsg.1-3) ...

  Preparing to unpack .../python-babel_1.3+dfsg.1-3_all.deb ...
  Unpacking python-babel (1.3+dfsg.1-3) over (0.9.6-1) ...
 
  Preparing to unpack .../python-pybabel_1.3+dfsg.1-3_all.deb ...
  Unpacking python-pybabel (1.3+dfsg.1-3) over (0.9.6-1) ...

  Setting up python-babel-localedata (1.3+dfsg.1-3) ...

  update-alternatives: using /usr/bin/pybabel-python2 to provide 
/usr/bin/pybabel (pybabel) in auto mode
  Setting up python-babel (1.3+dfsg.1-3) ...

  Setting up python-pybabel (1.3+dfsg.1-3) ...

until 

  debsums: missing file /usr/share/python-babel-localedata/localedata/aa.dat 
(from python-babel-localedata package)
  debsums: missing file /usr/share/python-babel-localedata/localedata/aa_DJ.dat 
(from python-babel-localedata package)
...
  debsums: missing file /usr/share/python-babel-localedata/localedata/zu.dat 
(from python-babel-localedata package)
  debsums: missing file /usr/share/python-babel-localedata/localedata/zu_ZA.dat 
(from python-babel-localedata package)


OK, lets try again with some more verboseness

  Selecting previously unselected package python-babel-localedata.
  Preparing to unpack .../python-babel-localedata_1.3+dfsg.1-3_all.deb ...
  Unpacking python-babel-localedata (1.3+dfsg.1-3) ...

  drwxr-xr-x 2 root root  9080 Dec  9 15:47 
/usr/lib/python2.6/dist-packages/babel/localedata
  lrwxrwxrwx 1 root root    46 Apr 16  2011 
/usr/lib/python2.6/dist-packages/babel/localedata.py -> 
../../../../share/pyshared/babel/localedata.py
  lrwxrwxrwx 1 root root    61 Dec  9 15:47 
/usr/lib/python2.7/dist-packages/babel/localedata -> 
/usr/lib/python2.7/dist-packages/babel/localedata.dpkg-backup
  drwxr-xr-x 2 root root  9080 Dec  9 15:47 
/usr/lib/python2.7/dist-packages/babel/localedata.dpkg-backup
  lrwxrwxrwx 1 root root    46 Apr 16  2011 
/usr/lib/python2.7/dist-packages/babel/localedata.py -> 
../../../../share/pyshared/babel/localedata.py
  drwxr-xr-x 2 root root 13320 Dec  9 15:47 
/usr/share/python-babel-localedata/localedata
  Preparing to unpack .../python-babel_1.3+dfsg.1-3_all.deb ...
  Unpacking python-babel (1.3+dfsg.1-3) over (0.9.6-1) ...

(why does the preinst output appear before the "Preparing" message?)
d-m-h *did* the rename in the preinst (the directory contained only shipped 
symlinks, no real files)

  Setting up python-babel-localedata (1.3+dfsg.1-3) ...

  update-alternatives: using /usr/bin/pybabel-python2 to provide 
/usr/bin/pybabel (pybabel) in auto mode
  Setting up python-babel (1.3+dfsg.1-3) ...

(again, postinst output before "Setting up" message)

but /usr/lib/python2.7/dist-packages/babel/localedata.dpkg-backup is not 
cleaned up in the postinst

(and files disappeared, of course)


Andreas


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to