On Mon, 21 Apr 2003 19:36:01 +0200, Denis Barbier <[EMAIL PROTECTED]> said:
> I wondered whether this use of ucf is safe. If postinst fails for > any reason, and package is reconfigured, the backup file is > overwritten. An alternative is to abort postinst if -old already > exists, and to remove it when postinst finishes. Isn't this safer? Well, I don't use proftpd, and I have blown away the downloaded package. Lets see. From what I recall, you had a single function where the configuration file was replaced, and that used ucf. Let us handle the trivial cases first a) Initial install. If the postinst is interrupted, and reconfigured, a new file is installed. Since there was no file before, no data is lost. b) There was a package installed, but no changes were made. Well, even if the file is replaced on reconfig, no user data is lost, since there was none to begin with. c) There is a locally modified configuration file. Before installation, the maintainers previous version is stashed away by ucf. i) If the postinst is interrupted before ucf is called, then no harm done, reconfig will create the new file, and the user shall get prompted, since the installed file is non the same as the generated file (since it contains user changes). ii) The postinst is interrupted after ucf is called. The hash stashed by ucf is that of the new file. The user has been prompted, and 1) accepts the new file. On reconfig, this is a no op, since the hashes of the new file and the file stashed away are the same. (If the auto generated file is changed, the user may be asked again). 2) the user chooses to retain his file. well, on reconfig, ucf does a nop, since the hashes of the new file are te same as the one stashed. If the auto generated file changes, the user is asked again. Can you postulate qa scenario where ucf would cause user data to be lost? manoj -- We don't need no education, we don't need no thought control. Pink Floyd Manoj Srivastava <[EMAIL PROTECTED]> <http://www.debian.org/%7Esrivasta/> 1024R/C7261095 print CB D9 F4 12 68 07 E4 05 CC 2D 27 12 1D F5 E8 6E 1024D/BF24424C print 4966 F272 D093 B493 410B 924B 21BA DABB BF24 424C