From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: Failing test in files-tests.el on MS-Windows Date: Fri, 15 Feb 2019 13:00:48 +0100 Message-ID: <87pnrtclcf.fsf@gmx.de> References: <83zhqxmjb4.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="17958"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 15 13:01:21 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gucBF-0004RJ-3x for ged-emacs-devel@m.gmane.org; Fri, 15 Feb 2019 13:01:21 +0100 Original-Received: from localhost ([127.0.0.1]:38273 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gucBE-0000PG-6P for ged-emacs-devel@m.gmane.org; Fri, 15 Feb 2019 07:01:20 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:55986) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gucB2-0000Oy-C1 for emacs-devel@gnu.org; Fri, 15 Feb 2019 07:01:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gucB0-000799-TP for emacs-devel@gnu.org; Fri, 15 Feb 2019 07:01:08 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:48327) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gucAz-0006rt-5O; Fri, 15 Feb 2019 07:01:05 -0500 Original-Received: from detlef.gmx.de ([212.86.59.221]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MJSx9-1gwX3C3mQN-0032n4; Fri, 15 Feb 2019 13:00:50 +0100 In-Reply-To: <83zhqxmjb4.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 15 Feb 2019 12:34:39 +0200") X-Provags-ID: V03:K1:q9o5/DsDtehQIr7ZEf68Gu/idar1uQqEl7CErQZSJxIVEuGtJcU fm+wQeCNDRJSBbUXc58MnHrD0QrmrsnjMYGdTQrcIKxIHiJw1plOXOyyEJUOvefyGjoSuT6 NWRJHxfo8X5qhk6KCu2dPW3wzsThwSpdgI1whyhOMbd97qsDwMND2QodF3IXMdDkkpZc8G0 s9Gd9DDHzYE5l/yyqK4lA== X-UI-Out-Filterresults: notjunk:1;V03:K0:LZnr0QkDIIY=:MzuP/ZPxB5IspFa+jCrYDJ se0hV/dpPXFbXkM2McsArTUadlFOr0sWiTN8hILt7Xk/qAF3ILUDMMrhg1Y7z6sEEHQ2gLHlU jpuoJKtJ9Gxfq1hvNrF28Qy02PXree0qIMglHYAb869EJ11UAzCbIRHrCXNCmWs7kp4DsyheM ujp1ew+/79Nn80oJZRTfIEnrdlTWWp+UYavlXvczQpdJVW3w8Bjbl/PDxEJHSpJXjqxl2obDU khJuj8VVyzC2fW8cLCS6WJx7j9bJyGJWHiPwfXSlmMJkh3lILzkNwwH73Cb8lRxDt7kTYeRE6 tJUBweVp0EDfMZc+NvquW7AxKd0ZZJtICYkMMS5zIi07X5Nm3L5ymn/oMFprDgbXZbV9BZG27 SoqLdZZzx1u+ErhxPEqsoYFZ8fz7PUOd6qoOHYrYLZCIQUkDz+8dhSQHFQ4S1L8HFqekXRMj0 itGkiBZiJ3XQ2m9h8jhvuZtJ5N13YZout9Zpss2ndaG8zR3ttNiaa+uVB7JRQmNB24uR0hMm2 fXZXZl/1/NuUCQaZlvKYId26KnVf2bV8IQ0E92vcvSP8LiK2+RobB+sUDOiYQyb53WW979Trb 5lpZwTmXxSmjoVtD+pLkth4cPwCHCxjgO95SbtH0hVyJrF+ue5drpkSouaJ1BS5iX7iw+go7b TOc67K9jachROwndffqMO/6hFizFuNvsT/1/k2PIvYojWvU/UEvVhfM7/9W0bGyrWmmqxBWBY jg/NI+DHMKZ8WNi3yv1h6VO2lPcHgqOVpiqzMls9UDMRoopzfEvXbuz4x8ernh2hcCiEMEqc X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.15.18 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:233363 Archived-At: Eli Zaretskii writes: > Michael, Hi Eli, > If you could tell a bit regarding why the expression > > (with-temp-buffer (insert-directory nospecial-dir "")) > > is supposed to signal an error here, I could look into the possible > reason(s). That is rather tricky. We have two macros for every files-tests-file-name-non-special- test: `files-tests--with-temp-non-special' and `files-tests--with-temp-non-special-and-file-name-handler'. The first macro is rather a straight forward test. In case of `files-tests-file-name-non-special-insert-directory', it does something like (house-keeping stripped off): --8<---------------cut here---------------start------------->8--- (let* ((temporary-file-directory (file-truename temporary-file-directory)) (tmpdir (make-temp-file "files-tests" t)) (nospecial-dir (file-name-quote tmpdir))) (should (equal (with-temp-buffer (insert-directory nospecial-dir "") (buffer-string)) (with-temp-buffer (insert-directory tmpdir "") (buffer-string))))) --8<---------------cut here---------------end--------------->8--- The second macro adds an additional file name handler `files-tests--special-file-name-handler', which cares about files with trailing ".special" in their name, and which removes this part of the file name, if they are not quoted. This is done just to see, whether this file name handler has been invoked (which shouldn't for quoted file names). So this part in the `files-tests-file-name-non-special-insert-directory' test expands to --8<---------------cut here---------------start------------->8--- (let* ((temporary-file-directory (file-truename temporary-file-directory)) (file-name-handler-alist `((,files-tests--special-file-name-regexp . files-tests--special-file-name-handler) . ,file-name-handler-alist)) (tmpdir (concat (make-temp-file "files-tests" t) files-tests--special-file-name-extension)) (nospecial-dir (file-name-quote tmpdir))) (should-error (with-temp-buffer (insert-directory nospecial-dir "")))) --8<---------------cut here---------------end--------------->8--- The idea is to check, that once a file name has been quoted with the leading "/:", no other file name handler comes in play. In the given example, a directory "/tmp/files-testsdItXI0" is created, and tmpdir gets the value "/tmp/files-testsdItXI0.special". (insert-directory tmpdir "") would work because the file name handler removes the trailing ".special" from tmpdir. (insert-directory nospecial-dir "") should raise an error, because the file name handler is not invoked, and nospecial-dir does not exist. This works fine under GNU/Linux. Luckily, I have a Windows machine under control today. Running the second snippet under edebug, I get: --8<---------------cut here---------------start------------->8--- c:/Users/albinmic/AppData/Local/Temp/files-testsKpFOvs.special: doesn=C2=92= t exist or is inaccessible Test failed: ((should-error (edebug-after (edebug-before 17) 21 (with-temp-= buffer (edebug-after (edebug-before 18) 20 (insert-directory (edebug-after = 0 19 nospecial-dir) ""))))) :form (edebug-after 17 21 nil) :value nil :fail= -reason "did not signal an error") --8<---------------cut here---------------end--------------->8--- `insert-directory' has shown a bug, but it doesn't signal an error. This seems to be the problem, and maybe also for the other failed tests you have presented. And indeed: --8<---------------cut here---------------start------------->8--- (insert-directory "c:/dir/does/not/exist" "") =3D> nil --8<---------------cut here---------------end--------------->8--- But no error is signaled. Under GNU/Linux, I have --8<---------------cut here---------------start------------->8--- (insert-directory "/dir/does/not/exist" "") =3D> Debugger entered--Lisp error: (file-missing "Reading directory" "No su= ch file or directory" "/dir/does/not/exist") --8<---------------cut here---------------end--------------->8--- > Thanks. Best regards, Michael. PS: Thanks to Noam, who has written all these boring files-tests, which uncover the problems now. Best regards, Michael.