Hello, I was looking again at the details of which pre- and post- scripts are called when and with what arguments. I am worrying about this because I am working on a patch for lintian.
On Sun, Aug 26, 2001 at 07:41:28PM -0400, Steve M. Robbins wrote: > I was re-reading the first section of chapter 9 (policy version > 3.5.6.0). The penultimate paragraph > > Any package installing shared libraries in one of the default > library directories of the dynamic linker (which are currently > /usr/lib and /lib) or a directory that is listed in > /etc/ld.so.conf[29] must call ldconfig in its postinst script if > the first argument is configure and should call it in the postrm > script if the first argument is remove. > > is clear. However, the next paragraph goes on to say > > However, postrm and preinst scripts must not call ldconfig in the > ^^^^^^^ > Shouldn't this say *post*inst? It sounds like a continuation of > the previous paragraph, and nowhere else is preinst mentioned. > > case where the package is being upgraded (see Details of unpack > phase of installation or upgrade, Section 6.5 for details), as > ldconfig will see the temporary names that dpkg uses for the files > while it is installing them and will make the shared library links > point to them, just before dpkg continues the installation and > renames the temporary files! > > > In fact, my understanding is that the preinst is run before > unpacking so running "ldconfig" in the preinst should be > safe (albeit useless). >From Policy Section 6.5, I see now that calling "ldconfig" in postrm during an upgrade will catch the system at a time when the new library is stored under a temporary name. So clearly one shouldn't call ldconfig in postrm, except when given the argument "remove". It is also clear that the preinst script for the new package is never called during this phase: the preinst is called in phase 3, while the new files are installed in phase 4. However, in the case of a failed upgrade, the *old* preinst could be called in step 5 before the temporary files vanish. Thus it is true that calling "ldconfig" in preinst is a bad idea. Now it seems to me that the policy is too weak. Rather, one should never call "ldconfig" in preinst under any circumstances. Nor is there any reason that I can discern for calling "ldconfig" in the prerm script. In summary, the correct usage of "ldconfig" is (a) call it in postinst when given the argument "configure", (b) call it in postrm when given the argument "remove", and (c) call it nowhere else. I have a patch to lintian so that it will perform checks along these lines. I plan to submit it in the next day or two. Do let me know if I have missed out cases. Thanks, -Steve -- by Rocket to the Moon, by Airplane to the Rocket, by Taxi to the Airport, by Frontdoor to the Taxi, by throwing back the blanket and laying down the legs ... - They Might Be Giants