NetBSD Problem Report #43163

From www@NetBSD.org  Wed Apr 14 19:09:50 2010
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 59E5963B8FE
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 14 Apr 2010 19:09:50 +0000 (UTC)
Message-Id: <20100414190950.2313663B8BC@www.NetBSD.org>
Date: Wed, 14 Apr 2010 19:09:50 +0000 (UTC)
From: pilyavets@gmail.com
Reply-To: pilyavets@gmail.com
To: gnats-bugs@NetBSD.org
Subject: mpc has encoding problem on non-Linux systems
X-Send-Pr-Version: www-1.0

>Number:         43163
>Category:       pkg
>Synopsis:       mpc has encoding problem on non-Linux systems
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    simonb
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 14 19:10:00 +0000 2010
>Last-Modified:  Wed Apr 14 19:56:46 +0000 2010
>Originator:     Oleg Pilyavets
>Release:        NetBSD 5.0.2
>Organization:
unicam
>Environment:
NetBSD user 5.0.2 NetBSD 5.0.2 (MYKERNEL) #0: &#1074;&#1089; &#1072;&#1087;&#1088; 11 17:39:14 UTC 2010  spinore@user:/usr/src/sys/arch/i386/compile/MYKERNEL i386
>Description:
Developer of mpc (client for music player daemon) uses non-standard glibc extension to iconv, namely, //IGNORE. Therefore, no recoding to system locale happens on netbsd. At the same time, it works fine on Linux. The problem arises in versions of mpc>12.0.

The second problem is that, if stdout is not TTY, mpc does not make encoding conversion.

I failed to register in their http://musicpd.org/mantis/ bugtracker, so have to write this here.

>How-To-Repeat:
Commands
$ mpc ls
or
$ mpc playlist
show buggy encoding for Russian characters. My locale is:
$ locale
LANG="ru_RU.KOI8-R"
LC_CTYPE="ru_RU.KOI8-R"
LC_COLLATE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES="ru_RU.KOI8-R"
LC_ALL=""

At the same time, e.g., ncmpc client works fine.

Pipe problem can be reproduced by comparing commands
$ mpc
and
$ mpc | cat
whose outputs do not coincide.
>Fix:
Good fix should extensively change source code, but I used the following workaround. I switched off IGNORE in source code using these patches (for version 0.16):
$ diff -u OLD/mpc-0.16/src/main.c NEW/mpc-0.16/src/main.c
--- mpc-0.16/src/main.c 2009-05-25 15:39:01.000000000 +0200
+++ /home/spinore/mpcdir/mpc-0.16/src/main.c    2010-04-14 19:54:32.000000000 +0200
@@ -280,8 +280,9 @@

        /* initialization */

-       charset_init(command->pipe >= 0 || isatty(STDIN_FILENO),
-                    isatty(STDOUT_FILENO));
+       /* charset_init(command->pipe >= 0 || isatty(STDIN_FILENO),
+                    isatty(STDOUT_FILENO)); */
+       charset_init(1, 1);

        /* run */


$ diff -u OLD/mpc-0.16/src/charset.c NEW/mpc-0.16/src/charset.c 
--- mpc-0.16/src/charset.c      2009-05-25 15:38:59.000000000 +0200
+++ /home/spinore/mpcdir/mpc-0.16/src/charset.c 2010-04-14 19:46:40.000000000 +0200
@@ -189,7 +189,8 @@
        if (!enable_input && !enable_output)
                return;

-       ignore_invalid = isatty(STDOUT_FILENO) && isatty(STDIN_FILENO);
+       /* ignore_invalid = isatty(STDOUT_FILENO) && isatty(STDIN_FILENO); */
+       ignore_invalid = 0; 

        original_locale = setlocale(LC_CTYPE,"");
        if (original_locale == NULL)

However, if musicpd base cannot be reencoded in system locale, new problems will appear due to the patch.

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->simonb
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Wed, 14 Apr 2010 19:56:46 +0000
Responsible-Changed-Why:
Over to maintainer.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.