[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Python3 support for hot-backup.py

From: C. Michael Pilato <cmpilato_at_red-bean.com>
Date: Mon, 15 Jun 2020 11:18:39 -0400

On Mon, Jun 15, 2020 at 10:32 AM Yasuhito FUTATSUKI <futatuki_at_yf.bsdclub.org>
wrote:

> On 2020/06/15 21:38, C. Michael Pilato wrote:
> Is it needed something like this?
>
> [[[
> Index: tools/backup/hot-backup.py.in
> ===================================================================
> --- tools/backup/hot-backup.py.in (revision 1878855)
> +++ tools/backup/hot-backup.py.in (working copy)
> @@ -218,7 +218,7 @@
>
> if stderr_lines:
> raise Exception("Unable to find the youngest revision for repository
> '%s'"
> - ": %s" % (repo_dir, stderr_lines[0].rstrip()))
> + ": %s" % (repo_dir,
> stderr_lines[0].rstrip().decode()))
>
> return stdout_lines[0].strip().decode();
>
> ]]]
>
> If svnlook runs on locale other than C, this can cause UnicodeDecodeError,
> but without applying it, the output from svnlook is embeded as a
> representaion
> of bytes object to the exception message, like b'...'.
> (Although I think this script assuming C locale implicitly.)
>
> So I'm not sure which is better applying this or not.
>
> 'return stdout_lines[0].strip().decode();' is okey (except an extra ';',
> but it is not critical), because stdout_lines[0] is always ascii string
> in this context.
>

I removed a couple of stray semicolons in r1878859 -- thanks for catching
that.

As for your question: if I force "svnlook" to create errors (by setting
the svnlook variable to "/usr/bin/svn"), today I see an error message with
the b'...' formatting. Adding .decode() as you suggested makes the b'...'
go away and I see what I'd expect to see. As far as I can tell, I'm using
the "en-US.UTF-8" locale, though -- not the "C" one. But maybe I'm just
getting lucky because the locale encoding is UTF-8 and not, say, Shift-JIS
or something? I dunno.
Received on 2020-06-15 17:19:17 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.