From unknown Sun Jun 15 08:25:51 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#50560 <50560@debbugs.gnu.org> To: bug#50560 <50560@debbugs.gnu.org> Subject: Status: 28.0.50; 'insert-file-contents-literally' on multibyte buffers Reply-To: bug#50560 <50560@debbugs.gnu.org> Date: Sun, 15 Jun 2025 15:25:51 +0000 retitle 50560 28.0.50; 'insert-file-contents-literally' on multibyte buffers reassign 50560 emacs submitter 50560 Augusto Stoffel severity 50560 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 13 02:58:18 2021 Received: (at submit) by debbugs.gnu.org; 13 Sep 2021 06:58:18 +0000 Received: from localhost ([127.0.0.1]:44008 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPfv0-0007fF-71 for submit@debbugs.gnu.org; Mon, 13 Sep 2021 02:58:18 -0400 Received: from lists.gnu.org ([209.51.188.17]:44038) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPfux-0007ez-Hf for submit@debbugs.gnu.org; Mon, 13 Sep 2021 02:58:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPfuu-0001rA-Hk for bug-gnu-emacs@gnu.org; Mon, 13 Sep 2021 02:58:15 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:36702) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPfut-0003GP-2p for bug-gnu-emacs@gnu.org; Mon, 13 Sep 2021 02:58:12 -0400 Received: by mail-wr1-x42d.google.com with SMTP id g16so12962486wrb.3 for ; Sun, 12 Sep 2021 23:58:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version; bh=GvQVLzF7zj8wk0+ExnNG3vaVnakFTlQNsrxbcP/3TlQ=; b=k0dC9Mgc3jhN3TwhP/bdhRXpeN4MeDxuf6Fn6YW7NNO/TeJKueIxg3BCM044giEjpZ mwSYLoSd68sJ28MVtTHoF6Rcd6uqI5lVxDSAz3N2vfpbIYT0zCo4VOiWEJuzsXIC6UKB aJlFs3XNDDR0Cgefqzq4H18H7IfUZ6QsQiNi/5QgRJ4CnIoRZhUJJ3R5Iix0mkRejuNM nuJe60YVuw1Xz1MCDOqv8khYDou3KQr0AkYNkdfyD/PdqjlaM64bgldfzeGMBRuUMuIW f6ezOXMshhe8a7fISDKzp53y7wNdXUHcckWSUajKrxuepDVHVUdLDmRfcYqg6+MypE6L JsxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=GvQVLzF7zj8wk0+ExnNG3vaVnakFTlQNsrxbcP/3TlQ=; b=cOx+V/5+ueJby+96PFUrEh84t7J0gQgn3HAyDkP9TO+IxooQxtr77/WeADzFl+xU1s nH5mE3gaFo22d0da4WIt2eBSxBT26CbIX6D68rvc7zSPfWSFZfJPRVCxZCCyIyznSk2G t2MNuHVwoEOwNMaCvrs7fUB01qJuvNEqCtkkHMDfWRSrpBlQIfIzf8tzAQydrX0zi1te MUxRgmy4iwn29j+gkzs6pdfhKfZez20XmVx77Tyw02XYZ6ppN7b3sO09BALeF4Jtq1z4 SbjUEI1VhVHEUKm2PyikhXhswnLNl1hoFoag5jLSIo2/+0s8Oyr1UgzZZibgzDqwbhra xYZA== X-Gm-Message-State: AOAM530UVaBph6F0J3KKWa6rvYdrisk4AEyq6dK3wNZcU6tli+cYsbsV 1cxgg7tNzG4/hE9J1y4cgI0jsD2YH/E= X-Google-Smtp-Source: ABdhPJy/Bzsjk8a7VUIdFPg2ZjSYWYvTecsLjoDnGkbnXgcY3LxaiIAhutTlF2OegL3lg3zjgWne/Q== X-Received: by 2002:a05:6000:160c:: with SMTP id u12mr10662468wrb.100.1631516288756; Sun, 12 Sep 2021 23:58:08 -0700 (PDT) Received: from ars3 ([2a02:8109:8ac0:56d0::b1d]) by smtp.gmail.com with ESMTPSA id o26sm5923030wmc.17.2021.09.12.23.58.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Sep 2021 23:58:08 -0700 (PDT) From: Augusto Stoffel To: bug-gnu-emacs@gnu.org Subject: 28.0.50; 'insert-file-contents-literally' on multibyte buffers Date: Mon, 13 Sep 2021 08:58:06 +0200 Message-ID: <87zgshotc1.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=arstoffel@gmail.com; helo=mail-wr1-x42d.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, 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 (--) I thought 'insert-file-contents-literally' literally just inserted the file contents, as bytes, but I noticed that in the following code (create-image (with-temp-buffer (set-buffer-multibyte nil) (insert-file-contents-literally "picure.jpg") (buffer-substring-no-properties (point-min) (point-max))) nil t) the call to 'set-buffer-multibyte' is really essential. Is this intended? If so, I think a note in the doctring is due. From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 13 03:11:10 2021 Received: (at 50560) by debbugs.gnu.org; 13 Sep 2021 07:11:10 +0000 Received: from localhost ([127.0.0.1]:44026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPg7R-0007zR-SI for submit@debbugs.gnu.org; Mon, 13 Sep 2021 03:11:10 -0400 Received: from quimby.gnus.org ([95.216.78.240]:54842) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPg7Q-0007zD-09 for 50560@debbugs.gnu.org; Mon, 13 Sep 2021 03:11:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=b3WsvRAYO0sQWMcqAw1+4hS5ilvUEOizWtWOqVLEf58=; b=nvqdk/NlbbuAhC51dhLJ4il16o KC86o505GnYpKRd4KQzYHQoNXRGxvSNNzi9ROjzv+NFGrSHfKNST5IflVOqeVK+g1vyn7V8t4ijcq aTFc1a2WMUYyBMWj8xGTTZp6u1dUtsWdw47+t/H9r5XtXS+SjHwT+hgprWI5tJanG8h8=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mPg7H-0005oA-QM; Mon, 13 Sep 2021 09:11:02 +0200 From: Lars Ingebrigtsen To: Augusto Stoffel Subject: Re: bug#50560: 28.0.50; 'insert-file-contents-literally' on multibyte buffers References: <87zgshotc1.fsf@gmail.com> Date: Mon, 13 Sep 2021 09:10:59 +0200 In-Reply-To: <87zgshotc1.fsf@gmail.com> (Augusto Stoffel's message of "Mon, 13 Sep 2021 08:58:06 +0200") Message-ID: <875yv5j6gs.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Augusto Stoffel writes: > I thought 'insert-file-contents-literally' literally just inserted the > file contents, as bytes, but I noticed that in the following code > > (create-image > (with-temp-buffer > (set-buffer-multiby [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50560 Cc: 50560@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 (---) Augusto Stoffel writes: > I thought 'insert-file-contents-literally' literally just inserted the > file contents, as bytes, but I noticed that in the following code > > (create-image > (with-temp-buffer > (set-buffer-multibyte nil) > (insert-file-contents-literally "picure.jpg") > (buffer-substring-no-properties (point-min) (point-max))) > nil t) > > the call to 'set-buffer-multibyte' is really essential. In what way? If the first byte in a binary file is #xff, inserting the file literally in a buffer and saying `(following-char)' on the first character in the buffer will say #xff. But, yes, when dealing with octet streams, it's a lot less confusing if you're using unibyte buffers (and strings). > Is this intended? If so, I think a note in the doctring is due. The doc string doesn't say anything about bytes, so I think that's an interpretation on your side. `insert-file-contents-literally' does insert "literally" -- but the byte contents of the internal buffer structure can't be violated (emacs uses utf-8 (plus extensions) for multibyte buffers). -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 13 03:17:12 2021 Received: (at 50560) by debbugs.gnu.org; 13 Sep 2021 07:17:12 +0000 Received: from localhost ([127.0.0.1]:44041 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPgDH-00088s-VO for submit@debbugs.gnu.org; Mon, 13 Sep 2021 03:17:12 -0400 Received: from quimby.gnus.org ([95.216.78.240]:54868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPgDG-00088g-Ce for 50560@debbugs.gnu.org; Mon, 13 Sep 2021 03:17:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=TaLl9xyb2v1FMFdHuENoXduaEg2rT+ILrCqsWqIpfJU=; b=GZDq8NqUjiIselWy/+gio/5BLr 9XAszqmCW1tj5wpmYFvOVTk6XsX/3HnoGftUT6jmFAv2NCLAaYq2hgtEk/ywsX+c+5Of9HlV0Qpjf 75cJvyMrI+88Em+3nCwNqE2LzhYqOrz6Nu630iBsNFRqcguSuNb4TQCD/R6vPf+JTtvQ=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mPgD5-0005s6-U6; Mon, 13 Sep 2021 09:17:04 +0200 From: Lars Ingebrigtsen To: Augusto Stoffel Subject: Re: bug#50560: 28.0.50; 'insert-file-contents-literally' on multibyte buffers References: <87zgshotc1.fsf@gmail.com> <875yv5j6gs.fsf@gnus.org> Date: Mon, 13 Sep 2021 09:16:59 +0200 In-Reply-To: <875yv5j6gs.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 13 Sep 2021 09:10:59 +0200") Message-ID: <871r5tj66s.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Lars Ingebrigtsen writes: > In what way? If the first byte in a binary file is #xff, inserting the > file literally in a buffer and saying `(following-char)' on the first > character in the buffer will say #xff. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50560 Cc: 50560@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 (---) Lars Ingebrigtsen writes: > In what way? If the first byte in a binary file is #xff, inserting the > file literally in a buffer and saying `(following-char)' on the first > character in the buffer will say #xff. Sorry, I meant `(get-byte (point))'. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 13 04:13:35 2021 Received: (at 50560) by debbugs.gnu.org; 13 Sep 2021 08:13:35 +0000 Received: from localhost ([127.0.0.1]:44196 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPh5r-0003Nv-EP for submit@debbugs.gnu.org; Mon, 13 Sep 2021 04:13:35 -0400 Received: from mail-wr1-f47.google.com ([209.85.221.47]:37780) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPh5n-0003Ne-SI for 50560@debbugs.gnu.org; Mon, 13 Sep 2021 04:13:34 -0400 Received: by mail-wr1-f47.google.com with SMTP id t8so8206940wrq.4 for <50560@debbugs.gnu.org>; Mon, 13 Sep 2021 01:13:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=ADkW9C8L9Ltlk7qtgGG+XjIylxI0byR4ZUXtghlE3SI=; b=LFuvu9KSKm5AM1Xj7vHrtJqtHprru6SIqjPbhKCiXaaw3rR1WSzxcN9/1q1EPmoDZz pt0uyz3dz5jv2xlMVz8LBx2VZmYHPju5eBgjVMpSwWpuBX0mx0a1cfzaIF26l3O76df+ NXkJwMvfNIoCkZUYs/ZNwcmbtU8eQbqzRBS3DMk8rKKRyNSwk6CfCvHkY3oFQnJEvp1v FrSsuOzsEES/LLU2YdOZfBHvfP5BwYbFYRCvU84zFvmEjdbUWH0zjGVxlQNUKZFT1nh5 GMBIwtbsyEu8JQ7EMJ28Uc8p4EZSnzGcL3ji0IZh/N/ybhBCuBe0d6vbdjGl9hbifDdL kf5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=ADkW9C8L9Ltlk7qtgGG+XjIylxI0byR4ZUXtghlE3SI=; b=vBaEVxW0Tl6ZTjhMy0PHCBYAIyow0wPyzHDfQpRF80reZONQgVWos490RDZ4SJpS+W GNE9dou69ICTf3purfEnza35cHU044/0MtriK8wMANV42qyZ62rs1/I/2qNUOg+pzsCY TwV6nnCyQIze4kko/RhB54mVd2dnYIKaxpdTfo3ZyGUaY3NAuHbE5TnTvKXnmnDe8l30 nCVTAfBGFhwxm6gVuemXJBnhm0okHBwY7gIV+BlMkMlKdonK+XYIeoQvmho/0id1DsHz Fgro9rSudXv9rTglN6pX5poivq1pHecyCkLOB7aBWnWrwjtfFMsjyyqnHziO4I0y4SUX OSOA== X-Gm-Message-State: AOAM530L2Owmve59AoEqf3yKY23caUDqhAo0f9NVUu3EyjJqbTKAxfjx wYLKLAGzloLcQmVYGlFMJFdfJXu7EQg= X-Google-Smtp-Source: ABdhPJy+YszGzrCqndeTd6LLFL1nSVhgcIKRmsEvDOuiXEMKK9pGZCu63Cwn+8dSE29Ej+YKWSCCvQ== X-Received: by 2002:adf:b7c7:: with SMTP id t7mr10652176wre.259.1631520805772; Mon, 13 Sep 2021 01:13:25 -0700 (PDT) Received: from ars3 (pd95c95b0.dip0.t-ipconnect.de. [217.92.149.176]) by smtp.gmail.com with ESMTPSA id u6sm8127879wrp.0.2021.09.13.01.13.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 01:13:25 -0700 (PDT) From: Augusto Stoffel To: Lars Ingebrigtsen Subject: Re: bug#50560: 28.0.50; 'insert-file-contents-literally' on multibyte buffers References: <87zgshotc1.fsf@gmail.com> <875yv5j6gs.fsf@gnus.org> Date: Mon, 13 Sep 2021 10:13:23 +0200 In-Reply-To: <875yv5j6gs.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 13 Sep 2021 09:10:59 +0200") Message-ID: <87wnnkvqos.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50560 Cc: 50560@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 (-) On Mon, 13 Sep 2021 at 09:10, Lars Ingebrigtsen wrote: > Augusto Stoffel writes: > >> I thought 'insert-file-contents-literally' literally just inserted the >> file contents, as bytes, but I noticed that in the following code >> >> (create-image >> (with-temp-buffer >> (set-buffer-multibyte nil) >> (insert-file-contents-literally "picure.jpg") >> (buffer-substring-no-properties (point-min) (point-max))) >> nil t) >> >> the call to 'set-buffer-multibyte' is really essential. > > In what way? If the first byte in a binary file is #xff, inserting the > file literally in a buffer and saying `(following-char)' on the first > character in the buffer will say #xff. > > But, yes, when dealing with octet streams, it's a lot less confusing if > you're using unibyte buffers (and strings). > >> Is this intended? If so, I think a note in the doctring is due. > > The doc string doesn't say anything about bytes, so I think that's an > interpretation on your side. > > `insert-file-contents-literally' does insert "literally" -- but the byte > contents of the internal buffer structure can't be violated (emacs uses > utf-8 (plus extensions) for multibyte buffers). Ah, sure, there is no coding _conversion_, but the bytes are still interpreted according to the buffer's coding system. I guess that's obvious in hindsight. Still, reading the bytes from a file is slightly trickier than it might seem, so there could be a word of caution somewhere. From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 13 04:19:38 2021 Received: (at 50560) by debbugs.gnu.org; 13 Sep 2021 08:19:38 +0000 Received: from localhost ([127.0.0.1]:44221 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPhBh-0005iL-TM for submit@debbugs.gnu.org; Mon, 13 Sep 2021 04:19:38 -0400 Received: from quimby.gnus.org ([95.216.78.240]:55550) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPhBf-0005i4-HH for 50560@debbugs.gnu.org; Mon, 13 Sep 2021 04:19:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=O3KWDxaVJLWUxzpBONNyX+8mC2byirOg6zsQdK20Oys=; b=Rdd0XYpT1Hb5BztNNTztd2g6iO GiaG0yZQ/7sgDE7ybZkBGwDoibBUBCDtIZNAXiEpo0HhoIuGxOYK07ng/BJhBVyzEtvG0Ut+SgzNL W93didLTraf2ky8T8DKpBREIkelfNDEDI/8GY1J6qJ+mq/Fr5rzHdyeGGRjRZMgEx2uM=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mPhBW-0006ZG-Uk; Mon, 13 Sep 2021 10:19:29 +0200 From: Lars Ingebrigtsen To: Augusto Stoffel Subject: Re: bug#50560: 28.0.50; 'insert-file-contents-literally' on multibyte buffers References: <87zgshotc1.fsf@gmail.com> <875yv5j6gs.fsf@gnus.org> <87wnnkvqos.fsf@gmail.com> Date: Mon, 13 Sep 2021 10:19:26 +0200 In-Reply-To: <87wnnkvqos.fsf@gmail.com> (Augusto Stoffel's message of "Mon, 13 Sep 2021 10:13:23 +0200") Message-ID: <87tuiohoq9.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Augusto Stoffel writes: >> `insert-file-contents-literally' does insert "literally" -- but the byte >> contents of the internal buffer structure can't be violated (emacs uses >> utf-8 (plus extensions) for multibyte buffers) [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50560 Cc: 50560@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 (---) Augusto Stoffel writes: >> `insert-file-contents-literally' does insert "literally" -- but the byte >> contents of the internal buffer structure can't be violated (emacs uses >> utf-8 (plus extensions) for multibyte buffers). > > Ah, sure, there is no coding _conversion_, but the bytes are still > interpreted according to the buffer's coding system. No, quite the opposite -- `insert-file-contents-literally' inserts the octets from the file in a way that makes them not be interpreted as characters: You end up with a buffer where each point in the buffer has something that represents one octet. (In reality, there's usually more than one byte "in the background", since it takes several bytes to represent an octet like #x90 in a multibyte buffer.) > I guess that's obvious in hindsight. Still, reading the bytes from a > file is slightly trickier than it might seem, so there could be a word > of caution somewhere. I think this is all covered in the lispref manual. It's a very complicated and confusing subject, and I don't think this docstring is the place to get into it. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 13 04:43:04 2021 Received: (at 50560) by debbugs.gnu.org; 13 Sep 2021 08:43:04 +0000 Received: from localhost ([127.0.0.1]:44319 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPhYO-0006Qu-0l for submit@debbugs.gnu.org; Mon, 13 Sep 2021 04:43:04 -0400 Received: from sonic303-19.consmr.mail.ir2.yahoo.com ([77.238.178.200]:34235) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPhYL-0006QE-Ks for 50560@debbugs.gnu.org; Mon, 13 Sep 2021 04:43:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1631522575; bh=8OOC62hafss5Xeotahy+ml5uBT5UjTlFjJSiCRb9R+Y=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=PnCt+hBZn8Az3CxIT/i6RLhHZyMxmWFPiwKu+kISt6SWOLLF3JxYf3exFkgTTJ1avo4x8obQW1fGuLAnJHUcCfrQiNESxD6GlpH48MqW0sbm6VnoFYRkSHalUXFLLwTx7J8dKze/jj3OzV5+KgupzXlQ+WiUFDgbi1w4fw1fRQc8aLQ8lWEHJpn2aYnDEL8BxNOW+0d1vxsENdpR0jug/r39rJ5DxtH+R4ToEoMmBxwTuX/WHJL4y/k1SKf+THdpyDXtMn1ShpDNqjHjhUn5FKQbGCxslWCB0JvUJt1nmFUOE0yOd67NZI98406GcDBOw9P7Gi9yQNhd3cykcRPGoA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1631522575; bh=8wBBe1Z3OtTmLIwyQshgrNsIY/lW0EX9magcvDRL/JE=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=Erw5jHlWrq0HW+Xpivpveqa9KqnGlcfzubmL7aa5fAy5gZiW10HmBxXS3ejnO8+170ImvzJb5wV0hg9YzImYxLnmk9qQFflpdbrRESQOOUtqc8wP0IW1oIgjiH5r0w7gGmdQle+2Cnh8wLnVytdy9sYGoMsNfWHI0Mo+r7Sw94qhuAK0gka2zzfVjNrXhRnVSUkPntzzZ6gfpu0ayjVyyCO33KxWoTwNoF4auCbfdXJmFjU8y+wfpa8CUpWNxqXI35R3vi+2XaC39l9csdHG7cgfAVKtw/nj2UYEGMoBlkh4xZlcg0AuzlpVffY9sNQ6vGbHQNsNUSjnf4X0AxnwEg== X-YMail-OSG: sjyqOt8VM1knxCNiBi.l3KkjQqiRdIyBCBAtOzKlSUXpM.XPm6lpCUHgRDVvqWO iRkhS70xgJZMOr.xcohkcGqmKeZX5gIUEsqTXgupGpxCFJNMn1JaomuLFhL0uuYlEg1a6DjAgcUH KAtbEFLdLWy0fq2sOrQLRqlivymTXR5TGPHHgnjY2zqHByv0PD02r0CpeOY8P.errfIKbHIbbR9P h68_fkIHciQFZrxPeP53g58TYBJxJavJqaK5abM07lsClLpnPav8l1pNV9fPwdUDIvYRicfBNABe yqCrCBNmMMhUB2hk7Nr9M.DWetaS3f6HXHAwDLryhshMmSJRXaVg7FMwxbVX.cXlkSQgIqY79ym3 .UVr4WWMYFdlCDlodVH6JKHhsw.K1mU7puBMhOBKeIzZwLYpxTqsvrxfm5.p9cmvjVaIFk2evWWg ryjdKvv5ya_Qva3zliLtvrcRjJfEHNvXAw9Oi8Y2.Gg57UHgAcfGbCG5P1KsLaxjXINVyVXFGiKT Ibo6nAt4SIujjOT9S8Q1Jq8kiT66lnew1YY6zjFDQ8l1CDdzEP8b3wVhFf9TBT3un6d8pk9x446I 2XnEmbBpHDaslCEits1XH_6sSejICjyQpxcEYWAI1OsT1NNP7wflL2SBgnY4asnyNfzth.UyQqKy xo2M0Jy33zR04q9wHqjDkWMJmo5JXdNckEStlTYY.fAhj8tN8jwy7agudwCaqieBTpa7P1xQZche OLYt2ZHbQ0MzHrr3tHKLQpoRSUJX1eXnyjvJUtTuqkZQfBupjrBy4ur_b28G8NWb36Du0d3VWj2w .zWEkpX.uRLlUCXXtRMnyKi3..s6aK74O2rvU3JUT0Uus.2RCEMI.2ej18cFz3HR23sdjyBruLMB Uqip7b96C4j00n_Id.2.kqvUgHBUxk3Ot9msu_oRj.Psju5TqahViS3Tt64KmwkPLXaU_qKj3HR0 LJMhq9GINo0Y7uM8O.nGScpovkdojGKBGg3VDr9jwTli4EDm8BE7UO2yEQ2wg30qIOtEFSX3SR.N O3bihKVW61FlMbwnKQfl_W5k.fZFqDeOSAfmc22D39xgAiQIjC8squxRMaddMjx1.qq7IQki.Bb3 ES74bMSQ9Gh4vtJSL2j81TSyvbOUHd04Xp.b5K8UQbfN0o3ToDVG._JN9wbuPxWwhKEpTNAMQ_vn XuTAeemuIsJHUzqSSsAkJtqlxft7JwVuTxk242SUymFlFFlXw6ABIM34HL5bxDom3Q7C_aUHBCXV hN.cTM3Px676CGu7U40VG0MkXNnYSCji6VdvFQOauU.AEuyA7B7iZuqhOmDOXWiW8BdVpib7SzVr ZpYCI_fg0GPJPhtVxSwCkVsptfUAO8xDUdt_jUAyVp3C_qtip9F5ZJ6iGBpUGoK_gnwgftXBdYxk ECcGxjDLJghYsXNrJq3r.45ErnQWUzkq4W.47SC9aY_3p4aBhTCPJ6UBhFSkF85nxPcWl19mqvBm 5efJGUX8RyQQ.tavGqXmm06KV1uOqUj1be92OW_rdvO4wxiaMEkYzXVA8tOIOlfevEeRcl97Nq7A KxRf2Fg5DM9n3RsYf5Xp_PvSVyqvUP7rGrSwAENaWTetEvRBgey3D9YrQKn.g1ki_6lZ8Uo04GlG 2R3nVXUZIKGULq3Mm7CDvLFpaEJZkoEqXedD.xgk0w_IdOHtpDAT_tPzYLUys9adnSA4sGYFb01d H7T7UotVpmjQXsjxpy6uWi.2uP81V6T3N4Akh7eM7p53L1FxKYuymezI_KxZ7Kpshb3M3IRjkW2d oMplkeK.vseiYu7TmkWPXAfqzHBKEOEWeFHSCyzqGzVyYWl6JCIoeSpNDR3Yi0Ou5XMIgqwGRAu0 W2zs02MOYxizX8098yDNY63BY9naCWm.w6cu.pa8H4SlG1W8..9Ipm6unK2WkOavP_ZwMCdAPPrM 5twJratMR6C7S2X.DHjkWCuorH5PF3cP1HCfk1sFqv2QQqu2aRnoJgpMprq2D2Vtyt5vGs9SrPLj vDzB.wG4X0ur0BrYv14sEp0JO9qp8St62zFYuoonCGpf2LJTptiEqG8a0VsDxmsrYIUzQmhdfmB0 zj3CmiXiFqmb6Bq3csGqj16OX_SmBkNL8ahDaaLlcJEUMWviR5xhLyAFJ2XUZxZkXYvnUmi4qpUi L1zPtsHy8.tirpksrIrFQViE4gluocrP63kFzCVyevxJof2AkgYAcdA7znuYRbFDUwFaOUHl.buf PuV7jd5ebuwqCqGGJ2CM908LY52eeLVys.pyCdu.mKh5uqm9a_043GLv_zdP9QIXYhvhzMzHm_E_ 2oAvIlhuEcmfBP244MQNl7dEj1BRdMhek_g-- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.ir2.yahoo.com with HTTP; Mon, 13 Sep 2021 08:42:55 +0000 Received: by kubenode524.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 7ef3712771f83d327caf5c4465766786; Mon, 13 Sep 2021 08:42:52 +0000 (UTC) From: =?utf-8?Q?Daniel_Mart=C3=ADn?= To: Augusto Stoffel Subject: Re: bug#50560: 28.0.50; 'insert-file-contents-literally' on multibyte buffers References: <87zgshotc1.fsf@gmail.com> Date: Mon, 13 Sep 2021 10:42:51 +0200 In-Reply-To: <87zgshotc1.fsf@gmail.com> (Augusto Stoffel's message of "Mon, 13 Sep 2021 08:58:06 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin) MIME-Version: 1.0 Content-Type: text/plain X-Mailer: WebService/1.1.18924 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 1159 X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 50560 Cc: 50560@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: -0.8 (/) Augusto Stoffel writes: > I thought 'insert-file-contents-literally' literally just inserted the > file contents, as bytes, but I noticed that in the following code > > (create-image > (with-temp-buffer > (set-buffer-multibyte nil) > (insert-file-contents-literally "picure.jpg") > (buffer-substring-no-properties (point-min) (point-max))) > nil t) > > the call to 'set-buffer-multibyte' is really essential. > > Is this intended? If so, I think a note in the doctring is due. It is intended, and the source of confusion may be the apparently symmetric `find-file-literally`, which _does_ make the buffer unibyte before filling the new buffer with the contents from a file (and documents this behavior). But if you think about it, it makes sense that `insert-file-contents-literally` does not set the buffer as unibyte, because it's intended for programmatic cases where you insert the content inside a buffer that may already have other content, so making the buffer unibyte unconditionally may cause unexpected results. So yeah, perhaps we can add a small sentence that clarifies this behavior. From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 13 07:52:18 2021 Received: (at 50560) by debbugs.gnu.org; 13 Sep 2021 11:52:18 +0000 Received: from localhost ([127.0.0.1]:44513 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPkVV-0005jd-TB for submit@debbugs.gnu.org; Mon, 13 Sep 2021 07:52:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52606) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPkVT-0005jP-O4 for 50560@debbugs.gnu.org; Mon, 13 Sep 2021 07:52:16 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:33750) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPkVO-0001o7-D3; Mon, 13 Sep 2021 07:52:10 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3881 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPkVK-0006S7-7J; Mon, 13 Sep 2021 07:52:10 -0400 Date: Mon, 13 Sep 2021 14:52:00 +0300 Message-Id: <83pmtcelr3.fsf@gnu.org> From: Eli Zaretskii To: Augusto Stoffel In-Reply-To: <87zgshotc1.fsf@gmail.com> (message from Augusto Stoffel on Mon, 13 Sep 2021 08:58:06 +0200) Subject: Re: bug#50560: 28.0.50; 'insert-file-contents-literally' on multibyte buffers References: <87zgshotc1.fsf@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50560 Cc: 50560@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: Augusto Stoffel > Date: Mon, 13 Sep 2021 08:58:06 +0200 > > I thought 'insert-file-contents-literally' literally just inserted the > file contents, as bytes, but I noticed that in the following code > > (create-image > (with-temp-buffer > (set-buffer-multibyte nil) > (insert-file-contents-literally "picure.jpg") > (buffer-substring-no-properties (point-min) (point-max))) > nil t) > > the call to 'set-buffer-multibyte' is really essential. It is only essential for some very specific uses of the resulting buffer, but definitely not for all. From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 13 08:05:36 2021 Received: (at 50560) by debbugs.gnu.org; 13 Sep 2021 12:05:36 +0000 Received: from localhost ([127.0.0.1]:44534 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPkiN-0006AO-P1 for submit@debbugs.gnu.org; Mon, 13 Sep 2021 08:05:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55648) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPkiM-0006A0-Aa for 50560@debbugs.gnu.org; Mon, 13 Sep 2021 08:05:34 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:34104) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPkiH-0002TO-1q; Mon, 13 Sep 2021 08:05:29 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4707 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPkiE-00037T-9m; Mon, 13 Sep 2021 08:05:28 -0400 Date: Mon, 13 Sep 2021 15:05:20 +0300 Message-Id: <83lf40el4v.fsf@gnu.org> From: Eli Zaretskii To: Daniel =?iso-8859-1?Q?Mart=EDn?= In-Reply-To: (bug-gnu-emacs@gnu.org) Subject: Re: bug#50560: 28.0.50; 'insert-file-contents-literally' on multibyte buffers References: <87zgshotc1.fsf@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50560 Cc: arstoffel@gmail.com, 50560@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 (---) > Cc: 50560@debbugs.gnu.org > Date: Mon, 13 Sep 2021 10:42:51 +0200 > From: Daniel Martín via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > So yeah, perhaps we can add a small sentence that clarifies this > behavior. What kind of sentence would you like to add there? IME, this stuff can rarely be explained by small sentences ;-) From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 13 08:44:37 2021 Received: (at 50560) by debbugs.gnu.org; 13 Sep 2021 12:44:38 +0000 Received: from localhost ([127.0.0.1]:44613 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPlK9-00011q-Na for submit@debbugs.gnu.org; Mon, 13 Sep 2021 08:44:37 -0400 Received: from mail-wm1-f49.google.com ([209.85.128.49]:52912) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPlK4-00011V-6i for 50560@debbugs.gnu.org; Mon, 13 Sep 2021 08:44:36 -0400 Received: by mail-wm1-f49.google.com with SMTP id e26so6572768wmk.2 for <50560@debbugs.gnu.org>; Mon, 13 Sep 2021 05:44:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=gBzata0+dRqyqT3eIMMOnKgLTEH7z6nUHgK72J/xWfs=; b=Oh7qq5+hnZypxG439Ns8NJkhh4s7sl/ux5NA/m9kjBzBab8Iu1KaZevz2L2Qb9i8rj l8FMkaFfM0gQMeFCuKPrH9Vfe2POh+TkJ7R0Z2s0gFVv2o6chh1lC5s8Ijzww1j+MdBZ qZ3rpdAkoOid7d5BRKvbF+g6GzLX8dbViCZJ8mc7wXwVECJGMPQRzxmPlturm0XrEEb+ v9Waa2QyP7gbHGRWg3sAKYzUloPBavNurXjxQ8owS36wAJPJrS/UdDrpNFK/INAOK+lJ /n25ZOveubUUlSValF9KN1t+A8Irqr17VqQAlUPSOVIDU0TShaNcvm2wogqdfHMSnLKa Mj+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=gBzata0+dRqyqT3eIMMOnKgLTEH7z6nUHgK72J/xWfs=; b=Au18AGPHLK/OyyF6xVftiKQaM8hSZ4anIXYEcuOXSplI8ckNMFXU49U4+yvNpYxb5R tFB30GrG7IowDfmXomwQM75CDjmCLint3a3O6dk6x8mdD9SzSHZEmg7vZQctTAz83DYv V2fM9CW+k7JqyOHT/zKbeTjgvsO8evtT4s52i4ebF3sj4G5V6xrGkw8+l1yF6NJudKB9 pjJI6/CzN8toLytaCanr2/yM+dGt0LOEqq9QluuyEWrGOoGe36qP4L3sYtivtbYoVfWY ueeVbZ+vHVqmm3paEcPxmqlaUrVW1ALn+UJFI+MZAsl4LkA+t7OIC2dj38qjzKBnSksx GgZA== X-Gm-Message-State: AOAM530SCl5fWbtwy+9K9yWCIcIg9teQ+NS2liADntlrX3X6PnALICJ5 GjYS7JNbCaJ+OFZ8j38wRjvLy7DWYXo= X-Google-Smtp-Source: ABdhPJw9FSwAyHDJZbfbVx6lMz4tdC9F/Yt1OGOTO7CQEsJFe1Fflo2x7KZ2Xo+Ws35zx2NFUGn92g== X-Received: by 2002:a05:600c:4e86:: with SMTP id f6mr4003425wmq.52.1631537065871; Mon, 13 Sep 2021 05:44:25 -0700 (PDT) Received: from ars3 (pd95c95b0.dip0.t-ipconnect.de. [217.92.149.176]) by smtp.gmail.com with ESMTPSA id d7sm7285110wrf.3.2021.09.13.05.44.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 05:44:25 -0700 (PDT) From: Augusto Stoffel To: Eli Zaretskii Subject: Re: bug#50560: 28.0.50; 'insert-file-contents-literally' on multibyte buffers References: <87zgshotc1.fsf@gmail.com> <83pmtcelr3.fsf@gnu.org> Date: Mon, 13 Sep 2021 14:44:24 +0200 In-Reply-To: <83pmtcelr3.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 13 Sep 2021 14:52:00 +0300") Message-ID: <87tuiomyqf.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50560 Cc: 50560@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 (-) On Mon, 13 Sep 2021 at 14:52, Eli Zaretskii wrote: >> From: Augusto Stoffel >> Date: Mon, 13 Sep 2021 08:58:06 +0200 >> >> I thought 'insert-file-contents-literally' literally just inserted the >> file contents, as bytes, but I noticed that in the following code >> >> (create-image >> (with-temp-buffer >> (set-buffer-multibyte nil) >> (insert-file-contents-literally "picure.jpg") >> (buffer-substring-no-properties (point-min) (point-max))) >> nil t) >> >> the call to 'set-buffer-multibyte' is really essential. > > It is only essential for some very specific uses of the resulting > buffer, but definitely not for all. That's a good point. Maybe the issue is actually with 'create-image', which seems to only work correctly when the data is passed as a unibyte string, but gives no warning if you pass a multibyte one. From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 13 09:18:12 2021 Received: (at 50560) by debbugs.gnu.org; 13 Sep 2021 13:18:12 +0000 Received: from localhost ([127.0.0.1]:44684 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPlqe-0004CB-Ep for submit@debbugs.gnu.org; Mon, 13 Sep 2021 09:18:12 -0400 Received: from quimby.gnus.org ([95.216.78.240]:59210) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPlqc-0004Br-AB for 50560@debbugs.gnu.org; Mon, 13 Sep 2021 09:18:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=9XBma7+As7OR62+V85vhdKQW5d3zVB/4J3kvmfUWmyc=; b=md+rIABjWo5xwxeoo8iRZEQpXq TrxBwNyw6k2zsZsXmWdxcEhEafBFQyxxELKV8YPpiqV1CXOeRFbHBXDSuVhBhejetg8ltcBJSYy2g fW5kvg26fmxLZSVahWi7eob8rL1ji25btCUqKs6G/Nl3R9/O+KZSUeYqXzcRfG4gWRjk=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mPlqT-0001HM-17; Mon, 13 Sep 2021 15:18:03 +0200 From: Lars Ingebrigtsen To: Eli Zaretskii Subject: Re: bug#50560: 28.0.50; 'insert-file-contents-literally' on multibyte buffers References: <87zgshotc1.fsf@gmail.com> <83lf40el4v.fsf@gnu.org> Date: Mon, 13 Sep 2021 15:18:00 +0200 In-Reply-To: <83lf40el4v.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 13 Sep 2021 15:05:20 +0300") Message-ID: <87bl4wd37b.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Eli Zaretskii writes: >> So yeah, perhaps we can add a small sentence that clarifies this >> behavior. > > What kind of sentence would you like to add there? IME, this stuff > can rarely be explained by small sentences ;-) Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50560 Cc: arstoffel@gmail.com, 50560@debbugs.gnu.org, Daniel =?utf-8?Q?Mart=C3=ADn?= 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 (---) Eli Zaretskii writes: >> So yeah, perhaps we can add a small sentence that clarifies this >> behavior. > > What kind of sentence would you like to add there? IME, this stuff > can rarely be explained by small sentences ;-) I've added a paragraph to the doc string mentioning that there might be issues, but referring the user to `(elisp)Character Codes'. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 13 09:18:18 2021 Received: (at control) by debbugs.gnu.org; 13 Sep 2021 13:18:18 +0000 Received: from localhost ([127.0.0.1]:44687 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPlqj-0004CU-LR for submit@debbugs.gnu.org; Mon, 13 Sep 2021 09:18:18 -0400 Received: from quimby.gnus.org ([95.216.78.240]:59236) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPlqh-0004C1-FM for control@debbugs.gnu.org; Mon, 13 Sep 2021 09:18:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=C/jYv5K51aJ0AcRkohCMlR4AQH3NTbm9SOTfpFn7w60=; b=CiC0WUkBS6j82I4ldvleMmQEdg /TIqd34rmbjGkEjz2lWEcyjAOD+qOqjc7UJLVaMgsvjn0mK8GXGRXJpM1pc4XNteG7BPIW/JQSIP2 xVkeZm+UeVERpae+7Uv65xIW/DLrlAYGUe7Ot9iqII0mUZ+Qaie6B3AOCKAzRNQOV65o=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mPlqZ-0001Hj-Lw for control@debbugs.gnu.org; Mon, 13 Sep 2021 15:18:09 +0200 Date: Mon, 13 Sep 2021 15:18:07 +0200 Message-Id: <87a6kgd374.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #50560 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 50560 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control 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 (---) close 50560 28.1 quit From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 13 09:26:26 2021 Received: (at 50560) by debbugs.gnu.org; 13 Sep 2021 13:26:26 +0000 Received: from localhost ([127.0.0.1]:44713 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPlyb-0004Q6-Uf for submit@debbugs.gnu.org; Mon, 13 Sep 2021 09:26:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45772) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPlya-0004Pu-A6 for 50560@debbugs.gnu.org; Mon, 13 Sep 2021 09:26:24 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36420) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPlyV-0000sh-3X; Mon, 13 Sep 2021 09:26:19 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1895 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPlyU-0007aS-Jf; Mon, 13 Sep 2021 09:26:18 -0400 Date: Mon, 13 Sep 2021 16:26:10 +0300 Message-Id: <838s00ehe5.fsf@gnu.org> From: Eli Zaretskii To: Augusto Stoffel In-Reply-To: <87tuiomyqf.fsf@gmail.com> (message from Augusto Stoffel on Mon, 13 Sep 2021 14:44:24 +0200) Subject: Re: bug#50560: 28.0.50; 'insert-file-contents-literally' on multibyte buffers References: <87zgshotc1.fsf@gmail.com> <83pmtcelr3.fsf@gnu.org> <87tuiomyqf.fsf@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50560 Cc: 50560@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: Augusto Stoffel > Cc: 50560@debbugs.gnu.org > Date: Mon, 13 Sep 2021 14:44:24 +0200 > > > It is only essential for some very specific uses of the resulting > > buffer, but definitely not for all. > > That's a good point. Maybe the issue is actually with 'create-image', > which seems to only work correctly when the data is passed as a unibyte > string, but gives no warning if you pass a multibyte one. Maybe we should have create-image convert the :data string to unibyte if it isn't already so. From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 13 17:38:02 2021 Received: (at 50560) by debbugs.gnu.org; 13 Sep 2021 21:38:02 +0000 Received: from localhost ([127.0.0.1]:47016 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPteM-0002Kw-8y for submit@debbugs.gnu.org; Mon, 13 Sep 2021 17:38:02 -0400 Received: from mail-wr1-f48.google.com ([209.85.221.48]:35682) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPteJ-0002KR-JP for 50560@debbugs.gnu.org; Mon, 13 Sep 2021 17:38:00 -0400 Received: by mail-wr1-f48.google.com with SMTP id i23so16835567wrb.2 for <50560@debbugs.gnu.org>; Mon, 13 Sep 2021 14:37:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=NAZUWLKen2/hHNM9gtYsR3+/B0wTdSRxMT1301IQ764=; b=Ij0vqKI1SgkBRWB8ixxUNoScRh9Ur3vce7qpbJmF/jUF5aRyhX5KKYzn3Holvnm+5C 4Swqa+krGNnar+M5UEOFh0dlNepMwL/rl2P7Diz5te6zNpRVmOJDWVlXSjtdgCmgJpGb KRQXUB5qIg5xNyA+zke6R2b2MnVodGxrwKKZ4D1Dbb8NdOJOzqPd4qjn1odFhVk8o+k+ TrA475TIZbdmNoAE7dskOf5zY4YmaLutiRHBeUn8zyBvDkmbZeRg9z20ChqIx07PG8TE WyDiHqFlnLiRcfUfWfEcou70J9J6VmvZJM7QxJwsbBxwQMZ6jLDCp7wOSFTpxweufLUK TVuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=NAZUWLKen2/hHNM9gtYsR3+/B0wTdSRxMT1301IQ764=; b=ODlW7dQmZwvNjeZp59Ko1L7HLwOo0+UvwwNAVALpGwMnvRwSqQjYRivAZ8xe4hYZ0j Y8b2KCW69fnAw7d/EV+1sN1DQvIRUC2dsUVhO009wACWe+i/kzPkeDOp6Ei6723JLGUL uwpokEyzNP8Jk68nlMOvpsxC7o8Z1432xFIRFuSJzNxSZ/R1bC6SsAHyeLMSCcOu82/z gUXLpHq4bimRLeRZBVwdoccw8szMH/iiKN0KQW19p8gWIzB0RjHLTgyE94JFr0KqvFId PF3wOXGFptXYj17dwpxbVwboxsi4YohowyNpF2xIanx1fRuqD9rRCYgk1yk098BIY0XZ /B6g== X-Gm-Message-State: AOAM531NWs95kgaADkzEq6fz14ezs91+6noKrTx2QUCp7ScHvhKje6up ryd/PT/mV2ibarnb4xf8q+c= X-Google-Smtp-Source: ABdhPJxQgbMcvSlKPsqyyjloQSW0jWKJebygH6w7mI4BjETZ1bk9CTNZUTd9b9ls2hxwtXEreqdQmA== X-Received: by 2002:a5d:5286:: with SMTP id c6mr15072893wrv.45.1631569073735; Mon, 13 Sep 2021 14:37:53 -0700 (PDT) Received: from ars3 ([2a02:8109:8ac0:56d0::3c3e]) by smtp.gmail.com with ESMTPSA id i2sm4505134wrq.78.2021.09.13.14.37.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 14:37:53 -0700 (PDT) From: Augusto Stoffel To: Lars Ingebrigtsen Subject: Re: bug#50560: 28.0.50; 'insert-file-contents-literally' on multibyte buffers References: <87zgshotc1.fsf@gmail.com> <83lf40el4v.fsf@gnu.org> <87bl4wd37b.fsf@gnus.org> Date: Mon, 13 Sep 2021 23:37:51 +0200 In-Reply-To: <87bl4wd37b.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 13 Sep 2021 15:18:00 +0200") Message-ID: <87czpc17io.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50560 Cc: Eli Zaretskii , 50560@debbugs.gnu.org, Daniel =?utf-8?Q?Mart=C3=ADn?= 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 (-) On Mon, 13 Sep 2021 at 15:18, Lars Ingebrigtsen wrote: > Eli Zaretskii writes: > >>> So yeah, perhaps we can add a small sentence that clarifies this >>> behavior. >> >> What kind of sentence would you like to add there? IME, this stuff >> can rarely be explained by small sentences ;-) > > I've added a paragraph to the doc string mentioning that there might be > issues, but referring the user to `(elisp)Character Codes'. Thanks, I think it's a good clarification. From unknown Sun Jun 15 08:25:51 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 12 Oct 2021 11: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