From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: phillip.lord@russet.org.uk (Phillip Lord) Newsgroups: gmane.emacs.devel Subject: Re: Viper tests failure? Date: Tue, 21 Jun 2016 21:26:58 +0100 Message-ID: <878txyguel.fsf@russet.org.uk> References: <874m8mvcq7.fsf@russet.org.uk> <83ziqe5zg0.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1466540880 27282 80.91.229.3 (21 Jun 2016 20:28:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Jun 2016 20:28:00 +0000 (UTC) Cc: fabrice.popineau@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 21 22:27:49 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bFSGu-0007Er-M0 for ged-emacs-devel@m.gmane.org; Tue, 21 Jun 2016 22:27:44 +0200 Original-Received: from localhost ([::1]:54094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFSGt-0000AJ-PL for ged-emacs-devel@m.gmane.org; Tue, 21 Jun 2016 16:27:43 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40933) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFSGK-0000AD-R8 for emacs-devel@gnu.org; Tue, 21 Jun 2016 16:27:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFSGI-0001AX-M2 for emacs-devel@gnu.org; Tue, 21 Jun 2016 16:27:07 -0400 Original-Received: from cloud103.planethippo.com ([31.216.48.48]:36762) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFSGC-00019k-Ir; Tue, 21 Jun 2016 16:27:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=russet.org.uk; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:Cc:To:From; bh=x+FAB563VT0ClX2gcbYD807k599C9oqGvbfdZqufPoM=; b=hrfu0wRH8HiHC/Yl4LqEi7zOna t6HhZXR6j7mTcDcr+Nn6kj+h1a/i5WYb7r3kvkJHN+XFzW2Fpaa37qQ7Ruay/DK7iVfyxPoFI6ain K38RRMNW5wv0Qn154YjuNr/aDr8/73uMhHqAfFFcpgysbjaInjT5EDR1EUUObvgFOrME6qNvHJfbl TpVcC9t4qKeth9do+8qN0xgDTuACupDoIpX+AsqbjkpcUI77GO+xpRRxJOCUmsKULzgaXXCUU9xvk 4Re/nqT/nsQIxS3d0eUtkgOsY29Xe3qkKeM4spQ4hABAHdesZ15+4l4xQerAPotnjTxsXDxG0eGqV rF68sfpw==; Original-Received: from cpc1-benw10-2-0-cust373.gate.cable.virginm.net ([77.98.219.118]:36103 helo=russet.org.uk) by cloud103.planethippo.com with esmtpsa (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.86_1) (envelope-from ) id 1bFSGB-003Vlj-BE; Tue, 21 Jun 2016 21:26:59 +0100 In-Reply-To: <83ziqe5zg0.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 21 Jun 2016 18:33:35 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.95 (gnu/linux) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cloud103.planethippo.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - russet.org.uk X-Get-Message-Sender-Via: cloud103.planethippo.com: authenticated_id: phillip.lord@russet.org.uk X-Authenticated-Sender: cloud103.planethippo.com: phillip.lord@russet.org.uk X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 31.216.48.48 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:204653 Archived-At: Eli Zaretskii writes: >> The file is only created to be empty (viper loads the custom-file >> whatever I do, so making an empty one seemed the only way to disable it. >> >> I've checked and the error comes from the viper-load-custom-file >> function which is calle during load. The file exists according to emacs, >> but it cannot be loaded. >> >> Not sure what to test next. > > The problem is real. There's a bug in Fload: it blindly overwrites > the last character of the file name, without making sure it ends in > ".elc". That's why the simple change below (which is really a > workaround) fixes the problem for me. > > The bug is here: > > /* openp already checked for newness, no point doing it again. > FIXME would be nice to get a message when openp > ignores suffix order due to load_prefer_newer. */ > if (!load_prefer_newer) > { > result = stat (SSDATA (efound), &s1); > if (result == 0) > { > SSET (efound, SBYTES (efound) - 1, 0); > result = stat (SSDATA (efound), &s2); > SSET (efound, SBYTES (efound) - 1, 'c'); > } > > This removes the last character of the file, then replaces it with > 'c', but we can end up in this fragment when the file name does not > end in a ".elc", because the condition which guards this says: > > if (suffix_p (found, ".elc") || (fd >= 0 && (version = safe_to_load_version (fd)) > 0)) > > and the second alternative does not guarantee that the file name ends > in ".elc". > > The error message we see on Windows is misleading, because it uses the > correct file name, not the one Emacs tries to open. The error only > happens on Windows, because we don't use fdopen there, but instead > close and reopen the file -- using the wrong name. > > And here's the simple workaround I mentioned: > > diff --git a/test/lisp/emulation/viper-tests.el b/test/lisp/emulation/viper-tests.el > index 074dd63..0d6095b 100644 > --- a/test/lisp/emulation/viper-tests.el > +++ b/test/lisp/emulation/viper-tests.el > @@ -38,7 +38,7 @@ viper-test-undo-kmacro > ;; Select an expert-level for the same reason. > (viper-expert-level 5) > ;; viper loads this even with -q so make sure it's empty! > - (viper-custom-file-name (make-temp-file "viper-tests")) > + (viper-custom-file-name (make-temp-file "viper-tests" nil ".elc")) > (before-buffer (current-buffer))) > (unwind-protect > (progn Okay, I was wondering whether it was a problem with the suffix. The viper-test is fix obviously fine by me -- should have done it that way in the first place, although uncovering the Fload but is a nice side effect. Can you add it to emacs-25 (I'm away from my windows machine, and I'd rather not commit something I can't test). Phil