* [gentoo-portage-dev] [PATCH] repoman/argparser.py: _unicode_decode the commitmsg (bug 562108)
@ 2015-10-03 17:34 Brian Dolbec
2015-10-03 17:58 ` Zac Medico
0 siblings, 1 reply; 2+ messages in thread
From: Brian Dolbec @ 2015-10-03 17:34 UTC (permalink / raw
To: gentoo-portage-dev
From 87ff1532e65e64c86fa80437944bda223aff3d93 Mon Sep 17 00:00:00 2001
From: Brian Dolbec <dolsen@gentoo.org>
Date: Sat, 3 Oct 2015 10:14:11 -0700
Subject: [PATCH] repoman/argparser.py: _unicode_decode the commitmsg (bug
562108)
Force utf-8 for the comit message to prevent a possible traceback.
X-Gentoo-bug: 562108
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=562108
---
pym/repoman/argparser.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/pym/repoman/argparser.py b/pym/repoman/argparser.py
index 85e261d..0f34ed0 100644
--- a/pym/repoman/argparser.py
+++ b/pym/repoman/argparser.py
@@ -1,4 +1,3 @@
-# -*- coding:utf-8 -*-
# repoman: Argument parser
# Copyright 2007-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
@@ -11,6 +10,7 @@ import sys
# import our initialized portage instance
from repoman._portage import portage
+from portage import _unicode_decode
from portage import util
from portage.util._argparse import ArgumentParser
@@ -211,6 +211,9 @@ def parse_args(argv, qahelp, repoman_default_opts):
logger = logging.getLogger()
logger.setLevel(logger.getEffectiveLevel() + 10)
+ if opts.mode == 'commit' and opts.commitmsg:
+ opts.commitmsg = _unicode_decode(opts.commitmsg)
+
if opts.mode == 'commit' and not (opts.force or opts.pretend):
if opts.ignore_masked:
opts.ignore_masked = False
--
2.5.3
--
Brian Dolbec <dolsen>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] repoman/argparser.py: _unicode_decode the commitmsg (bug 562108)
2015-10-03 17:34 [gentoo-portage-dev] [PATCH] repoman/argparser.py: _unicode_decode the commitmsg (bug 562108) Brian Dolbec
@ 2015-10-03 17:58 ` Zac Medico
0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2015-10-03 17:58 UTC (permalink / raw
To: gentoo-portage-dev
On 10/03/2015 10:34 AM, Brian Dolbec wrote:
> From 87ff1532e65e64c86fa80437944bda223aff3d93 Mon Sep 17 00:00:00 2001
> From: Brian Dolbec <dolsen@gentoo.org>
> Date: Sat, 3 Oct 2015 10:14:11 -0700
> Subject: [PATCH] repoman/argparser.py: _unicode_decode the commitmsg (bug
> 562108)
>
> Force utf-8 for the comit message to prevent a possible traceback.
> X-Gentoo-bug: 562108
> X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=562108
> ---
> pym/repoman/argparser.py | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/pym/repoman/argparser.py b/pym/repoman/argparser.py
> index 85e261d..0f34ed0 100644
> --- a/pym/repoman/argparser.py
> +++ b/pym/repoman/argparser.py
> @@ -1,4 +1,3 @@
> -# -*- coding:utf-8 -*-
> # repoman: Argument parser
> # Copyright 2007-2014 Gentoo Foundation
> # Distributed under the terms of the GNU General Public License v2
> @@ -11,6 +10,7 @@ import sys
> # import our initialized portage instance
> from repoman._portage import portage
>
> +from portage import _unicode_decode
> from portage import util
> from portage.util._argparse import ArgumentParser
>
> @@ -211,6 +211,9 @@ def parse_args(argv, qahelp, repoman_default_opts):
> logger = logging.getLogger()
> logger.setLevel(logger.getEffectiveLevel() + 10)
>
> + if opts.mode == 'commit' and opts.commitmsg:
> + opts.commitmsg = _unicode_decode(opts.commitmsg)
> +
> if opts.mode == 'commit' and not (opts.force or opts.pretend):
> if opts.ignore_masked:
> opts.ignore_masked = False
>
Looks good.
The rest of the commit message handling uses unicode, so this patch
makes it consistent. None of the other arguments can contain free-form
text like this, so they don't need explicit decoding.
--
Thanks,
Zac
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-03 17:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-03 17:34 [gentoo-portage-dev] [PATCH] repoman/argparser.py: _unicode_decode the commitmsg (bug 562108) Brian Dolbec
2015-10-03 17:58 ` Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox