From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 30 10:59:48 2024 Received: (at submit) by debbugs.gnu.org; 30 Nov 2024 15:59:48 +0000 Received: from localhost ([127.0.0.1]:48347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHPsp-0001Cc-P1 for submit@debbugs.gnu.org; Sat, 30 Nov 2024 10:59:48 -0500 Received: from lists.gnu.org ([209.51.188.17]:53476) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHPsk-0001CG-EZ for submit@debbugs.gnu.org; Sat, 30 Nov 2024 10:59:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tHPsj-0004PB-PQ for bug-gnu-emacs@gnu.org; Sat, 30 Nov 2024 10:59:42 -0500 Received: from forward400d.mail.yandex.net ([2a02:6b8:c41:1300:1:45:d181:db01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tHPsf-0006zQ-5i for bug-gnu-emacs@gnu.org; Sat, 30 Nov 2024 10:59:40 -0500 Received: from mail-nwsmtp-smtp-production-main-19.klg.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-19.klg.yp-c.yandex.net [IPv6:2a02:6b8:c42:3143:0:640:c03:0]) by forward400d.mail.yandex.net (Yandex) with ESMTPS id C6F6A61B69 for ; Sat, 30 Nov 2024 18:59:26 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-19.klg.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id Pxei3HTOnqM0-g6L0eRI4; Sat, 30 Nov 2024 18:59:26 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1732982366; bh=IcwbElCNqngA24+VeR4itnhsY9h9zKgA4q4xbRAJYaY=; h=Message-ID:Date:To:Subject:From; b=iyRxm862cO0eQ2UzGXs76/29DpYPunizyNUwOC+EKspp+JbRqhGfgw/o/cb+1xxjI FWHIyNuYXEpQ8xtRILzYuRTjsBhBZ/9dd0dwAsEYT0ONNejRshbSZ7R3DUihDJDyXf GlP8UpfGvVZ2VgksXkOEeKKw2GCa4CMRSnntfcXk= Authentication-Results: mail-nwsmtp-smtp-production-main-19.klg.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Konstantin To: bug-gnu-emacs@gnu.org Subject: 29.4.50; Gnus cannot parse some filenames(UTF8) in an attachment Organization: Home Date: Sat, 30 Nov 2024 18:59:25 +0300 Message-ID: <87v7w44srm.fsf@localdomain> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a02:6b8:c41:1300:1:45:d181:db01; envelope-from=reich-cv@yandex.ru; helo=forward400d.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >From time to time i get emails with attachments from my colleges, which the= y send from "Roundcube" web-interface.=20 Often, i cannot open these attachments by =3DRET=3D(gnus-article-press-butt= on) or save them =3Do=3D(gnus-mime-save-part) with correct name. (interestingly =3DX-m=3D(gnus-summary-save-parts) works correctly) The reason is gnus cannot parse correctly some attached filenames. The example of such attachment (I took it from gnus-summary-show-raw-articl= e) --=3D_d38c0abddd645077f401d42fa430d9d5 Content-Transfer-Encoding: base64 Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingm= l.document; name=3D"=3D?UTF-8?Q?=3DD0=3D9E=3DD0=3DB1=3DD0=3DB7=3DD0=3DBE=3DD1=3D80_202= 4_=3D28=3DD0=3DBD=3DD0=3DB0_=3D2Ed?=3D =3D?UTF-8?Q?ocx?=3D" Content-Disposition: attachment; filename*0*=3DUTF-8''%D0%9E%D0%B1%D0%B7%D0%BE%D1%80%202024%20%28%D0%BD%D0; filename*1*=3D%B0%20.docx; size=3D10 c2Rmc2FmYXNmCg=3D=3D --=3D_d38c0abddd645077f401d42fa430d9d5-- I have tried to examine the reason. As i see it,=20=20 gnus-data for such attachment is formed incorrectly: (# ("application/vnd.openxmlformats-officedocument.word..." (name . "=D0=9E=D0=B1=D0=B7=D0=BE=D1=80 2024 (=D0=BD=D0=B0 .docx")) base64 nil ("attachment" (size . "10") (filename . "=D0=9E=D0=B1=D0=B7=D0=BE=D1=80 2024 (=D0=BD\320")) nil ni= l nil) One can see that the filename is broken. It should be "=D0=9E=D0=B1=D0=B7=D0=BE=D1=80 2024 (=D0=BD=D0=B0 .docx" just= like the name. I have attached the example of the mail(one can open it with nndoc) Please, could you fix this bug. --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=mail.test Content-Transfer-Encoding: base64 UmV0dXJuLXBhdGg6IDx0ZXN0QHRlc3QuY29tPgpFbnZlbG9wZS10bzogdGVzdEB0ZXN0LmNvbQpE ZWxpdmVyeS1kYXRlOiBTYXQsIDMwIE5vdiAyMDI0IDExOjA0OjM1ICswMzAwCk1JTUUtVmVyc2lv bjogMS4wCkRhdGU6IFNhdCwgMzAgTm92IDIwMjQgMTE6MDQ6MzUgKzAxMDAKRnJvbTogcmVpY2gg PHRlc3RAdGVzdC5jb20+ClRvOiB0ZXN0QHRlc3QuY29tClN1YmplY3Q6IHRlc3QKTWVzc2FnZS1J RDogPDFhYWM3Njc2YTgzOGYzZWM3YTE2ODIwZjY1ZTZmZjRjQHRlc3QuY29tPgpDb250ZW50LVR5 cGU6IG11bHRpcGFydC9taXhlZDsKIGJvdW5kYXJ5PSI9X2QzOGMwYWJkZGQ2NDUwNzdmNDAxZDQy ZmE0MzBkOWQ1IgoKLS09X2QzOGMwYWJkZGQ2NDUwNzdmNDAxZDQyZmE0MzBkOWQ1CkNvbnRlbnQt VHJhbnNmZXItRW5jb2Rpbmc6IGJhc2U2NApDb250ZW50LVR5cGU6IGFwcGxpY2F0aW9uL3ZuZC5v cGVueG1sZm9ybWF0cy1vZmZpY2Vkb2N1bWVudC53b3JkcHJvY2Vzc2luZ21sLmRvY3VtZW50Owog bmFtZT0iPT9VVEYtOD9RPz1EMD05RT1EMD1CMT1EMD1CNz1EMD1CRT1EMT04MF8yMDI0Xz0yOD1E MD1CRD1EMD1CMF89MkVkPz0KID0/VVRGLTg/UT9vY3g/PSIKQ29udGVudC1EaXNwb3NpdGlvbjog YXR0YWNobWVudDsKIGZpbGVuYW1lKjAqPVVURi04JyclRDAlOUUlRDAlQjElRDAlQjclRDAlQkUl RDElODAlMjAyMDI0JTIwJTI4JUQwJUJEJUQwOwogZmlsZW5hbWUqMSo9JUIwJTIwLmRvY3g7CiBz aXplPTEwCgpjMlJtYzJGbVlYTm1DZz09Ci0tPV9kMzhjMGFiZGRkNjQ1MDc3ZjQwMWQ0MmZhNDMw ZDlkNS0tCg== --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 30 11:20:29 2024 Received: (at 74624) by debbugs.gnu.org; 30 Nov 2024 16:20:29 +0000 Received: from localhost ([127.0.0.1]:48386 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHQCq-0002S4-Uj for submit@debbugs.gnu.org; Sat, 30 Nov 2024 11:20:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41134) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHQCp-0002Rq-5K for 74624@debbugs.gnu.org; Sat, 30 Nov 2024 11:20:27 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tHQCj-0004cx-Qq; Sat, 30 Nov 2024 11:20:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=OlH0S5ae4gC6y2vbfmEnwYirubgVgSVZRxEfiZEqJBw=; b=g/bjvy5MK8R3ert41FtE H757ei53VJHHXjHk7+e6M2JqrzXl9iQ/wxvguK07o7u2OhvotvdpMd6BQEQmag5QxHaNz1AX82Gwz wAptnXVb22X7oRK4HASyDl9X7g8nBpQPnt6FKFDb8OojlRr7UnEIfWGRM6cJpdteNUWcz+4CJBqND UIwIhWZwEQyaJ8K3ZfHzUxGYuODGjGAIIo1PdZDBjWpo6cN0lSZCKUHBCm/1zUuhC1pneWW0h7htc i76aQOOAsGtQGZdsbko8YccQ7RIpI7aOqWTjsrjN2RtcCE2cMjWDBRIQVIM9jvhfvUHVonRg2bHJW C6xToDdIj4tW5w==; Date: Sat, 30 Nov 2024 18:20:18 +0200 Message-Id: <86ed2s7kxp.fsf@gnu.org> From: Eli Zaretskii To: Konstantin In-Reply-To: <87v7w44srm.fsf@localdomain> (message from Konstantin on Sat, 30 Nov 2024 18:59:25 +0300) Subject: Re: bug#74624: 29.4.50; Gnus cannot parse some filenames(UTF8) in an attachment References: <87v7w44srm.fsf@localdomain> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74624 Cc: 74624@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Konstantin > Date: Sat, 30 Nov 2024 18:59:25 +0300 > > >From time to time i get emails with attachments from my colleges, which they send from > "Roundcube" web-interface. > > Often, i cannot open these attachments by =RET=(gnus-article-press-button) > or save them =o=(gnus-mime-save-part) with correct name. > (interestingly =X-m=(gnus-summary-save-parts) works correctly) > > The reason is gnus cannot parse correctly some attached filenames. > > The example of such attachment (I took it from gnus-summary-show-raw-article) > > --=_d38c0abddd645077f401d42fa430d9d5 > Content-Transfer-Encoding: base64 > Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document; > name="=?UTF-8?Q?=D0=9E=D0=B1=D0=B7=D0=BE=D1=80_2024_=28=D0=BD=D0=B0_=2Ed?= > =?UTF-8?Q?ocx?=" > Content-Disposition: attachment; > filename*0*=UTF-8''%D0%9E%D0%B1%D0%B7%D0%BE%D1%80%202024%20%28%D0%BD%D0; > filename*1*=%B0%20.docx; > size=10 > > c2Rmc2FmYXNmCg== > --=_d38c0abddd645077f401d42fa430d9d5-- > > I have tried to examine the reason. As i see it, > gnus-data for such attachment is formed incorrectly: > > (# > ("application/vnd.openxmlformats-officedocument.word..." > (name . "Обзор 2024 (на .docx")) > base64 nil > ("attachment" (size . "10") > (filename . "Обзор 2024 (н\320")) nil nil nil) > > One can see that the filename is broken. > It should be "Обзор 2024 (на .docx" just like the name. It looks like Gnus fails to decipher the file name when it is split in the middle of a UTF-8 sequence. I don't know Gnus. If you can help me by showing where the value of 'gnus-data property is calculated, I might be able to find the bug and suggest a fix. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 01 01:25:23 2024 Received: (at 74624) by debbugs.gnu.org; 1 Dec 2024 06:25:23 +0000 Received: from localhost ([127.0.0.1]:49952 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHdOV-0004JU-C7 for submit@debbugs.gnu.org; Sun, 01 Dec 2024 01:25:23 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:57430) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHdOT-0004JB-1L for 74624@debbugs.gnu.org; Sun, 01 Dec 2024 01:25:21 -0500 Received: by mail-pf1-f195.google.com with SMTP id d2e1a72fcca58-724d8422f37so2558121b3a.2 for <74624@debbugs.gnu.org>; Sat, 30 Nov 2024 22:25:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733034255; x=1733639055; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Q9xHDGK1J9PvsymZcA0YhmqV6pNAhc/ZKV4742pxX40=; b=F/ioFuH8FiCgLyNj4Ow3KZoWeJo9ryhETMfy+eYGZ+3fEHIp2rBn3Xi2l1Vszrmwbo OtbPF4I0+MMAvkfHXcQeOps2v2pb2Icu9g3rcEr6gkb5FDv+vNTsrtzCXkV839p+h2qv OygI6DL7fp3uqAXHucZ/g+o2UjDswEnkcFyC3Pkwz2lweNDofyVduUjOuvBV0fBOUb3d lnDs/V22tTcWA1CiJl1fmZ0JkTVe12SRpo/MolrQI6WedwwyP/JiJc73apla7Px5XltN 0cSGJijKKJFomlgtFk5GOZDbHyHRWcmIIwixsUUwsg+XczWhe/VZQZXiiHaGNHsJ5m2N Ghmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733034255; x=1733639055; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Q9xHDGK1J9PvsymZcA0YhmqV6pNAhc/ZKV4742pxX40=; b=LlTH0gCboQYeElSCKju8M3kfbkYkkZu0BT0wcCLYs8Yc2TOBontnm2nlYWM08kLMM1 UvSa03NNXr1Xu3UNUP8xzsiTvi8Gzz1QlwgXMFqjaiYnTo16OY7Oh+rd9bKkHX8suS5E dgQD1Z1xyhvisUkxJCh2YjP2eEHNB2iUhosfVwmGLvXbpzVL4a2dtAqWk0mj1j3kdIYY ztkqGhBN4zv6kyi24YZm19/80180zquOtpKGxdxLptZJHJ5lAO+aJtHH1Lcl7JY02PD1 gCvciwJ4j8rudqrLMYoGdLEbYrOaHN4tbL84/SxjiIPZbXZQOlHJ3af/nAoTpGOf88PH CWDQ== X-Forwarded-Encrypted: i=1; AJvYcCXYt7YY4MSpf0BsLBEDtMM13gnYnvy5rRZhj5n5GSIdZGsDjpITnZxeE/zTje2wtvKo0D8g2A==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzIBDEgK5Mt+cuXFe3RM5MtU2BN/giamHbwXthKtJP2PEG3fHzJ rEZ3PtvDcMwZpo7ke3QWNC9eDZBBxHxRmvkQIGbgTIowP+AwQM1c X-Gm-Gg: ASbGncuGtzXMRNRwWlh6u5jrLh1ShnIsVoBoBtXHaF7zPCXBhCDj1GV1yLiR9mpyXps y/sr28GgQvijvGblXr8aso7Zc7UBjcE46YPJ6iHPitBcgLT7evnZ7lu/V9ZMlmEfOVc3ide+mzC b35jnJv6m6nk0VbyUm0pcT87VPIrdENVEPVJxhgdjNRJ7KVpsB/kM6cUdSiKiZCsWVcmQYr/kl5 iUXRTF/LVk/UGl/e5COZ3q52UplvHLqSlIvs/oJe+7B8mA= X-Google-Smtp-Source: AGHT+IFRKTX/IZJNKWVHPbV0OKx/jugLS/YIeUGOP6dB2Weg+XyzC1flg8vHIDHITeXeGhEtHMpXbw== X-Received: by 2002:a05:6a00:928e:b0:71e:659:f2e7 with SMTP id d2e1a72fcca58-72530013bd7mr30808377b3a.8.1733034255144; Sat, 30 Nov 2024 22:24:15 -0800 (PST) Received: from localhost ([115.240.90.130]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7254176f8f9sm6311116b3a.66.2024.11.30.22.24.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2024 22:24:14 -0800 (PST) From: Visuwesh To: Eli Zaretskii Subject: Re: bug#74624: 29.4.50; Gnus cannot parse some filenames(UTF8) in an attachment In-Reply-To: <86ed2s7kxp.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 30 Nov 2024 18:20:18 +0200") References: <87v7w44srm.fsf@localdomain> <86ed2s7kxp.fsf@gnu.org> Date: Sun, 01 Dec 2024 11:54:11 +0530 Message-ID: <875xo3q5tg.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74624 Cc: 74624@debbugs.gnu.org, Konstantin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) [=E0=AE=9A=E0=AE=A9=E0=AE=BF =E0=AE=A8=E0=AE=B5=E0=AE=AE=E0=AF=8D=E0=AE=AA= =E0=AE=B0=E0=AF=8D 30, 2024] Eli Zaretskii wrote: >> From: Konstantin >> Date: Sat, 30 Nov 2024 18:59:25 +0300 >>=20 >> >From time to time i get emails with attachments from my colleges, which= they send from >> "Roundcube" web-interface.=20 >>=20 >> Often, i cannot open these attachments by =3DRET=3D(gnus-article-press-b= utton) >> or save them =3Do=3D(gnus-mime-save-part) with correct name. >> (interestingly =3DX-m=3D(gnus-summary-save-parts) works correctly) >>=20 >> The reason is gnus cannot parse correctly some attached filenames. >>=20 >> The example of such attachment (I took it from gnus-summary-show-raw-art= icle) >>=20 >> --=3D_d38c0abddd645077f401d42fa430d9d5 >> Content-Transfer-Encoding: base64 >> Content-Type: application/vnd.openxmlformats-officedocument.wordprocessi= ngml.document; >> name=3D"=3D?UTF-8?Q?=3DD0=3D9E=3DD0=3DB1=3DD0=3DB7=3DD0=3DBE=3DD1=3D80_= 2024_=3D28=3DD0=3DBD=3DD0=3DB0_=3D2Ed?=3D >> =3D?UTF-8?Q?ocx?=3D" >> Content-Disposition: attachment; >> filename*0*=3DUTF-8''%D0%9E%D0%B1%D0%B7%D0%BE%D1%80%202024%20%28%D0%BD%= D0; >> filename*1*=3D%B0%20.docx; >> size=3D10 >>=20 >> c2Rmc2FmYXNmCg=3D=3D >> --=3D_d38c0abddd645077f401d42fa430d9d5-- >>=20 >> I have tried to examine the reason. As i see it,=20=20 >> gnus-data for such attachment is formed incorrectly: >>=20 >> (# >> ("application/vnd.openxmlformats-officedocument.word..." >> (name . "=D0=9E=D0=B1=D0=B7=D0=BE=D1=80 2024 (=D0=BD=D0=B0 .docx")) >> base64 nil >> ("attachment" (size . "10") >> (filename . "=D0=9E=D0=B1=D0=B7=D0=BE=D1=80 2024 (=D0=BD\320")) nil= nil nil) >>=20 >> One can see that the filename is broken. >> It should be "=D0=9E=D0=B1=D0=B7=D0=BE=D1=80 2024 (=D0=BD=D0=B0 .docx" j= ust like the name. > > It looks like Gnus fails to decipher the file name when it is split in > the middle of a UTF-8 sequence. > > I don't know Gnus. If you can help me by showing where the value of > 'gnus-data property is calculated, I might be able to find the bug and > suggest a fix. The decoding of the filename in the Content-Disposition header is done in mm-dissect-buffer by calling mail-header-parse-content-disposition. Specifically, rfc2231-parse-string. The following patch fixes the issue on my end: diff --git a/lisp/mail/rfc2231.el b/lisp/mail/rfc2231.el index 33324cafb5b..632e270a922 100644 --- a/lisp/mail/rfc2231.el +++ b/lisp/mail/rfc2231.el @@ -193,7 +193,7 @@ rfc2231-parse-string (push (list attribute value encoded) cparams)) ;; Repetition of a part; do nothing. ((and elem - (null number)) + (null part)) ) ;; Concatenate continuation parts. (t NUMBER is the variable used during the parsing portion of the function in the big condition-case form above the cl-loop form which the patch modifies. In the header below Content-Disposition: attachment; filename*0*=3DUTF-8''%D0%9E%D0%B1%D0%B7%D0%BE%D1%80%202024%20%28%D0%B= D%D0; filename*1*=3D%B0%20.docx; size=3D10 the function first parses filename*0* and here NUMBER is 0, then filename*1* and here NUMBER is 1. By the time it finishes parsing size, NUMBER is set to nil. The loop should use the value of NUMBER pushed to PARAMETERS as the 3rd element (referred to as `part' by the cl-loop form) instead of whatever value NUMBER happened to be when we parsed the last element. From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 01 02:53:11 2024 Received: (at 74624) by debbugs.gnu.org; 1 Dec 2024 07:53:12 +0000 Received: from localhost ([127.0.0.1]:50131 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHelT-0000k3-Br for submit@debbugs.gnu.org; Sun, 01 Dec 2024 02:53:11 -0500 Received: from forward502d.mail.yandex.net ([178.154.239.210]:44708) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHelR-0000jf-EM for 74624@debbugs.gnu.org; Sun, 01 Dec 2024 02:53:10 -0500 Received: from mail-nwsmtp-smtp-production-main-19.klg.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-19.klg.yp-c.yandex.net [IPv6:2a02:6b8:c42:3143:0:640:c03:0]) by forward502d.mail.yandex.net (Yandex) with ESMTPS id 81D2160F5F; Sun, 1 Dec 2024 10:52:33 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-19.klg.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id VqXxb5ZOneA0-bPROPQPD; Sun, 01 Dec 2024 10:52:33 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1733039553; bh=8NicyL+SOomDlvN6yb2AXSZn7X5mUPDOKRdhzSAtyEI=; h=Cc:Message-ID:References:Date:In-Reply-To:Subject:To:From; b=Yq6DsfyZ3bqvWoO3IVGU9V3Ny0ESBhcH+W5Rv4ttkWxum2fODykvkDsgDEYjJJlg8 vxL2Bbk8GPE9quhauhr2j0foSsxlIj2t2IXII/7R8j6ssmDnQlOuFpgNUmI1utcxs6 9EhhyLgCLCWbUrp4il0RgDRo7B1mK5/V8xy18tLg= Authentication-Results: mail-nwsmtp-smtp-production-main-19.klg.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Konstantin To: Visuwesh Subject: Re: bug#74624: 29.4.50; Gnus cannot parse some filenames(UTF8) in an attachment In-Reply-To: <875xo3q5tg.fsf@gmail.com> (Visuwesh's message of "Sun, 01 Dec 2024 11:54:11 +0530") Organization: Home References: <87v7w44srm.fsf@localdomain> <86ed2s7kxp.fsf@gnu.org> <875xo3q5tg.fsf@gmail.com> Date: Sun, 01 Dec 2024 10:52:30 +0300 Message-ID: <87bjxvsuv5.fsf@localdomain> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74624 Cc: Eli Zaretskii , 74624@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Visuwesh writes: > [=E0=AE=9A=E0=AE=A9=E0=AE=BF =E0=AE=A8=E0=AE=B5=E0=AE=AE=E0=AF=8D=E0=AE= =AA=E0=AE=B0=E0=AF=8D 30, 2024] Eli Zaretskii wrote: > >>> From: Konstantin >>> Date: Sat, 30 Nov 2024 18:59:25 +0300 >>>=20 >>> >From time to time i get emails with attachments from my colleges, whic= h they send from >>> "Roundcube" web-interface.=20 >>>=20 >>> Often, i cannot open these attachments by =3DRET=3D(gnus-article-press-= button) >>> or save them =3Do=3D(gnus-mime-save-part) with correct name. >>> (interestingly =3DX-m=3D(gnus-summary-save-parts) works correctly) >>>=20 >>> The reason is gnus cannot parse correctly some attached filenames. >>>=20 >>> The example of such attachment (I took it from gnus-summary-show-raw-ar= ticle) >>>=20 >>> --=3D_d38c0abddd645077f401d42fa430d9d5 >>> Content-Transfer-Encoding: base64 >>> Content-Type: application/vnd.openxmlformats-officedocument.wordprocess= ingml.document; >>> name=3D"=3D?UTF-8?Q?=3DD0=3D9E=3DD0=3DB1=3DD0=3DB7=3DD0=3DBE=3DD1=3D80= _2024_=3D28=3DD0=3DBD=3DD0=3DB0_=3D2Ed?=3D >>> =3D?UTF-8?Q?ocx?=3D" >>> Content-Disposition: attachment; >>> filename*0*=3DUTF-8''%D0%9E%D0%B1%D0%B7%D0%BE%D1%80%202024%20%28%D0%BD= %D0; >>> filename*1*=3D%B0%20.docx; >>> size=3D10 >>>=20 >>> c2Rmc2FmYXNmCg=3D=3D >>> --=3D_d38c0abddd645077f401d42fa430d9d5-- >>>=20 >>> I have tried to examine the reason. As i see it,=20=20 >>> gnus-data for such attachment is formed incorrectly: >>>=20 >>> (# >>> ("application/vnd.openxmlformats-officedocument.word..." >>> (name . "=D0=9E=EF=B8=8F=D0=B1=D0=B7=D0=BE=D1=80 2024 (=D0=BD=D0= =B0 .docx")) >>> base64 nil >>> ("attachment" (size . "10") >>> (filename . "=D0=9E=EF=B8=8F=D0=B1=D0=B7=D0=BE=D1=80 2024 (=D0=BD\= 320")) nil nil nil) >>>=20 >>> One can see that the filename is broken. >>> It should be "=D0=9E=EF=B8=8F=D0=B1=D0=B7=D0=BE=D1=80 2024 (=D0=BD=D0= =B0 .docx" just like the name. >> >> It looks like Gnus fails to decipher the file name when it is split in >> the middle of a UTF-8 sequence. >> >> I don't know Gnus. If you can help me by showing where the value of >> 'gnus-data property is calculated, I might be able to find the bug and >> suggest a fix. > > The decoding of the filename in the Content-Disposition header is done > in mm-dissect-buffer by calling mail-header-parse-content-disposition. > Specifically, rfc2231-parse-string. The following patch fixes the issue > on my end: > > diff --git a/lisp/mail/rfc2231.el b/lisp/mail/rfc2231.el > index 33324cafb5b..632e270a922 100644 > --- a/lisp/mail/rfc2231.el > +++ b/lisp/mail/rfc2231.el > @@ -193,7 +193,7 @@ rfc2231-parse-string > (push (list attribute value encoded) cparams)) > ;; Repetition of a part; do nothing. > ((and elem > - (null number)) > + (null part)) > ) > ;; Concatenate continuation parts. > (t > > NUMBER is the variable used during the parsing portion of the function > in the big condition-case form above the cl-loop form which the patch > modifies. In the header below > > Content-Disposition: attachment; > filename*0*=3DUTF-8''%D0%9E%D0%B1%D0%B7%D0%BE%D1%80%202024%20%28%D0= %BD%D0; > filename*1*=3D%B0%20.docx; > size=3D10 > > the function first parses filename*0* and here NUMBER is 0, then > filename*1* and here NUMBER is 1. By the time it finishes parsing size, > NUMBER is set to nil. The loop should use the value of NUMBER pushed to > PARAMETERS as the 3rd element (referred to as `part' by the cl-loop > form) instead of whatever value NUMBER happened to be when we parsed the > last element. Thank you, indeed the patch fixes this bug. From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 01 03:17:44 2024 Received: (at 74624-done) by debbugs.gnu.org; 1 Dec 2024 08:17:44 +0000 Received: from localhost ([127.0.0.1]:50194 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHf9D-00026e-PT for submit@debbugs.gnu.org; Sun, 01 Dec 2024 03:17:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40954) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHf9B-00026M-Ma for 74624-done@debbugs.gnu.org; Sun, 01 Dec 2024 03:17:42 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tHf96-0005qp-G6; Sun, 01 Dec 2024 03:17:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=9eUqj//lPSxTqOKk08JreWL8gh2kXGsOXD17Rc479RQ=; b=YfdeLYPQms5e NEyqc3PPIizpuSnZg/9i1QraMgx/pDC5noi+zMIgLbvzp6t5kVr9ttq4IgOdFtsz1eadNr1FeCr/o 3sUA1vgPVpjfAdKdeMZbka1IqA/zkHexwGiS7huCSqqCNbLA8zDcMcL3KAOkLvF+nC/WrueUkH9Nw juiWKKiyCMWumL4x/ods5h1thLp8pdfR1sATBf2Z8JJmonlYoEkEwbSBgrADqusHzQV7YMjzl8YwZ RDRv9PQTO6dh6HvgZb8Yl/XBMUvuGvZ227x7ZJGk9aM6LV6uZM00m7bYypctIJJPpXtTIP//wNifY LMYtDHzESIpLEUuLbw7HPA==; Date: Sun, 01 Dec 2024 10:17:33 +0200 Message-Id: <86frn76cma.fsf@gnu.org> From: Eli Zaretskii To: Konstantin In-Reply-To: <87bjxvsuv5.fsf@localdomain> (message from Konstantin on Sun, 01 Dec 2024 10:52:30 +0300) Subject: Re: bug#74624: 29.4.50; Gnus cannot parse some filenames(UTF8) in an attachment References: <87v7w44srm.fsf@localdomain> <86ed2s7kxp.fsf@gnu.org> <875xo3q5tg.fsf@gmail.com> <87bjxvsuv5.fsf@localdomain> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74624-done Cc: 74624-done@debbugs.gnu.org, visuweshm@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Konstantin > Cc: Eli Zaretskii , 74624@debbugs.gnu.org > Date: Sun, 01 Dec 2024 10:52:30 +0300 > > > Visuwesh writes: > > > The decoding of the filename in the Content-Disposition header is done > > in mm-dissect-buffer by calling mail-header-parse-content-disposition. > > Specifically, rfc2231-parse-string. The following patch fixes the issue > > on my end: > > > > diff --git a/lisp/mail/rfc2231.el b/lisp/mail/rfc2231.el > > index 33324cafb5b..632e270a922 100644 > > --- a/lisp/mail/rfc2231.el > > +++ b/lisp/mail/rfc2231.el > > @@ -193,7 +193,7 @@ rfc2231-parse-string > > (push (list attribute value encoded) cparams)) > > ;; Repetition of a part; do nothing. > > ((and elem > > - (null number)) > > + (null part)) > > ) > > ;; Concatenate continuation parts. > > (t > > > > NUMBER is the variable used during the parsing portion of the function > > in the big condition-case form above the cl-loop form which the patch > > modifies. In the header below > > > > Content-Disposition: attachment; > > filename*0*=UTF-8''%D0%9E%D0%B1%D0%B7%D0%BE%D1%80%202024%20%28%D0%BD%D0; > > filename*1*=%B0%20.docx; > > size=10 > > > > the function first parses filename*0* and here NUMBER is 0, then > > filename*1* and here NUMBER is 1. By the time it finishes parsing size, > > NUMBER is set to nil. The loop should use the value of NUMBER pushed to > > PARAMETERS as the 3rd element (referred to as `part' by the cl-loop > > form) instead of whatever value NUMBER happened to be when we parsed the > > last element. > > Thank you, > > indeed the patch fixes this bug. Thanks, installed on the emacs-30 branch, and closing the bug. From unknown Thu Jun 19 14:26:06 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 29 Dec 2024 12:24:09 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator