bash rpm-requires

Steve G linux_4ever at yahoo.com
Wed Aug 4 14:49:04 UTC 2004


Hi,

>It's nice but only as an aid to a packager, it has too many problems to be
>usable in automated manner. For example try it on the little script 
>below... Dunno how hard it would be to fix.

Right. Your script shows 2 of 3 problems that I see.

1) It doesn't expand variables when they are used as a command. The downside to
this is that some commands are missed. The fallback is that you depend on the
maintainer to have stated the requirements correctly. So in reality, nothing is
gained or lost.

2) It can't tell that a function call is internal. This can be a problem. If the
function name is the same as a real command, it will resolve to a wrong
requirement.

But it has another problem that I see...

3) It has problems with a script that does an unconditional exec. For example,
many tk scripts start off a shell script and do an exec of wish. From that point
forward, everything in the script is tk/tcl. This could be handled in the sh2rpms
script by prescanning and seeing if a known interpreter is reported. If so,
reduce the requirements to that interpreter.


In terms of usability, though, I think it is still usable. I would encourage the
Red Hat team to continue this patch and refine it. Because of this patch, I have
also written scripts that scan shell scripts (that admins are likely to run) for
incomplete paths. e.g. grep instead of /bin/grep.

Another interesting bash feature that maintainers might want to know about is the
-n option, which does a syntax check of a script. I've written a script that
searches the hard drive for shell scripts and uses -n on them. It falls victim to
the same problem as #3 above, but can handle the problem by further examination
of the file in question. On my RH9 system, this script shows that there are
problems in:

/usr/lib/rpm/check-prereqs
/usr/bin/pcdindex
/usr/bin/cvsversion
/usr/bin/kde-build

Try them yourself. It would be interesting to have rpmbuild run 'sh -n' against
all packaged shell scripts, weed out interpreter calls like wish or guile, and
report them to stderr...but don't break the build.

Hope this spurs some creativity...

-Steve Grubb


	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 





More information about the fedora-devel-list mailing list