From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: patch about moving file (or directory) to the Recycle Bin on Windows NT series Date: Wed, 23 Apr 2008 07:55:02 +0300 Message-ID: References: Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1208926533 2311 80.91.229.12 (23 Apr 2008 04:55:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 23 Apr 2008 04:55:33 +0000 (UTC) Cc: t_tuneyosi@hotmail.com, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 23 06:56:05 2008 connect(): Connection refused 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 1JoX1U-0008KB-0o for ged-emacs-devel@m.gmane.org; Wed, 23 Apr 2008 06:56:00 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JoX0o-0007s0-Cs for ged-emacs-devel@m.gmane.org; Wed, 23 Apr 2008 00:55:18 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JoX0j-0007rv-Gh for emacs-devel@gnu.org; Wed, 23 Apr 2008 00:55:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JoX0i-0007rg-6c for emacs-devel@gnu.org; Wed, 23 Apr 2008 00:55:12 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JoX0i-0007rd-1f for emacs-devel@gnu.org; Wed, 23 Apr 2008 00:55:12 -0400 Original-Received: from mtaout3.012.net.il ([84.95.2.7]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JoX0h-0004Bc-Pw for emacs-devel@gnu.org; Wed, 23 Apr 2008 00:55:12 -0400 Original-Received: from HOME-C4E4A596F7 ([83.130.1.82]) by i_mtaout3.012.net.il (HyperSendmail v2004.12) with ESMTPA id <0JZR007LCIBCTC93@i_mtaout3.012.net.il> for emacs-devel@gnu.org; Wed, 23 Apr 2008 08:09:22 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-kernel: by monty-python.gnu.org: Solaris 9.1 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:95824 Archived-At: > From: Stefan Monnier > Cc: Toru TSUNEYOSHI , emacs-devel@gnu.org > Date: Tue, 22 Apr 2008 21:14:30 -0400 > > >> + /* On Unix, unlink works without write permission. */ > >> + _chmod (path, 0666); > > > Can this somehow leave the file writable without deleting it, if the > > code is interrupted before it gets to undo this _chmod call? If so, > > we need to guard against that somehow. > > Also that makes the file temporarily readable/writable by everybody. > It's probably better to set it to 0600. Of course, maybe this is > irrelevant because of the way w32 interprets those > Unix-style permissions. Yes, 0600 and 0666 are the same on Windows. When using the Posix emulation functions, such as _chmod, there's only 1 bit that describes whether the file is writable or not. If we really care about this, we need to use the security API, where a full-blown ACL functionality is available. Alternatively, we could simply let the call fail for files not writable by the user: after all, this is what the Windows Explorer will do when you delete files through it.