From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Vincent Liard Newsgroups: gmane.emacs.bugs Subject: Re: Crash on empty HOME var in Windows registry Date: Mon, 18 Jun 2007 14:47:26 +0200 Message-ID: <46767EDE.3010704@free.fr> References: <46764C61.1050804@free.fr> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1182170849 9680 80.91.229.12 (18 Jun 2007 12:47:29 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 18 Jun 2007 12:47:29 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org To: Juanma Barranquero Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 18 14:47:28 2007 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 1I0Gdi-00005E-A4 for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Jun 2007 14:47:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I0Gdh-0002hm-W3 for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Jun 2007 08:47:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I0Gdf-0002h5-8e for bug-gnu-emacs@gnu.org; Mon, 18 Jun 2007 08:47:23 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I0Gdd-0002ge-ND for bug-gnu-emacs@gnu.org; Mon, 18 Jun 2007 08:47:23 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I0Gdd-0002gV-Gh for bug-gnu-emacs@gnu.org; Mon, 18 Jun 2007 08:47:21 -0400 Original-Received: from smtp1-g19.free.fr ([212.27.42.27]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I0Gdc-0000Of-5g; Mon, 18 Jun 2007 08:47:20 -0400 Original-Received: from [127.0.0.1] (mol92-2-81-56-75-108.fbx.proxad.net [81.56.75.108]) by smtp1-g19.free.fr (Postfix) with ESMTP id 56D0E1AB31F; Mon, 18 Jun 2007 14:47:19 +0200 (CEST) User-Agent: Thunderbird 1.5.0.12 (Windows/20070509) In-Reply-To: X-detected-kernel: Linux 2.6 (newer, 3) 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:15937 Archived-At: > I'm not sure whether is the right thing to do, though: first, > because a null HOME or SHELL in the registry is likely an > error; and second, because I'm not sure it makes sense for > other environment variables to have null values on the > registry. As for me, I have switched to the solution of using a HOME environment var, anyway. And I agree on you view for the content of the registry entry. >> having an empty HOME string value at this place causes emacs to >> crash at start. > > In fact Emacs is not crashing, but aborting because it doesn't have a > valid HOME value in its environment. It's a check. At first, I get an emacs notification error "A fatal error has occurred! Select Abort to exit, Retry to debug, Ignore to continue". But when deciding to ignore, I get a Windows error indicating that GNU Emacs encountered a problem and ought to stop (approximately translated from the French error message). The error signature given is : AppName: emacs.exe AppVer: 21.2.0.0 ModName: msvcrt.dll ModVer: 7.0.2600.2180 Offset: 000360cb > It could be fixed with the simple patch below, which forces > environment variables coming from the registry to have non-null values > (else they get the default value). Apart from the opening curly brace which is on the + but not on the - in the changelog, I guess it would be ok for emacs and thus prevent the error from Windows. Vincent > Index: src/w32.c > =================================================================== > RCS file: /cvsroot/emacs/emacs/src/w32.c,v > retrieving revision 1.113 > diff -u -2 -r1.113 w32.c > --- src/w32.c 14 Jun 2007 15:58:13 -0000 1.113 > +++ src/w32.c 18 Jun 2007 12:07:47 -0000 > @@ -1156,5 +1156,6 @@ > int dont_free = 0; > > - if ((lpval = w32_get_resource (env_vars[i].name, &dwType)) == > NULL) > + if ((lpval = w32_get_resource (env_vars[i].name, &dwType)) == NULL > + || *lpval == 0) > { > lpval = env_vars[i].def_value;