From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 23 11:30:53 2023 Received: (at submit) by debbugs.gnu.org; 23 Jun 2023 15:30:54 +0000 Received: from localhost ([127.0.0.1]:39354 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qCikL-0001nK-QY for submit@debbugs.gnu.org; Fri, 23 Jun 2023 11:30:53 -0400 Received: from lists.gnu.org ([209.51.188.17]:57348) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qCaz0-0001w0-Kv for submit@debbugs.gnu.org; Fri, 23 Jun 2023 03:13:27 -0400 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 1qCaz0-0003wy-DG for bug-gnu-emacs@gnu.org; Fri, 23 Jun 2023 03:13:26 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qCayy-0000Vc-Ma for bug-gnu-emacs@gnu.org; Fri, 23 Jun 2023 03:13:26 -0400 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-25e836b733eso149105a91.0 for ; Fri, 23 Jun 2023 00:13:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687504403; x=1690096403; h=content-transfer-encoding:mime-version:from:subject:cc:to :message-id:date:from:to:cc:subject:date:message-id:reply-to; bh=fTAQRcJgoNe2Jr6EgrU/u0gREKnSPZmRJsZalTCkkAk=; b=CUCQKOXN/R/FZzLdU1vYVb4ntR8JvOY++3v06edCbklF6Uc2L1gT+o8zpNyGlXzaSI nEY2cDNx/mJYGDDlLPUtRLMoKfOh9ALLLkcdq887CjYV7J0i1TsChJ1kXvvs/bMG7FbQ YnKMjIkqszJBaj1IFYcNyDJ8wDqtkksS4+oxlDK1OGT2f5MZtlBLJawziLXaOmPmiK4o 8pkWNEIRJhWZ+Tq/qzNQluX7v6rgOUwpmvm87MERjp0byhdwSS9fHFuMXGdeVD9KbVVj xIzmbrnoM19RyhdSlss22Pi3DURBdcZ4TIgvLru5FXRqsgsWfUUD70l0lI9Vh4qCDth9 MXFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687504403; x=1690096403; h=content-transfer-encoding:mime-version:from:subject:cc:to :message-id:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fTAQRcJgoNe2Jr6EgrU/u0gREKnSPZmRJsZalTCkkAk=; b=HOIUziOQuDzMR2YPD/kwtowu2ecI2qUh/5s8pE161Uz/Qwr/07bR39qsoqfMEj/t+H nu2H4FFxIp4ayS/OLrYcRH08VwwnRZgG1jNG6SoU2VUEBfB85cPKEpzvnxGyDzNumn+f TRIWIgovQNcXfNWn7MRLP4/N3jv3XBFkIXbkr5hI608HWR4tnteRKHbSq5vFuJ4eCysc 805WnrseRNhA0aeeiOgVoFB0be7XYKZQi82KNtQFbycM/pIuqyugYD2ZahcE3y/6TRuk w4QxjPsXnMef1lgsjX06cqFTeYpkQGxY1m7CHcc3Ka7JfvBOq4JePB6FDOnh1Ng097bZ aWzA== X-Gm-Message-State: AC+VfDxl2e3IPnYuDFBLwAjrR9ZrHGOkA2cpnwGA0N1KukOytE7smC9w Yk6JCXs7UhhTOXPT3S+6/o8= X-Google-Smtp-Source: ACHHUZ4p9HyJ759+aqAw9zmdhKdYEotW41yFdBBRDHZDxa94vOuuRYRty/5gJdfR+R5x0K7luapKjw== X-Received: by 2002:a17:90a:db49:b0:25e:a1c0:af23 with SMTP id u9-20020a17090adb4900b0025ea1c0af23mr15871700pjx.38.1687504402979; Fri, 23 Jun 2023 00:13:22 -0700 (PDT) Received: from vostro ([106.210.225.17]) by smtp.gmail.com with ESMTPSA id 12-20020a17090a01cc00b0024e33c69ee5sm888362pjd.5.2023.06.23.00.13.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 00:13:22 -0700 (PDT) Date: Fri, 23 Jun 2023 12:43:19 +0530 (IST) Message-Id: <20230623.124319.782140973726874654.mail@localhost.localdomain> To: bug-gnu-emacs@gnu.org Subject: 26.3; Bug in revert-buffer-with-coding-system From: meta1729 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=meta1729@gmail.com; helo=mail-pj1-x102f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 23 Jun 2023 11:30:48 -0400 Cc: meta1729 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.1 (--) When a buffer is terminated with an un-encodable character, revert-buffer-with-coding-system modifies the buffer in unexpected ways when coding system of the buffer is changed from default iso-latin-1-unix to utf-8-unix, when the visited file contains characters that cannot be encoded in either iso-latin-1-unix or utf-8-unix. Procedure to reproduce the bug. [Create a file which has un-encodable characters and some text between them.] $ echo 3b3b20410a3b3b20420aa80a3b3b20430a3b3b20440aa9 | xxd -r -p > sample Open in Emacs. $ emacs -q -nw --no-site-file -nsl sample Enter: C-h C [describe-coding-system] Output: Coding system for saving this buffer: 1 -- iso-latin-1-unix (alias: iso-8859-1-unix latin-1-unix) Enter: M-x revert-buffer-with-coding-system RET utf-8 RET yes [The buffer has been incorrectly modified. You can see escaped character code at the beginning of buffer, which previously existed at the end of the buffer.] Enter : C-h C [describe-coding-system] Output: Coding system for saving this buffer: U -- utf-8-unix (alias: mule-utf-8-unix cp65001-unix) [Save the buffer to demonstrate that the file has really been incorrectly modified.] Enter: C-x C-w [write-file] Filename: sample2 Select coding system: default raw-text Exit Emacs. C-x C-c $ xxd -p sample2 a93b3b20410a3b3b20420aa80a3b3b20430a3b3b20440a [Compare sample and sample2. Last character (hex code a9) has been moved to beginning of file.] Retry above procedure with different choice for revert-buffer-with-coding-system. Does occur when utf-8 or utf-16 or utf-7 is chosen. Does not occur when iso-2022-7bit is chosen. In GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.14) of 2020-03-26, modified by Debian built on lcy01-amd64-020 System Description: Ubuntu 20.04.6 LTS From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 24 04:51:34 2023 Received: (at 64253) by debbugs.gnu.org; 24 Jun 2023 08:51:34 +0000 Received: from localhost ([127.0.0.1]:39912 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qCyzV-0006UL-To for submit@debbugs.gnu.org; Sat, 24 Jun 2023 04:51:34 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58996) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qCyzS-0006U6-Jr for 64253@debbugs.gnu.org; Sat, 24 Jun 2023 04:51:32 -0400 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 1qCyzN-0006OI-3Y; Sat, 24 Jun 2023 04:51:25 -0400 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=DBUcuUnn3i4yxxnW4bsM1uYfmKnxbovPW8KZlgHWY0E=; b=Wrr2Mx9o1tat s1qYEfMNUeBSfVbMZTbfuieEj9FSJdZLuiZICQlzjt8gjGPtC6BWmbJ3B3wHoEiSD4WVueqZkIQzW Wfv08CTi8PTckRHt7RKFdGyF3G9DRrwMQEeQ+sK7xgwOQmRjE1uJAO4lVpKhkG94MXyLtfGnaM2Xr RAINZljhiKdwDYnxPEZtAh0vzot4EQI7586xI83fg6pG9LGVwyKhg77rLmeUMooOYYJNC3w+OQDUO SMIS4p0yPgS5xCHOijQ+npwbzjaBBzWvvFzgsZokea+LcovXG7rz1DRfjmUUzXItf/aWFamoS3a/7 UCB+940LDaqMQ1bO6dlIHQ==; Received: from [87.69.77.57] (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 1qCyzM-0000of-KB; Sat, 24 Jun 2023 04:51:24 -0400 Date: Sat, 24 Jun 2023 11:51:39 +0300 Message-Id: <83sfahz1ic.fsf@gnu.org> From: Eli Zaretskii To: meta1729 In-Reply-To: <20230623.124319.782140973726874654.mail@localhost.localdomain> (message from meta1729 on Fri, 23 Jun 2023 12:43:19 +0530 (IST)) Subject: Re: bug#64253: 26.3; Bug in revert-buffer-with-coding-system References: <20230623.124319.782140973726874654.mail@localhost.localdomain> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64253 Cc: 64253@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: meta1729 > Date: Fri, 23 Jun 2023 12:43:19 +0530 (IST) > From: meta1729 > > > When a buffer is terminated with an un-encodable character, > revert-buffer-with-coding-system modifies the buffer in unexpected > ways when coding system of the buffer is changed from default > iso-latin-1-unix to utf-8-unix, when the visited file contains > characters that cannot be encoded in either iso-latin-1-unix or > utf-8-unix. > > Procedure to reproduce the bug. > > [Create a file which has un-encodable characters and some text between them.] > $ echo 3b3b20410a3b3b20420aa80a3b3b20430a3b3b20440aa9 | xxd -r -p > sample > > Open in Emacs. > $ emacs -q -nw --no-site-file -nsl sample > > Enter: C-h C [describe-coding-system] > Output: > Coding system for saving this buffer: > 1 -- iso-latin-1-unix (alias: iso-8859-1-unix latin-1-unix) > > Enter: M-x revert-buffer-with-coding-system RET utf-8 RET yes > > [The buffer has been incorrectly modified. You can see escaped > character code at the beginning of buffer, which previously existed at > the end of the buffer.] Thanks. This 21-year old bug (a simple omission of a single code line) should now be fixed on the emacs-29 branch. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 01 04:30:23 2023 Received: (at 64253-done) by debbugs.gnu.org; 1 Jul 2023 08:30:23 +0000 Received: from localhost ([127.0.0.1]:56515 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qFVzq-0005Qu-Mu for submit@debbugs.gnu.org; Sat, 01 Jul 2023 04:30:22 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43616) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qFVzo-0005Qc-LM for 64253-done@debbugs.gnu.org; Sat, 01 Jul 2023 04:30:21 -0400 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 1qFVzj-00078M-E9; Sat, 01 Jul 2023 04:30:15 -0400 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=Xn6MH7w+qMP/8G9f1USZUyIi3XvZMsTW7ejP9lchKF4=; b=ffHUn8MnNOP8 5ZRHMtGZg1altlvJj+5blvXg0ro/E8jOqXdzUfbRQfV2qPzoFS33eXG56c0suE8e7jGjyf+nqwbeD W4N8TyqKQs95Tf6BMpNDAVXch8Kueq6m7WRmnQyAY0tc4rU5ZkHZavBgIT7LGkhSVy5YBMEk7Gye+ BfWhYFOB0EXg1OsgYmjVWYG+qh/3MGOIiaf3VWj+hYfZJWjzCZAlkxLrFlmbSsssOuw9k0bVQ7fFs qxddqdzIPMtEgroFdxfsnAVHBszbiE9/gM+T0hPPjCDLueXcnVz644ZpRDwzguXvTmKHqdmal347b m54PH+Tycwx5jJ04QEB2yg==; Received: from [87.69.77.57] (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 1qFVzi-0004wh-Uy; Sat, 01 Jul 2023 04:30:15 -0400 Date: Sat, 01 Jul 2023 11:30:47 +0300 Message-Id: <83o7kwqbig.fsf@gnu.org> From: Eli Zaretskii To: meta1729@gmail.com In-Reply-To: <83sfahz1ic.fsf@gnu.org> (message from Eli Zaretskii on Sat, 24 Jun 2023 11:51:39 +0300) Subject: Re: bug#64253: 26.3; Bug in revert-buffer-with-coding-system References: <20230623.124319.782140973726874654.mail@localhost.localdomain> <83sfahz1ic.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64253-done Cc: 64253-done@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: 64253@debbugs.gnu.org > Date: Sat, 24 Jun 2023 11:51:39 +0300 > From: Eli Zaretskii > > > $ emacs -q -nw --no-site-file -nsl sample > > > > Enter: C-h C [describe-coding-system] > > Output: > > Coding system for saving this buffer: > > 1 -- iso-latin-1-unix (alias: iso-8859-1-unix latin-1-unix) > > > > Enter: M-x revert-buffer-with-coding-system RET utf-8 RET yes > > > > [The buffer has been incorrectly modified. You can see escaped > > character code at the beginning of buffer, which previously existed at > > the end of the buffer.] > > Thanks. This 21-year old bug (a simple omission of a single code > line) should now be fixed on the emacs-29 branch. No further comments, so I assume the bug is indeed fixed, and I'm closing it. From unknown Mon Aug 11 12:53:40 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 29 Jul 2023 11:24:11 +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