<br><br><div class="gmail_quote">On 14 September 2011 17:10, Peter Ruprecht <span dir="ltr"><<a href="mailto:peter.ruprecht@jila.colorado.edu">peter.ruprecht@jila.colorado.edu</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

I seem to be able to reproduce in RHEL 6 the bug reported in <a href="https://bugzilla.redhat.com/show_bug.cgi?id=597578" target="_blank">https://bugzilla.redhat.com/<u></u>show_bug.cgi?id=597578</a> .  I have glibc-static 2.12-1.25.el6_1.3 installed.<br>

<br>
Before I open a bugzilla report on this, I just want to check the wisdom of the community on whether it really is a bug, or whether it's just an expected manifestation of the "don't static link with glibc" model (a la <a href="http://people.redhat.com/drepper/no_static_linking.html" target="_blank">http://people.redhat.com/<u></u>drepper/no_static_linking.html</a> .)<br>
<br></blockquote><div><br></div><div>In the past when I've found people trying to statically link with glibc, the problems have revolved around things like gethostbyname() failing because they can't dynamically load the relevant library.</div>
<div><br></div><div>This doesn't look like that: it's a failure somewhere within malloc().   Can you open a file for reading with a very small static program (e.g. fopen("/etc/passwd", "r") and not a lot else)?  Or just malloc() a buffer?</div>
<div><br></div><div>Having said that, I'm not at all keen on glibc static linking.   I'm surprised it works at all (to produce something that can be executed), but, of course, you're baking in any security problems or bugs that might be fixed in a future version and if you're planning to distribute the resultant binary then you have licensing issues to worry about.  I would expect that Ulrich's web page goes into more detail, but you need to be sure that dynamic linking is going to fix more problems than it solves.   (I had a couple of people convinced that you couldn't debug an executable unless it was static.   That might've been true a decade or more ago on HP/UX, but it's not true now.)</div>
<div><br></div><div>Interestingly, compiling that example program on F15 gives this warning:</div><div><br></div><div><div>/tmp/cc4822Uz.o: In function `main':</div><div>foo.c:(.text+0x15): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking</div>
</div><div><br></div><div>And indeed, running it under strace shows it dynamically loading a library in order to do the gethostbyname().   So it's not as static as you might think it is.    The executable is also 832KB, unstripped, and size tells me that it's 780KB so it's going to take a hell of a long time to load compared to the dynamic version although, of course, once it's cached it's pretty quick.  On the other hand, the dynamic program is 6.5KB unstripped and size says it's actually a little less than 2KB.</div>
<div><br></div><div>jch</div><div><br></div></div>