Bug#651854: apt-cacher: problems finding port number in /etc/xinetd.d/apt-cacher

2011-12-16 Thread Mark Hindley
On Wed, Dec 14, 2011 at 10:42:49PM -0500, Jon Daley wrote:
 Looks like the local and the quotes on the for line do the trick.

Thanks. I will queue them for the next upload.

Mark



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#651854: apt-cacher: problems finding port number in /etc/xinetd.d/apt-cacher

2011-12-14 Thread Jon Daley

Looks like the local and the quotes on the for line do the trick.

Thanks.

On Tue, 13 Dec 2011, Mark Hindley wrote:


On Mon, Dec 12, 2011 at 09:21:07PM +, Mark Hindley wrote:

Thanks for this, but I am afraid I don't quite understand what is going
on.

I can see the uninitialized value warning, but I can't see how it is
arising. :(


I have woken up with my brain working this morning! I had forgotten that
$_ is not localized automatically in while loops. This should fix the
uninitialized value warning.

Mark
commit 8319befeebbb72bfdc7f2c53ac4bad9e141d0407
Author: Mark Hindley m...@hindley.org.uk
Date:   Tue Dec 13 09:16:13 2011 +

   Localize $_ before while ($fh) loop.

diff --git a/apt-cacher b/apt-cacher
index dccb22e..d0989c7 100755
--- a/apt-cacher
+++ b/apt-cacher
@@ -1990,6 +1990,7 @@ sub get_inetd_port {
open(my $fh, '', $_) || do {
info_message(Warning: Cannot open $_, $!); next;
};
+   local $_;
  LINE:
while ($fh) {
next LINE if /^(?:#|$)/; # Weed comments and empty lines



--
Jon Daley
http://jon.limedaley.com
~~
Anything dropped in the bathroom falls in the toilet.
-- Flucard's Corollary



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#651854: apt-cacher: problems finding port number in /etc/xinetd.d/apt-cacher

2011-12-13 Thread Mark Hindley
On Mon, Dec 12, 2011 at 09:21:07PM +, Mark Hindley wrote:
 Thanks for this, but I am afraid I don't quite understand what is going 
 on.
 
 I can see the uninitialized value warning, but I can't see how it is 
 arising. :(

I have woken up with my brain working this morning! I had forgotten that 
$_ is not localized automatically in while loops. This should fix the 
uninitialized value warning.

Mark
commit 8319befeebbb72bfdc7f2c53ac4bad9e141d0407
Author: Mark Hindley m...@hindley.org.uk
Date:   Tue Dec 13 09:16:13 2011 +

Localize $_ before while ($fh) loop.

diff --git a/apt-cacher b/apt-cacher
index dccb22e..d0989c7 100755
--- a/apt-cacher
+++ b/apt-cacher
@@ -1990,6 +1990,7 @@ sub get_inetd_port {
open(my $fh, '', $_) || do {
info_message(Warning: Cannot open $_, $!); next;
};
+   local $_;
  LINE:
while ($fh) {
next LINE if /^(?:#|$)/; # Weed comments and empty lines



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#651854: apt-cacher: problems finding port number in /etc/xinetd.d/apt-cacher

2011-12-12 Thread Jon Daley
Package: apt-cacher
Version: 1.7.2
Severity: normal
Tags: patch

I've been running apt-cacher with xinetd, and made my own 
/etc/xinetd.d/apt-cacher:
service apt-cacher
{
disable = no
type= UNLISTED
socket_type = stream
protocol= tcp
user= www-data
wait= no
server  = /usr/sbin/apt-cacher
server_args = -i
bind= clementine.internal
port= 3142
}   

And it has been working fine, but I was having trouble connecting today, and 
looked in the log, and saw these messages:
Use of uninitialized value $xinetdconf in concatenation (.) or string at 
/usr/sbin/apt-cacher line 1995.
Warning: no apt-cacher port found in 

which it turns out have been occurring for as long as I've had it in xinetd 
mode.  They come from around line 2010.

Here is my fix.  I'm not sure what the original for loop was trying to do, but 
it appears to not have worked.  From the docs, I 
would have guessed a foreach was more appropriate, but the change below fixes 
it.  The original code doesn't search the xinetd.d directory at all.

1987c1987
   for ($xinetdconf, glob('$xinetdconfdir/*')) {
---
 for (glob($xinetdconf $xinetdconfdir/*)) {


And then this is just a documentation change to make it clearer that it is 
(now) appropriately looking in the xinetd.d directory.
2010c2010
   info_message(Warning: no apt-cacher port found in $xinetdconf) if 
!$found;
---
 info_message(Warning: no apt-cacher port found in $xinetdconfdir or 
 $xinetdconf) if !$found;


Lastly, I thought about changing the for line to:
for (glob($xinetdconf $xinetdconfdir/[a-z-]*)) {

which would ignore an apt-cacher~ file, but perhaps that isn't necessary since 
the loop exits out as soon as it finds a match.


-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 3.1.0-1-686-pae (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages apt-cacher depends on:
ii  debconf [debconf-2.0]  1.5.41  
ii  dpkg   1.16.1.2
ii  ed 1.5-3   
ii  libfilesys-df-perl 0.92-4+b1   
ii  libfreezethaw-perl 0.5001-1
ii  libio-interface-perl   1.06-1+b1   
ii  libnetaddr-ip-perl 4.058+dfsg-1
ii  libwww-curl-perl   4.15-1+b2   
ii  libwww-perl6.03-1  
ii  lsb-base   3.2-28  
ii  perl   5.14.2-6
ii  update-inetd   4.41

Versions of packages apt-cacher recommends:
ii  libberkeleydb-perl  0.49-1

Versions of packages apt-cacher suggests:
ii  libio-socket-inet6-perl  2.65-1.1

-- debconf information:
* apt-cacher/mode: inetd



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#651854: apt-cacher: problems finding port number in /etc/xinetd.d/apt-cacher

2011-12-12 Thread Mark Hindley
On Mon, Dec 12, 2011 at 11:25:01AM -0500, Jon Daley wrote:
 Package: apt-cacher
 Version: 1.7.2
 Severity: normal
 Tags: patch
 
 I've been running apt-cacher with xinetd, and made my own 
 /etc/xinetd.d/apt-cacher:
 service apt-cacher
 {
 disable = no
 type= UNLISTED
 socket_type = stream
 protocol= tcp
 user= www-data
 wait= no
 server  = /usr/sbin/apt-cacher
 server_args = -i
 bind= clementine.internal
 port= 3142
 } 
   
 
 And it has been working fine, but I was having trouble connecting today, and 
 looked in the log, and saw these messages:
 Use of uninitialized value $xinetdconf in concatenation (.) or string at 
 /usr/sbin/apt-cacher line 1995.
 Warning: no apt-cacher port found in 
 
 which it turns out have been occurring for as long as I've had it in xinetd 
 mode.  They come from around line 2010.
 
 Here is my fix.  I'm not sure what the original for loop was trying to do, 
 but it appears to not have worked.  From the docs, I 
 would have guessed a foreach was more appropriate, but the change below fixes 
 it.  The original code doesn't search the xinetd.d directory at all.

Thanks for this, but I am afraid I don't quite understand what is going 
on.

I can see the uninitialized value warning, but I can't see how it is 
arising. :(

For and foreach loops in perl are identical, as far as I know

I think the fix for globbing /etc/xinetd.d/* correctly is below. Could 
you test it for me please.

Many thanks

Mark

diff --git a/apt-cacher b/apt-cacher
index c9042a6..dccb22e 100755
--- a/apt-cacher
+++ b/apt-cacher
@@ -1986,7 +1986,7 @@ sub get_inetd_port {
my $ident;
my $found;
   FILE:
-   for ($xinetdconf, glob('$xinetdconfdir/*')) {
+   for ($xinetdconf, glob($xinetdconfdir/*)) {
open(my $fh, '', $_) || do {
info_message(Warning: Cannot open $_, $!); next;
};



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org