From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Li Zhai Newsgroups: gmane.emacs.bugs Subject: bug#13079: 24.3.50; Emacs cannot create subprocess Date: Thu, 6 Dec 2012 16:18:10 +0800 Message-ID: References: <83ehj5r2gs.fsf@gnu.org> <83wqwwpfu1.fsf@gnu.org> <83obi7q1hn.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1354781948 26412 80.91.229.3 (6 Dec 2012 08:19:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 6 Dec 2012 08:19:08 +0000 (UTC) Cc: 13079@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Dec 06 09:19:21 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1TgWft-0003MM-HC for geb-bug-gnu-emacs@m.gmane.org; Thu, 06 Dec 2012 09:19:17 +0100 Original-Received: from localhost ([::1]:50090 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgWfh-0007EA-Hb for geb-bug-gnu-emacs@m.gmane.org; Thu, 06 Dec 2012 03:19:05 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:44218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgWfZ-0007Dy-FM for bug-gnu-emacs@gnu.org; Thu, 06 Dec 2012 03:19:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TgWfT-00035f-41 for bug-gnu-emacs@gnu.org; Thu, 06 Dec 2012 03:18:57 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45580) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgWfT-00035b-0j for bug-gnu-emacs@gnu.org; Thu, 06 Dec 2012 03:18:51 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TgWfe-0007G1-DV for bug-gnu-emacs@gnu.org; Thu, 06 Dec 2012 03:19:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Li Zhai Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 06 Dec 2012 08:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13079 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13079-submit@debbugs.gnu.org id=B13079.135478190727852 (code B ref 13079); Thu, 06 Dec 2012 08:19:02 +0000 Original-Received: (at 13079) by debbugs.gnu.org; 6 Dec 2012 08:18:27 +0000 Original-Received: from localhost ([127.0.0.1]:55831 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TgWf4-0007FB-Ff for submit@debbugs.gnu.org; Thu, 06 Dec 2012 03:18:26 -0500 Original-Received: from mail-la0-f44.google.com ([209.85.215.44]:32803) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TgWf1-0007F3-IK for 13079@debbugs.gnu.org; Thu, 06 Dec 2012 03:18:24 -0500 Original-Received: by mail-la0-f44.google.com with SMTP id d3so5317835lah.3 for <13079@debbugs.gnu.org>; Thu, 06 Dec 2012 00:18:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=nMsMmbw3YsLZsQRJvjkif6H5gSht85j/XnfZkfWPui4=; b=WMUJ5AJjsZGryPgRy23QKOJSMQsAlYlL9QljRDSAu3XQHRY/bcDypC3sQo/iyhqhL9 HwGVOVD1IjHddV9geddBAakwnIYYXgxwzi+P7Y3PvvD5NVb5xskha6kjboyKa47nV8GA TQlN2mpZD0lyrASVCc8Fz/m1lFmygTQ2d9PWmyb9agBYBy0+6ZbNmJ31pFT+fK8VBl7c D6kdR7Txm3iPp2d6eqihxmWoIvKA69E/lmBrR7KSHJZAVMEfbShP//Sg7FxnosZwcHk0 97sr+jP5Z6sPhJTtfwRyyu1yG1RpXL51QvuPz8RfWbMWZ5mkGYxFUG2b/Bc0EFFGWMny 0+0Q== Original-Received: by 10.152.110.229 with SMTP id id5mr732600lab.36.1354781890613; Thu, 06 Dec 2012 00:18:10 -0800 (PST) Original-Received: by 10.114.22.167 with HTTP; Thu, 6 Dec 2012 00:18:10 -0800 (PST) In-Reply-To: <83obi7q1hn.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:68016 Archived-At: I've tried another method, using the flag FILE_FLAG_DELETE_ON_CLOSE while open the files. Create a file by passed the flag FILE_FLAG_DELETE_ON_CLOSE to CreateFile, if all the handles are closed, the file will be deleted automatically. I wrote a very simple program to test that feature. It seems works. #include #include #include #include #include #include void main( void ) { HANDLE fh1, fh2; char buf[100]; DWORD dwReadSize; DWORD dwWriteSize; fh1 = CreateFile("temp.txt", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, NULL); WriteFile(fh1, "hello", 5, &dwWriteSize, NULL); fh2 = CreateFile("temp.txt", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (fh2 == INVALID_HANDLE_VALUE) perror( "Open failed on fh2" ); printf("Close the first file handle...\n"); CloseHandle(fh1); printf("Read file...\n"); ReadFile(fh2, buf, 5, &dwReadSize, NULL); buf[5] = 0; printf("File content:\n %s\n", buf); _getch(); printf("Close the second file handle...The file should be deleted\n"); CloseHandle(fh2); } But this method has some limit. Firstly, all the files must create/open by Win32 API, the codes are totally unportable. Secondly, the file must be opened with a flag FILE_SHARE_DELETE, or the file will not be deleted. And I don't know how to integrate the Win32 API with the emacs codes. Emacs codes use POSIX functions(_open, _close, _read...), and the delete_on_close feature required WIN32 API. I've tried using _O_TEMPORARY flags with _open function, but not succeeded. On Thu, Dec 6, 2012 at 11:54 AM, Eli Zaretskii wrote: >> Date: Thu, 6 Dec 2012 09:58:19 +0800 >> From: Li Zhai >> Cc: 13079@debbugs.gnu.org >> >> I got it. The maximize number of calling mktemp is 42 if we don't >> remove the temporary em* files. > > Yes. > >> I found a very interesting discuss about the limit of mktemp on windows. >> >> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47439 >> >> They implement a new mktemp function to walk around the limit on the >> number of concurrently open files. >> >> Can we implement our mktemp functions instead of using microsoft's stuff? > > But that will just push the limit farther. It will not fix the > underlying fundamental problem of not deleting temporary files in this > case. Since Emacs is typically run for long periods of time, sooner > or later the problem will strike anyway.