Monday, September 29, 2008

The Trouble with Tribbles; or, Why It Takes So Long to Update Gtk-Gnutella

I want to apologize in advance for what I'm going to be posting on this blog in the future. I love Ubuntu, and I have yet to find a distribution that rivals it in both pure operation and the friendliness of its community. That being said, I think it needs to be clarified that "having a lovefest" should not necessarily be equated to "getting knowledgeable answers on the subject". That being said, I've only been on the scene since 2002 / Shrike, so I suppose I'm a relative newcomer (particularly if we go much beyond "BASH Scripting for Chores"), but I like to at least look into a subject enough to have an answer ready for a question that may never be asked.

That is in stark contrast to this thread. The user enters the forums, basically states that Gnutella cannot be updated to its latest version (0.96.5), and sits back. The first reply is perhaps misguided, but astute (particularly given the ineptitude of the average newbie): check apt-get again. The user does so, and returns back. The next viable solution consists of WAITING FOR THE NEXT RELEASE. I'm sorry, that may be an acceptable solution for people who have no need to update, but the understanding needs to be made that "ancient versions" of Gnutella are essentially blacklisted by 99% of the Internet population as "suspicious activity". It's completely subjective, completely unfair, and a practice that I fell victim to recently.

For the curious, out of more than 200 threads, here is the one post that correctly identifies and solves the problem: read the README. This isn't a difficult concept; after all, any good developer knows that people should enter the restaurant with the big neon sign that says "Joe's" if they want to eat at Joe's, right? Apparently not, and this is a downside to society in general. What's even more remarkable is that almost every single thread lacked even ONE post linking to the solution, even though even the thread in question was formed less than a month after the initial solution.

Bearing this in mind, is it really any wonder that Microsoft is merely concerned about Linux?



UPDATE: Here's a quick solution to the problem, that took me two hours to code - mostly because I forgot the proper orientation of escape sequences (*shudder*). Enjoy.

Of course, there are a few notes:
A. You can name the file whatever you like. The setup depends on an embedded temporary file with a constant filename.
B. The file needs to be given permission to run (chmod +x) in order to function correctly. Since it accesses apt for many of the requirements, it must also be run as sudo (at least until I figure out fakeroot a little better).
C. The "sleep 1m" line waits one minute for the download to complete. This works fine on most high-speed lines, but needs adjustment for sub-optimal (read: Dial-Up) carriers. If there's some better way to prevent execution of the next line until wget finishes its chore, I'm unaware of it.



UPDATE #2 (October 7, 2008): The "sleep 1m" issue has been fixed with a simple Do-While loop that effectively halts further operations until wget completes its task. Of course, being a BASH script, it will still need to be set executable and run as sudo.



UPDATE #3 (October 14, 2008): Here's the fix for some issues introduced the last time I tried to improve this code base. See what I mean about loathing escape sequences?

http://lagreview.pastebin.com/f61ca2198

No comments: