From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [gmane.emacs.bugs] Emacs fails to start properly if the current working directory is on a vfat or ntfs filesystem Date: Tue, 26 Feb 2008 10:18:43 -0500 Message-ID: References: <877igvl4dn.fsf@stupidchicken.com> <47C180F9.2060901@gnu.org> <47C2014A.4090702@gnu.org> <47C35614.6020407@gnu.org> <47C3DE3E.70402@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1204039260 32264 80.91.229.12 (26 Feb 2008 15:21:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 Feb 2008 15:21:00 +0000 (UTC) Cc: cyd@stupidchicken.com, eliz@gnu.org, rms@gnu.org, emacs-devel@gnu.org To: Jason Rumney Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 26 16:21:16 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JU1b9-0000m8-80 for ged-emacs-devel@m.gmane.org; Tue, 26 Feb 2008 16:20:03 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JU1ad-0004Si-36 for ged-emacs-devel@m.gmane.org; Tue, 26 Feb 2008 10:19:31 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JU1aK-0004KC-7i for emacs-devel@gnu.org; Tue, 26 Feb 2008 10:19:12 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JU1aI-0004JN-O8 for emacs-devel@gnu.org; Tue, 26 Feb 2008 10:19:11 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JU1aI-0004JG-Kf for emacs-devel@gnu.org; Tue, 26 Feb 2008 10:19:10 -0500 Original-Received: from mercure.iro.umontreal.ca ([132.204.24.67]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JU1a7-0002WQ-UJ; Tue, 26 Feb 2008 10:19:00 -0500 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 994862CF8E2; Tue, 26 Feb 2008 10:18:59 -0500 (EST) Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 0F56F3FE1; Tue, 26 Feb 2008 10:18:44 -0500 (EST) Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id EFD6E6CAA2; Tue, 26 Feb 2008 10:18:43 -0500 (EST) In-Reply-To: <47C3DE3E.70402@gnu.org> (Jason Rumney's message of "Tue, 26 Feb 2008 09:39:10 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) 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:90506 Archived-At: > OK, here's a revised patch that accepts only ASCII alphanumerics, -, _, ., > ~, # and +, and percent encodes all others. > It's not strict URL encoding, since multibyte characters will be translated > to more than two hex characters, but as far as I can tell the encoding > doesn't have to be reversable, just give unique names that don't contain > invalid characters, so I think it is good enough. On the trunk it is cheap > and easy to convert to utf-8, so we could properly URL encode them there. > *** files.el.~1.896.2.38.~ 2008-02-24 16:51:32.796875000 +0000 > --- files.el 2008-02-26 09:27:34.078125000 +0000 > *************** > *** 4561,4575 **** > (let ((buffer-name (buffer-name)) > (limit 0) > file-name) > ! ;; Eliminate all slashes and backslashes by > ! ;; replacing them with sequences that start with %. > ! ;; Quote % also, to keep distinct names distinct. > ! (while (string-match "[/\\%]" buffer-name limit) > (let* ((character (aref buffer-name (match-beginning 0))) > (replacement > ! (cond ((eq character ?%) "%%") > ! ((eq character ?/) "%+") > ! ((eq character ?\\) "%-")))) > (setq buffer-name (replace-match replacement t t buffer-name)) > (setq limit (1+ (match-end 0))))) > ;; Generate the file name. > --- 4561,4576 ---- > (let ((buffer-name (buffer-name)) > (limit 0) > file-name) > ! ;; Restrict the characters used in the file name to those which > ! ;; are known to be safe on all filesystems, url-encoding the > ! ;; rest. > ! ;; We do this on all platforms, because even if we are not > ! ;; running on DOS/Windows, the current directory may be on a > ! ;; mounted VFAT filesystem, such as a USB memory stick. > ! (while (string-match "[^A-Za-z0-9-_.~#+]" buffer-name limit) > (let* ((character (aref buffer-name (match-beginning 0))) > (replacement > ! (format "%%%02X" character))) > (setq buffer-name (replace-match replacement t t buffer-name)) > (setq limit (1+ (match-end 0))))) > ;; Generate the file name. Looks good. Feel free to install it on the 22 branch (assuming you've actually tested it, of course). Stefan