Hallo intrigeri,
* [email protected] [Thu, Dec 26 2013, 11:00:24AM]:
> 
> the upgrade to apt-cacher-ng 0.7.24-1 fails for me:

Interesting...

>   + RET=/var/cache/apt-cacher-ng
>   + return 0
>   + CDIR=/var/cache/apt-cacher-ng
>   + CDIRCONF=CacheDir: /var/cache/apt-cacher-ng
>   + PRINTCFGVAR=CacheDir /usr/sbin/apt-cacher-ng -c /etc/apt-cacher-ng
>   + TESTPATH=

Well, I just realized that the code around this behaves wrong in corner
cases, I will make a minor revision anyhow. Please apply the patch from
the attachment to your postinst file.

>   dpkg: error processing package apt-cacher-ng (--configure):
>    subprocess installed post-installation script returned error exit status 1
>   Errors were encountered while processing:
>    apt-cacher-ng
>   E: Sub-process /usr/bin/dpkg returned an error code (1)
> 
> So I've tried to debug this a bit more:
> 
>   # PRINTCFGVAR=CacheDir /usr/sbin/apt-cacher-ng -c /etc/apt-cacher-ng
>   Error opening file, terminating.
> 
> Any other information that would be useful?

Please look which file it stops,

PRINTCFGVAR=CacheDir strace /usr/sbin/apt-cacher-ng -c /etc/apt-cacher-ng

I worked around the failure in the patch mentioned above (||:) but it
still isn't right.

Regards,
Eduard.
Index: debian/apt-cacher-ng.postinst
===================================================================
--- debian/apt-cacher-ng.postinst	(Revision 4187)
+++ debian/apt-cacher-ng.postinst	(Arbeitskopie)
@@ -136,24 +136,24 @@
    db_get $NAME/cachedir
    case "$RET" in
       keep|"")
-         # not to be set by debconf mechanism, use whatever we have
-         CDIR=$(PRINTCFGVAR=CacheDir $BINPATH -c $CFG 2>/dev/null)
-         CDIRCONF="# not set by debconf"
+         # but making sure that it's really set to something sensible in the
+         # config, otherwise replace with the default
+         TESTPATH=$(PRINTCFGVAR=CacheDir $BINPATH -c $CFG 2>/dev/null ||:)
+         if test -d "$TESTPATH" ; then
+            CDIR="$TESTPATH"
+            CDIRCONF="# not set by debconf"
+         else
+            CDIR=/var/cache/$NAME
+            CDIRCONF="CacheDir: $CDIR # default or overridden since '$TESTPATH' directory didn't exist"
+         fi
          ;;
       *)
-         # ok, configured by debconf
+         # ok, configured by debconf, will be created as needed
          CDIR="$RET"
          CDIRCONF="CacheDir: $RET"
          ;;
    esac
 
-   # make sure it's set even if commented out by the user
-   TESTPATH=$(PRINTCFGVAR=CacheDir $BINPATH -c $CFG 2>/dev/null)
-   if test -e "$TESTPATH" ; then
-      CDIR=/var/cache/$NAME
-      CDIRCONF="CacheDir: $CDIR"
-   fi
-
    # user should exist. adduser sometimes fails (system range issue) but that's ok
    adduser --quiet --system --group --no-create-home --home "$CDIR" $NAME || id $NAME
    # also setup permissions ASAP

Reply via email to