From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.devel Subject: Re: dired-tests.el fails on MS-Windows Date: Wed, 2 Aug 2017 15:44:59 +0900 (JST) Message-ID: References: <83zibjz519.fsf@gnu.org> <87d18fw79z.fsf@calancha-pc> <83pocfyurp.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-235051422-1501656302=:29825" X-Trace: blaine.gmane.org 1501656352 5453 195.159.176.226 (2 Aug 2017 06:45:52 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 2 Aug 2017 06:45:52 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: Eli Zaretskii , Emacs developers , Tino Calancha To: Fabrice Popineau Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 02 08:45:46 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcnPY-0000nX-Eb for ged-emacs-devel@m.gmane.org; Wed, 02 Aug 2017 08:45:40 +0200 Original-Received: from localhost ([::1]:45738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcnPe-00060T-IS for ged-emacs-devel@m.gmane.org; Wed, 02 Aug 2017 02:45:46 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51849) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcnP3-0005xH-FE for emacs-devel@gnu.org; Wed, 02 Aug 2017 02:45:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcnP2-0003tZ-8u for emacs-devel@gnu.org; Wed, 02 Aug 2017 02:45:09 -0400 Original-Received: from mail-it0-x22e.google.com ([2607:f8b0:4001:c0b::22e]:34895) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcnOy-0003ps-En; Wed, 02 Aug 2017 02:45:04 -0400 Original-Received: by mail-it0-x22e.google.com with SMTP id h199so19046943ith.0; Tue, 01 Aug 2017 23:45:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=FqNAGtc+UUgmta/Nvy9pfuFVOqWIU6lItpnaKv+PR9E=; b=Wk3dZjhmvYq0JexttHWtzY7hTfRh8g3mI4ndxIx3PsxJ4OfHf9fr7cKfK5fkQbGo2S WDikt70Kque/np8HxgrT9P249U3eSWspiQRXr1H15pCrVr2kEeGwyyo3hY+3ConBDBH0 rmgxS8W1g7+YsgIsKSeqEJf/XbZWhB9I9deNMcXAOKyEHB2n5nLj6G1V0E5DBah8xNpT fb44byf+TwuYcAEXuNwtR4KW5T752NAzaG3pKNp4zhie8NMsTwB89mMm6PnHcV3mYl/L djBEkEuzxScdefXsP5dwKLhmNLqmXZCelXHlH+XLAS3wHUSwN19aZM4DSQBAcTC30nfD uvkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=FqNAGtc+UUgmta/Nvy9pfuFVOqWIU6lItpnaKv+PR9E=; b=qjDwYTELjkGubNENz7f1KJkN4Ko59vzgVQR9QxZdGwBldCEq4xkO6qa5BDKJJhuLOw LW1Ms7b3pGpeVFdzF0yr4ftVqmd5xb6CTAMjR8QsmaFuV20gKLa7fNaP1RY/7Pwxzjvm 6j9mxTMe6AXoe10P5LFhHqRL3Qj+RcnyhopqAZbxWcXXGuqNsh8lvNeCHOMFEFgq2r/+ t6TaGytcXlZY3vkta3ZVuvdP2xEtujCoi1fLLwClAgE0CeG9syn2mZiJBlySKBP8CynJ pbeHJZrmBScRjt8Fe1GnbcRqVYl8kqTggdb8MHuBDMXxpYfKHhTaYD8jxg7Ez2GHHRL/ +1mw== X-Gm-Message-State: AIVw112PhyfmVAO6nXP6/LC3cvKqsxKPU36LdAVlUXDQjI/1Yfhdo78d zwA66jWg3YxVAw== X-Received: by 10.36.253.135 with SMTP id m129mr4673085ith.152.1501656303547; Tue, 01 Aug 2017 23:45:03 -0700 (PDT) Original-Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170]) by smtp.gmail.com with ESMTPSA id e136sm1655489ita.1.2017.08.01.23.45.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 23:45:02 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c0b::22e 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:217233 Archived-At: --8323329-235051422-1501656302=:29825 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Tue, 1 Aug 2017, Fabrice Popineau wrote: > > > 2017-08-01 21:04 GMT+02:00 Eli Zaretskii : > > Only if there's no better way.  The Patch invocation definitely needs > the --binary switch on Windows, though.  But the failure above is not > about that, it's about something else, because directory-files returns > an empty list.  Something prevents Patch from creating backup files. > > > When I add the '--binary' option to patch, the test passes. > Again, windows 10, mingw64. Fabrice, Eli does the following work in your environments? --8<-----------------------------cut here---------------start------------->8--- commit 16fd5bf68538240b7a601e0975bdd92f0521b7e5 Author: Tino Calancha Date: Wed Aug 2 15:37:11 2017 +0900 Fix an ediff test which fails in MS-Windows https://lists.gnu.org/archive/html/emacs-devel/2017-08/msg00018.html * test/lisp/vc/ediff-ptch-tests.el (ediff-ptch-test-bug26084): Add comments to explain the test logic. Pass '--binary' option to 'patch' program in windows environments. Check explicitely that a backup is created before compare file contents. diff --git a/test/lisp/vc/ediff-ptch-tests.el b/test/lisp/vc/ediff-ptch-tests.el index 387786ced0..6fbc1b0a8b 100644 --- a/test/lisp/vc/ediff-ptch-tests.el +++ b/test/lisp/vc/ediff-ptch-tests.el @@ -66,41 +66,55 @@ (write-region nil nil bar nil 'silent)) (call-process git-program nil `(:file ,patch) nil "diff") (call-process git-program nil nil nil "reset" "--hard" "HEAD") + ;; Visit the diff file i.e., patch; extract from it the parts + ;; affecting just each of the files: store in patch-bar the part + ;; affecting 'bar', and in patch-qux the part affecting 'qux'. (find-file patch) (unwind-protect (let* ((info (progn (ediff-map-patch-buffer (current-buffer)) ediff-patch-map)) - (patch1 + (patch-bar (buffer-substring-no-properties (car (nth 3 (car info))) (car (nth 4 (car info))))) - (patch2 + (patch-qux (buffer-substring-no-properties (car (nth 3 (cadr info))) (car (nth 4 (cadr info)))))) ;; Apply both patches. - (dolist (x (list (cons patch1 bar) (cons patch2 qux))) + (dolist (x (list (cons patch-bar bar) (cons patch-qux qux))) (with-temp-buffer - (insert (car x)) - (call-process-region (point-min) - (point-max) - ediff-patch-program - nil nil nil - "-b" (cdr x)))) - ;; Check backup files were saved correctly. + ;; Some windows variants require the option '--binary' + ;; in order to 'patch' create backup files. + (let ((opts (format "--backup%s" + (if (memq system-type '(windows-nt ms-dos)) + " --binary" "")))) + (insert (car x)) + (call-process-region (point-min) + (point-max) + ediff-patch-program + nil nil nil + opts (cdr x))))) + ;; Check backup files were saved correctly; in Bug#26084 some + ;; of the backup files are overwritten with the actual content + ;; of the updated file. To ensure that the bug is fixed we just + ;; need to check that every backup file produced has different + ;; content that the current updated file. (dolist (x (list qux bar)) (let ((backup (car (directory-files tmpdir 'full (concat (file-name-nondirectory x) "."))))) - (should-not - (string= (with-temp-buffer - (insert-file-contents x) - (buffer-string)) - (with-temp-buffer - (insert-file-contents backup) - (buffer-string)))))) + ;; Compare files only if the backup has being created. + (when backup + (should-not + (string= (with-temp-buffer + (insert-file-contents x) + (buffer-string)) + (with-temp-buffer + (insert-file-contents backup) + (buffer-string))))))) (delete-directory tmpdir 'recursive) (delete-file patch))))) --8<-----------------------------cut here---------------end--------------->8--- In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-08-02 built Repository revision: 0fd6de9cb444d6cc553ea67815ccfb7a923012a2 --8323329-235051422-1501656302=:29825--