webOS 2.X bug could cripple reinstalled node.js + db8 apps | webOS Nation

webOS 2.X bug could cripple reinstalled node.js + db8 apps

by Derek Kessler Thu, 14 Apr 2011 8:02 pm EDT

One of the touted features of webOS 2.0 was that developers could used node.js services and db8 databases to make for apps that were faster, better, and easier to code. It’s good stuff, and though admittedly over our head, we can appreciate how well it works when an app like Email just flies on our Pre 2.

But it turns out there’s a problem, and it’s not with node.js or db8, but more how webOS 2.0’s app deleting system works. As was discovered by WebOS Internals, an app that uses node.js and db8 won’t delete properly. The app will be gone and all, but the file setting the permissions for that database will stay behind. Since you’ve deleted that app, you might be slightly peeved that there’s a tiny file taking up a trivial amount of space on your phone, but that’s not the issue here. The issue is that when you reinstall that app, the configurator process sees that there’s an already configured permissions file in the cache directory and skips applying any permissions, meaning that the app can’t access the database at all.

That, dear reader, is a problem. This issue becomes worse in that the only way to clear that file out of the cache directory is to erase the device or run the webOS Doctor. In short, there is no way for average Joe user like most of us to correct it, short of going nuclear.

As a number of WebOS Internals apps, like Tweaks and ModeSwitcher, have been built or rebuilt for webOS 2.0 using node.js and db8, they saw this as a problem. The workaround, which was first implemented in Tweaks, isn’t exactly elegant, but it does the job. Tweaks has been updated with a homebrew pre-remove script that forcibly deletes the permissions file from the cache directory when the Tweaks node.js service is removed. But to do this, the pre-remove script has to have already been in place, which means that making it work requires deleting, reinstalling, deleting again, and reinstalling again to make the magic happen (and removing your preferences in the process).

This homebrew script could obviously be implemented into any other homebrew apps that utilized node.js and db8, but App Catalog apps are a different story, as they don’t have access to the same kind of post-install and pre-remove scripts as the homebrew crowd. The best solution is going to have to come from HP in the form of an update to webOS, which will hopefully come soon. In the meantime, we don’t recommend you go deleting any apps you intend to use again sometime soon. It could get messy.

Source: WebOS Internals (Twitter); Thanks to Rod Whitby for the additional info!