LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-26-2017, 11:13 AM   #16
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 2,011

Rep: Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619

Quote:
Originally Posted by orbea View Post
I guess you could make a shell script to look at other shell scripts, compare every word in it and compile a list of binaries. Sounds way more effort than it would be worth.
Actually in concept that doesn't sound too difficult, but I'm sure it would be hard to get the details and "edge cases" right.
 
Old 06-26-2017, 11:46 AM   #17
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,950

Rep: Reputation: Disabled
It would also have to be recursive in the event the script calls other scripts. slackpkg is ~500 lines and pkgtool is ~700, I don't think it'd be a huge chore to skim them.
 
Old 06-28-2017, 09:20 AM   #18
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
HeHe, I use a patch from RH for bash which will make it list all the bins/scripts called by a script. Very handy indeed -even if it may miss certain constructs. The patch itself is really quite small and non-invasive in that it simply expands the '-n' option to print out the called programs. Any fedora/RH source archive of bash will have the patch in there. I filter/sort the results to get a list of unique calls.
 
1 members found this post helpful.
Old 06-29-2017, 05:43 AM   #19
Slax-Dude
Member
 
Registered: Mar 2006
Location: Valadares, V.N.Gaia, Portugal
Distribution: Slackware
Posts: 528

Rep: Reputation: 272Reputation: 272Reputation: 272
Quote:
Originally Posted by Didier Spaier View Post
The word "dependency" usually refers to shared objects on which some binary depends.

-noarch packages have no dependencies using this definition, as they include no files in /usr/lib or /usr/lib64.

If you use the word dependency with another meaning, you will have to define it.
Dependency is universally defined thus: if A needs B to function, then B is a dependency for A.
It matters not if A or B are scripts or binaries or shared objects.
Simply put: if you are missing 'sed' or 'awk' then probably 'network-scripts' will not work.

Quote:
Originally Posted by Didier Spaier View Post
If for instance you speak about all programs that a shell script needs to run as intended, you will have to analyze the the script to find what utilities or other programs it runs or calls. If you write a program that does that automatically, please share it with us.
I'm not a programmer and have no skills to build such a tool.
As for analyzing shell scripts to find their dependencies, already did that here.

The OP wants to build a dependency resolver and asked for input.
I was just point out to him that the existing tools and lists do not take into account the dependencies of 'shell script packages' and it would be a good thing if some future tool or list did it.
Just giving input, as asked by the OP
 
Old 06-29-2017, 06:23 AM   #20
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
Quote:
Originally Posted by Slax-Dude View Post
Dependency is universally defined thus: if A needs B to function, then B is a dependency for A.
It matters not if A or B are scripts or binaries or shared objects.
Simply put: if you are missing 'sed' or 'awk' then probably 'network-scripts' will not work.
Generally speaking, yes. But as the OP mentioned in the thread's title "ldd-based", the post you quoted highlights that there are dependencies that ldd can't detect, thus have to be dealt with other tools or methods (if they are in the scope).

Last edited by Didier Spaier; 06-29-2017 at 06:27 AM.
 
Old 06-29-2017, 12:56 PM   #21
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,504

Rep: Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461
Quote:
Originally Posted by Didier Spaier View Post
Generally speaking, yes. But as the OP mentioned in the thread's title "ldd-based", the post you quoted highlights that there are dependencies that ldd can't detect, thus have to be dealt with other tools or methods (if they are in the scope).
The biggest issue is that ldd detects too many dependencies, i.e. indirect ones. A binary may be linked to several shared objects, and ldd will also report the shared objects that those link to in turn. If the purpose is to find what might need recompiling after a shared library bumps its version number, you really only want to report the direct dependencies to avoid a lot of needless recompiles.

For this purpose, "readelf -d" is a better source of dependency information than "ldd".
 
6 members found this post helpful.
Old 06-29-2017, 02:01 PM   #22
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
Quote:
Originally Posted by volkerdi View Post
The biggest issue is that ldd detects too many dependencies, i.e. indirect ones. A binary may be linked to several shared objects, and ldd will also report the shared objects that those link to in turn. If the purpose is to find what might need recompiling after a shared library bumps its version number, you really only want to report the direct dependencies to avoid a lot of needless recompiles.

For this purpose, "readelf -d" is a better source of dependency information than "ldd".
Indeed. depfinder uses ldd, but its purpose is to find all packages needed to run the programs included in a given package, thus it has to find the dependencies recursively.

But of course to find which dependencies you need to recompile for a shared library's version bump in -current, readelf -d is better. As an end user I didn't come across a missing dependency so far in a full Slackware installation, so thanks ;-)

Last edited by Didier Spaier; 06-29-2017 at 04:01 PM.
 
Old 06-30-2017, 12:38 AM   #23
a4z
Senior Member
 
Registered: Feb 2009
Posts: 1,727

Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
Quote:
Originally Posted by volkerdi View Post
The biggest issue is that ldd detects too many dependencies, i.e. indirect ones. A binary may be linked to several shared objects, and ldd will also report the shared objects that those link to in turn. If the purpose is to find what might need recompiling after a shared library bumps its version number, you really only want to report the direct dependencies to avoid a lot of needless recompiles.

For this purpose, "readelf -d" is a better source of dependency information than "ldd".
and this is why sbbdep does read the elf information plus handling and emulating linker search path correct, including all properties, that ones found in the elf dyn section like rpath dynpath + relative path handling and resolving of the HOME location plus respecting the system properties, to find the used libraries and the alternatives. (plus a hidden option to handle some special cases that developers might have) And having a cache to get those info as fast as possible, and not just tell you what a binary/library needs, but also who is needing a library. self plug done ;-)
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: APT - Advanced Package Management tool for Debian Based Systems LXer Syndicated Linux News 0 05-25-2016 06:12 AM
[SOLVED] Parallel multiple ssh tool pseudo tty support bridrod Linux - Server 13 01-27-2011 09:34 AM
ldd does not show the dependency library list sandy_linux Linux - Newbie 3 11-18-2010 02:11 AM
"list dynamic dependency" of an executable using command other than "ldd" Amrita@3086 Solaris / OpenSolaris 3 04-04-2007 04:56 AM
possible BIOS attack tool??? Paul6253 Linux - Security 8 11-05-2004 06:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration