From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Trent W. Buck" Newsgroups: gmane.emacs.bugs Subject: bug#1058: 23.0.60; emacs --daemon should not return until socket is ready Date: Fri, 3 Oct 2008 08:42:38 +1000 Message-ID: <20081002224236.GA29467@Clio.twb.ath.cx> References: <1222782234_2281@mail.internode.on.net> <200810011651.m91GpAZQ010333@mothra.ics.uci.edu> <87k5csds03.fsf@elegiac.orebokech.com> <200810012332.m91NWJ4s014658@mothra.ics.uci.edu> <874p3vediy.fsf@elegiac.orebokech.com> <200810020814.m928Ed1C016380@mothra.ics.uci.edu> <200810021726.m92HQcTQ017644@mothra.ics.uci.edu> Reply-To: "Trent W. Buck" , 1058@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1222989062 16238 80.91.229.12 (2 Oct 2008 23:11:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 2 Oct 2008 23:11:02 +0000 (UTC) Cc: 1058@emacsbugs.donarmstrong.com, Dan Nicolaescu , Romain Francoise To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Oct 03 01:11:59 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KlXKw-0000vV-6l for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Oct 2008 01:11:58 +0200 Original-Received: from localhost ([127.0.0.1]:35546 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KlXJt-0001lF-0x for geb-bug-gnu-emacs@m.gmane.org; Thu, 02 Oct 2008 19:10:53 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KlXJ2-0001Ua-4L for bug-gnu-emacs@gnu.org; Thu, 02 Oct 2008 19:10:00 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KlXJ1-0001Tz-AE for bug-gnu-emacs@gnu.org; Thu, 02 Oct 2008 19:09:59 -0400 Original-Received: from [199.232.76.173] (port=45749 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KlXJ1-0001Tr-53 for bug-gnu-emacs@gnu.org; Thu, 02 Oct 2008 19:09:59 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:38368) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KlXJ0-0004RY-FV for bug-gnu-emacs@gnu.org; Thu, 02 Oct 2008 19:09:58 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m92N9utw002703; Thu, 2 Oct 2008 16:09:56 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m92Mo2YI029769; Thu, 2 Oct 2008 15:50:02 -0700 X-Loop: don@donarmstrong.com Resent-From: "Trent W. Buck" Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Thu, 02 Oct 2008 22:50:02 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1058 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 1058-submit@emacsbugs.donarmstrong.com id=B1058.122298734728563 (code B ref 1058); Thu, 02 Oct 2008 22:50:02 +0000 Original-Received: (at 1058) by emacsbugs.donarmstrong.com; 2 Oct 2008 22:42:27 +0000 Original-Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.236]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m92MgOXm028557 for <1058@emacsbugs.donarmstrong.com>; Thu, 2 Oct 2008 15:42:25 -0700 Original-Received: by rv-out-0506.google.com with SMTP id k40so1370427rvb.1 for <1058@emacsbugs.donarmstrong.com>; Thu, 02 Oct 2008 15:42:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=h1nnLPylghGYToYi2weCH98oF0f+0tXYHUxKNz5e9qM=; b=EfDYLWIiCxVwj1DE6LNY2xVygwV0pBY+/E2kFSgb1J10rHtYL6hcbJYQC4SYDii9fl ZDYTVDWFAww/JpNwODdDr/0E9Cyu80PfLA8KYrGB61yF8kwDUJGM8xaqCFw+OyJf6Sg1 iGJhV743lfHRNcbi3gGYevHMO8pkqGTpT7v1o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=GtrkD7EXSI/zFId4EZ1mqGscH7qGmkyjesLUIwOM4nLfa2wjYjhGMCAnSRwaTS6H4g hT1dXcdUsMS7zs8GzCjBWwfd1ESGEcX19V6a1Cylk5e/92fJdtRPBwO5OLhb1ZWl9MEN OphGYPSrP73wSwLBUlMTMMa/J6xHV2O6J8uwA= Original-Received: by 10.114.13.10 with SMTP id 10mr335700wam.106.1222987344123; Thu, 02 Oct 2008 15:42:24 -0700 (PDT) Original-Received: from localhost (ppp121-44-196-87.lns10.mel4.internode.on.net [121.44.196.87]) by mx.google.com with ESMTPS id l30sm7918432waf.25.2008.10.02.15.42.22 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 02 Oct 2008 15:42:23 -0700 (PDT) Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Thu, 02 Oct 2008 19:09:59 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:21011 Archived-At: On Thu, Oct 02, 2008 at 05:32:32PM -0400, Stefan Monnier wrote: > >> I could accept a similar patch, maybe, but first I need to understand > >> why/where we currently "detach" so early. > > > Where? in emacs.c:main, look for: > > if (argmatch (argv, argc, "-daemon", "--daemon", 5, NULL, &skip_args)) > > { > > #ifndef DOS_NT > > pid_t f = fork (); > > Oh, thanks. I somehow overlooked it. > > > - in order to not make detaching an elisp function, and have to > > deal with users trying to call it from different contexts - the > > `fork' call for detaching needs to happen before some of the > > initialization is run (although after my 2008-09-28 change it > > might be possible to push it later), and also before .emacs is run > > and before the server is started. > > I see what you mean. But I think forking so early is wrong: all > the --eval and .emacs processing should take place "in the foreground" > with input/output from stdin/stdout (like --batch). What happens if .emacs asks questions? Does 'emacs --daemon' require a terminal? Also, I'm currently using the following test to check whether the running Emacs supports --daemon. If you break it, please make some other test work. emacs --batch -q --no-site-file --daemon &>/dev/null