X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Date: Wed, 27 Aug 2008 16:27:58 +0200
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: printf: %ls or %S does not work when string is of length 1.
Message-ID: <20080827142758.GA14761@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <e27efe130808270654p515fce76y8356edbfec8b7830@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <e27efe130808270654p515fce76y8356edbfec8b7830@mail.gmail.com>
User-Agent: Mutt/1.5.16 (2007-06-09)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Aug 27 15:54, Amaury Forgeot d'Arc wrote:
> Hello,
> it seems that cygwin does not correctly handle the %ls format when the
> given string
> has only one character.
> 
> The following program should print
>     Test 1 (T)
> and that's what it does on Linux 64bit and Windows, when compiled with VS8.0
> 
> But cygwin's output is
>     Test 1
> 
> I've seen this only for 1-wchar strings.
> This is will be a problem with the upcoming python 3.0 interpreter, as
> reported here:
> http://bugs.python.org/issue3626
> 
> Is there a problem with cygwin's implementation, or did I miss
> something obvious?
> 
> 
> /* ======================================== */
> #include <stdio.h>
> int main()
> {
>   wchar_t text[] = L"T";
>   printf("Test %d (%ls)\n", wcslen(text), text);
> }
> /* ======================================== */

Thanks for the testcase.  This looks like a bug in the newlib function
_wcsrtombs_r.  I'll send a bug report and a proposed fix upstream.
This will be fixed in Cygwin 1.7.


Thanks again,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

