From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Juanma Barranquero" Newsgroups: gmane.emacs.bugs Subject: Re: Crash on empty HOME var in Windows registry Date: Mon, 18 Jun 2007 14:15:31 +0200 Message-ID: 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 1182168944 1905 80.91.229.12 (18 Jun 2007 12:15:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 18 Jun 2007 12:15:44 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org To: "Vincent Liard" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 18 14:15:42 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 1I0G8v-0008GB-Sp for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Jun 2007 14:15:38 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I0G8u-0002s9-UL for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Jun 2007 08:15:36 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I0G8s-0002qn-2H for bug-gnu-emacs@gnu.org; Mon, 18 Jun 2007 08:15:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I0G8q-0002qZ-Mx for bug-gnu-emacs@gnu.org; Mon, 18 Jun 2007 08:15:33 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I0G8q-0002qW-I9 for bug-gnu-emacs@gnu.org; Mon, 18 Jun 2007 08:15:32 -0400 Original-Received: from wx-out-0506.google.com ([66.249.82.238]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I0G8q-0002XZ-6h for bug-gnu-emacs@gnu.org; Mon, 18 Jun 2007 08:15:32 -0400 Original-Received: by wx-out-0506.google.com with SMTP id h26so1632192wxd for ; Mon, 18 Jun 2007 05:15:31 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=b2gqCKM9SwOJFlpygjFFTW9/VNk5V7YTXdQNyX+LbIhkZHSKNncNbp1EeO6PzczSuNp3g5L7eoW4ll56srEH5u/RsmYiesP1E/sgV8zqIpCjF9gT5JT2snzEocL4ZizTf6hLT0c/Pj9c4q3Kv2UKBW8NLFnDYU1AMM4nIBKYehc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=VkR29AtoNsnkSXmfDOR6VcP/vjKIYYPl+LFTSoNmUT6azYWWyg5ddTS+LBZPSMoxRDVNZhZQREAJPu61H809XDE7QFdAF8V6GsEiKKVfGYyQqVKxaAOmtg/mKArA7DcrhMaVjSnQqNbejoDfhAAdMWdh0rx3uLF3y/3OcS6nYF0= Original-Received: by 10.90.104.14 with SMTP id b14mr3540965agc.1182168931303; Mon, 18 Jun 2007 05:15:31 -0700 (PDT) Original-Received: by 10.90.87.8 with HTTP; Mon, 18 Jun 2007 05:15:31 -0700 (PDT) In-Reply-To: <46764C61.1050804@free.fr> Content-Disposition: inline X-detected-kernel: Linux 2.4-2.6 (Google crawlbot) 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:15936 Archived-At: On 6/18/07, Vincent Liard wrote: > 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. 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). 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. Jason? Juanma 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;