Hi Sashank999
... Well, object files end with .o so "grep -v '\.o$'" might work to filter them out from the list of files even before executing the "file" command. As we are filtering out .o files, we could eliminate "grep -E 'executable|shared object'" ...
I don't know what other unwanted file extensions (or names with no extensions) could pop up, do you?
We want 2 types of ELF files, so that's what it makes sense to search for.
... Also, using "file" command to find .so libs in submitqc is time taking(IMO). We could simply "grep '\.so$'" on list of files to that. ...
That will catch all of the .so files but miss all of the programs.
... I still don't get why you don't like readelf...
I guess the real questions are:
Is it sufficient to only check whether the direct dependencies are available?
Do we need to check for the entire dependency tree?
Maybe someone else could chime in.
link=https://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN115
Beware: do not run ldd on a program you don't trust. As is clearly stated in the ldd(1) manual, ldd works by (in certain cases) by setting a special environment variable (for ELF objects, LD_TRACE_LOADED_OBJECTS) and then executing the program. It may be possible for an untrusted program to force the ldd user to run arbitrary code (instead of simply showing the ldd information). So, for safety's sake, don't use ldd on programs you don't trust to execute.
So, by using readelf to determine dependencies you won't get any bad behavior from the "untrusted program".
Now that you have resolved the dependencies, what do you think will happen when you run the "untrusted program"?
If the program is untrusted, would you be packaging it for the repository?
If you knew in advance that a program is untrusted, you would not be performing any of those activities with it.