Mantis - pkg_get
Viewing Issue Advanced Details
3701 upgrade minor always 2009-05-31 17:12 2009-06-09 10:00
skayser  
bonivart  
normal  
closed  
fixed  
none    
none  
0003701: Upgrading pkgutil with -y fails and leaves system without pkgutil
Just tried to upgrade pkgutil to 1.6 with -y (don't bother me ;). Unfortunately, /var/opt/csw/pkgutil/admin is deleted when removing the old version, so the pkgadd of 1.6 fails. Maybe find some way to keep the admin file around?

# pkgutil -v
1.5
# pkgutil -yu pkgutil
Parsing catalog, may take a while...
Updated packages: CSWpkgutil-1.6,REV=2009.05.29
Total size: 108.5 KB
Fetching CSWpkgutil-1.6,REV=2009.05.29...
--2009-05-31 16:13:48-- http://csw.informatik.uni-erlangen.de/csw/current/i386/5.10/pkgutil-1.6,REV=2009.05.29-SunOS5.8-i386-CSW.pkg.gz [^]
Resolving csw.informatik.uni-erlangen.de... 131.188.30.102
Connecting to csw.informatik.uni-erlangen.de|131.188.30.102|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 111094 (108K) [application/octet-stream]
Saving to: `/var/opt/csw/pkgutil/packages/pkgutil-1.6,REV=2009.05.29-SunOS5.8-i386-CSW.pkg.gz'

100%[=======================================>] 111,094 178K/s in 0.6s

2009-05-31 16:13:49 (178 KB/s) - `/var/opt/csw/pkgutil/packages/pkgutil-1.6,REV=2009.05.29-SunOS5.8-i386-CSW.pkg.gz' saved [111094/111094]

Removing old version of CSWpkgutil

Removal of <CSWpkgutil> was successful.
Installing CSWpkgutil-1.6,REV=2009.05.29
pkgadd: ERROR: unable to open admin file </var/opt/csw/pkgutil/admin>: No such file or directory
Issue History
2009-05-31 17:12 skayser New Issue
2009-06-01 09:51 bonivart Note Added: 0006233
2009-06-01 09:51 bonivart Status new => assigned
2009-06-01 09:51 bonivart Assigned To => bonivart
2009-06-01 11:59 skayser Note Added: 0006234
2009-06-01 16:50 bonivart Note Added: 0006239
2009-06-05 10:00 dam Note Added: 0006271
2009-06-05 10:29 bonivart Note Added: 0006272
2009-06-05 11:15 dam Note Added: 0006273
2009-06-05 11:24 bonivart Note Added: 0006274
2009-06-05 15:13 bonivart Note Added: 0006275
2009-06-09 10:00 bonivart Note Added: 0006288
2009-06-09 10:00 bonivart Status assigned => closed
2009-06-09 10:00 bonivart Resolution open => fixed

Notes
(0006233)
bonivart   
2009-06-01 09:51   
Thanks for reporting that, I usually don't use -y myself because I want to see everything looking for bugs but of course there was one related to -y! :-)

I'll see what I will do about this, I'm thinking two things, either keep the admin file around somehow (not really nice if you permanently remove the package) or simply checking for its existence before using it, the latter would in practice temporarily disable -y until the admin file is back again.
(0006234)
skayser   
2009-06-01 11:59   
Your second option seems like a good option. Straight-forward and fully sufficient in the seldom case of a pkgutil upgrade (with its admin file removal).
(0006239)
bonivart   
2009-06-01 16:50   
I went with the second option, it seemed the simplest. I will release 1.6.1 shortly, hopefully not that many will use -y to upgrade to it... :-)

http://pkgutil.svn.sourceforge.net/viewvc/pkgutil/trunk/pkgutil?revision=55 [^]
(0006271)
dam   
2009-06-05 10:00   
This is not good. If you upgrade a machine which receives updates only once every few month you have almost always an update of pkgutil and also many many packages. Just not using a removed admin file renders -y useless in these scenarios. It would be better to copy the admin file somewhere on pkgutil start, use it during pkgutil runtime, and remove it after that. That way removing admin from the package wouldn't interfere with package installation.

Additionally, there should be a special case which always updated pkgutil first and restarts it, so in case of an error the error is fixable. Currently using -y leaves a machine completely broken as packages are downloaded, removed, but not installed as the admin file was missing. So lots of packages are removed and not installed again.
(0006272)
bonivart   
2009-06-05 10:29   
At least for interactive it's no worse than having to confirm for pkgutil, right? If you're running from cron or something it would halt.

I kept it on my todo-list but I wanted a quick fix for those like Sebastian who ended up without pkgutil.
(0006273)
dam   
2009-06-05 11:15   
It is worse. Because it deinstalls all upgradeable packages and instead of installing the packages it throws errors. So you end up without all packages to be upgraded and without trace which packages got deinstalled.
(0006274)
bonivart   
2009-06-05 11:24   
No, read the code. :-) It actually removes/installs the packages one by one so all packages up to pkgutil will be upgraded.

But I agree with you that it's not how I want things to be, your idea with copying the admin file at start sounds interesting...
(0006275)
bonivart   
2009-06-05 15:13   
Please try r59 if you have a chance, it copies the admin file like you suggested Dago.

http://pkgutil.svn.sourceforge.net/viewvc/pkgutil/trunk/pkgutil?revision=59 [^]
(0006288)
bonivart   
2009-06-09 10:00   
v1.6.1 released.