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#50988: 26.3; gnus-cloud gets wrong chunk byte count writing sync from windows Date: Sun, 03 Oct 2021 12:15:08 +0300 Message-ID: <83czoma2qr.fsf@gnu.org> References: <86o886jym9.fsf@dod.no> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33551"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 50988@debbugs.gnu.org To: sb@dod.no Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 03 11:17:56 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 1mWxd6-0008Wd-72 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 03 Oct 2021 11:17:56 +0200 Original-Received: from localhost ([::1]:47330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWxd4-00066D-2t for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 03 Oct 2021 05:17:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWxbG-0004mQ-Jd for bug-gnu-emacs@gnu.org; Sun, 03 Oct 2021 05:16:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49479) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWxbG-0006oc-Bc for bug-gnu-emacs@gnu.org; Sun, 03 Oct 2021 05:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mWxbG-0001Ay-6q for bug-gnu-emacs@gnu.org; Sun, 03 Oct 2021 05:16:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 Oct 2021 09:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50988 X-GNU-PR-Package: emacs Original-Received: via spool by 50988-submit@debbugs.gnu.org id=B50988.16332525463661 (code B ref 50988); Sun, 03 Oct 2021 09:16:02 +0000 Original-Received: (at 50988) by debbugs.gnu.org; 3 Oct 2021 09:15:46 +0000 Original-Received: from localhost ([127.0.0.1]:32792 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mWxb0-0000wc-Ex for submit@debbugs.gnu.org; Sun, 03 Oct 2021 05:15:46 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:42214) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mWxaz-0000rl-RE for 50988@debbugs.gnu.org; Sun, 03 Oct 2021 05:15:46 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:43842) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWxat-0006Wr-DR; Sun, 03 Oct 2021 05:15:39 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3262 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 1mWxad-0007e8-5a; Sun, 03 Oct 2021 05:15:38 -0400 In-Reply-To: <86o886jym9.fsf@dod.no> (sb@dod.no) 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:216228 Archived-At: > From: sb@dod.no > Date: Sun, 03 Oct 2021 10:34:06 +0200 > > When gnus-cloud-upload-all-data is run in gnus on emacs on windows, the > byte count in the sync data chunks is wrong, so that the data is broken > when attemting to sync on a debian machine. > > The first chunk has the following header: > (:type :file :file-name "~/.gnus.el" :timestamp "2021-09-19T15:04:33+0200" :length 16241) > > The byte count here is 16241, but it should have been 15754. > > This results in the contents of the score files that follows .gnus.el to > be copied into .gnus.el and the .gnus.el file becomes unparsable. > > The difference in length corresponds to the number of lines in .gnus.el, > so I'm guessing it's because the CR in CRLF line endings is stripped > away. > > The place where the length is set, is here > https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/gnus/gnus-cloud.el#n98 > > I've tried taking the length of the string instead of the size of the > buffer, but the count for .gnus.el still came out as 16241 (so the CR > stripping doesn't take place there). > > I've also, as an experiment, replaced insert-file-contents-literally, > with insert-file-contents, and then windows gnus wrote data that > gnus-cloud-download-all-data on debian gnus could read. Does the file read by that code have DOS-style CRLF end-of-line format? And what does that code have to do with your .gnus.el? (I don't use Gnus, so apologies for asking questions whose answers are trivial.) In general, if that function is supposed to read user-written files (as opposed to files Gnus itself writes), then it should not assume the EOL format is Unix. But I'm not sure insert-file-contents is the right solution here, because I don't know what will Gnus do with the file. Note that the function reads the file into a unibyte buffer, while insert-file-contents performs decoding, and these two don't mix well, usually. Do you understand why the byte count "should have been 15754"? If gnus-cloud synchronizes your files with a remote repository, then the files on the remote should have the same EOL format as on your original disk, so where does Emacs strip or ignore the CR characters to come up with a smaller number of bytes in the actual transfer? HTH