From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: [gmane.emacs.xemacs.beta] [Bug: 21.5-b27] [CRASH] (file-name-directory "1:") Date: Wed, 01 Nov 2006 16:16:56 +0100 Message-ID: <85irhz8adz.fsf@lola.goethe.zz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1162394316 2050 80.91.229.2 (1 Nov 2006 15:18:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 1 Nov 2006 15:18:36 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 01 16:18:35 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GfHr7-0002ji-3Q for ged-emacs-devel@m.gmane.org; Wed, 01 Nov 2006 16:18:18 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GfHr6-0000vJ-BI for ged-emacs-devel@m.gmane.org; Wed, 01 Nov 2006 10:18:16 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GfHqr-0000ul-Mh for emacs-devel@gnu.org; Wed, 01 Nov 2006 10:18:01 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GfHqq-0000su-2m for emacs-devel@gnu.org; Wed, 01 Nov 2006 10:18:00 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GfHqp-0000sd-PW for emacs-devel@gnu.org; Wed, 01 Nov 2006 10:18:00 -0500 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GfHqp-0000i0-Ld for emacs-devel@gnu.org; Wed, 01 Nov 2006 10:17:59 -0500 Original-Received: from localhost ([127.0.0.1] helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.34) id 1GfHqp-0000gi-1s for emacs-devel@gnu.org; Wed, 01 Nov 2006 10:17:59 -0500 Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id E9E2C1C460D5; Wed, 1 Nov 2006 16:16:56 +0100 (CET) Original-To: emacs-devel@gnu.org User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:61547 Archived-At: --=-=-= Saw the following bug report on the XEmacs developer list. The code in fileio.c in Emacs is very much identical, lines 446 and 472 would seem to be relevant to the problem. I don't have a Windows Emacs available, so I can't vouch for this actually crashing Emacs too, but I consider it quite likely. Somebody using Windows better check this. --=-=-= Content-Type: message/rfc822 Content-Disposition: inline From: stephen@xemacs.org Newsgroups: gmane.emacs.xemacs.beta Subject: [Bug: 21.5-b27] [CRASH] (file-name-directory "1:") Date: Wed, 01 Nov 2006 23:41:46 +0900 Message-ID: <87lkmv5ivp.fsf@uwakimon.sk.tsukuba.ac.jp> References: Cc: XEmacs Beta Archived-At: MIME-Version: 1.0 Adrian Aichner writes: > Just evaluate > (file-name-directory "1:") > in the *scratch* buffer (without any unsaved autobiographies or other > work close to your heart). This is only a problem on Windows. Here's the problem, I think, in fileio.c:find_end_of_directory_component: ------------------------------------------------------------------------ while (p != path && !IS_DIRECTORY_SEP (p[-1]) #ifdef WIN32_FILENAMES /* only recognise drive specifier at the beginning */ && !(p[-1] == ':' /* handle the "/:d:foo" and "/:foo" cases correctly */ && ((p == path + 2 && !IS_DIRECTORY_SEP (*path)) || (p == path + 4 && IS_DIRECTORY_SEP (*path)))) #endif ) p--; ------------------------------------------------------------------------ This code doesn't check whether the X in "X:" is a valid drive letter or not! My guess would be that if X is a valid drive letter, you won't have a problem. Could you try `(file-name-directory "X:")' for X = "C" and X = "S" (or some other letter that definitely isn't mapped to a drive on your system)? I'll bet that it crashes for X = ".", or anything else that isn't a valid drive letter, too. Even if it doesn't fix the crash, if the IS_VALID_DRIVE_LETTER macro exists, then it seems to me the above fragment should be ------------------------------------------------------------------------ while (p != path && !IS_DIRECTORY_SEP (p[-1]) #ifdef WIN32_FILENAMES /* only recognise drive specifier at the beginning */ && !(p == path + 2 && path[1] == ':' && IS_VALID_DRIVE_LETTER (*path)) #endif ) p--; ------------------------------------------------------------------------ It might be even more sane (not to mention faster) to ------------------------------------------------------------------------ #ifdef WIN32_FILENAMES const Ibyte *beg = (path[0] && path[1] && path[1] == ':' && IS_VALID_DRIVE_LETTER (path[0])) ? path + 2 : path; #else const Ibyte *beg = path; #endif while (p != beg && !IS_DIRECTORY_SEP (p[-1])) p--; ------------------------------------------------------------------------ don't you think? --=-=-= -- David Kastrup, Kriemhildstr. 15, 44793 Bochum --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --=-=-=--