Debian Bug report logs -
#502072
apt-cacher-ng refuses to start via init script
Reported by: Theppitak Karoonboonyanan <thep@linux.thai.net>
Date: Mon, 13 Oct 2008 11:36:02 UTC
Severity: grave
Tags: patch
Found in version apt-cacher-ng/0.3.1-1
Fixed in version apt-cacher-ng/0.3.2-1
Done: Eduard Bloch <blade@debian.org>
Bug is archived. No further changes may be made.
Toggle useless messages
Report forwarded
to debian-bugs-dist@lists.debian.org, Eduard Bloch <blade@debian.org>:
Bug#502072; Package apt-cacher-ng.
(Mon, 13 Oct 2008 11:36:05 GMT) (full text, mbox, link).
Acknowledgement sent
to Theppitak Karoonboonyanan <thep@linux.thai.net>:
New Bug report received and forwarded. Copy sent to Eduard Bloch <blade@debian.org>.
(Mon, 13 Oct 2008 11:36:05 GMT) (full text, mbox, link).
Message #5 received at submit@bugs.debian.org (full text, mbox, reply):
[Message part 1 (text/plain, inline)]
Package: apt-cacher-ng
Version: 0.3.1-1
Severity: grave
Justification: renders package unusable
When starting/restarting apt-cacher-ng from init script, it refuses to start:
---8<---
# invoke-rc.d apt-cacher-ng start
Starting apt-cacher-ng: apt-cacher-ngUsage: apt-cacher -h -c configdir
<var=value ...>
Options:
-h: this help message
-c configuration directory
-e: run expiration on startup
Most interesting variables:
Daemon: 1 Daemonize program
PidFile: /path/to/pidfile File to store daemon's PID
FifoPath: /path/to/fifofile FIFO file, for control and local communication
CacheDir: /directory/for/storage
LogDir: /directory/for/logfiles
See manpage for all directives.
.
---8<---
With "sh -x /etc/init.d/apt-cacher-ng start", the invoked command line
appears to be:
---8<---
+ start-stop-daemon --start --chuid apt-cacher-ng --group apt-cacher-ng --quiet
--pidfile /var/run/apt-cacher-ng/pid --exec /usr/sbin/apt-cacher-ng -- -c
/etc/apt-cacher-ng pidfile=/var/run/apt-cacher-ng/pid
SocketPath=/var/run/apt-cacher-ng/socket foreground=0
---8<---
If I edit /etc/init.d/apt-cacher-ng by removing "foreground=0" from
DAEMON_OPTS, the service can start again.
apt-cacher-ng 0.3.1 seems to refuse integer argument of zero value.
In acfg.cc, function SetOption():
---8<---
...
else if ( NULL != (nTarget = _GetIntPtr(key)))
{
*nTarget=atoi(value.c_str());
if(0==*nTarget)
{
if(value.length()<1)
cerr << "Unexpected empty value for " << key << ", check the configuration!"<<endl;
else if(!isdigit((UINT) value[0]))
cerr << "Invalid value for " << key << ", expected a number!"<<endl;
return false;
}
}
...
---8<---
So, if atoi returns 0, despite being a valid value, it's always treated as
error.
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.26-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=th_TH.UTF-8, LC_CTYPE=th_TH.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages apt-cacher-ng depends on:
ii adduser 3.110 add and remove users and groups
ii libbz2-1.0 1.0.5-1 high-quality block-sorting file co
ii libc6 2.7-14 GNU C Library: Shared libraries
ii libfuse2 2.7.4-1.1 Filesystem in USErspace library
ii libgcc1 1:4.3.2-1 GCC support library
ii libstdc++6 4.3.2-1 The GNU Standard C++ Library v3
ii zlib1g 1:1.2.3.3.dfsg-12 compression library - runtime
apt-cacher-ng recommends no packages.
apt-cacher-ng suggests no packages.
-- no debconf information
--
Theppitak Karoonboonyanan
http://linux.thai.net/~thep/
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to debian-bugs-dist@lists.debian.org, Eduard Bloch <blade@debian.org>:
Bug#502072; Package apt-cacher-ng.
(Mon, 13 Oct 2008 12:33:05 GMT) (full text, mbox, link).
Acknowledgement sent
to Theppitak Karoonboonyanan <thep@linux.thai.net>:
Extra info received and forwarded to list. Copy sent to Eduard Bloch <blade@debian.org>.
(Mon, 13 Oct 2008 12:33:05 GMT) (full text, mbox, link).
Message #10 received at 502072@bugs.debian.org (full text, mbox, reply):
[Message part 1 (text/plain, inline)]
package apt-cacher-ng
tags 502072 patch
thanks
Using strtol() with appropriate check instead of atoi() should cope with
the error better, without false alarm. (See the proposed patch.)
--
Theppitak Karoonboonyanan
http://linux.thai.net/~thep/
[int-arg-parsing.patch (text/x-diff, attachment)]
[signature.asc (application/pgp-signature, inline)]
Tags added: patch
Request was from Theppitak Karoonboonyanan <thep@linux.thai.net>
to control@bugs.debian.org.
(Mon, 13 Oct 2008 12:33:06 GMT) (full text, mbox, link).
Information forwarded
to debian-bugs-dist@lists.debian.org, Eduard Bloch <blade@debian.org>:
Bug#502072; Package apt-cacher-ng.
(Mon, 13 Oct 2008 19:12:15 GMT) (full text, mbox, link).
Acknowledgement sent
to Eduard Bloch <edi@gmx.de>:
Extra info received and forwarded to list. Copy sent to Eduard Bloch <blade@debian.org>.
(Mon, 13 Oct 2008 19:12:15 GMT) (full text, mbox, link).
Message #17 received at 502072@bugs.debian.org (full text, mbox, reply):
#include <hallo.h>
* Theppitak Karoonboonyanan [Mon, Oct 13 2008, 07:27:32PM]:
> package apt-cacher-ng
> tags 502072 patch
> thanks
>
> Using strtol() with appropriate check instead of atoi() should cope with
> the error better, without false alarm. (See the proposed patch.)
Indeed, thanks. But please read the manpage carefully, i.e. this part:
Since strtol() can legitimately return 0, LONG_MAX, or LONG_MIN
(LLONG_MAX or LLONG_MIN for strtoll()) on both success and
failure, the calling program should set errno to 0 before the
call, and then determine if an error occurred by checking whether
errno has a non-zero value after the call.
Regarsd,
Eduard.
>
> --
> Theppitak Karoonboonyanan
> http://linux.thai.net/~thep/
> Index: apt-cacher-ng-0.3.1/source/acfg.cc
> ===================================================================
> --- apt-cacher-ng-0.3.1.orig/source/acfg.cc 2008-10-13 19:19:28.000000000 +0700
> +++ apt-cacher-ng-0.3.1/source/acfg.cc 2008-10-13 19:19:53.000000000 +0700
> @@ -16,6 +16,8 @@
> #include <glob.h>
> #endif
>
> +#include <errno.h>
> +
> #include <iostream>
> #include <fstream>
> #include <string>
> @@ -234,8 +236,9 @@
> *sTarget=value;
> else if ( NULL != (nTarget = _GetIntPtr(key)))
> {
> - *nTarget=atoi(value.c_str());
> - if(0==*nTarget)
> + char *pEnd;
> + *nTarget=strtol(value.c_str(), &pEnd, 10);
> + if(*pEnd || errno == EINVAL || errno == ERANGE)
> {
> if(value.length()<1)
> cerr << "Unexpected empty value for " << key << ", check the configuration!"<<endl;
--
Programmierer, die nur dann nicht chaotisch programmieren,
wenn sie die Sprache dazu zwingt, nicht chaotisch zu
programmieren, sind schlechte Programmierer.
-- 1. Satz des Sesom
Reply sent
to Eduard Bloch <blade@debian.org>:
You have taken responsibility.
(Mon, 13 Oct 2008 20:00:15 GMT) (full text, mbox, link).
Notification sent
to Theppitak Karoonboonyanan <thep@linux.thai.net>:
Bug acknowledged by developer.
(Mon, 13 Oct 2008 20:00:15 GMT) (full text, mbox, link).
Message #22 received at 502072-close@bugs.debian.org (full text, mbox, reply):
Source: apt-cacher-ng
Source-Version: 0.3.2-1
We believe that the bug you reported is fixed in the latest version of
apt-cacher-ng, which is due to be installed in the Debian FTP archive:
apt-cacher-ng_0.3.2-1.diff.gz
to pool/main/a/apt-cacher-ng/apt-cacher-ng_0.3.2-1.diff.gz
apt-cacher-ng_0.3.2-1.dsc
to pool/main/a/apt-cacher-ng/apt-cacher-ng_0.3.2-1.dsc
apt-cacher-ng_0.3.2-1_amd64.deb
to pool/main/a/apt-cacher-ng/apt-cacher-ng_0.3.2-1_amd64.deb
apt-cacher-ng_0.3.2.orig.tar.gz
to pool/main/a/apt-cacher-ng/apt-cacher-ng_0.3.2.orig.tar.gz
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 502072@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Eduard Bloch <blade@debian.org> (supplier of updated apt-cacher-ng package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Format: 1.8
Date: Mon, 13 Oct 2008 21:14:11 +0200
Source: apt-cacher-ng
Binary: apt-cacher-ng
Architecture: source amd64
Version: 0.3.2-1
Distribution: unstable
Urgency: low
Maintainer: Eduard Bloch <blade@debian.org>
Changed-By: Eduard Bloch <blade@debian.org>
Description:
apt-cacher-ng - Caching proxy for distribution of software packages
Closes: 502072
Changes:
apt-cacher-ng (0.3.2-1) unstable; urgency=low
.
* New upstream version, fixes startup problem with numeric command line
options, based on patch from Theppitak Karoonboonyanan (closes: #502072)
Checksums-Sha1:
d8a6ff1f0e3e735f9f9655f3f7c83d9743d645d6 1028 apt-cacher-ng_0.3.2-1.dsc
93efbacaf39c6e1a1152a62fc5264cbd176d3a34 209686 apt-cacher-ng_0.3.2.orig.tar.gz
ec1660c3000684fbec7784c279a1c7750396a5db 9487 apt-cacher-ng_0.3.2-1.diff.gz
ebd8f00813a13fb752e31f4ae27d1389261d2190 267426 apt-cacher-ng_0.3.2-1_amd64.deb
Checksums-Sha256:
ff86f2d3a37ca20ae3a8ae87ccf7354372715192f9c930524398e04fccf1f7e4 1028 apt-cacher-ng_0.3.2-1.dsc
c036e46c1dace4611c073aa0b29f0e78b622b73002b37f8d2d809eb31d49acc0 209686 apt-cacher-ng_0.3.2.orig.tar.gz
beefb33f47e0d5c71a81d0ce7bd578b225000caa86a256090d8a26e93dbc600d 9487 apt-cacher-ng_0.3.2-1.diff.gz
765a020e5bdac427910a7845a1fe60bd501657650ec53bf768cd1c415e7d35dc 267426 apt-cacher-ng_0.3.2-1_amd64.deb
Files:
1cb80aa3c555c885430f0d1ee8eeea03 1028 net optional apt-cacher-ng_0.3.2-1.dsc
6f0f5ec3ac15027bb0b5f24438c775d7 209686 net optional apt-cacher-ng_0.3.2.orig.tar.gz
581d1f511bb110ad4f149d905e8f3f44 9487 net optional apt-cacher-ng_0.3.2-1.diff.gz
4025f1a53d878a3f2e8f2ef25d9b838f 267426 net optional apt-cacher-ng_0.3.2-1_amd64.deb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iD8DBQFI855m4QZIHu3wCMURAsV2AJ9TlaITsqPaOTZX21CIykPUNkjmhACdFXzl
jfhefRmZCd6A+8+etGhklBg=
=CZto
-----END PGP SIGNATURE-----
Bug archived.
Request was from Debbugs Internal Request <owner@bugs.debian.org>
to internal_control@bugs.debian.org.
(Wed, 12 Nov 2008 07:35:58 GMT) (full text, mbox, link).
Send a report that this bug log contains spam.
Debian bug tracking system administrator <owner@bugs.debian.org>.
Last modified:
Fri Jan 12 02:27:06 2018;
Machine Name:
buxtehude
Debian Bug tracking system
Debbugs is free software and licensed under the terms of the GNU
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.
Copyright © 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson,
2005-2017 Don Armstrong, and many other contributors.