From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.bugs Subject: bug#50560: 28.0.50; 'insert-file-contents-literally' on multibyte buffers Date: Mon, 13 Sep 2021 14:44:24 +0200 Message-ID: <87tuiomyqf.fsf@gmail.com> References: <87zgshotc1.fsf@gmail.com> <83pmtcelr3.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13294"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 50560@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 13 15:11:07 2021 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 1mPljn-0003IP-82 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 13 Sep 2021 15:11:07 +0200 Original-Received: from localhost ([::1]:57140 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPljl-0003YZ-7N for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 13 Sep 2021 09:11:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52906) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPlKY-0000XE-Az for bug-gnu-emacs@gnu.org; Mon, 13 Sep 2021 08:45:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33067) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPlKY-0004Iy-2V for bug-gnu-emacs@gnu.org; Mon, 13 Sep 2021 08:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mPlKX-00013A-W9 for bug-gnu-emacs@gnu.org; Mon, 13 Sep 2021 08:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 13 Sep 2021 12:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50560 X-GNU-PR-Package: emacs Original-Received: via spool by 50560-submit@debbugs.gnu.org id=B50560.16315370783962 (code B ref 50560); Mon, 13 Sep 2021 12:45:01 +0000 Original-Received: (at 50560) by debbugs.gnu.org; 13 Sep 2021 12:44:38 +0000 Original-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 Original-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 Original-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) Original-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) In-Reply-To: <83pmtcelr3.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 13 Sep 2021 14:52:00 +0300") 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" Xref: news.gmane.io gmane.emacs.bugs:214221 Archived-At: 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.