* [philippe.waroquiers@eurocontrol.int: RE: emacs 22.1 on hp-ux 11.11 core dumps when DISPLAY not set]
@ 2007-08-09 23:11 Richard Stallman
2007-08-15 2:43 ` Glenn Morris
0 siblings, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2007-08-09 23:11 UTC (permalink / raw)
To: emacs-devel
Would someone please check and install this fix?
It is not presented very clearly, and you need to write the change log,
but I think that is better than trying to pressure him to do it.
Please install the fix in Eacs 22.
Please ack when it is done.
------- Start of forwarded message -------
X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed
version=3.1.0
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Subject: RE: emacs 22.1 on hp-ux 11.11 core dumps when DISPLAY not set
Date: Thu, 9 Aug 2007 09:39:08 +0200
In-Reply-To: <E1IJ0VO-0005kY-AQ@fencepost.gnu.org>
Thread-Topic: emacs 22.1 on hp-ux 11.11 core dumps when DISPLAY not set
Thread-Index: AcfaRSWSpQ2knbdCQFGAAyYBXoXcGwAEbgyA
From: "WAROQUIERS Philippe" <philippe.waroquiers@eurocontrol.int>
To: <rms@gnu.org>
Cc: <bug-gnu-emacs@gnu.org>
>Please try to debug it and find the cause.
>First I suggest recompiling using -g.
>That means the .gdbinit file wasn't found or didn't work.
>Please try to figure out why.
.gdbinit was not found because I was not in the good directory.
After recompiling with debug and using gdb, I was able to see
what is happening, and tested a fix.
The problem is that when emacs starts up without DISPLAY, it calls
the function tty_default_color_capabilities.
For a reason not clear to me (my knowledge of C is *very* rusty),
the static local variables in tty_default_color_capabilities are
not properly initialized to NULL or 0 at startup.
I first tried to just put a " = NULL;" and a "= 0;"
but that did not solve the problem.
At the end, the problem was solved by moving the static variables
just before the function tty_default_color_capabilities
(and also initializing them to NULL/0).
In other words, the below fixes the problem:
/* Save or restore the default color-related capabilities of this
terminal. */
static char
*default_orig_pair, *default_set_foreground, *default_set_background
= NULL; /* need init ??? */
static int default_max_colors, default_max_pairs,
default_no_color_video = 0; /* need init ??? */
static void
tty_default_color_capabilities (save)
int save;
{
if (save)
{
if (default_orig_pair)
As I do not understand too much the problem, if you need any other
investigation, I can
always see what I can do.
Thanks for your help ...
____
This message and any files transmitted with it are legally privileged and intended for the sole use of the individual(s) or entity to whom they are addressed. If you are not the intended recipient, please notify the sender by reply and delete the message and any attachments from your system. Any unauthorised use or disclosure of the content of this message is strictly prohibited and may be unlawful.
Nothing in this e-mail message amounts to a contractual or legal commitment on the part of EUROCONTROL, unless it is confirmed by appropriately signed hard copy.
Any views expressed in this message are those of the sender.
------- End of forwarded message -------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [philippe.waroquiers@eurocontrol.int: RE: emacs 22.1 on hp-ux 11.11 core dumps when DISPLAY not set]
2007-08-09 23:11 [philippe.waroquiers@eurocontrol.int: RE: emacs 22.1 on hp-ux 11.11 core dumps when DISPLAY not set] Richard Stallman
@ 2007-08-15 2:43 ` Glenn Morris
2007-08-15 2:46 ` Glenn Morris
[not found] ` <E1ILNVk-0007Gh-IH@fencepost.gnu.org>
0 siblings, 2 replies; 6+ messages in thread
From: Glenn Morris @ 2007-08-15 2:43 UTC (permalink / raw)
To: rms; +Cc: emacs-devel
Richard Stallman wrote:
> Would someone please check and install this fix?
It doesn't make any sense to me, except as a workaround for an HPUX
compiler bug, but I guess I can't do any harm...?
Summary:
1. Explicitly initialize static variables, even though the standard
requires this to happen automatically;
2. Move static vars from function scope to file scope, even though
they are only used in the function.
Curiously, the only online reference I can find for this is an emacs
bug report from 1993, about what looks like the same problem with a
HPUX compiler compiling etags.
http://groups.google.com/group/gnu.emacs.bug/msg/a2caf200c2a84695
> This message and any files transmitted with it are legally
> privileged and intended for the sole use of the individual(s) or
> entity to whom they are addressed. If you are not the intended
> recipient, please notify the sender by reply and delete the message
> and any attachments from your system. Any unauthorised use or
> disclosure of the content of this message is strictly prohibited and
> may be unlawful.
Oh noes. :(
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [philippe.waroquiers@eurocontrol.int: RE: emacs 22.1 on hp-ux 11.11 core dumps when DISPLAY not set]
2007-08-15 2:43 ` Glenn Morris
@ 2007-08-15 2:46 ` Glenn Morris
[not found] ` <E1ILNVk-0007Gh-IH@fencepost.gnu.org>
1 sibling, 0 replies; 6+ messages in thread
From: Glenn Morris @ 2007-08-15 2:46 UTC (permalink / raw)
To: rms; +Cc: emacs-devel
Glenn Morris wrote:
> It doesn't make any sense to me, except as a workaround for an HPUX
> compiler bug, but I guess I can't do any harm...?
^^
s/I/it
(for the sake of machismo)
^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <E1ILNVk-0007Gh-IH@fencepost.gnu.org>]
* Re: [philippe.waroquiers@eurocontrol.int: RE: emacs 22.1 on hp-ux 11.11 core dumps when DISPLAY not set]
[not found] ` <E1ILNVk-0007Gh-IH@fencepost.gnu.org>
@ 2007-08-15 18:38 ` Andreas Schwab
2007-08-16 21:00 ` WAROQUIERS Philippe
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2007-08-15 18:38 UTC (permalink / raw)
To: rms; +Cc: Glenn Morris, philippe.waroquiers, emacs-devel
Richard Stallman <rms@gnu.org> writes:
> In Emacs we don't use static vars at less than file scope. I don't
> 100% remember the reason why.
See src/s/hpux.h, for example:
/* USG systems tend to put everything declared static
into the initialized data area, which becomes pure after dumping Emacs.
Foil this. Emacs carefully avoids static vars inside functions. */
#define static
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [philippe.waroquiers@eurocontrol.int: RE: emacs 22.1 on hp-ux 11.11 core dumps when DISPLAY not set]
2007-08-15 18:38 ` Andreas Schwab
@ 2007-08-16 21:00 ` WAROQUIERS Philippe
2007-08-17 4:49 ` Richard Stallman
0 siblings, 1 reply; 6+ messages in thread
From: WAROQUIERS Philippe @ 2007-08-16 21:00 UTC (permalink / raw)
To: Andreas Schwab, rms; +Cc: Glenn Morris, emacs-devel
>Richard Stallman <rms@gnu.org> writes:
>
>> In Emacs we don't use static vars at less than file scope. I don't
>> 100% remember the reason why.
>
>See src/s/hpux.h, for example:
>
>/* USG systems tend to put everything declared static
> into the initialized data area, which becomes pure after
>dumping Emacs.
> Foil this. Emacs carefully avoids static vars inside functions. */
>
>#define static
>
>Andreas.
Note that in emacs src directory, doing :
grep '^ *static ' *.c
finds something like 140 occurences of static vars in functions.
(maybe most of these occurences are in some code not used on USG systems
?)
Maybe what emacs tries to avoid is
static vars which are both initialized
and which are then modified during execution.
(as unexec on USG systems will transform these vars into pure)
Assuming this last reasoning is correct, the bug on hp-ux of emacs-22
can then be explained by:
On hp-ux, the #define static in hpux.h means that none of the function
local static vars are in fact really static when compiled: they become
"normal local vars".
Without initialization, a variable (e.g. char *default_orig_pair)
has its static keyword removed by the #define above on hpux.h, and gets
a random value at function entry (which explains then the core dump).
What is not yet clear to me is why the explicit initialization to NULL
of
the local variables in tty_default_color_capabilities has not solved the
core dump problem. Maybe I would need to understand what save/restore
is needed for.
A thing that could be done to avoid having such a bug (a "written
static" in a func)
to be re-introduced but still keep static is to always
use "static const " inside functions.
In such a case, compilation will fail if writing to the static is done
inside
the function.
(by the way, sorry for the "signature" added at the end of the mail.
This
is done automatically by the company mailing system).
____
This message and any files transmitted with it are legally privileged and intended for the sole use of the individual(s) or entity to whom they are addressed. If you are not the intended recipient, please notify the sender by reply and delete the message and any attachments from your system. Any unauthorised use or disclosure of the content of this message is strictly prohibited and may be unlawful.
Nothing in this e-mail message amounts to a contractual or legal commitment on the part of EUROCONTROL, unless it is confirmed by appropriately signed hard copy.
Any views expressed in this message are those of the sender.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [philippe.waroquiers@eurocontrol.int: RE: emacs 22.1 on hp-ux 11.11 core dumps when DISPLAY not set]
2007-08-16 21:00 ` WAROQUIERS Philippe
@ 2007-08-17 4:49 ` Richard Stallman
0 siblings, 0 replies; 6+ messages in thread
From: Richard Stallman @ 2007-08-17 4:49 UTC (permalink / raw)
To: WAROQUIERS Philippe; +Cc: schwab, emacs-devel, rgm
Note that in emacs src directory, doing :
grep '^ *static ' *.c
finds something like 140 occurences of static vars in functions.
(maybe most of these occurences are in some code not used on USG systems
?)
We should check all of these to make sure that none of them can be
used on systems that do `#define static '. If any can be used there,
we need to change the code.
But there is another possibility. Maybe we can get rid of the
practice of #define static.
I wonder if recent versions of HPUX still need the #define static.
How about if you try deleting that from hpux.h, and rebuild Emacs, and
see if it works?
I see that s/usg5-4.h does #undef static.
Are any pre-5.4 USG systems still used?
Are any really still supported?
It would be nice to get rid of that issue.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-08-17 4:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-09 23:11 [philippe.waroquiers@eurocontrol.int: RE: emacs 22.1 on hp-ux 11.11 core dumps when DISPLAY not set] Richard Stallman
2007-08-15 2:43 ` Glenn Morris
2007-08-15 2:46 ` Glenn Morris
[not found] ` <E1ILNVk-0007Gh-IH@fencepost.gnu.org>
2007-08-15 18:38 ` Andreas Schwab
2007-08-16 21:00 ` WAROQUIERS Philippe
2007-08-17 4:49 ` Richard Stallman
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.