From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Kazuhiro Ito Newsgroups: gmane.emacs.bugs Subject: bug#44411: 28.0.50; uudecode-decode-region-internal is broken Date: Wed, 04 Nov 2020 17:26:56 +0900 Message-ID: <86wnz14je7.wl--xmue@d1.dion.ne.jp> References: <86y2ji6e0y.wl--xmue@d1.dion.ne.jp> <83d00ucv0j.fsf@gnu.org> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13723"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL-LB/10.8 Emacs/28.0.50 (x86_64-w64-mingw32) MULE/6.0 (HANACHIRUSATO) Cc: 44411@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 04 09:28:11 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 1kaE9K-0003Pk-UP for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 04 Nov 2020 09:28:10 +0100 Original-Received: from localhost ([::1]:45634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kaE9H-0002IW-W3 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 04 Nov 2020 03:28:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kaE9C-0002IP-9d for bug-gnu-emacs@gnu.org; Wed, 04 Nov 2020 03:28:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35783) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kaE9C-0003jo-0S for bug-gnu-emacs@gnu.org; Wed, 04 Nov 2020 03:28:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kaE9B-0006DT-T6 for bug-gnu-emacs@gnu.org; Wed, 04 Nov 2020 03:28:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Kazuhiro Ito Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 04 Nov 2020 08:28:01 +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.160447842323813 (code B ref 44411); Wed, 04 Nov 2020 08:28:01 +0000 Original-Received: (at 44411) by debbugs.gnu.org; 4 Nov 2020 08:27:03 +0000 Original-Received: from localhost ([127.0.0.1]:47329 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kaE8E-0006C1-PZ for submit@debbugs.gnu.org; Wed, 04 Nov 2020 03:27:03 -0500 Original-Received: from snd00005.auone-net.jp ([111.86.247.5]:24289 helo=dmta0002.auone-net.jp) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kaE8B-0006BV-N9 for 44411@debbugs.gnu.org; Wed, 04 Nov 2020 03:27:01 -0500 Original-Received: from kzhr.d1.dion.ne.jp by dmta0002.auone-net.jp with ESMTP id <20201104082656798.SHW.69332.kzhr.d1.dion.ne.jp@dmta0002.auone-net.jp>; Wed, 4 Nov 2020 17:26:56 +0900 In-Reply-To: <83d00ucv0j.fsf@gnu.org> 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:192661 Archived-At: > > When I call uudecode-decode-region-internal in multibyte buffer, it > > fails to decode eight-bit characters. > > 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? > Can you describe the real-life use case where this happened? 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. > Please show only the changes to fix what you think is a bug. Here is. diff --git a/lisp/mail/uudecode.el b/lisp/mail/uudecode.el index bcbd571b53..81a0a8ae0d 100644 --- a/lisp/mail/uudecode.el +++ b/lisp/mail/uudecode.el @@ -151,9 +151,9 @@ uudecode-decode-region-internal (cond ((= counter 4) (setq result (cons (concat - (char-to-string (ash bits -16)) - (char-to-string (logand (ash bits -8) 255)) - (char-to-string (logand bits 255))) + (unibyte-string (ash bits -16)) + (unibyte-string (logand (ash bits -8) 255)) + (unibyte-string (logand bits 255))) result)) (setq bits 0 counter 0)) (t (setq bits (ash bits 6))))))) @@ -168,12 +168,12 @@ uudecode-decode-region-internal ((= counter 3) (setq result (cons (concat - (char-to-string (logand (ash bits -16) 255)) - (char-to-string (logand (ash bits -8) 255))) + (unibyte-string (logand (ash bits -16) 255)) + (unibyte-string (logand (ash bits -8) 255))) result))) ((= counter 2) (setq result (cons - (char-to-string (logand (ash bits -10) 255)) + (unibyte-string (logand (ash bits -10) 255)) result)))) (skip-chars-forward non-data-chars end)) (if file-name @@ -184,7 +184,7 @@ uudecode-decode-region-internal (goto-char start) (if enable-multibyte-characters (dolist (x (nreverse result)) - (insert (decode-coding-string x 'binary))) + (insert x)) (insert (apply #'concat (nreverse result)))) (delete-region (point) end)))))) -- Kazuhiro Ito