Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 51193 - RFE: %_netsharedpath mechanism is naive, needs redesign
Summary: RFE: %_netsharedpath mechanism is naive, needs redesign
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: rawhide
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: David Lawrence
: 3229 4330 (view as bug list)
Depends On:
Blocks: 50670 51188 52742 52743 59494 61147 71665 71676 73321 132846 132847 142103
TreeView+ depends on / blocked
Reported: 2001-08-08 12:24 UTC by Enrico Scholz
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Last Closed: 2004-12-07 23:59:51 UTC

Attachments (Terms of Use)

Description Enrico Scholz 2001-08-08 12:24:17 UTC
Some packages are modifying files in their scriptlets (e.g. anonftp, XFree86).
Because these files can be on shared partitions it would be nice to test if 
they are covered by %_netsharedpath or not.

In my rpms I am using a macro:

| %define __isDirectoryShared	rpm --eval '%%{_netsharedpath}' | perl -e '$_=$ARGV[0];$l=<STDIN>;chomp($l);foreach $p (split(/:/,$l)) {exit(0) if m!^$p!;}; exit(1)'

which can be used e.g. as:

| %post
| %__isDirectoryShared %{_infodir} || %{__install_info} %{_infodir}/my-doc

Well, the macro contains perl and rpmlint complains about dangerous commands in the 
%post scriptlet, but this could be solved by a C implementation and a popt-command
for rpm doing the "rpm --eval '%%{_netsharedpath}'".

It would be nice if the official rpm contains such a functionality...

Comment 1 Jeff Johnson 2001-08-08 13:17:14 UTC
Agreed %_netsharedpath is pretty feeble and complicated mechanism.

Rather than adding yet more complicated macro glop to do the right
thing, I suggest an alternative approach
	1) Classify all files, in this case, mark a file as an "info" file.
	2) Associate actions with each class, in this case, the install
	action is %{__install_info}
	3) Parameterize the actions with per-install-system configuration,
	in this case the (default) parameter is %{_infodir}/my-doc
	4) Enrich the transaction state machine to automagically
	perform actions for each file in a class.
	5) Make the transaction state machine sensitive to transaction
	context like %_netsharedpath
The end result would essentially factor most of the operations now done
in %post et al scriptlets out of packages, and into the installer (i.e. rpm)
context without the cumbersome artifacts like "rpm --eval" to reacquire
the transaction context.

Comment 2 Enrico Scholz 2001-08-08 13:30:31 UTC
How would a package fit into this scheme whose files can not be classified or
are used only by this package?

An example is anonftp:

| $ rpm -q --scripts anonftp
| ...
| preuninstall scriptlet (through /bin/sh):
| if [ $1 = 0 ]; then
|         rm -f /var/ftp/lib/* /var/ftp/bin/*
| fi

or XFree86

| $ rpm -q --scripts XFree86
| ...
| postinstall scriptlet (through /bin/sh):
| {
|   for dir in lbxproxy proxymngr rstart xserver ; do
|    [ ! -L /usr/X11R6/lib/X11/$dir -a ! -d /usr/X11R6/lib/X11/$dir ] && \
|      ln -snf ../../../../etc/X11/$dir /usr/X11R6/lib/X11/$dir || :

[see bug #51188 and bug #50670]

What is with packages which are executing special installation-programs in their
scriptlets (e.g. glibc, see bug #50667).

Comment 3 Jeff Johnson 2001-08-08 18:53:21 UTC
Yes, there will always be execeptions. I'm talking about 
regularizing the 20 or so common actions that constitute
the majority of %post et al scriptlets. The existing mechanism
will remain.

Comment 4 Jeff Johnson 2001-08-30 18:56:49 UTC
I'm gonna use this bug as a collection point
for redesigning netsharedpath functionality.

Comment 5 Jeff Johnson 2001-08-30 19:00:03 UTC
*** Bug 4330 has been marked as a duplicate of this bug. ***

Comment 6 Jeff Johnson 2001-08-30 19:01:03 UTC
*** Bug 3229 has been marked as a duplicate of this bug. ***

Comment 7 Mike A. Harris 2002-11-10 18:11:45 UTC
One of these days....  I'm going to redo all the X rpm scripts from
scratch.  A lot of crap in there probably can go.

Comment 8 Jeff Johnson 2004-12-07 23:59:51 UTC
OK, there's a bug pile on here and no suggestions for better
replacement for %_netsharedpath.

So my intent -- asking for suggestions for better ideas --
is not being served anymore.

AFAIAC, %_netsharedpath is the best known mechanism,
and better solutions are at odds with my "stable rpm"
prime directive.


Comment 9 Enrico Scholz 2004-12-08 00:25:29 UTC
hehe, it's a clever trick to change the initial summary/request of

| Add functionality to test if path is in %_netsharedpath


| RFE: %_netsharedpath mechanism is naive, needs redesign

and wait 3 years till everybody forgets this change. So, it is easier
to say WONTFIX...

But my mailarchive never forgets...

And to clearify things... I never said that %_netsharedpath is naive --
it is doing exactly this, for what it was designed (ok... not
exactly... there are other 3 year old bugs about misclassification of
parent-directories... but this is another issue and when we let pass
other 3 years, we can close this with WONTFIX also).

I just wanted a simple resp. standardized method to test in %scriptlets
whether a path is covered by %_netsharedpath.

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