RPM Community Forums

Mailing List Message of <popt-devel>

Extending POPT_SET_BIT from first-found to all-found?

From: Jeff Johnson <jbj@jbj.org>
Date: Tue 31 Mar 2009 - 00:21:40 CEST
Message-Id: <0DC9F340-C5AE-4F31-8BE8-142328736BF1@jbj.org>
There's an odd behavior with popt that bites me every
other year or so in RPM that I should describe.

Note that RPM uses popt in ways no other program does (and
likely in ways that no other program should use popt).

E.g., RPM has 3 separate contextual meanings for -i:
	1) -i as in --install
	2) -qi as in --query --info
	3) -bi used while building

Yes, its crazy to have 3 separate meanings for -i but
it was way too late in 1998, a decade later the usage
cases are so locked in concrete that the *MUST* be dealt with.

The flaw that bites me every other year or so is
the difference in the way per-table callbacks are
handled as opposed to other option/alias/exec handling in popt.

Normally, popt traverses nested tables, finds an option match, performs
some operation, and returns. That is "first-found" behavior.

However, a popt enhancement was introduced (to accomodate GNOME)
to have popt continue through all tables performing callbacks
for every occurence of an option found. That is "all-found" behavior.

The problem is that there's no way to handle "all-found" behavior
when there are multiple occurences of identically named options
__EXCEPT__ through a call back. Non-callback options are always
"first-found" behavior.

The "all-found" popt behavior has actually been useful in RPM because  
certain
options have been generalized by having multiple callbacks, with
different side-effects, through multiple per-table callbacks.

But popt also supplies POPT_BIT_SET and POPT_BIT_CLEAR, which
are also quite convenient automation __EXCEPT__ when there are multiple
tables with identically named options, and the debugging is quite  
obscure.

I dunno if I can (or should) attempt to process non-callback options
with an "all-found" mode of behavior like callback options have in popt.

Hmmm ...

Meanwhile reverting some POPT_BIT_SET options back to callbacks in RPM
has restored --nofdigests functionality which is "gud enuf" until
I forget this flaw Yet Again and attempt Yet Again to use POPT_BIT_SET  
instead.

Thanks for listening. I'm pretty sure that the need for "all-found"  
non-callback
option processing is specific only to RPM, but I thought I'd describe  
the flaw.

73 de Jeff
Received on Tue Mar 31 14:43:08 2009
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.