# portupgrade fails with a Ruby exception



## yks (Jun 8, 2010)

I'm trying to upgrade KDE4 (because of new gettext).
First I issued

```
# portupgrade -rR gettext
```
and portupgrade started gathering dependencies but died with an exception "ArgumentError" (listing below), on the first encountered KDE4 port (kdetoys or smth).
I deleted kdetoys, and run the same command again, and it dies with the same exception on the next kde4 port, kdeutils.
I deleted all kde4 ports, and the command eventually worked.
Now I'm trying to do

```
# portupgrade -RN x11/kde4
```
and it dies again likewise.
I mailed the error description and listing to ruby@FreeBSD.org, but I've got no response in 24h and don't have any idea whether this was read and taken into account.
Here is the listing:

```
# portupgrade -RN x11/kde4
--->  Session started at: Tue, 08 Jun 2010 13:52:32 +0400
[Gathering depends for x11/kde4 <dots removed> --->  Session ended at: Tue, 08 Jun 2010 13:52:46 +0400 (consumed 00:00:14)
/usr/local/lib/ruby/1.8/set.rb:263:in `merge': value must be enumerable (ArgumentError)
	from /usr/local/sbin/portupgrade:879:in `get_all_depends'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each_key'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
	from /usr/local/sbin/portupgrade:878:in `get_all_depends'
	from /usr/local/sbin/portupgrade:879:in `get_all_depends'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each_key'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
	from /usr/local/sbin/portupgrade:878:in `get_all_depends'
	from /usr/local/sbin/portupgrade:879:in `get_all_depends'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each_key'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
	from /usr/local/sbin/portupgrade:878:in `get_all_depends'
	from /usr/local/sbin/portupgrade:879:in `get_all_depends'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each_key'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
	from /usr/local/sbin/portupgrade:878:in `get_all_depends'
	from /usr/local/sbin/portupgrade:897:in `get_notinstalled_depends'
	from /usr/local/sbin/portupgrade:777
	from /usr/local/sbin/portupgrade:755:in `each'
	from /usr/local/sbin/portupgrade:755
	from /usr/local/lib/ruby/1.8/optparse.rb:1310:in `call'
	from /usr/local/lib/ruby/1.8/optparse.rb:1310:in `parse_in_order'
	from /usr/local/lib/ruby/1.8/optparse.rb:1306:in `catch'
	from /usr/local/lib/ruby/1.8/optparse.rb:1306:in `parse_in_order'
	from /usr/local/lib/ruby/1.8/optparse.rb:1254:in `catch'
	from /usr/local/lib/ruby/1.8/optparse.rb:1254:in `parse_in_order'
	from /usr/local/lib/ruby/1.8/optparse.rb:1248:in `order!'
	from /usr/local/lib/ruby/1.8/optparse.rb:1241:in `order'
	from /usr/local/sbin/portupgrade:565:in `main'
	from /usr/local/lib/ruby/1.8/optparse.rb:791:in `initialize'
	from /usr/local/sbin/portupgrade:229:in `new'
	from /usr/local/sbin/portupgrade:229:in `main'
	from /usr/local/sbin/portupgrade:2213
#
```


----------



## SirDice (Jun 8, 2010)

> Last edited by yks; Today at 12:06. Reason: what do `tags do, why does text inside them disappear?[/quote]
> [url]http://forums.freebsd.org/misc.php?do=bbcode#cmd[/url]
> 
> As for your problem, try updating the portupgrade tool itself first.`


----------



## yks (Jun 8, 2010)

> As for your problem, try updating the portupgrade tool itself first.


I had done this beforehand, of course.

```
# pkg_glob portupgrade
portupgrade-2.4.6_4,2
```

P.S. Thanks for the `link, would have never guessed myself =) only wonder why does pressing CMD [i]require[/i] a non-empty option (and why is it called 'option'?)`


----------



## zyanho (Jun 8, 2010)

try to update your ports first,like use
`# portsnap fetch`
`# portsnap update`
then portupgrade again.


----------



## DutchDaemon (Jun 8, 2010)

SirDice said:
			
		

> http://forums.freebsd.org/misc.php?do=bbcode#cmd





> .S. Thanks for the `link, would have never guessed myself =) only wonder why does pressing CMD require a non-empty option (and why is it called 'option'?)[/quote]
> 
> Read [url]http://forums.freebsd.org/showthread.php?t=8816[/url]`


----------



## yks (Jun 8, 2010)

zyanho said:
			
		

> try to update your ports first,like use
> `# portsnap fetch`
> `# portsnap update`
> then portupgrade again.


I csup ports and rebuild index by portsdb on each boot. I think it is generally the same.
I am sure that software just *may not* fail with an exception if it is written carefully. If there were something wrong on my behalf, the software must inform me of that, rather than die. An exception in a program _is_ a bug, whatsoever.



			
				DutchDaemon said:
			
		

> Read http://forums.freebsd.org/showthread.php?t=8816


Yeah, if this post were up when I registered on this forum in December, 2008, I would have surely read it...  But anyway, this doesn't answer the question why the type of prompt is called 'option', it is not logical from any point of view. Maybe modify the popup text to "Please enter a prompt for the command"? It would be less confusing.


----------



## zeiz (Jun 8, 2010)

What do you mean "dies"? With exactly those messages you've posted?
If some dependency links become broken *portupgrade* may prompt you to run `# pkgdb -F` manually so it's not much choice but run it and then return to *portupgrade*.
What you say looks weird. Could you give more details how it "dies" and with what errors as its "last will"?

As to `options there are 3 options there: root prompt, user prompt and just hit Space for empty input. Probably not everybody cares to post what prompt should be used so it's kinda reminder.`


----------



## yks (Jun 8, 2010)

zeiz said:
			
		

> What do you mean "dies"? With exactly those messages you've posted?


Yes, the last CODE area in my first post. It is an ArgumentError exception. Terminate with an exception is what I mean by "die".



			
				zeiz said:
			
		

> If some dependency links become broken *portupgrade* may prompt you to run `# pkgdb -F` manually so it's not much choice but run it and then return to *portupgrade*.


I do not have problems with dependencies. And whenever I had them I fixed them by pkgdb. Currently, `# pkgdb -F` does not show any sign of disorder.



			
				zeiz said:
			
		

> What you say looks weird. Could you give more details how it "dies" and with what errors as its "last will"?


I think the exception trace in my first post is enough as to show how it dies, and in any case it doesn't provide any more data, so that's really all.



			
				zeiz said:
			
		

> As to `options there are 3 options there: root prompt, user prompt and just hit Space for empty input. Probably not everybody cares to post what prompt should be used so it's kinda reminder.[/quote]
> I actually don't mind the popup itself, although when I (personally) enter a command, I do with the prompt sign already. But what is confusing is the word 'option'. A prompt type is in no way an 'option', it is the shell you could start with an option of setting a specific prompt type :) but the phrase 'please enter the option for the [CMD] tag' is totally confusing: and what is one supposed to do had he not read the manual? Close the modal dialog, open a new tab, search forum for a description of that magic `option' (not quite quickly found), then go back, and provide the option? Do you agree that if there were the phrase 'Please enter the prompt sign for the command' it would be quite a million times more clear what to enter? I don't think that a tiny bit of usability ever hindered any site. But this discussion is more suitable for a different thread...`


----------



## zeiz (Jun 8, 2010)

Nothing is perfect. In general we can only change ourselves rather than reality.

Well...let's back to business. It's important to know what is your FreeBSD version:
`uname -a`
If that was all (with exception of the dots suppressed) I can so far suggest trying to rebuild pkgdb.db with
`# pkgdb -fu`
and try again. No luck? Then rebuild portupgrade from source with
`# cd /usr/ports/ports-mgmt/portupgrade && make clean deinstall install clean`
Doesn't help? then try *portmaster* if you suspect that portupgrade(ruby) is broken on two.
No joy? Then forget about upgrades and reinstall KDE with just "make install clean".

Personally what I would do myself today is:
1. Clean up my system from KDE totally and reinstall KDE4 from packages with just "pkg_add -r kde4" because the packages now are of the same version as source.


----------



## yks (Jun 10, 2010)

zeiz said:
			
		

> Nothing is perfect. In general we can only change ourselves rather than reality.


Agree. To make things clearer, I personally don't feel frustrated or whatever, I realize well that bugs can creep everywhere (I am a developer myself), I just wanted the developers of portupgrade to be informed.



			
				zeiz said:
			
		

> Well...let's back to business. It's important to know what is your FreeBSD version:
> `uname -a`



Oh, really I missed it:

```
FreeBSD yntel 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #0: Tue Apr 20 00:38:11 MSD 2010     yks@yntel:/home/src/src/sys/amd64/compile/KERNEL_20100420  amd64
```



			
				zeiz said:
			
		

> If that was all (with exception of the dots suppressed) I can so far suggest trying to rebuild pkgdb.db with
> `# pkgdb -fu`
> and try again. No luck?


Alas.



			
				zeiz said:
			
		

> Then rebuild portupgrade from source with
> `# cd /usr/ports/ports-mgmt/portupgrade && make clean deinstall install clean`
> Doesn't help? then try *portmaster* if you suspect that portupgrade(ruby) is broken on two.
> No joy?


Neither.



			
				zeiz said:
			
		

> Then forget about upgrades and reinstall KDE with just "make install clean".


That's the true unix way =) 



			
				zeiz said:
			
		

> Personally what I would do myself today is:
> 1. Clean up my system from KDE totally and reinstall KDE4 from packages with just "pkg_add -r kde4" because the packages now are of the same version as source.


Thanks for the idea, I don't check packages too often.

As I said, the world doesn't fall on me with this portupgrade bug, I just aimed to inform of the bug to make portupgrade better  
Thanks everyone for your help!


----------



## DutchDaemon (Jun 10, 2010)

There are not a lot of developers (ports and otherwise) here. If you want to report a bug, use the the Ports category on the PR website: http://www.freebsd.org/send-pr.html


----------



## kenorb (Nov 30, 2010)

The same problem.


```
> pkg_glob portupgrade
portupgrade-2.4.6_4,2
```


```
> sudo pkgdb -F
--->  Checking the package registry database
tale dependency: gnome2-2.30.2 -> empathy-2.30.2 (net-im/empathy):
gtk-2.22.1_1: "/usr/ports/graphics/gdk-pixbuf2" non-existent -- dependency list incomplete
gconf2-2.32.0_2: "/usr/ports/devel/dconf" non-existent -- dependency list incomplete
libgdata-0.6.5: "/usr/ports/devel/libsoup-gnome" non-existent -- dependency list incomplete
gvfs-1.6.6: "/usr/ports/devel/libsoup-gnome" non-existent -- dependency list incomplete
totem-pl-parser-2.32.1: "/usr/ports/devel/libsoup-gnome" non-existent -- dependency list incomplete
clutter-1.4.0: "/usr/ports/graphics/gdk-pixbuf2" non-existent -- dependency list incomplete
gtkmm-2.22.0: "/usr/ports/accessibility/atkmm" non-existent -- dependency list incomplete
telepathy-glib-0.12.5: "/usr/ports/lang/vala-vapigen" non-existent -- dependency list incomplete
epiphany-2.30.6_1: "/usr/ports/devel/libsoup-gnome" non-existent -- dependency list incomplete
empathy-2.32.2: "/usr/ports/net-im/telepathy-logger" non-existent -- dependency list incomplete
empathy-2.32.2: "/usr/ports/net-im/folks" non-existent -- dependency list incomplete
libchamplain-0.8.0: "/usr/ports/devel/libsoup-gnome" non-existent -- dependency list incomplete
Install stale dependency? ([y]es/[n]o/[a]ll) [yes] [Gathering depends for net-im/empathy ................................................................../usr/local/lib/ruby/1.8/set.rb:263:in `merge': value must be enumerable (ArgumentError)
	from /usr/local/sbin/portinstall:879:in `get_all_depends'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each_key'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
	from /usr/local/sbin/portinstall:878:in `get_all_depends'
	from /usr/local/sbin/portinstall:879:in `get_all_depends'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each_key'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
	from /usr/local/sbin/portinstall:878:in `get_all_depends'
	from /usr/local/sbin/portinstall:879:in `get_all_depends'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each_key'
	from /usr/local/lib/ruby/1.8/set.rb:195:in `each'
	from /usr/local/sbin/portinstall:878:in `get_all_depends'
	from /usr/local/sbin/portinstall:897:in `get_notinstalled_depends'
	from /usr/local/sbin/portinstall:777
	from /usr/local/sbin/portinstall:755:in `each'
	from /usr/local/sbin/portinstall:755
	from /usr/local/lib/ruby/1.8/optparse.rb:1310:in `call'
	from /usr/local/lib/ruby/1.8/optparse.rb:1310:in `parse_in_order'
	from /usr/local/lib/ruby/1.8/optparse.rb:1306:in `catch'
	from /usr/local/lib/ruby/1.8/optparse.rb:1306:in `parse_in_order'
	from /usr/local/lib/ruby/1.8/optparse.rb:1254:in `catch'
	from /usr/local/lib/ruby/1.8/optparse.rb:1254:in `parse_in_order'
	from /usr/local/lib/ruby/1.8/optparse.rb:1248:in `order!'
	from /usr/local/lib/ruby/1.8/optparse.rb:1241:in `order'
	from /usr/local/sbin/portinstall:565:in `main'
	from /usr/local/lib/ruby/1.8/optparse.rb:791:in `initialize'
	from /usr/local/sbin/portinstall:229:in `new'
	from /usr/local/sbin/portinstall:229:in `main'
	from /usr/local/sbin/portinstall:2213
Command failed [exit code 1]: /usr/local/sbin/portinstall net-im/empathy
```

Please FIX, because it's broken.


----------



## kenorb (Nov 30, 2010)

After 2 years problem still exists in FreeBSD and it's not solved.
Other people have this problem as well (even from couple months ago).
See: http://lists.freebsd.org/pipermail/freebsd-ruby/2010-June/000370.html
Please don't close this thread till there will be the proper solution provided.


----------



## kenorb (Nov 30, 2010)

Upgraded to: pkgtools-2.4.8.tar.bz2

```
> cvs log | less
revision 1.260
date: 2010/11/23 20:41:22;  author: stas;  state: Exp;  lines: +1 -1
- Update to 2.4.8:
  - Fix the bug in BEFOREDEINSTALL processing.
  - Add .txz packages support.
----------------------------
revision 1.259
date: 2010/11/08 07:56:14;  author: stas;  state: Exp;  lines: +3 -4
- Update to 2.4.7.
```
Looks like it's fixed in recent version added in the last week.
Thank you.


----------

