[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#728572: python-apt: string to float conversion exception



On Fri, Nov 08, 2013 at 08:47:32AM +0200, Pauli Nieminen wrote:
> Maybe these patches will help fixing the issue. At least to me it looks
> like the cause of the problem.

Thanks a bunch for digging into this and for the patches (and sorry
that it took me so long to reply). 

I'm still a bit confused though, AFAICS, 0.9.12.1 does send the sort
pkgname so the first patch should not be needed with the apt in
current unstable. Or am I missing something? I.e. do you still
observe that 0.9.12.1 sends the architecture string?

As for the second patch, the new
PackageManagerProgressFd::StatusChanged() has a line.
  status << "pmstatus:" << StringSplit(PackageName, ":")[0]
that should also strip the architectire before it goes out over the
status-fd to python-apt. The InstallProgress needs the full
architecture string for progress classes like the new deb822 progress
that will send out the archtitecture as a sperate field.

Cheers,
 Michael

> From 03482179d0a91cf3f23fa777874a5e45344a4486 Mon Sep 17 00:00:00 2001
> From: Pauli Nieminen <suokkos@gmail.com>
> Date: Fri, 8 Nov 2013 08:11:26 +0200
> Subject: [PATCH] Avoid sending package name with arch to status FD
> 
> Sending arch with package name to status fd makes other side parse the
> string incorrectly because expectation is to do simple string split with
> colon. But of course there would be an extra colon in the string.
> 
> Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
> ---
>  apt-pkg/deb/dpkgpm.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
> index fe38bf6..f2dc296 100644
> --- a/apt-pkg/deb/dpkgpm.cc
> +++ b/apt-pkg/deb/dpkgpm.cc
> @@ -583,7 +583,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
>     if(strncmp(list[0].c_str(), "processing", strlen("processing")) == 0)
>     {
>        char s[200];
> -      const char* const pkg_or_trigger = list[2].c_str();
> +      const char* const pkg_or_trigger = StringSplit(list[2], ":")[0].c_str();
>        action =  list[1].c_str();
>        const std::pair<const char *, const char *> * const iter =
>  	std::find_if(PackageProcessingOpsBegin,
> -- 
> 1.8.4.2
> 

> From b1b7ece6ca12c1eea14e9a6dc69ec138f6298c9e Mon Sep 17 00:00:00 2001
> From: Pauli Nieminen <suokkos@gmail.com>
> Date: Fri, 8 Nov 2013 08:11:26 +0200
> Subject: [PATCH] Avoid sending package name with arch to status FD
> 
> Sending arch with package name to status fd makes other side parse the
> string incorrectly because expectation is to do simple string split with
> colon. But of course there would be an extra colon in the string.
> 
> Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
> ---
>  apt-pkg/deb/dpkgpm.cc | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
> index 26d79db..92b85b6 100644
> --- a/apt-pkg/deb/dpkgpm.cc
> +++ b/apt-pkg/deb/dpkgpm.cc
> @@ -664,7 +664,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(char *line)
>        }
>        std::string msg;
>        strprintf(msg, _(iter->second), i18n_pkgname.c_str());
> -      d->progress->StatusChanged(pkgname, PackagesDone, PackagesTotal, msg);
> +      d->progress->StatusChanged(short_pkgname, PackagesDone, PackagesTotal, msg);
>  
>        // FIXME: this needs a muliarch testcase
>        // FIXME2: is "pkgname" here reliable with dpkg only sending us 
> @@ -693,7 +693,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(char *line)
>           PackagesDone++;
>  
>           strprintf(msg, translation, i18n_pkgname.c_str());
> -         d->progress->StatusChanged(pkgname, PackagesDone, PackagesTotal, msg);
> +         d->progress->StatusChanged(short_pkgname, PackagesDone, PackagesTotal, msg);
>           
>        }
>        if (Debug == true) 
> -- 
> 1.8.4.2
> 


Reply to: