From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Evgeny Kurnevsky 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 06:08:30 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000f3900306297120a6" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27257"; mail-complaints-to="usenet@ciao.gmane.io" To: 74922@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 17 07:50:37 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 1tNRPg-0006vA-Aq for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Dec 2024 07:50:36 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNRPE-0001jw-2x; Tue, 17 Dec 2024 01:50:08 -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 1tNRPA-0001iU-Qv for bug-gnu-emacs@gnu.org; Tue, 17 Dec 2024 01:50:05 -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 1tNRPA-0007Ls-HA for bug-gnu-emacs@gnu.org; Tue, 17 Dec 2024 01:50:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:From:MIME-Version:To:Subject; bh=taNMoIz8ymKDr57HpX9zHMLO/SXJ35ueIf2rwlrFY14=; b=nH0uEJ/mwLXq5+1/tQDoFF9siJqxClDeUI/tu8lJb90Li/7a7ucHbEzjVJkktmIOkMvicRzdV9Dg3evmaY2Ntk+FuP9NubVn7S5SFNVVi7mnewZCiTvupwwR3SohpLPrOhepuoWkuZqNdvduuid2uuR6qS835F3/J/VLAYIcT+vLxWFQAN1LG2ruHkixiFqWPAm1Zci47ZEjeAgvy0RSsx18sldeEB3cDdyjZCcz8fvBYYpSedPDFUI/jitdbZGjZhlI3w2bpXOHjbFbYMoCmTl0kRHFdlgwAe21KrXG/hJE3fkpkv64OlaXmGtLK76i9d0MJEXK/Q3YjqegdpPdKA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tNQlR-0003We-Qo for bug-gnu-emacs@gnu.org; Tue, 17 Dec 2024 01:09:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Evgeny Kurnevsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Dec 2024 06:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74922 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.173441573113534 (code B ref -1); Tue, 17 Dec 2024 06:09:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Dec 2024 06:08:51 +0000 Original-Received: from localhost ([127.0.0.1]:57238 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tNQlH-0003WD-5C for submit@debbugs.gnu.org; Tue, 17 Dec 2024 01:08:51 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:54500) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tNQlD-0003W2-Kp for submit@debbugs.gnu.org; Tue, 17 Dec 2024 01:08:48 -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 1tNQlC-00086I-UX for bug-gnu-emacs@gnu.org; Tue, 17 Dec 2024 01:08:46 -0500 Original-Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNQlB-0002xE-8W for bug-gnu-emacs@gnu.org; Tue, 17 Dec 2024 01:08:46 -0500 Original-Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5d0d32cd31aso6035532a12.0 for ; Mon, 16 Dec 2024 22:08:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734415721; x=1735020521; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=taNMoIz8ymKDr57HpX9zHMLO/SXJ35ueIf2rwlrFY14=; b=fgFV9qsGlBU7gsOJMtGw/pL49oWzZYsG2RcUYWO7Bphd7ehvu1rXpN3j4lcha6MPJE /BhVW28JIWMlTTUltorNnKtYv3h5e2ktNEZlTaVAMMD8Gu9/7x8ph1GGKWWknz4WksgE 8epg6CNTkWXkIx/ySzbRmXEguwg/FUt6+NwH0TZyzAtWi1sb/dEZJ9lXl6E82UJQ0avu /pOjhIaJmi+dWti7Pmjh7nDsJspj5jPWPi0X+49I5KEisTMp8f2NqZeNuz2dN91NWYkT peBrrkAzNWUjL1Yb/eq7Wd3mhkO5EbRZ3KVvTYC9iOq1RWcKUeQ1FHZYP9qhuZ9slNyj TvfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734415721; x=1735020521; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=taNMoIz8ymKDr57HpX9zHMLO/SXJ35ueIf2rwlrFY14=; b=CaKZ+bdF2NZF5uJO/9bKQ/D0M5Gml/ZlqJ+EPEggo21mxVKlwNeLAafLox0yUTDTpC +uKZMf/0ll9zXBSrczFFRNLI0MAN3KkU+akHbBNadHWJq8B5j8Z6vVVSvVTVB7qf6at0 nXoDsADNWQdsV5XDWdCsfTGK76wIscI9pEyRhe6W5uZFjJ9s7OoLJqYsy0ZQp3VL1jU+ NhKEPO2t7wEGrJD9IRt6j2GEpJmsrB90oGTQXhUKj2HrgDTpDPdrIBGt2iBVhPoVOEC4 xyBXLR6HPpHQjHhqyTX6FWuoZP+/Gs9sdf3OuidUcqmryg9KYjjlnKpyF1/P/tKKokHG s2sA== X-Gm-Message-State: AOJu0Yz66ObUbWrp4jF6Q0OtPltLrWuyC8TmFNKJiZiRMiP5YNzlUFyI xevI7yYW5x2sEnf6EkN01AkRlQKd3gL2WVY9iCVTiiyyMcVROLa73PqnUdluuLZYWKBz4Zeir5b ucx9DpoQL4cprYQaIbZJDjutox+ljnrdy4zo= X-Gm-Gg: ASbGncvV8a7DQAZ5BFw/mlhWrCXHlfim9Rvo2FNChQtOLLT9kXvusP4ESm9XrwDq+nx 3hoYgeampc3+l9wsvOtWW+J+fQrTyD9ZoFLkT51STIIKFDhM1O5hiQ/ivR47exsn5Yy0cqg== X-Google-Smtp-Source: AGHT+IHNFtOxnCWGTutSAonw+UOUdH4TDT0g6vBgtwvGxAIXSnh8uA3EiR+jUasIuPRB/yadhf9cJobH/CX0Quahgl8= X-Received: by 2002:a05:6402:34cf:b0:5d1:1064:326a with SMTP id 4fb4d7f45d1cf-5d63c33e9e0mr35706800a12.15.1734415721138; Mon, 16 Dec 2024 22:08:41 -0800 (PST) Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=kurnevsky@gmail.com; helo=mail-ed1-x52c.google.com 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, HTML_MESSAGE=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-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:297253 Archived-At: --000000000000f3900306297120a6 Content-Type: text/plain; charset="UTF-8" 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 See https://github.com/ubolonton/emacs-module-rs/issues/58 for additional details. --000000000000f3900306297120a6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
According to the docs and comment inside module_copy_= string_contents it should always produce a valid utf-8 string that can be u= sed in dynamic modules, but it seems it's not always the case. I encoun= tered 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 &= quot;wg-private-pc.age") 'utf-8 t))


--000000000000f3900306297120a6--