all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Crash on empty HOME var in Windows registry
@ 2007-06-18  9:12 Vincent Liard
  2007-06-18 12:15 ` Juanma Barranquero
  2007-06-19 10:40 ` Richard Stallman
  0 siblings, 2 replies; 16+ messages in thread
From: Vincent Liard @ 2007-06-18  9:12 UTC (permalink / raw)
  To: bug-gnu-emacs

Hi,

I'm using emacs on Windows XP SP2 (yes, I would prefer to run it 
under GNU/Linux). While configuring the HOME variable in the 
registry, at HKEY_CURRENT_USER\Software\GNU\emacs, I noticed that 
having an empty HOME string value at this place causes emacs to 
crash at start. My emacs version is
GNU Emacs 21.3.1 (i386-mingw-nt5.1.2600) of 2004-03-10 on NYAUMO

Thanks for the great work on emacs !
Have a good day,

Vincent

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Crash on empty HOME var in Windows registry
  2007-06-18  9:12 Crash on empty HOME var in Windows registry Vincent Liard
@ 2007-06-18 12:15 ` Juanma Barranquero
  2007-06-18 12:47   ` Vincent Liard
  2007-06-18 15:19   ` Jason Rumney
  2007-06-19 10:40 ` Richard Stallman
  1 sibling, 2 replies; 16+ messages in thread
From: Juanma Barranquero @ 2007-06-18 12:15 UTC (permalink / raw)
  To: Vincent Liard; +Cc: bug-gnu-emacs

On 6/18/07, Vincent Liard <vincent.liard@free.fr> 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;

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Crash on empty HOME var in Windows registry
  2007-06-18 12:15 ` Juanma Barranquero
@ 2007-06-18 12:47   ` Vincent Liard
  2007-06-18 13:05     ` Juanma Barranquero
  2007-06-18 15:19   ` Jason Rumney
  1 sibling, 1 reply; 16+ messages in thread
From: Vincent Liard @ 2007-06-18 12:47 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: bug-gnu-emacs

 > 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;

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Crash on empty HOME var in Windows registry
  2007-06-18 12:47   ` Vincent Liard
@ 2007-06-18 13:05     ` Juanma Barranquero
  0 siblings, 0 replies; 16+ messages in thread
From: Juanma Barranquero @ 2007-06-18 13:05 UTC (permalink / raw)
  To: Vincent Liard; +Cc: bug-gnu-emacs

On 6/18/07, Vincent Liard <vincent.liard@free.fr> wrote:

> As for me, I have switched to the solution of using a HOME
> environment var, anyway.

Yes, that's what I do. It's better if you have other programs which use HOME.

> 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).

Yes. Emacs calls abort(), so Windows offers you to run a debugger. If
you don't, the program is forcefully finished.

> Apart from the opening curly brace which is on the + but not on
> the - in the changelog

I don't understand; the patch is fine...

             Juanma

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Crash on empty HOME var in Windows registry
  2007-06-18 12:15 ` Juanma Barranquero
  2007-06-18 12:47   ` Vincent Liard
@ 2007-06-18 15:19   ` Jason Rumney
  2007-06-18 16:43     ` Juanma Barranquero
  1 sibling, 1 reply; 16+ messages in thread
From: Jason Rumney @ 2007-06-18 15:19 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: bug-gnu-emacs, Vincent Liard

Juanma Barranquero wrote:
> 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.

Environment variables cannot have null values when set from the
command-line, so there is no reason I can see to support null values
when set from the registry.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Crash on empty HOME var in Windows registry
  2007-06-18 15:19   ` Jason Rumney
@ 2007-06-18 16:43     ` Juanma Barranquero
  2007-06-18 21:04       ` Jason Rumney
  0 siblings, 1 reply; 16+ messages in thread
From: Juanma Barranquero @ 2007-06-18 16:43 UTC (permalink / raw)
  To: Jason Rumney; +Cc: bug-gnu-emacs, Vincent Liard

On 6/18/07, Jason Rumney <jasonr@gnu.org> wrote:

> Environment variables cannot have null values when set from the
> command-line, so there is no reason I can see to support null values
> when set from the registry.

Well, I don't want to "support" them, more like ignore them (that's
what the patch does). Do you think it's better to abort Emacs?

             Juanma

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Crash on empty HOME var in Windows registry
  2007-06-18 16:43     ` Juanma Barranquero
@ 2007-06-18 21:04       ` Jason Rumney
  2007-06-18 21:23         ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 16+ messages in thread
From: Jason Rumney @ 2007-06-18 21:04 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: bug-gnu-emacs, Vincent Liard

Juanma Barranquero wrote:
> Well, I don't want to "support" them, more like ignore them (that's
> what the patch does). Do you think it's better to abort Emacs?

Most users would never figure out why emacs is aborting, so it is better
to ignore them.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Crash on empty HOME var in Windows registry
  2007-06-18 21:04       ` Jason Rumney
@ 2007-06-18 21:23         ` Lennart Borgman (gmail)
  2007-06-18 21:35           ` Juanma Barranquero
  0 siblings, 1 reply; 16+ messages in thread
From: Lennart Borgman (gmail) @ 2007-06-18 21:23 UTC (permalink / raw)
  To: Jason Rumney; +Cc: Juanma Barranquero, bug-gnu-emacs, Vincent Liard

Jason Rumney wrote:
> Juanma Barranquero wrote:
>> Well, I don't want to "support" them, more like ignore them (that's
>> what the patch does). Do you think it's better to abort Emacs?
> 
> Most users would never figure out why emacs is aborting, so it is better
> to ignore them.


Why?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Crash on empty HOME var in Windows registry
  2007-06-18 21:23         ` Lennart Borgman (gmail)
@ 2007-06-18 21:35           ` Juanma Barranquero
  2007-06-18 21:49             ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 16+ messages in thread
From: Juanma Barranquero @ 2007-06-18 21:35 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: bug-gnu-emacs, Vincent Liard

On 6/18/07, Lennart Borgman (gmail) <lennart.borgman@gmail.com> wrote:

> Why?

What?

             Juanma

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Crash on empty HOME var in Windows registry
  2007-06-18 21:35           ` Juanma Barranquero
@ 2007-06-18 21:49             ` Lennart Borgman (gmail)
  2007-06-18 22:01               ` Jason Rumney
  0 siblings, 1 reply; 16+ messages in thread
From: Lennart Borgman (gmail) @ 2007-06-18 21:49 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: bug-gnu-emacs, Vincent Liard

Juanma Barranquero wrote:
> On 6/18/07, Lennart Borgman (gmail) <lennart.borgman@gmail.com> wrote:
> 
>> Why?
> 
> What?


Why ignore the users in that case?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Crash on empty HOME var in Windows registry
  2007-06-18 21:49             ` Lennart Borgman (gmail)
@ 2007-06-18 22:01               ` Jason Rumney
  2007-06-18 22:24                 ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 16+ messages in thread
From: Jason Rumney @ 2007-06-18 22:01 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Juanma Barranquero, bug-gnu-emacs, Vincent Liard

Lennart Borgman (gmail) wrote:
> Why ignore the users in that case?
>
Not the users! We were talking about the environment variables.


Read the whole thread before you jump in challenging our decisions.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Crash on empty HOME var in Windows registry
  2007-06-18 22:01               ` Jason Rumney
@ 2007-06-18 22:24                 ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 16+ messages in thread
From: Lennart Borgman (gmail) @ 2007-06-18 22:24 UTC (permalink / raw)
  To: Jason Rumney; +Cc: Juanma Barranquero, bug-gnu-emacs, Vincent Liard

Jason Rumney wrote:
> Lennart Borgman (gmail) wrote:
>> Why ignore the users in that case?
>>
> Not the users! We were talking about the environment variables.
> 
> Read the whole thread before you jump in challenging our decisions.

Ok, sorry, stupid of me to think that you would ignore the users. But 
you actually wrote:

"Most users would never figure out why emacs is aborting, so it is 
better to ignore them."

(And I think Juanma did the right thing.)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Crash on empty HOME var in Windows registry
  2007-06-18  9:12 Crash on empty HOME var in Windows registry Vincent Liard
  2007-06-18 12:15 ` Juanma Barranquero
@ 2007-06-19 10:40 ` Richard Stallman
  2007-06-19 11:45   ` Juanma Barranquero
  2007-06-19 11:51   ` Vincent Liard
  1 sibling, 2 replies; 16+ messages in thread
From: Richard Stallman @ 2007-06-19 10:40 UTC (permalink / raw)
  To: Vincent Liard; +Cc: bug-gnu-emacs

Would you like to try the latest Emacs release, 22.1,
and see if it has the same problem?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Crash on empty HOME var in Windows registry
  2007-06-19 10:40 ` Richard Stallman
@ 2007-06-19 11:45   ` Juanma Barranquero
  2007-06-19 11:51   ` Vincent Liard
  1 sibling, 0 replies; 16+ messages in thread
From: Juanma Barranquero @ 2007-06-19 11:45 UTC (permalink / raw)
  To: rms; +Cc: bug-gnu-emacs, Vincent Liard

On 6/19/07, Richard Stallman <rms@gnu.org> wrote:

> Would you like to try the latest Emacs release, 22.1,
> and see if it has the same problem?

Emacs 22.1 on Windows has the same problem. I'll install the fix as
soon as CVS is working again.

             Juanma

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Crash on empty HOME var in Windows registry
  2007-06-19 10:40 ` Richard Stallman
  2007-06-19 11:45   ` Juanma Barranquero
@ 2007-06-19 11:51   ` Vincent Liard
  2007-06-19 12:00     ` Juanma Barranquero
  1 sibling, 1 reply; 16+ messages in thread
From: Vincent Liard @ 2007-06-19 11:51 UTC (permalink / raw)
  To: rms; +Cc: bug-gnu-emacs

> Would you like to try the latest Emacs release, 22.1,
> and see if it has the same problem?

So, I have installed 22.1 and tried. With no HOME env var and an 
empty (but defined) HKEY_CURRENT_USER\Software\GNU\emacs\HOME 
registry key, emacs complains "A fatal error has occurred!" and 
gives the opportunity either to abort, which stops without error, 
or to continue inside GDB, which causes a Windows "crash" 
notification since I can't prepare it with gdb -p <emacs-PID> as 
advised (because I don't have GDB installed on Windows). The 
error report is:

AppName: emacs.exe
AppVer: 22.1.0.0
ModName: ntdll.dll
ModVer: 5.1.2600.2180
Offset: 00001230

Wouldn't it be desirable to just tell the user that they have 
misconfigured their HOME or to proceed without complaining ?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Crash on empty HOME var in Windows registry
  2007-06-19 11:51   ` Vincent Liard
@ 2007-06-19 12:00     ` Juanma Barranquero
  0 siblings, 0 replies; 16+ messages in thread
From: Juanma Barranquero @ 2007-06-19 12:00 UTC (permalink / raw)
  To: Vincent Liard; +Cc: bug-gnu-emacs, rms

On 6/19/07, Vincent Liard <vincent.liard@free.fr> wrote:

> Wouldn't it be desirable to just tell the user that they have
> misconfigured their HOME or to proceed without complaining ?

We'll proceed without complaining; it's simpler, and the user is going
to notice he's not getting the .emacs he was expecting anyway.

But please be patient; I cannot commit the fix to CVS right now.

             Juanma

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2007-06-19 12:00 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-18  9:12 Crash on empty HOME var in Windows registry Vincent Liard
2007-06-18 12:15 ` Juanma Barranquero
2007-06-18 12:47   ` Vincent Liard
2007-06-18 13:05     ` Juanma Barranquero
2007-06-18 15:19   ` Jason Rumney
2007-06-18 16:43     ` Juanma Barranquero
2007-06-18 21:04       ` Jason Rumney
2007-06-18 21:23         ` Lennart Borgman (gmail)
2007-06-18 21:35           ` Juanma Barranquero
2007-06-18 21:49             ` Lennart Borgman (gmail)
2007-06-18 22:01               ` Jason Rumney
2007-06-18 22:24                 ` Lennart Borgman (gmail)
2007-06-19 10:40 ` Richard Stallman
2007-06-19 11:45   ` Juanma Barranquero
2007-06-19 11:51   ` Vincent Liard
2007-06-19 12:00     ` Juanma Barranquero

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.