From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.lisp.guile.devel Subject: Re: Windows file name separators Date: Tue, 10 Jun 2014 19:00:58 +0300 Message-ID: <83egyw21qd.fsf@gnu.org> References: <83lht730k8.fsf@gnu.org> <87k38p6f9v.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: ger.gmane.org 1402416124 30944 80.91.229.3 (10 Jun 2014 16:02:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 10 Jun 2014 16:02:04 +0000 (UTC) Cc: guile-devel@gnu.org To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Jun 10 18:01:58 2014 Return-path: Envelope-to: guile-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 1WuOUl-0002oo-No for guile-devel@m.gmane.org; Tue, 10 Jun 2014 18:01:55 +0200 Original-Received: from localhost ([::1]:40828 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuOUl-000819-Cc for guile-devel@m.gmane.org; Tue, 10 Jun 2014 12:01:55 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuOTx-0006il-Nb for guile-devel@gnu.org; Tue, 10 Jun 2014 12:01:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WuOTr-0003YB-QN for guile-devel@gnu.org; Tue, 10 Jun 2014 12:01:05 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:49260) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuOTr-0003Xo-JA; Tue, 10 Jun 2014 12:00:59 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0N6Y00G00MYA6800@a-mtaout20.012.net.il>; Tue, 10 Jun 2014 19:00:57 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N6Y00FEYN5LX150@a-mtaout20.012.net.il>; Tue, 10 Jun 2014 19:00:57 +0300 (IDT) In-reply-to: <87k38p6f9v.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.166 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:17204 Archived-At: > From: ludo@gnu.org (Ludovic Court=C3=A8s) > Date: Mon, 09 Jun 2014 21:42:36 +0200 >=20 > Eli Zaretskii skribis: >=20 > > 3. load.test fails: > > > > FAIL: load.test: search-path for "foo.scm" yields "dir1/foo.= scm" > > > > (The messages are misleading: "yields" should be "should yield= ".) > > > > The test fails because: > > > > . it compares file names with equal?, which fails when Window= s > > file names with mixed forward and backslashes are used, and= /or > > when the files differ but for letter case > > > > . the expected result uses a relative file name of temp-dir, = while > > search-path returns absolute file names > > > > Fixed by using "/" to create a file name from its parts in loa= d.c: > > > > --- libguile/load.c~=092014-02-28 23:01:27 +0200 > > +++ libguile/load.c=092014-06-08 13:27:24 +0300 > > @@ -452,11 +452,15 @@ scm_c_string_has_an_ext (char *str, size > > return 0; > > } > > =20 > > +#if 0 > > #ifdef __MINGW32__ > > #define FILE_NAME_SEPARATOR_STRING "\\" > > #else > > #define FILE_NAME_SEPARATOR_STRING "/" > > #endif > > +#else > > +#define FILE_NAME_SEPARATOR_STRING "/" > > +#endif > > =20 > > static int > > is_file_name_separator (SCM c) > > > > I don't see any reasons to use the backslashes when constructi= ng > > Windows file names. Unless someone can tell why using backsla= shes > > is a good idea, I propose to remove the Windows setting of > > FILE_NAME_SEPARATOR_STRING. >=20 > I=E2=80=99m confused: this was added in 4bab7f01 precisely to suppo= rt MinGW or > Windows. Similarly, boot-9.scm has =E2=80=98file-name-separator-st= ring=E2=80=99 and > related stuff. This was the result of the discussion at > . Sorry, that's my fault: I didn't explain the problem in enough detail= . There's nothing wrong with the 4bab7f01 commit per se (and you will see that its only part that I changed is the definition of FILE_NAME_SEPARATOR_STRING for MinGW). The problem is not in that commit, it is elsewhere: in Scheme code, in this case in the test suite, that compares file names as simple strings. Such comparisons fail if the file names differ by the style of directory separators: one uses forward slashes, the other backslashes, or some mix thereof. Now, FILE_NAME_SEPARATOR_STRING is used only for constructing file names from their parts. It is not used for testing a particular file-name character for being a directory separator. Therefore, we can discard the separate definition of FILE_NAME_SEPARATOR_STRING for Windows, and use "/" on all platforms. This makes the problem of comparing file names easier, and in particular lets Guile pass load.test. But it doesn't solve the problem entirely. To solve this problem completely, we need a function that canonicalizes a file name wrt directory separators -- converts all backslashes to forward slashes. Does Guile have such a function? If it does, then comparing the canonicalized file names will work reliably on Windows. I hope I made myself clear this time. Thanks. P.S. Please CC me on your responses, as I'm not subscribed to the list, so I need to download the list archives in order to reply.