Your message dated Tue, 23 Mar 2010 04:47:31 +0000
with message-id <1269319651.18314.250.ca...@localhost>
and subject line Re: IPv6 link local addresses dont work because apt 
URL-decodes the hostname part of an URL
has caused the Debian Bug report #534886,
regarding IPv6 link local addresses dont work because apt URL-decodes the 
hostname part of an URL
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
534886: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=534886
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: apt
Version: 0.7.21
Severity: important
Tags: patch

When specifying an IPv6 link local address one needs to specify the scope 
identifier
(on which interface this address is valid), such as 
fe80::216:eaff:fecb:826%wlan2.

However, one cannot use such an address in /etc/apt/sources.list because when 
parsing,
apt url-decodes the _whole_ string instead of just the path. Thereforce, the 
workaround
of specifying %25 instead of % works (that is,
http://[fe80::216:eaff:fecb:826%25wlan2]/debian works).

The attached code modifies the parsing so that it only url-decodes after 
finding the
protocol (two slashes) and the hostname (one slash after the protocol has been 
found).

-- Package-specific info:

-- /etc/apt/sources.list --

deb http://[fe80::216:eaff:fecb:826%wlan2]/debian testing main contrib non-free

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.29.1-midna-2 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages apt depends on:
ii  debian-archive-keyring        2009.01.31 GnuPG archive keys of the Debian a
ii  libc6                         2.9-12     GNU C Library: Shared libraries
ii  libgcc1                       1:4.4.0-5  GCC support library
ii  libstdc++6                    4.4.0-5    The GNU Standard C++ Library v3

apt recommends no packages.

Versions of packages apt suggests:
pn  apt-doc                      <none>      (no description available)
pn  aptitude | synaptic | gnome- <none>      (no description available)
ii  bzip2                        1.0.5-1     high-quality block-sorting file co
ii  dpkg-dev                     1.14.26     Debian package development tools
ii  lzma                         4.43-14     Compression method of 7z format in
ii  python-apt                   0.7.10.3+b1 Python interface to libapt-pkg

-- no debconf information
>From 5af8952e24fcad803cbd0dfc2a57f8ba99a787ed Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <mich...@stapelberg.de>
Date: Sun, 28 Jun 2009 00:13:03 +0200
Subject: [PATCH] Bugfix: Only URL-decode the part of the URL after the hostname

---
 apt-pkg/contrib/strutl.cc |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index a69cf01..587b121 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -168,21 +168,33 @@ bool ParseQuoteWord(const char *&String,string &Res)
    char Tmp[3];
    const char *Start = String;
    char *I;
+   bool parsed_protocol = false, parsed_host = false;
    for (I = Buffer; I < Buffer + sizeof(Buffer) && Start != C; I++)
    {
-      if (*Start == '%' && Start + 2 < C)
+      if (parsed_protocol && parsed_host && *Start  == '%' && Start + 2 < C)
       {
-        Tmp[0] = Start[1];
-        Tmp[1] = Start[2];
-        Tmp[2] = 0;
-        *I = (char)strtol(Tmp,0,16);
-        Start += 3;
-        continue;
+        Tmp[0] = Start[1];
+        Tmp[1] = Start[2];
+        Tmp[2] = 0;
+        *I = (char)strtol(Tmp,0,16);
+        Start += 3;
+        continue;
+      }
+      if (*Start == '/')
+      {
+        if (!parsed_protocol && Start + 1 < C && *(Start+1) == '/')
+        {
+          parsed_protocol = true;
+          *I++ = *Start++;
+        } else if (parsed_protocol)
+        {
+          parsed_host = true;
+        }
       }
       if (*Start != '"')
-        *I = *Start;
+        *I = *Start;
       else
-        I--;
+        I--;
       Start++;
    }
    *I = 0;
-- 
1.6.3.1


--- End Message ---
--- Begin Message ---
On Sun, 2009-06-28 at 00:37 +0200, Michael Stapelberg wrote:
> Package: apt
> Version: 0.7.21
> Severity: important
> Tags: patch
> 
> When specifying an IPv6 link local address one needs to specify the scope 
> identifier
> (on which interface this address is valid), such as 
> fe80::216:eaff:fecb:826%wlan2.
> 
> However, one cannot use such an address in /etc/apt/sources.list because when 
> parsing,
> apt url-decodes the _whole_ string instead of just the path.
[...]

This is not a bug.  URL-escaping is valid in all parts of a URL (except
the separators).  Further, RFC 3986 does not allow for scope identifiers
at all.

Ben.

-- 
Ben Hutchings
If you seem to know what you are doing, you'll be given more to do.

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


--- End Message ---

Reply via email to