Bug 142197 - Provide a standardized low-level way to test in %scriptlets whether a path is covered by %_netsharedpath
Provide a standardized low-level way to test in %scriptlets whether a path is...
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
Mike McLean
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-12-07 20:57 EST by Enrico Scholz
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-12-07 22:15:05 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Enrico Scholz 2004-12-07 20:57:05 EST
Description of problem:

Although the longterm goal of rpm is/was(??) to classify certain
actions which are currently done by %scriptlets, such a classification
will never cover all possible cases. Because it is easy for such
scriptlets to conflict with %_netsharedpath settings and the related
test is not trivial, a standardized test is highly needed. For samples
of broken scriptlets see the blocks-list of bug #51193.

My preferred solution would be a check like:

| %post
| <black_magic> /usr || exit 0     # check whether /usr is not in %_netsharedpath
| touch /usr/something


For '<black_magic>' you have the choice between

- a perl/awk/python/... script. Disadvantages are additional dependencies
  on perl/gawk/python (which might be superfluously on minimal systems),
  and the redundancy to write the same script into every %post

- a %macro executing the script; this removes the redundancy in the
  scripts but the superfluous dependencies remain. With recent rpm,
  such a macro can be provided in /etc/rpm/macros.netsharedpath from
  an additional package.

- a native C implementation of such a test; this can do simple pattern
  matching or use the related librpm function (I do not know if such a
  function exists). When linked against dietlibc, the pattern-matching
  thing will have nearly no dependency.

- a %macro executing the C program above. This avoids hardcoded paths
  in the scriptlet. I prefer this method.



Giving the actual value of %_netsharedpath to <black_magic> is a
problem: the direct execution of "rpm --eval '%{_netsharedpath}'" is
error-prone (how often have I to quote the '%'?) and incorrect as it
does not honor flags of current rpm invocation which might influence
%_netsharedpath (e.g. '--define _netsharedpath ...' or '--rcfile
%...').


Therefore, rpm would have to set an environment-variable like
'RPM_NETSHAREDPATH' before script-execution. Other interprocess
communication mechanisms like pipes or shared-memory are not
applicable (pipes must be open in scriptlet, but closed in started
programs) or too complicated (how will the shared-memory be
identified?).
Comment 1 Jeff Johnson 2004-12-07 21:31:10 EST
My current rpm roadmap plan is to turn all scriptlets into parameterized
embedded lua triggers fired by patterns against file(1)
class tags currently in header metadata and avoid (abandon
if up to me) scriptlets in *.rpm packages entirely.

At that point, side-effects of the parameterized triggers on
RO mounts can be reasonably dealt with, as there's a whole
new batch of package monkeys coming on line without any clear
and definite packaging policy or methodology. I'm too old
for the sh*t ...

Sound like a plan? rpm-devel@lists.dulug.duke.edu for progress
reports if so ...
Comment 2 Jeff Johnson 2004-12-07 22:15:05 EST
UPSTREAM, because that's where the fix will be attempted.

Note You need to log in before you can comment on or make changes to this bug.