Bug#824093: dpkg-reconfigure libdvd-pkg fails to build libdvdcss2 with dpkg 1.18.7

2016-05-15 Thread Dmitry Smirnov
On Thursday, 12 May 2016 5:54:40 PM AEST Carlos Maddela wrote:
> I have attached a patch with this fix.

Thank you very much for your help, Carlos. :)

-- 
Regards,
 Dmitry Smirnov
 GPG key : 4096R/53968D1B

---

"For every complex problem there is an answer that is clear, simple, and
wrong.
-- H. L. Mencken


signature.asc
Description: This is a digitally signed message part.


Bug#824093: dpkg-reconfigure libdvd-pkg fails to build libdvdcss2 with dpkg 1.18.7

2016-05-12 Thread Carlos Maddela
Package: libdvd-pkg
Version: 1.4.0-1-1
Severity: normal
Tags: patch

With dpkg version 1.18.7 (possibly other versions > 1.18.4 as well),
'dpkg-reconfigure libdvd-pkg' fails to build anything. It always ends up
with the following error:

libdvd-pkg: dpkg database is locked. You may need to use command "sudo 
dpkg-reconfigure libdvd-pkg".
libdvd-pkg: Building and installation of package(s) [libdvdcss2 
libdvdcss-dev] postponed till after next APT operation.

The problem occurs in /usr/lib/libdvd-pkg/b-i_libdvdcss.sh, which uses
"dpkg -i /dev/zero" to determine the lock status of dpkg. Newer versions
of dpkg produce the following error:

dpkg: error: archive '/dev/zero' is not a regular file

which also returns an error status of 2, hence nothing ever builds.

Purging or removing a non-existent package should restore the original
behaviour. I have attached a patch with this fix.

Best regards,

Carlos

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.5.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libdvd-pkg depends on:
ii  build-essential12.2
ii  debconf [debconf-2.0]  1.5.59
ii  debhelper  9.20160403
ii  devscripts 2.16.4
ii  dh-autoreconf  12
ii  wget   1.17.1-2

Versions of packages libdvd-pkg recommends:
ii  libcap2-bin  1:2.24-12

libdvd-pkg suggests no packages.

-- debconf information excluded
>From 254f7072153f865e7301b487ebc6024ab1a3e53d Mon Sep 17 00:00:00 2001
From: Carlos Maddela 
Date: Thu, 12 May 2016 16:10:33 +1000
Subject: [PATCH] Use alternative way to check if dpkg database is locked

Version 1.18.7 of dpkg also returns an error status of 2 when
attempting to install /dev/zero, so this method can no longer
be used to check the lock status. Trying to purge a non-existent
package achieves the original behaviour.
---
 debian/b-i_libdvdcss.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/b-i_libdvdcss.sh b/debian/b-i_libdvdcss.sh
index 127799d..8615185 100755
--- a/debian/b-i_libdvdcss.sh
+++ b/debian/b-i_libdvdcss.sh
@@ -17,7 +17,7 @@ if [ -f "${DIR}/${PKGG}-${VERGG}.is-installed" ]; then
 fi
 
 ## check if DPKG database is locked
-dpkg -i /dev/zero 2>/dev/null
+dpkg -P non-existent-package 2>/dev/null
 if [ "$?" -eq 2 ]; then
 echo "${PKGI}: dpkg database is locked. You may need to use command \"sudo dpkg-reconfigure ${PKGI}\"."
 if [ -h "/etc/apt/apt.conf.d/${P88}" ]; then
-- 
2.8.1