From owner-freebsd-hackers@FreeBSD.ORG Tue Nov 11 00:10:01 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 48EBC16A4CE for ; Tue, 11 Nov 2003 00:10:01 -0800 (PST) Received: from hpna.infotecstt.ru (hpna.infotecstt.ru [80.68.0.217]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3BCDA43FE3 for ; Tue, 11 Nov 2003 00:09:58 -0800 (PST) (envelope-from xm@x-infinity.com) Received: from XMWXP (ms69vi [80.68.3.184]) by hpna.infotecstt.ru (8.11.6/8.11.6) with ESMTP id hAB899S00913 for ; Tue, 11 Nov 2003 11:09:12 +0300 From: "Aristarkh A Zagorodnikov" To: Date: Tue, 11 Nov 2003 11:09:09 +0300 Message-ID: <000001c3a82b$1a678d80$0600a8c0@XMWXP> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4510 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Subject: PR bin/59167 fix question X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Nov 2003 08:10:01 -0000 Hi! Recently, I submitted PR bin/59167 and I'm interested in the preferred way of fixing it. Below, I duplicate the "Fix" section of submitted PR for your convenience. Note that the following conclusions are made after only a brief looking = at the problem code so they may be partially or event completely wrong. The fix involves support for __SSTR and __SALC FILE flags in output = function which is called from internal formatting function __vfwprintf. Currently, __vfwprintf uses __fputwc for output, which in = turn uses __sputc which blindly writes characters and calls __swbuf when buffer is exhausted. In contrast, single-character internal formatting function __vfprintf uses __sfvwrite function to write output, which correctly handles __SSTR and __SALC FILE flags (reallocating the buffer) and does not exhibit the problem. So, proposed solutions are: 1. rewrite __vfwprintf output to use something other than __fputwc (i.e. = use __sfvwrite with some wcs->mbcs preprocessing?) 2. fix __fputwc to support the __SSTR and __SALC flags (bad idea, this function should be fast) 3. fix __swbuf to support the __SSTR and __SALC flags (looks good to me, especially because it's called at the exact time when buffer is about to overflow) I already concluded a quick patch using (3), but not tested it good = enough, so I'm not posting it here. If someone considers that my patch can be of any value, I will gladly = submit it for review. Aristarkh A Zagorodnikov X-Infinity Software