[pve-devel] [PATCH pve-cluster] Remove decode from log_msg
Dietmar Maurer
dietmar at proxmox.com
Thu Oct 29 10:30:22 CET 2015
I do not think this fixes bug 790 - not sure what this patch solve?
> On October 28, 2015 at 6:01 PM Thomas Lamprecht <t.lamprecht at proxmox.com>
> wrote:
>
>
> decode('utf8', $msg) expects $msg to be an sequence of octets with
> Perls internal encoding - thus no octect may be an wide character,
> or in other words have a character bigger than 255.
> In this context decode doesn't really makes sense and can easily
> fail if we want to log an message including an utf8 character.
> The text is alreayde decoded.
>
> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
> ---
>
> Proposal, maybe there is some better way.
>
> This fixes bug 790.
>
>
> data/PVE/Cluster.pm | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
> index 554ec0b..5575e15 100644
> --- a/data/PVE/Cluster.pm
> +++ b/data/PVE/Cluster.pm
> @@ -963,12 +963,10 @@ sub log_msg {
> $msg = "empty message" if !$msg;
>
> $ident = "" if !$ident;
> - $ident = encode("ascii", decode_utf8($ident),
> + $ident = encode("ascii", $ident,
> sub { sprintf "\\u%04x", shift });
>
> - my $utf8 = decode_utf8($msg);
> -
> - my $ascii = encode("ascii", $utf8, sub { sprintf "\\u%04x", shift });
> + my $ascii = encode("ascii", $msg, sub { sprintf "\\u%04x", shift });
>
> if ($ident) {
> syslog($priority, "<%s> %s", $ident, $ascii);
> --
> 2.1.4
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
More information about the pve-devel
mailing list