Broken %post scriptlets in recent java packages

Enrico Scholz enrico.scholz at informatik.tu-chemnitz.de
Tue Dec 7 15:28:52 UTC 2004


Hello,

recent java-packages (ant*, xerces*, ...) have scriptlets like

| $ rpm -q --scripts servletapi5-javadoc
| postinstall scriptlet (using /bin/sh):
| rm -f /usr/share/javadoc/servletapi5
| rm -f /usr/share/javadoc/jsp-api
| ln -s servletapi5-5.0.18 /usr/share/javadoc/servletapi5
| ln -s jsp-api-5.0.18 /usr/share/javadoc/jsp-api


This is really bad code because it does not make sense in an rpm-world
and causes problems in combination with the %_netsharedpath feature.

E.g. when the /usr/share filesystem is shared between several hosts you
can:

* manage (add, remove, modify) files on this filesystem on exactly one
  host, and
* mount this filesystem (e.g. over NFS) as read-only on the other hosts
  and add it to rpm's %_netsharedpath. E.g.

  | # cat /proc/mounts | grep /usr/share
  | morden:/usr/share /usr/share nfs ro,...
  |
  | # rpm --showrc | grep netsha
  | -14: _netsharedpath     ...:/usr/share:...

  Then, rpm will assume the files under /usr/share as existing and does
  not touch them:

  | $ rpm -qs servletapi5-javadoc
  | net shared    /usr/share/javadoc/jsp-api-5.0.18
  | net shared    /usr/share/javadoc/jsp-api-5.0.18/JAVADOC.PLACEHOLDER
  | net shared    /usr/share/javadoc/servletapi5-5.0.18
  | net shared    /usr/share/javadoc/servletapi5-5.0.18/JAVADOC.PLACEHOLDER




In such a scenario, scriptlets like above will fail horribly

| Preparing...                ########################################### [100%]
|    1:servletapi5-javadoc    ########################################### [ 50%]
| rm: cannot remove `/usr/share/javadoc/servletapi5': Read-only file system
| rm: cannot remove `/usr/share/javadoc/jsp-api': Read-only file system
| ln: creating symbolic link `/usr/share/javadoc/servletapi5/servletapi5-5.0.18' to `servletapi5-5.0.18': Read-only file system
| ln: creating symbolic link `/usr/share/javadoc/jsp-api/jsp-api-5.0.18' to `jsp-api-5.0.18': Read-only file system
| error: %post(servletapi5-javadoc-5.0.18-1jpp_3fc) scriptlet failed, exit status 1


As already said, this does not make sense in an rpm-world. There, the
'jsp-api' symlink should be created in the %install stage and packaged
as an ordinary file. Then, rpm will unpack it correctly (inclusive
honoring the %_netsharedpath) and no %post scriptlet is needed.





Enrico




More information about the fedora-devel-list mailing list