mailing list of musl libc
 help / color / mirror / code / Atom feed
* musl's ldd - don't exit immidately even if some libraries was not found
@ 2012-06-19 16:42 orc
  2012-06-20  0:53 ` Isaac Dunham
  0 siblings, 1 reply; 4+ messages in thread
From: orc @ 2012-06-19 16:42 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 70 bytes --]

Patch to make ldd not to exit immidately after unsolved dependencies.

[-- Attachment #2: musl-0.9.1-ldd-dontfail.patch --]
[-- Type: application/octet-stream, Size: 998 bytes --]

diff -Naur musl-0.9.1.o/src/ldso/dynlink.c musl-0.9.1/src/ldso/dynlink.c
--- musl-0.9.1.o/src/ldso/dynlink.c	2012-06-04 04:32:05.000000000 +0800
+++ musl-0.9.1/src/ldso/dynlink.c	2012-06-20 00:32:52.332607400 +0800
@@ -430,12 +430,16 @@
 			if (p->dynv[i] != DT_NEEDED) continue;
 			dep = load_library(p->strings + p->dynv[i+1]);
 			if (!dep) {
-				snprintf(errbuf, sizeof errbuf,
-					"Error loading shared library %s: %m (needed by %s)",
-					p->strings + p->dynv[i+1], p->name);
-				if (runtime) longjmp(rtld_fail, 1);
-				dprintf(2, "%s\n", errbuf);
-				_exit(127);
+				if (!ldd_mode) {
+					snprintf(errbuf, sizeof errbuf,
+						"Error loading shared library %s: %m (needed by %s)",
+						p->strings + p->dynv[i+1], p->name);
+					if (runtime) longjmp(rtld_fail, 1);
+					dprintf(2, "%s\n", errbuf);
+					_exit(127);
+				}
+				else
+					dprintf(1, "\t%s => not found\n", p->strings + p->dynv[i+1]);
 			}
 			if (runtime) {
 				tmp = realloc(*deps, sizeof(*tmp)*(ndeps+2));

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

* Re: musl's ldd - don't exit immidately even if some libraries was not found
  2012-06-19 16:42 musl's ldd - don't exit immidately even if some libraries was not found orc
@ 2012-06-20  0:53 ` Isaac Dunham
  2012-06-20  1:17   ` Rich Felker
  0 siblings, 1 reply; 4+ messages in thread
From: Isaac Dunham @ 2012-06-20  0:53 UTC (permalink / raw)
  To: musl

On Wed, 20 Jun 2012 00:42:10 +0800
orc <orc@sibserver.ru> wrote:

> Patch to make ldd not to exit immidately after unsolved dependencies.

Out of curiosity, 
1-what practical use is this, and

2-is there any other system that behaves the same? 

(well, I can think of HXRT with one environment variable set...but
that's Windows emulation for DOS, so I can see them having odd behavior)

(Note, I'm not saying it's the wrong thing to do, just wondering where
you could use it without expecting SIGSEGV)



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

* Re: musl's ldd - don't exit immidately even if some libraries was not found
  2012-06-20  0:53 ` Isaac Dunham
@ 2012-06-20  1:17   ` Rich Felker
  2012-06-20  7:40     ` orc
  0 siblings, 1 reply; 4+ messages in thread
From: Rich Felker @ 2012-06-20  1:17 UTC (permalink / raw)
  To: musl

On Tue, Jun 19, 2012 at 05:53:16PM -0700, Isaac Dunham wrote:
> On Wed, 20 Jun 2012 00:42:10 +0800
> orc <orc@sibserver.ru> wrote:
> 
> > Patch to make ldd not to exit immidately after unsolved dependencies.
> 
> Out of curiosity, 
> 1-what practical use is this, and
> 
> 2-is there any other system that behaves the same? 
> 
> (well, I can think of HXRT with one environment variable set...but
> that's Windows emulation for DOS, so I can see them having odd behavior)
> 
> (Note, I'm not saying it's the wrong thing to do, just wondering where
> you could use it without expecting SIGSEGV)

My guess is that the practical use is to get a list of ALL missing
library dependencies rather than just the first one.

Rich


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

* Re: musl's ldd - don't exit immidately even if some libraries was not found
  2012-06-20  1:17   ` Rich Felker
@ 2012-06-20  7:40     ` orc
  0 siblings, 0 replies; 4+ messages in thread
From: orc @ 2012-06-20  7:40 UTC (permalink / raw)
  To: musl

On Tue, 19 Jun 2012 21:17:36 -0400
Rich Felker <dalias@aerifal.cx> wrote:

> On Tue, Jun 19, 2012 at 05:53:16PM -0700, Isaac Dunham wrote:
> > On Wed, 20 Jun 2012 00:42:10 +0800
> > orc <orc@sibserver.ru> wrote:
> > 
> > > Patch to make ldd not to exit immidately after unsolved
> > > dependencies.
> > 
> > Out of curiosity, 
> > 1-what practical use is this, and
> > 
> > 2-is there any other system that behaves the same? 
> > 
> > (well, I can think of HXRT with one environment variable set...but
> > that's Windows emulation for DOS, so I can see them having odd
> > behavior)
> > 
> > (Note, I'm not saying it's the wrong thing to do, just wondering
> > where you could use it without expecting SIGSEGV)
> 
> My guess is that the practical use is to get a list of ALL missing
> library dependencies rather than just the first one.
> 
> Rich

Yes, in ldd mode dynamic linker will not exit immediately after missing
library. That what this patch does.
In environments where everything is built from source and no missing
libraries this patch is useless I think, but just to be sure.

Sorry for my English mistakes and message without [PATCH] tag.


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

end of thread, other threads:[~2012-06-20  7:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-19 16:42 musl's ldd - don't exit immidately even if some libraries was not found orc
2012-06-20  0:53 ` Isaac Dunham
2012-06-20  1:17   ` Rich Felker
2012-06-20  7:40     ` orc

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).