From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#70301: 30.0.50; secrets-create-item mangles cyrillic passwords Date: Wed, 10 Apr 2024 17:32:43 +0200 Message-ID: <87jzl5s06c.fsf@gmx.de> References: <1712650236526.1662743497.3911072838@cdots.bg> <86o7aix3wq.fsf@gnu.org> Reply-To: Michael Albinus Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10891"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 70301@debbugs.gnu.org, k.ninev@cdots.bg To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 10 17:34:33 2024 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 1ruZy4-0002YC-RB for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Apr 2024 17:34:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruZxW-0001Dm-A5; Wed, 10 Apr 2024 11:33:58 -0400 Original-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 1ruZxV-0001DH-1G for bug-gnu-emacs@gnu.org; Wed, 10 Apr 2024 11:33:57 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruZxU-0005X2-Os for bug-gnu-emacs@gnu.org; Wed, 10 Apr 2024 11:33:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ruZxc-0001WH-U6 for bug-gnu-emacs@gnu.org; Wed, 10 Apr 2024 11:34:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Apr 2024 15:34:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70301 X-GNU-PR-Package: emacs Original-Received: via spool by 70301-submit@debbugs.gnu.org id=B70301.17127631905319 (code B ref 70301); Wed, 10 Apr 2024 15:34:04 +0000 Original-Received: (at 70301) by debbugs.gnu.org; 10 Apr 2024 15:33:10 +0000 Original-Received: from localhost ([127.0.0.1]:54187 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruZwj-0001Nc-54 for submit@debbugs.gnu.org; Wed, 10 Apr 2024 11:33:10 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:51633) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruZwf-0001Le-Sh for 70301@debbugs.gnu.org; Wed, 10 Apr 2024 11:33:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1712763164; x=1713367964; i=michael.albinus@gmx.de; bh=F78+uJjtUnzj62w34EYspKKtvEYwFrwxb9G68dBi7lU=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=RCz1m/az13sEwHHtHdF59CnmF+P2kO+2jxf4Zcuylf6ToogGYwtcecDt6E4P3/Px scBo9psth+4Onf0nWSIFIjFeyrDhzvAYzmnfVbRqbl8p2oEGjW6NGeZbVqhGhyq89 XJSGrZPNX2YcsX3xVMCeghbwtSnzcOfYInNkbrhnzcmdnqh6Qe69r3htHh5qhTB3V 0fb7DV/8fMziHAiCiUpQldhDv7AiMgCsB7s0NYb0RtjtOBepABu9bvvdnCZ+lPHqW s8eU4ebZdIHqosngtxHKACeSoaMIpRK0r4hetuvL/XoeUrd7b1eYLRkoGCBkSNT/9 5R6RUqW/PdRpmaHJkg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from gandalf.gmx.de ([185.89.39.16]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M4s51-1rtD1n0INj-0020ik; Wed, 10 Apr 2024 17:32:44 +0200 In-Reply-To: <86o7aix3wq.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 09 Apr 2024 12:48:37 +0300") X-Provags-ID: V03:K1:MtvW8iF99b3XCJv65XGAtdoIesBZpXdgYPU13szzDg10hDLjSCQ OeQcvjBxCaqVN3hdpImHMYkKB2m5BfgdlYVnVxy7ICGCQzJ60YFs5uQX+Pxw9KLrNW7eqhV moJpBh23CnmhaNK16dos5/DtfmjH6cMSQP0MgmOdRmSi2PQyR4JKB48QszXoeHKFA7bjG1+ h7ZIxu9WzZRDxfgAa5zyA== UI-OutboundReport: notjunk:1;M01:P0:ZsociVLCtMk=;th9qft1JvBPB+e2UhAavwgms388 vLNNcFwgeeUjORQ3vp3EYhR2Era5Z6X45d11ATsWcy5fjVhCFlA6Ulrtre+f1J+Bz1dAK3Du1 C5caOb4Ljh7nSDRr7pR1uv57Ih91SNgiuYBHmSGMcgJruoZdzRte4/RM3fRGUIG7tN74kWf4g VSbW1+KBr4/VTQ7D9Ke0GojwH+C30Qcm3y+xkyvxrvCixpK2bOBPzYv4a3oNXDbWZ6Ib8STJD /i+0SwcZ0bjl72ZiQ9zKlc2g6Gt/sGB6xigJUN1pRy+7J70bNXlKey2+h4z+ZwNYDqz2G+IZr khbZKYwjFbuvCHmexee9/E0YRkUnaMPswAdT6b5rthzoJClEU8kGPYIbEoWmSaIUFcpplWRqp ojjCxzgrt+eI213d+oAjLQSjq1jZ9000B5nJb0BuP9MWPbzNACTvJFCOoRNrGBLrarZNhHX0b SAKDqW+elBOxYQoXXVfeRpiGvbz90a8FI8Onim9SYV1Kv4bWh+zSlH7QrIncSMj7MtvMT0oYh dz6IHWwnsOgGHvIZMTICnk5mGAZzVxC8CmtXvW2rCayUEEkIv5SPJfwxt4+cNZ2y2pesL6LOU QPQygOTWsiIUkr0P2JUcDQ9/eo5b4GDN4zxpgxFKtn04IcvRyXwYM9efq0XOyg2OW0NLLMeXg d58jjXnzKYGZwt8PxIkukE16aukc/UlKgIaJ2KjMsqKxL/ix2SJiDbkgWTG9iX3ZNO1cX5E4k sUEZIGr0Oc28Yd0EOD62hNOGLPd5kECc8Mxs7Jz0MEtjYfTATCEeHHhwkWB8buzrynM4M593 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:283052 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: Hi Eli, > Does the patch below give good results? Thanks for the patch. However, I believe we shouldn't fix it in secrets.el, but in dbus.el. > Michael, I think we have a similar problem in > dbus-byte-array-to-string: when MULTIBYTE is non-nil, the function > should call decode-coding-string on the unibyte string it produces > instead of converting each byte to multibyte. Because the bytes in > the argument BYTE-ARRAY are not characters, they are raw bytes of the > UTF-8 sequence, so calling 'string' on them is not TRT. Yes. The following patch works for me. WDYT? --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el index 46f85daba24..11c87e72d4e 100644 =2D-- a/lisp/net/dbus.el +++ b/lisp/net/dbus.el @@ -997,17 +997,18 @@ dbus-string-to-byte-array STRING shall be UTF-8 coded." (if (zerop (length string)) '(:array :signature "y") - (cons :array (mapcan (lambda (c) (list :byte c)) string)))) + (cons :array + (mapcan (lambda (c) (list :byte c)) + (encode-coding-string string 'utf-8))))) -(defun dbus-byte-array-to-string (byte-array &optional multibyte) +(defun dbus-byte-array-to-string (byte-array &optional _multibyte) "Transform BYTE-ARRAY into UTF-8 coded string. -BYTE-ARRAY must be a list of structure (c1 c2 ...), or a byte -array as produced by `dbus-string-to-byte-array'. The resulting -string is unibyte encoded, unless MULTIBYTE is non-nil." - (apply - (if multibyte #'string #'unibyte-string) - (unless (equal byte-array '(:array :signature "y")) - (seq-filter #'characterp byte-array)))) +BYTE-ARRAY must be a unibyte list of structure (c1 c2 ...), or a byte +array as produced by `dbus-string-to-byte-array'." + (if-let ((bytes (seq-filter #'characterp byte-array)) + (string (apply #'unibyte-string bytes))) + (decode-coding-string string 'utf-8) + "")) (defun dbus-escape-as-identifier (string) "Escape an arbitrary STRING so it follows the rules for a C identifier. --=-=-=--