[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#372148: debian-policy: old postinst abort-upgrade, not new



Package: debian-policy
Version: 3.7.2.0
Severity: normal

$ echo 1 >counter; DPKG_DEBUG=2 sudo dpkg -i a.deb
(Reading database ... 100920 files and directories currently installed.)
Preparing to replace a 1 (using a.deb) ...

Runnning: /var/lib/dpkg/info/a.prerm upgrade 1
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
iFR a              1              a
debug: 1 2 0.

Running: /var/lib/dpkg/tmp.ci/preinst upgrade 1
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
iHR a              1              a
debug: 2 2 2.
dpkg: error processing a.deb (--install):
 subprocess pre-installation script returned error exit status 2

Running: /var/lib/dpkg/tmp.ci/postrm abort-upgrade 1
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
iHR a              1              a
debug: 4 2 0.

Running: /var/lib/dpkg/info/a.postinst abort-upgrade 1
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
iU  a              1              a
debug: 8 2 0.
Errors were encountered while processing:
 a.deb

This is inconsistent with the behavior documented in 6.6.3.1.1:
|    3.   1.   If the package is being upgraded, call:
|                   <new-preinst> upgrade <old-version>
|              If this fails, we call:
|                   <new-postrm> abort-upgrade <old-version>
|
|              1.   If that works, then
|
|                        <new-postinst> abort-upgrade <new-version>

The same problem exists in 6.6.5.1.2:
|         2.   If this fails, `dpkg' will attempt:
|                   <new-postrm> failed-upgrade <old-version>
|              If this works, installation continues.  If not, Error
|              unwind:
|                   <old-preinst> abort-upgrade <new-version>
|              If this fails, the old version is left in an "Half
|              Installed" state.  If it works, dpkg now calls:
|                   <new-postrm> abort-upgrade <old-version>
|              If this fails, the old version is left in an "Half
|              Installed" state.  If it works, dpkg now calls:
|                   <new-postinst> abort-upgrade <new-version>
|              If this fails, the old version is in an "Unpacked" state.


$ echo 1 >counter; DPKG_DEBUG=12 sudo dpkg -i a.deb
(Reading database ... 100920 files and directories currently installed.)
Preparing to replace a 1 (using a.deb) ...

Runnning: /var/lib/dpkg/info/a.prerm upgrade 1
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
iFR a              1              a
debug: 1 12 0.

Running: /var/lib/dpkg/tmp.ci/preinst upgrade 1
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
iHR a              1              a
debug: 2 12 0.
Unpacking replacement a ...

Running: /var/lib/dpkg/info/a.postrm upgrade 1
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
iHR a              1              a
debug: 4 12 4.
dpkg: warning - old post-removal script returned error exit status 4
dpkg - trying script from the new package instead ...

Running: /var/lib/dpkg/tmp.ci/postrm failed-upgrade 1
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
iHR a              1              a
debug: 8 12 8.
dpkg: error processing a.deb (--install):
 subprocess new post-removal script returned error exit status 8

Running: /var/lib/dpkg/info/a.preinst abort-upgrade 1
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
iHR a              1              a
debug: 16 12 0.

Running: /var/lib/dpkg/tmp.ci/postrm abort-upgrade 1
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
iHR a              1              a
debug: 32 12 0.

Running: /var/lib/dpkg/info/a.postinst abort-upgrade 1
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
iU  a              1              a
debug: 64 12 0.
Errors were encountered while processing:
 a.deb

I also suspect a problem with 6.8.4:

|         If the error unwind fails, the package is in an "Half-Installed"
|         state, or else it remains "Installed" - even though all the files
|         may have been deleted..

I think this is meant to be the rollback description for prerm remove,
in the previous subsubsection.  In that case, dpkg hasn't actually
done anything yet, and successful return of postinst abort-remove
indicates that the effects of prerm remove have been undone, and so
"Installed" is the proper state.  In my test, an internal error
following postrm remove leaves the package in a "Half-installed"
state (and only conffiles remain):

|root@andromeda:/tmp/dpkg# echo 1 >counter; DPKG_DEBUG=0 gdb --args dpkg -r a
|GNU gdb 6.4-debian
|Copyright 2005 Free Software Foundation, Inc.
|GDB is free software, covered by the GNU General Public License, and you are
|welcome to change it and/or distribute copies of it under certain conditions.
|Type "show copying" to see the conditions.
|There is absolutely no warranty for GDB.  Type "show warranty" for details.
|This GDB was configured as "i486-linux-gnu"...(no debugging symbols found)
|Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
|
|(gdb) break fork
|Function "fork" not defined.
|Make breakpoint pending on future shared library load? (y or [n]) y
|
|Breakpoint 1 (fork) pending.
|(gdb) r 
|Starting program: /usr/bin/dpkg -r a
|(no debugging symbols found)
|(no debugging symbols found)
|(no debugging symbols found)
|(no debugging symbols found)
|Breakpoint 2 at 0xb7f30bf6
|Pending breakpoint "fork" resolved
|(Reading database ... 100920 files and directories currently installed.)
|Removing a ...
|
|Breakpoint 2, 0xb7f30bf6 in fork () from /lib/tls/i686/cmov/libc.so.6
|(gdb) cont
|Continuing.
|
|Runnning: /var/lib/dpkg/info/a.prerm remove
|Desired=Unknown/Install/Remove/Purge/Hold
|| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
||/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
|||/ Name           Version        Description
|+++-==============-==============-============================================
|rF  a              1              a
|debug: 1 0 0.
|
|Breakpoint 2, 0xb7f30bf6 in fork () from /lib/tls/i686/cmov/libc.so.6
|(gdb) d 2
|(gdb) break unlink
|Breakpoint 3 at 0xb7f622c0
|(gdb) cont
|Continuing.
|
|Running: /var/lib/dpkg/info/a.postrm remove
|Desired=Unknown/Install/Remove/Purge/Hold
|| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
||/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
|||/ Name           Version        Description
|+++-==============-==============-============================================
|rH  a              1              a
|debug: 2 0 0.
|
|Breakpoint 3, 0xb7f622c0 in unlink () from /lib/tls/i686/cmov/libc.so.6
|(gdb) d 3
|(gdb) return -1
|Make selected stack frame return now? (y or n) y
|#0  0x0805b1cb in ?? ()
|(gdb) cont
|Continuing.
|dpkg: error processing a (--remove):
| unable to delete control info file `/var/lib/dpkg/info/a.postinst': No such file or directory
|Errors were encountered while processing:
| a
|
|Program exited with code 01.
|(gdb) shell dpkg -l a
|Desired=Unknown/Install/Remove/Purge/Hold
|| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
||/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
|||/ Name           Version        Description
|+++-==============-==============-============================================
|rH  a              1              a



Reply to: