Bug 733531

Summary: nfs-utils scriptlets contains paths from rpm srcdir (/builddir/build/SOURCES)
Product: [Fedora] Fedora Reporter: Mattias Ellert <mattias.ellert>
Component: nfs-utilsAssignee: Steve Dickson <steved>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 16CC: bfields, jlayton, steved
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: nfs-utils-1.2.4-8.fc16 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-09-09 13:12:28 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:

Description Mattias Ellert 2011-08-25 18:26:56 EDT
Description of problem:

preuninstall scriptlet (using /bin/sh):
if [ $1 -eq 0 ]; then
	# Package removal, not upgrade
	for service in /builddir/build/SOURCES/nfs-lock.service /builddir/build/SOURCES/nfs-secure.service /builddir/build/SOURCES/nfs-secure-server.service /builddir/build/SOURCES/nfs-server.service /builddir/build/SOURCES/nfs-idmap.service /builddir/build/SOURCES/var-lib-nfs-rpc_pipefs.mount /builddir/build/SOURCES/proc-fs-nfsd.mount ; do
    	/bin/systemctl disable $service >/dev/null 2>&1 || :
    	/bin/systemctl stop $service >/dev/null 2>&1 || :
	done
    /usr/sbin/userdel rpcuser 2>/dev/null || :
    /usr/sbin/groupdel rpcuser 2>/dev/null || :
    /usr/sbin/userdel nfsnobody 2>/dev/null || :
    /usr/sbin/groupdel nfsnobody 2>/dev/null || :
    rm -rf /var/lib/nfs/statd
    rm -rf /var/lib/nfs/v4recovery
fi
postuninstall scriptlet (using /bin/sh):
if [ $1 -ge 1 ]; then
	# Package upgrade, not uninstall
	for service in /builddir/build/SOURCES/nfs-lock.service /builddir/build/SOURCES/nfs-secure.service /builddir/build/SOURCES/nfs-secure-server.service /builddir/build/SOURCES/nfs-server.service /builddir/build/SOURCES/nfs-idmap.service /builddir/build/SOURCES/var-lib-nfs-rpc_pipefs.mount /builddir/build/SOURCES/proc-fs-nfsd.mount ; do
		echo "try-restart $service service"
    	/bin/systemctl try-restart $service >/dev/null 2>&1 || :
	done
fi
/bin/systemctl --system daemon-reload >/dev/null 2>&1 || :


Version-Release number of selected component (if applicable):
nfs-utils-1.2.4-7.fc16.x86_64

How reproducible:
Always
Comment 1 Steve Dickson 2011-08-26 10:35:22 EDT
Here is how those source files are defined in the spec file.

Source11: nfs-lock.service
Source12: nfs-secure.service
Source13: nfs-secure-server.service
Source14: nfs-server.service
Source15: nfs-idmap.service
Source16: var-lib-nfs-rpc_pipefs.mount
Source17: proc-fs-nfsd.mount

Source50: nfs-lock.preconfig
Source51: nfs-server.preconfig
Source52: nfs-server.postconfig

How should they be defined??
Comment 2 Mattias Ellert 2011-08-27 22:27:30 EDT
(In reply to comment #1)
> Here is how those source files are defined in the spec file.
> 
> Source11: nfs-lock.service
> Source12: nfs-secure.service
> Source13: nfs-secure-server.service
> Source14: nfs-server.service
> Source15: nfs-idmap.service
> Source16: var-lib-nfs-rpc_pipefs.mount
> Source17: proc-fs-nfsd.mount
> 
> Source50: nfs-lock.preconfig
> Source51: nfs-server.preconfig
> Source52: nfs-server.postconfig
> 
> How should they be defined??

This is all fine, but...

In the specfile your scriptlets say:

for service in %{nfs_services} ; do

and nfs_services is defined as:

%define nfs_services %{SOURCE11} %{SOURCE12} %{SOURCE13} %{SOURCE14} ...

The SOURCEX macros expands to the absolute path of the source file in the rpm src directoty, i.e. normally ~/rpmbuild/SOURCES/... for a local build and /builddir/build/SOURCES/... for a koji build.

This is what you want for the %install section

for service in %{nfs_services} ; do
         install -m 644 $service $RPM_BUILD_ROOT/lib/systemd/system
done

But in the scriptlets using the full path of the file in the source directory is not the right thing. Here something like

for service in %(sed 's!\S*/!!g' <<< '%{nfs_services}') ; do

would be better.
Comment 3 Steve Dickson 2011-08-30 09:46:27 EDT
Ok... I see the problem... 

Question, How do I get that verbosity that shows the paths as
have in Comment 0?
Comment 4 Mattias Ellert 2011-08-30 10:33:57 EDT
(In reply to comment #3)
> Ok... I see the problem... 
> 
> Question, How do I get that verbosity that shows the paths as
> have in Comment 0?

For the scripts used by the RPM package:

rpm -q --scripts -p nfs-utils-1.2.4-7.fc16.x86_64.rpm

For the scripts used by the installed package

rpm -q --scripts nfs-utils
Comment 5 Fedora Update System 2011-08-30 17:23:24 EDT
nfs-utils-1.2.4-8.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/nfs-utils-1.2.4-8.fc16
Comment 6 Fedora Update System 2011-08-31 17:44:57 EDT
Package nfs-utils-1.2.4-8.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing nfs-utils-1.2.4-8.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/nfs-utils-1.2.4-8.fc16
then log in and leave karma (feedback).
Comment 7 Fedora Update System 2011-09-09 13:12:11 EDT
nfs-utils-1.2.4-8.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.