* Re: gdb
[not found] <richard@atheist.tamu.edu>
@ 1996-05-09 14:55 ` Eric Youngdale
1996-10-29 18:50 ` thanks to Richard : Xemacs compiled as ELF Zarmfab Software Development
` (4 subsequent siblings)
5 siblings, 0 replies; 27+ messages in thread
From: Eric Youngdale @ 1996-05-09 14:55 UTC (permalink / raw)
>Well, that's obviously not true.. You said it yourself: the linker _does_
>need to know about it, so the assembler is wrong.
If you assume the linker doesn't remove any code, then I don't
see how the linker would need to know about local branches.
>Now, I don't want to be the linker who tries to find local labels in the
>above. Maybe the data values happen to have patterns that match a "bsr"
>instruction, and then the linker "fixes" it because there is some jsr we
>optimized somewhere.. Uggh..
>
>So, making the linker fix things up is not only hard as h*ll, it's
>actually impossible.
No, it isn't impossible - this is getting close to the sort of
thing I get paid to do in my day job, and I know it can be done given
enough care and persistance. I will agree that it is damn hard, however.
One thing I could suggest however is that if the compiler is
absolutely 100% strict about only putting executable code into the .text
segment, then the problem becomes significantly easier. I would say
that it is even doable. The question is how easy it would be to impose
this restriction. On some architectures, it is not terribly complicated,
but on others it imposes a significant hardship.
If it is not possible to eliminate the use of non-executable
code from the .text segment, then it would be possible to add special
relocations to mark those regions of non-executable code in the text
segment, so the linker still knows to do the right thing.
>So, now think of the problem without a fixed assembler.. What do we get?
We
>get an assembler that isn't a "traditional" assembler any more: we just get
>a smart pre-processor. Essentially, the assembler shouldn't emit runnable
>code, it should emit runnable code _fragments_, and then the linker would
be >free to pad those as it sees fit. You said the hpux setup did something
that
>sounded like this (and take a look at the currently fastest single-CPU
>machine - it's not made by Digital. It's the HP PA-8000, so they have done
>some things _right_, and the compiler is probably one of those things
>even though the memory subsystem seems to be quite good).
I agree, they have done some things right. The older
32 bit versions had some very strange features which must have driven
the compiler and linker people crazy. Things like how their address space
is divided into 4 1Gb quadrants - it is very expensive to call from one
quadrant to another, especially when floating point is involved, so they
added some hacks which basically allow certain functions to be performed
without branching outside of the quadrant. With the 8000 series machine,
they now have a 64 bit machine, and I am told that some of this stupidity
goes away. The compiler people from HP that I have spoken to seem to get
rather excited about no longer having to worry about this sort of crap :-).
I have been told in all seriousness by people from HP that you should
consider static linking programs for optimum performance (basically to
avoid the overhead of branching to another quadrant - the executable
is normally in quadrant 0, and shared libs are in quadrant 1 or 2 depending
upon whether the debugger is in use or not). Anyways, let me explain some
of the things they have done in their compilers and related tools.
If you compile a program with the highest optimziation (+O4) under
SoftBench, the compiler itself doesn't actually generate any code. It
generates an internal representation of the parse tree, and it isn't
easy for me to tell whether much in the way of optimization has been done
at this point.
When you go to link such a file, the linker itself collects all of
the intermediate code that is supposed to go into the output image, and
invokes the code generator (the same one the compiler invokes if lower
levels of optimization are selected). The code generator is able to do all
of the
proper optimizations in order to optimize the *entire* image. I have
been told by people from HP that there are limits to how large a program
you can link in this manner - as you might imagine the VM usage can get
rather impressively large.
Anyways, to sum up, I think this is still a tractible problem for
the linker to handle completely without any help from the assembler
(other than some special relocation types to indicate non-executable code
in the .text section). It is highly academic at this point anyways, since
I have much more important things I need to be hacking right now anyways.
I guess we are still looking for that elusive volunteer :-).
-Eric
--
"The woods are lovely, dark and deep. But I have promises to keep,
And lines to code before I sleep, And lines to code before I sleep."
^ permalink raw reply [flat|nested] 27+ messages in thread* thanks to Richard : Xemacs compiled as ELF
[not found] <richard@atheist.tamu.edu>
1996-05-09 14:55 ` gdb Eric Youngdale
@ 1996-10-29 18:50 ` Zarmfab Software Development
1996-11-15 13:28 ` glibc snapshot 961111 binaries Zarmfab Software Development
` (3 subsequent siblings)
5 siblings, 0 replies; 27+ messages in thread
From: Zarmfab Software Development @ 1996-10-29 18:50 UTC (permalink / raw)
with many help from Richard Henderson i just installed Xemacs 19.14
at my Avanti running Redhat 4.0 as ELF,
many thanks , Richard
--
Martin Cornelius, ZARMFAB software development, University of Bremen
phone: 49-421-218-4807 FAX: 49-421-218-3889
email: fabsoft@zarm.uni-bremen.de
paper-mail: Hochschulring / Am Fallturm, 28359 BREMEN, Germany
--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: glibc snapshot 961111 binaries
[not found] <richard@atheist.tamu.edu>
1996-05-09 14:55 ` gdb Eric Youngdale
1996-10-29 18:50 ` thanks to Richard : Xemacs compiled as ELF Zarmfab Software Development
@ 1996-11-15 13:28 ` Zarmfab Software Development
1996-11-18 13:30 ` PLEASE HELP glibc 961111 : can't execute libm - linked programs Zarmfab Software Development
` (2 subsequent siblings)
5 siblings, 0 replies; 27+ messages in thread
From: Zarmfab Software Development @ 1996-11-15 13:28 UTC (permalink / raw)
On Nov 14, 10:02pm, Richard Henderson wrote:
> ps. Recently I've been told that atheist isn't always friendly
> with anon ftp, so someone probably ought to mirror this.
Well, that's true.
I'd ! promise ! to mirror the library at fabsoft.zarm.uni-bremen.de, if i
only could get it.
Couldn't you send it to me by mail, Richard ?
--
Martin Cornelius, ZARMFAB software development, University of Bremen
phone: 49-421-218-4807 FAX: 49-421-218-3889
email: fabsoft@zarm.uni-bremen.de
paper-mail: Hochschulring / Am Fallturm, 28359 BREMEN, Germany
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread* PLEASE HELP glibc 961111 : can't execute libm - linked programs
[not found] <richard@atheist.tamu.edu>
` (2 preceding siblings ...)
1996-11-15 13:28 ` glibc snapshot 961111 binaries Zarmfab Software Development
@ 1996-11-18 13:30 ` Zarmfab Software Development
1996-11-19 11:12 ` Miquel van Smoorenburg
1996-11-26 19:15 ` binutils fun Bryan W. Headley
1997-02-17 19:47 ` fclose() Bryan W. Headley
5 siblings, 1 reply; 27+ messages in thread
From: Zarmfab Software Development @ 1996-11-18 13:30 UTC (permalink / raw)
after installing glibc961111 executing any program linked with libm
results in:
<xxx>: error in loading shared libraries
/lib/libm.so.6: undefined symbol: EDOM
can anybody help me with this ?
--
Martin Cornelius, ZARMFAB software development, University of Bremen
phone: 49-421-218-4807 FAX: 49-421-218-3889
email: fabsoft@zarm.uni-bremen.de
paper-mail: Hochschulring / Am Fallturm, 28359 BREMEN, Germany
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: PLEASE HELP glibc 961111 : can't execute libm - linked programs
1996-11-18 13:30 ` PLEASE HELP glibc 961111 : can't execute libm - linked programs Zarmfab Software Development
@ 1996-11-19 11:12 ` Miquel van Smoorenburg
0 siblings, 0 replies; 27+ messages in thread
From: Miquel van Smoorenburg @ 1996-11-19 11:12 UTC (permalink / raw)
You (Zarmfab Software Development) wrote:
> after installing glibc961111 executing any program linked with libm
> results in:
>
> <xxx>: error in loading shared libraries
> /lib/libm.so.6: undefined symbol: EDOM
>
> can anybody help me with this ?
It's because sysdeps/alpha/w_sqrt.S misses a #define __need_Emath
before it includes <errnos.h>. With the standard Linux 2.0.x header
files, EDOM doesn't get defined then.
Wouldn't it be better to change errnos.h so that it does a
#ifndef EMON
#define EDOM ...
.. instead of having the app/lib having to define __need_Emath ?
I don't know if this was fixed after 961114, because I can't reach
alpha.gnu.ai.mit.edu
Mike.
--
Miquel van | Cistron Internet Services -- Alphen aan den Rijn.
Smoorenburg, | mailto:info@cistron.nl http://www.cistron.nl/
miquels@cistron.nl | Our vision is to speed up time, eventually eliminating it.
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread
* binutils fun
[not found] <richard@atheist.tamu.edu>
` (3 preceding siblings ...)
1996-11-18 13:30 ` PLEASE HELP glibc 961111 : can't execute libm - linked programs Zarmfab Software Development
@ 1996-11-26 19:15 ` Bryan W. Headley
1996-11-26 18:54 ` Richard Henderson
1997-02-17 19:47 ` fclose() Bryan W. Headley
5 siblings, 1 reply; 27+ messages in thread
From: Bryan W. Headley @ 1996-11-26 19:15 UTC (permalink / raw)
Rich,
Has the bug with objcopy moving from ECOFF to ELF been fixed? Secondary issue
(actually, not), is that compiling "sudo" as a static binary yields assert
errors in elf.c/libbfd in ld. The same damned assert errors that objcopy
enjoys... Will pull in more details as needed.
BTW, thanks for the glibc snapshot. Getting /usr/include straighten out between
elfBall, 3.0.3, 4.0, etc. really helps!
Bryan
--
Bryan W. Headley Home: bheadley@interaccess.com
211 East Pineview Drive Office: bwh@abnamro.com
Round Lake Park, IL 60073 Phone: 847 740-1446
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: binutils fun
1996-11-26 19:15 ` binutils fun Bryan W. Headley
@ 1996-11-26 18:54 ` Richard Henderson
0 siblings, 0 replies; 27+ messages in thread
From: Richard Henderson @ 1996-11-26 18:54 UTC (permalink / raw)
> Has the bug with objcopy moving from ECOFF to ELF been fixed?
No, and such a thing is very low priority. It is a non-trivial
transformation as you have to undo the brain damage inherent in
ECOFF's handling of the GP and the .lita.
> Secondary issue (actually, not), is that compiling "sudo" as a
> static binary yields assert errors in elf.c/libbfd in ld. The
> same damned assert errors that objcopy enjoys.
Those assertion failures turn out to be harmless -- your sudo should
still work -- but that has been fixed in any case for some time.
Which brings me to another point. Would those of you that have
gotten "LITERAL relocation truncated" messages while linking large
binaries contact me privately? I've now got a linker that can
handle multiple .got subsections and before I unleash it on the
world I'd like to try it out on some non-trivial examples.
r~
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: fclose()
[not found] <richard@atheist.tamu.edu>
` (4 preceding siblings ...)
1996-11-26 19:15 ` binutils fun Bryan W. Headley
@ 1997-02-17 19:47 ` Bryan W. Headley
1997-02-17 20:04 ` fclose() Richard Henderson
5 siblings, 1 reply; 27+ messages in thread
From: Bryan W. Headley @ 1997-02-17 19:47 UTC (permalink / raw)
On Feb 17, 1:01pm, Richard Henderson wrote:
> Subject: Re: fclose()
> > fclose(fchan); /* works */
> > fclose(fchan); /* segfaults */
>
> Yep. malloc doen't like it when you free the same pointer twice.
>
> > Ok, so Who's in charge of this code, so I relay my findings?
>
> Me, I guess. This is a known occurrence. The bug, though,
> is with the program trying to fclose twice. The solution of
> course is not to do that.
>
Sometimes you can control that, sometimes you can't. Stupid example:
let's say that I, overly-conscientious guy, fclose stdin and stdout
and then do an exit(). It's exit's job to close all opened file handles,
and naturally it should try to close stdin/stdout. Should exit segv or
exit gracefully? The latter. Especially since fclose() should return
error code in rather than segv'ing.
In professional world, I've seen far too many programs that close all
handles at termination, regardless of whether if known that handle is
open or not. It WOULD be nice to legislate good programming, I agree...
But legacy code rules, especially when practice is "sort of" backed up by API
specs.
--
Bryan W. Headley Home: bheadley@interaccess.com
211 East Pineview Drive Office: bwh@abnamro.com
Round Lake Park, IL 60073 Phone: 847 740-1446
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: fclose()
1997-02-17 19:47 ` fclose() Bryan W. Headley
@ 1997-02-17 20:04 ` Richard Henderson
0 siblings, 0 replies; 27+ messages in thread
From: Richard Henderson @ 1997-02-17 20:04 UTC (permalink / raw)
> In professional world, I've seen far too many programs that close all
> handles at termination, regardless of whether if known that handle is
> open or not. It WOULD be nice to legislate good programming, I agree...
*sigh* Well, there is a solution when you can't fix the source
and that is use a different malloc that can handle multiple frees.
This can be done by either explicitly linking with one when you are
in control of such things or using LD_PRELOAD when you aren't.
But the vast majority of the programs run under Linux *can* have
their sources fixed, and most often it's just a silly little thing
that only takes a few minutes, and so we should.
> But legacy code rules, especially when practice is "sort of" backed up
> by API specs.
There is no API spec that allows "fclose(foo); fclose(foo);".
As always, the effect is undefined/unpredictable.
r~
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread
* fclose()
@ 1997-02-17 16:44 Uncle George
0 siblings, 0 replies; 27+ messages in thread
From: Uncle George @ 1997-02-17 16:44 UTC (permalink / raw)
ever since I upgraded to 4.0/4.1 the pgm called 'suck' has crashed with
a seg fault.
I finally got fed up( gdb/xxgdb doesn't exactly work well with stack
traces!) , and tracked it down to an fclose() call.
ie: fchan = fopen(); /* works */
fclose(fchan); /* works */
fclose(fchan); /* segfaults */
I suppose that there are other pgms that potentially follow this
process, and maybe there would be a fclose() that recognises a bogus
pointer/close channel.
Ok, so Who's in charge of this code, so I relay my findings?
--
Uncle George ( aka G. Baeslack )
http://www.voicenet.com/~gatgul
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread
[parent not found: <33088AF0.2FF1@voicenet.com>]
* Re: fclose()
[not found] <33088AF0.2FF1@voicenet.com>
@ 1997-02-17 19:01 ` Richard Henderson
0 siblings, 0 replies; 27+ messages in thread
From: Richard Henderson @ 1997-02-17 19:01 UTC (permalink / raw)
> fclose(fchan); /* works */
> fclose(fchan); /* segfaults */
Yep. malloc doen't like it when you free the same pointer twice.
> Ok, so Who's in charge of this code, so I relay my findings?
Me, I guess. This is a known occurrence. The bug, though,
is with the program trying to fclose twice. The solution of
course is not to do that.
r~
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: fclose()
@ 1997-02-18 14:19 Uncle George
0 siblings, 0 replies; 27+ messages in thread
From: Uncle George @ 1997-02-18 14:19 UTC (permalink / raw)
Richard Henderson wrote:
>
> > fclose(fchan); /* works */
> > fclose(fchan); /* segfaults */
>
> Yep. malloc doen't like it when you free the same pointer twice.
>
That may be nice to blame malloc, but it should not have gotten that far
- the channel is closed!!! fclose should be returning an error. A
segfault is not appropriate under any circumstances
fd = open();
close(fd); /* system allows it */
close(fd); /* OS Paniks-is this what u want!!*/
/* Or acceptable? */
> > Ok, so Who's in charge of this code, so I relay my findings?
>
> Me, I guess. This is a known occurrence. The bug, though,
> is with the program trying to fclose twice. The solution of
> course is not to do that.
that is one bug, the other is of course the segfault.This didn't happen
under the static lib's in 3.0.3 - only occured in the redhat 4 series
gat
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread
[parent not found: <3309BA67.2168@voicenet.com>]
* Re: fclose()
[not found] <3309BA67.2168@voicenet.com>
@ 1997-02-18 16:04 ` Richard Henderson
0 siblings, 0 replies; 27+ messages in thread
From: Richard Henderson @ 1997-02-18 16:04 UTC (permalink / raw)
> that is one bug, the other is of course the segfault.This didn't happen
> under the static lib's in 3.0.3 - only occured in the redhat 4 series
Yes, there is a new thread-aware malloc in place. It happens to
be very picky about proper memory manegement.
I don't know what to tell you. I am fairly sure ISO C says fclose
on a closed file is undefined. Which mean we can do anything at
all -- including launching rogue on your terminal.
This is not unique to the alpha either. It'll show up on any system
running glibc 2.0. At this point it is more or less an administrative
decision to keep the faster thread-safe malloc rather than the previous.
Complain to drepper@gnu.ai.mit.edu if you like.
However, I also don't really understand that you'd rather the system
hid from you errors in your program that can do just as bizzare
undefined things on other systems, as Jim Nance pointed out for SunOS.
r~
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: fclose()
@ 1997-02-18 18:06 Uncle George
0 siblings, 0 replies; 27+ messages in thread
From: Uncle George @ 1997-02-18 18:06 UTC (permalink / raw)
> However, I also don't really understand that you'd rather the system
> hid from you errors in your program that can do just as bizzare
> undefined things on other systems, as Jim Nance pointed out for SunOS.
actually my point wudda have been the the primitive os calls
open/close behave in predictable ways.
the first close() I would get a return of 0;
the second close() I would, and expect a return of -1 with errno set.
I do not expect an system crash to happen. If a system crash does
happen, according to this discussion, it is not the fault of the system
designer, but rather the fault of the poor victum, who has stumbled on
to the failing condition. Who is at fault - they both are. Who should be
more responsible - The OS designer - that person knows, or should know
that things like that are bound to happen.
I can only say that the analogy is the same with fclose(). I expect
fclose to give me an error return - something more gracefull than a
segfault. Fclose should know that the ptr is invalid - points to no open
channel - and give an appropiate error code.
Uncle George ( aka G. Baeslack )
http://www.voicenet.com/~gatgul
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: fclose()
@ 1997-02-18 19:11 Mark Hamstra
0 siblings, 0 replies; 27+ messages in thread
From: Mark Hamstra @ 1997-02-18 19:11 UTC (permalink / raw)
On Tue, 18 Feb 1997, Uncle George wrote:
> I can only say that the analogy is the same with fclose(). I expect
> fclose to give me an error return - something more gracefull than a
> segfault. Fclose should know that the ptr is invalid - points to no open
> channel - and give an appropiate error code.
The only error POSIX compliant fclose() can return is EOF, which is not
appropriate in the case of this type of programmer error. I suppose you
could make a case that your compiler should return a warning or error, but
to change fclose() to return what you think is an appropriate error at
runtime is at least as wrong as depending upon what is specified as
undefined behaviour.
Mark Hamstra
Bentley Systems, Inc.
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: fclose()
@ 1997-02-18 19:13 Eric Smith
0 siblings, 0 replies; 27+ messages in thread
From: Eric Smith @ 1997-02-18 19:13 UTC (permalink / raw)
Uncle George <gatgul@voicenet.com> wrote:
> actually my point wudda have been the the primitive os calls
> open/close behave in predictable ways.
The primitive OS calls open() and close() do behave in predictable ways. If
you call close() on an FD that isn't open, it will return an error.
fclose() isn't a primitive OS call.
> the first close() I would get a return of 0;
> the second close() I would, and expect a return of -1 with errno set.
> I do not expect an system crash to happen.
A system crash does not happen. The process is sent a signal and exits.
> I expect fclose to give me an error return - something more gracefull than a
> segfault. Fclose should know that the ptr is invalid - points to no open
> channel - and give an appropiate error code.
What's the point in checking the return code or errno for fclose()? What
are you going to do if it fails, try to close it again, hoping that the error
condition has been remedied? Print "Abort, Retry, Ignore?" to stderr? :-)
Cheers,
Eric
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread
[parent not found: <19970218191335.5758.qmail@brouhaha.com>]
* Re: fclose()
[not found] <19970218191335.5758.qmail@brouhaha.com>
@ 1997-02-18 22:32 ` D. Champion
0 siblings, 0 replies; 27+ messages in thread
From: D. Champion @ 1997-02-18 22:32 UTC (permalink / raw)
>> I expect fclose to give me an error return - something more gracefull than a
>> segfault. Fclose should know that the ptr is invalid - points to no open
>> channel - and give an appropiate error code.
>
>What's the point in checking the return code or errno for fclose()? What
>are you going to do if it fails, try to close it again, hoping that the error
>condition has been remedied? Print "Abort, Retry, Ignore?" to stderr? :-)
Oh, so -you're- the guy who does that.
One reason off the top of my head is that the f* stdio suite is
buffered, and a failed fclose() can indicate failure to flush pending
output. Maybe you differ, but I want to know when my newly-compiled
kernel image didn't complete its copy to /vmunix.gz because / is 40
bytes too small.
-D.
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: fclose()
@ 1997-02-19 13:20 Uncle George
0 siblings, 0 replies; 27+ messages in thread
From: Uncle George @ 1997-02-19 13:20 UTC (permalink / raw)
Mark Hamstra wrote:
> The only error POSIX compliant fclose() can return is EOF, which is not
> appropriate in the case of this type of programmer error.
I suppose it would be asking too much to have
if ( chan not open )
return ( EOF );
as part of the fclose() process. I suppose EOF means anything you want
it to mean ( Alice in Wonderland? ).
So who do I really vent this fustration upon? POSIX? GNU? axp ( axp - if
i really look at the code and see that something is not working ) ?
--
Uncle George ( aka G. Baeslack )
http://www.voicenet.com/~gatgul
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread
[parent not found: <330AFE32.5C6E@voicenet.com>]
* Re: fclose()
[not found] <330AFE32.5C6E@voicenet.com>
@ 1997-02-19 14:49 ` Richard Henderson
1997-02-19 17:45 ` fclose() Philip Blundell
1 sibling, 0 replies; 27+ messages in thread
From: Richard Henderson @ 1997-02-19 14:49 UTC (permalink / raw)
> I suppose it would be asking too much to have
>
> if ( chan not open )
> return ( EOF );
Yes. The memory has been freed. There can be anything at all
there now. Or nothing, as the memory could have been returned
to the system.
> So who do I really vent this fustration upon? POSIX? GNU?
I told you how to solve your particular problem (though IMHO it
doesn't solve anything): use the previous malloc. You can find
it conveniently all in one file as gmalloc.c in emacs.
> axp
Huh?
r~
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: fclose()
[not found] <330AFE32.5C6E@voicenet.com>
1997-02-19 14:49 ` fclose() Richard Henderson
@ 1997-02-19 17:45 ` Philip Blundell
1 sibling, 0 replies; 27+ messages in thread
From: Philip Blundell @ 1997-02-19 17:45 UTC (permalink / raw)
On Wed, 19 Feb 1997, Uncle George wrote:
> Mark Hamstra wrote:
>
> > The only error POSIX compliant fclose() can return is EOF, which is not
> > appropriate in the case of this type of programmer error.
> I suppose it would be asking too much to have
>
> if ( chan not open )
> return ( EOF );
>
> as part of the fclose() process.
Yes. The argument you pass to fclose() is a pointer. From fclose's point
of view there is no difference between a completely garbage pointer and
one that's been closed and freed. T
phil
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: fclose()
@ 1997-02-24 13:57 Uncle George
0 siblings, 0 replies; 27+ messages in thread
From: Uncle George @ 1997-02-24 13:57 UTC (permalink / raw)
I just looked at the Linux man pages for fclose(). I shudda looked at
them at the beginning of this dialog, but interestingly enough THAT
DOCUMENTATION seems to support my view point -under ERRORS:
EBADF the argument stream is not an open stream.
The fclose() function conforms the the ANSI standard. No mention of a
posix standard.
I suppose now I'll get a lecture on the virtues/history of ANSI, and
Posix compliances ;-(
--
Uncle George ( aka G. Baeslack )
http://www.voicenet.com/~gatgul
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread
[parent not found: <33119E2E.7313@voicenet.com>]
* Re: fclose()
[not found] <33119E2E.7313@voicenet.com>
@ 1997-02-24 19:34 ` Richard Henderson
0 siblings, 0 replies; 27+ messages in thread
From: Richard Henderson @ 1997-02-24 19:34 UTC (permalink / raw)
> The fclose() function conforms the the ANSI standard. No mention of a
> posix standard.
>
> I suppose now I'll get a lecture on the virtues/history of ANSI, and
> Posix compliances ;-(
If you mean a lecture on how to read a standards document, yes.
Here's the excerpt from the ANSI standard:
] 7.9.3 Files
]
] [...]
]
] A file may be disassociated from a controlling stream by _closing_
] the file. Output streams are flushed (any unwritten buffers are
] transmitted to the host environment) before the stream is
] dissociated from the file. The value of a pointer to a FILE object is
] indeterminate after the associated file is closed (including the
] standard text streams).
and from the ISO standard that supersedes it:
] The <tt/fclose/ function causes the stream pointed to by <tt/stream/
] to be flushed and the associated file to be closed. Any unwritten
] data for the stream are delivered to the host environment to be
] written to the file; any unread data are discarded. The stream is
] disassociated from the file. If the associated buffer was
] automatically allocated, it is deallocated.
The ANSI document is a bit more explicit about stating that the
state of the stream ("indeterminate"), but even the ISO version
gets there indirectly ("it is deallocated").
There will be no change to the current behavior of glibc. I have
suggested before using a different malloc, you didn't like that. I
also understand you can enable arena verification in malloc either
by setting the environment variable MALLOC_CHECK_ or with
mallopt(M_CHECK_ACTION, 1);
in your program. This will prevent segv in the specific problem of
back-to-back frees, but will still fail under more complex conditions.
Expect a 20% performance hit for the extra verification.
I still urge you to go to the trouble to fix your program, as there
is no libc workaround that does not fail under some condition. If you
don't want to do this, there's not much to be done.
r~
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: fclose()
@ 1997-02-24 19:41 Eric Smith
0 siblings, 0 replies; 27+ messages in thread
From: Eric Smith @ 1997-02-24 19:41 UTC (permalink / raw)
Uncle George <gatgul@voicenet.com> wrote:
> I just looked at the Linux man pages for fclose(). I shudda looked at
> them at the beginning of this dialog, but interestingly enough THAT
> DOCUMENTATION seems to support my view point -under ERRORS:
> EBADF the argument stream is not an open stream.
Yes, but even if it did that, you *still* wouldn't be safe calling fclose()
twice on the same stream. Why? Because it would still be possible that
an intermediate open() call might have returned the same pointer:
f1 = fopen ("foo", "r"); /* returns 28 */
fclose (f1);
f2 = fopen ("bar", "r"); /* also returns 28 */
fclose (f1); /* oops! 28 is still a valid stream! */
fprintf (f2, "test\n"); /* fails */
Cheers,
Eric
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: fclose()
@ 1997-02-24 21:17 Craig Burley
0 siblings, 0 replies; 27+ messages in thread
From: Craig Burley @ 1997-02-24 21:17 UTC (permalink / raw)
>I still urge you to go to the trouble to fix your program, as there
>is no libc workaround that does not fail under some condition. If you
>don't want to do this, there's not much to be done.
In any case, this discussion should probably be moved off of
axp-list. It long ago became fairly irrelevant to the issue
of making stuff work on DEC Alpha machines, becoming instead
a waste of time for people, like myself, who don't want to
read about those who can't take the time to write correct
code and want everybody else's programs slowed down to
compensate.
tq vm, (burley)
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread[parent not found: <eric@brouhaha.com>]
* Re: fclose()
[not found] <eric@brouhaha.com>
@ 1997-02-25 4:08 ` Bryan W. Headley
0 siblings, 0 replies; 27+ messages in thread
From: Bryan W. Headley @ 1997-02-25 4:08 UTC (permalink / raw)
On Feb 24, 7:41pm, Eric Smith wrote:
> Subject: Re: fclose()
> Uncle George <gatgul@voicenet.com> wrote:
> > I just looked at the Linux man pages for fclose(). I shudda looked at
> > them at the beginning of this dialog, but interestingly enough THAT
> > DOCUMENTATION seems to support my view point -under ERRORS:
> > EBADF the argument stream is not an open stream.
>
> Yes, but even if it did that, you *still* wouldn't be safe calling fclose()
> twice on the same stream. Why? Because it would still be possible that
> an intermediate open() call might have returned the same pointer:
>
> f1 = fopen ("foo", "r"); /* returns 28 */
> fclose (f1);
> f2 = fopen ("bar", "r"); /* also returns 28 */
> fclose (f1); /* oops! 28 is still a valid stream! */
> fprintf (f2, "test\n"); /* fails */
Actually, there's a semaphore bit you can set on close that prevents the stream
from looking valid. The library currently uses signature patterns to see if the
stream looks legit, and adding a check for this semaphore bit to that code
would not be hard. Sure, the fprintf() will return an error -- it should. But
I'd rather fail on the signature bit test and immediately return with an error
than to allow fprintf to write to f2->buffer, who got freed in fclose(f1), and
whose state is rather "undefined". SOME wrong code is harder to debug than
others...
I passed the idea to Uli and Richard, let's see what they say...
--
Bryan W. Headley Home: bheadley@interaccess.com
211 East Pineview Drive Office: bwh@abnamro.com
Round Lake Park, IL 60073 Phone: 847 740-1446
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: fclose()
@ 1997-02-25 9:52 Uncle George
0 siblings, 0 replies; 27+ messages in thread
From: Uncle George @ 1997-02-25 9:52 UTC (permalink / raw)
Richard Henderson wrote:
>
>
> I still urge you to go to the trouble to fix your program, as there
> is no libc workaround that does not fail under some condition. If you
> don't want to do this, there's not much to be done.
>
> r~
The Program Is not in my care - I am just a (l)user of a seg-fault.
your diatribe on fclose() does not mention error codes. Anyway the doc I
refered to is from the Linux Man pages on my alpha/axp. Maybe not up to
date, but apparently a viable reference to the prob at hand!
--
Uncle George ( aka G. Baeslack )
http://www.voicenet.com/~gatgul
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: fclose()
@ 1997-02-25 10:03 Uncle George
0 siblings, 0 replies; 27+ messages in thread
From: Uncle George @ 1997-02-25 10:03 UTC (permalink / raw)
Craig Burley wrote:
>
> a waste of time for people, like myself, who don't want to
> read about those who can't take the time to write correct
> code and want everybody else's programs slowed down to
> compensate.
>
> tq vm, (burley)
>
I suppose u are right:
Seat Belts are useless,
air-bags are useless
crash impact bumpers are useless,
roll bars are useless,
and so on
These features waste a lot of money, time, lives, and slow down
everyone because of a few people who cannot compensate.
Just as a side note - Its not my program.
--
Uncle George ( aka G. Baeslack )
http://www.voicenet.com/~gatgul
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 27+ messages in thread
end of thread, other threads:[~1997-02-25 10:03 UTC | newest]
Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <richard@atheist.tamu.edu>
1996-05-09 14:55 ` gdb Eric Youngdale
1996-10-29 18:50 ` thanks to Richard : Xemacs compiled as ELF Zarmfab Software Development
1996-11-15 13:28 ` glibc snapshot 961111 binaries Zarmfab Software Development
1996-11-18 13:30 ` PLEASE HELP glibc 961111 : can't execute libm - linked programs Zarmfab Software Development
1996-11-19 11:12 ` Miquel van Smoorenburg
1996-11-26 19:15 ` binutils fun Bryan W. Headley
1996-11-26 18:54 ` Richard Henderson
1997-02-17 19:47 ` fclose() Bryan W. Headley
1997-02-17 20:04 ` fclose() Richard Henderson
1997-02-17 16:44 fclose() Uncle George
[not found] <33088AF0.2FF1@voicenet.com>
1997-02-17 19:01 ` fclose() Richard Henderson
-- strict thread matches above, loose matches on Subject: below --
1997-02-18 14:19 fclose() Uncle George
[not found] <3309BA67.2168@voicenet.com>
1997-02-18 16:04 ` fclose() Richard Henderson
1997-02-18 18:06 fclose() Uncle George
1997-02-18 19:11 fclose() Mark Hamstra
1997-02-18 19:13 fclose() Eric Smith
[not found] <19970218191335.5758.qmail@brouhaha.com>
1997-02-18 22:32 ` fclose() D. Champion
1997-02-19 13:20 fclose() Uncle George
[not found] <330AFE32.5C6E@voicenet.com>
1997-02-19 14:49 ` fclose() Richard Henderson
1997-02-19 17:45 ` fclose() Philip Blundell
1997-02-24 13:57 fclose() Uncle George
[not found] <33119E2E.7313@voicenet.com>
1997-02-24 19:34 ` fclose() Richard Henderson
1997-02-24 19:41 fclose() Eric Smith
1997-02-24 21:17 fclose() Craig Burley
[not found] <eric@brouhaha.com>
1997-02-25 4:08 ` fclose() Bryan W. Headley
1997-02-25 9:52 fclose() Uncle George
1997-02-25 10:03 fclose() Uncle George
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox