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#74922: 29.4; copy_string_contents doesn't always produce a valid utf-8 Date: Tue, 17 Dec 2024 15:18:07 +0200 Message-ID: <86msguo3cg.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26730"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74922@debbugs.gnu.org To: Evgeny Kurnevsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 17 14:19:32 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 1tNXU2-0006jA-K7 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Dec 2024 14:19:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNXTb-0000Vj-GM; Tue, 17 Dec 2024 08:19:03 -0500 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 1tNXTa-0000VV-Db for bug-gnu-emacs@gnu.org; Tue, 17 Dec 2024 08:19:02 -0500 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 1tNXTa-0001hj-5G for bug-gnu-emacs@gnu.org; Tue, 17 Dec 2024 08:19:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=caoD6v6UAalds8EnUn3paA7xu0xbzRn9Q5HxiYIZQaE=; b=ockRMRKNi4/dsdGVOi2mHVEh8H64rkFhVLcjWiuQRzeS4IxW5inr69wIUhdT5mqcaCWkoiT5um+wCfgTd9/v2rlkFsV8/dsyYPt3s+QGGMKtUnpMUHm1UT8Xz1A8CUmnniLRIoG0qtjQaUxxemyWuNa3xYDnMdaKtyFj+0rQ0u+X5T96CXZzNOFOdbCpxB75uKbCfvDrVr85RbgvsC9dW5F2KTy/lv/4j8q7AlK5XBaU81J6ev8Qe9T3IGYDfdTOgjjkL70uOTDswzYjUzSaiHKhbFL4YYLpWIBlQwUy51B+dHQ2M6indBsHrEHnlHMRo1lcm0D8q2Nnvl6B81O8JQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tNXTZ-0007Pa-Vy for bug-gnu-emacs@gnu.org; Tue, 17 Dec 2024 08:19: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: Tue, 17 Dec 2024 13:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74922 X-GNU-PR-Package: emacs Original-Received: via spool by 74922-submit@debbugs.gnu.org id=B74922.173444149928425 (code B ref 74922); Tue, 17 Dec 2024 13:19:01 +0000 Original-Received: (at 74922) by debbugs.gnu.org; 17 Dec 2024 13:18:19 +0000 Original-Received: from localhost ([127.0.0.1]:58007 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tNXSt-0007OO-2N for submit@debbugs.gnu.org; Tue, 17 Dec 2024 08:18:19 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48724) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tNXSq-0007O7-UG for 74922@debbugs.gnu.org; Tue, 17 Dec 2024 08:18:17 -0500 Original-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 1tNXSk-0001bK-8w; Tue, 17 Dec 2024 08:18:10 -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=caoD6v6UAalds8EnUn3paA7xu0xbzRn9Q5HxiYIZQaE=; b=PHzy5UWfeTdp qJVDztSvY0q9wQpIStPIeWNulKBqSyhKJ9c7Kr+ylLiZGJZynaUUtO9cZ7hlu00aE74puuKROrJ4n I9tBfgPA2fQ6wYfQvnnfZWXgjqEGlbZ30uwaxILzAcrvDn7wshvEFypBoDWiWq79ZqHpCvlakhJd/ 0kDSoLSbGUgYWLwIKrn2PSzb7+SVBfgroZmsNxJrbeuyDLrtpZQZgknf7kGeYNNs5Jg1q9ta98han q6gSczvTUj5h3FdXiw3UZCCk3l6YLdVVz405MhDxPktPvFlvNKdW0iIeEJ8oyADM5nmvPSV/uGBKX W7qrlBeggDPGvquTcy9uxA==; In-Reply-To: (message from Evgeny Kurnevsky on Tue, 17 Dec 2024 06:08:30 +0000) 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:297284 Archived-At: > From: Evgeny Kurnevsky > Date: Tue, 17 Dec 2024 06:08:30 +0000 > > According to the docs and comment inside module_copy_string_contents it should always produce a valid > utf-8 string that can be used in dynamic modules, but it seems it's not always the case. I encountered an > emacs crash when using emacs-module-rs because it always expects a valid utf-8 for strings. To reproduce > you can call: > > (some-function-from-dynamic-library (encode-coding-string (f-read-text "wg-private-pc.age") 'utf-8 t)) > > The file is > https://github.com/kurnevsky/nixfiles/raw/0b3de016dac551398627a55788b80d4809afcbf9/secrets/wg-private-pc.age This string includes raw bytes, it isn't a text string, as far as I could see. It definitely isn't UTF-8 encoded text. What did you expect to happen with it when you copy such a string from Emacs? > See https://github.com/ubolonton/emacs-module-rs/issues/58 for additional details. Can't say there are too many details there...