From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#44411: 28.0.50; uudecode-decode-region-internal is broken Date: Wed, 04 Nov 2020 17:26:52 +0200 Message-ID: <83o8kdb0sj.fsf@gnu.org> References: <86y2ji6e0y.wl--xmue@d1.dion.ne.jp> <83d00ucv0j.fsf@gnu.org> <86wnz14je7.wl--xmue@d1.dion.ne.jp> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9648"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 44411@debbugs.gnu.org To: Kazuhiro Ito Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 04 16:46:10 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kaKzC-0002Ow-1l for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 04 Nov 2020 16:46:10 +0100 Original-Received: from localhost ([::1]:41912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kaKzB-0002Sm-1u for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 04 Nov 2020 10:46:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kaKhe-0001Qk-Sh for bug-gnu-emacs@gnu.org; Wed, 04 Nov 2020 10:28:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38741) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kaKhe-0000kf-KL for bug-gnu-emacs@gnu.org; Wed, 04 Nov 2020 10:28:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kaKhe-0003AY-Ha for bug-gnu-emacs@gnu.org; Wed, 04 Nov 2020 10:28:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 04 Nov 2020 15:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44411 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 44411-submit@debbugs.gnu.org id=B44411.160450362812096 (code B ref 44411); Wed, 04 Nov 2020 15:28:02 +0000 Original-Received: (at 44411) by debbugs.gnu.org; 4 Nov 2020 15:27:08 +0000 Original-Received: from localhost ([127.0.0.1]:50282 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kaKgm-000392-2m for submit@debbugs.gnu.org; Wed, 04 Nov 2020 10:27:08 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33508) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kaKgk-00038l-V3 for 44411@debbugs.gnu.org; Wed, 04 Nov 2020 10:27:07 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:41394) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kaKge-0000d7-Ld; Wed, 04 Nov 2020 10:27:00 -0500 Original-Received: from [176.228.60.248] (port=3283 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kaKga-0000m2-N5; Wed, 04 Nov 2020 10:26:58 -0500 In-Reply-To: <86wnz14je7.wl--xmue@d1.dion.ne.jp> (message from Kazuhiro Ito on Wed, 04 Nov 2020 17:26:56 +0900) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:192672 Archived-At: > Date: Wed, 04 Nov 2020 17:26:56 +0900 > From: Kazuhiro Ito > Cc: 44411@debbugs.gnu.org > > > What do you mean by "decode eight-bit characters"? > > I mean "decode uuencoded raw bytes 128-255 as eight-bit characters". > > > How could such "characters" appear in uuencoded email message? > > I did not said anything about uuencoded email message. What do you > mean? Sorry, it looks like I misunderstood the use case. Ignore that question. > 1. Yank below uuencoded string into multibyte buffer. > > begin 644 c8c8c8c8.bin > $R,C(R```@ > `` > end > size 4 > > 2. C-SPC at the beginning of uuencoded text and move point to the end > of uuencoded text. > > 3. M-x uudecode-decode-region-internal > > 4. decoded result is broken. Original data is 4bytes of 0xc8, but > inserted text is "8888". uudecode-decode-region-external returns > expected result. OK, I see the problem now: it's the call to decode-coding-string, which replaced string-as-unibyte of yore. > > Please show only the changes to fix what you think is a bug. > > Here is. OK, I agree also to your other optimizations, but can we please go a step further and avoid consing a string here? 'insert' is perfectly capable of inserting characters, not only strings. So in the unibyte-buffer case, just something like (apply #'insert (nreverse result)) with 'result' being a list of bytes, will produce what you want. And in the multibyte-buffer case you just need to convert each byte to its Unicode-compatible codepoint, by using (decode-char 'eight-bit CH) probably in 'mapcar' or somesuch, and then call 'insert'. Can you augment your patch along these lines, please? Thanks.