Bug 142197 - Provide a standardized low-level way to test in %scriptlets whether a path is covered by %_netsharedpath
Summary: Provide a standardized low-level way to test in %scriptlets whether a path is...
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
(Show other bugs)
Version: rawhide
Hardware: All Linux
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: Mike McLean
Depends On:
TreeView+ depends on / blocked
Reported: 2004-12-08 01:57 UTC by Enrico Scholz
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-12-08 03:15:05 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Enrico Scholz 2004-12-08 01:57:05 UTC
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

Comment 1 Jeff Johnson 2004-12-08 02:31:10 UTC
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-08 03:15:05 UTC
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.