Wednesday, January 4, 2012

UPDATED: FireFox 9.0.1 Font CSS Bug Strictness

Today I got a nice surprise at work this morning. One of my teammates got the FireFox 9.0.1 (Windows) update pushed to them yesterday and it broke an internal mediawiki site. Thinking this must be a bug in the CSS of our mediawiki skin I dove into explore the issue. This is not my CSS code so I was naturally suspicious and couldn't wait to rub it in to another colleague (author of said CSS) when I found his hideously stupid bug....

Unfortunately I didn't get the opportunity to do a little chiding, because the problem, it turns out, is with the CSS parser in the FireFox 9.0.1 update. The CSS parser in FireFox 9.0.1 doesn't handle the font stack correctly.

Honestly that's being far too generous. This bug breaks font attributes in CSS, okay not all font attributes in CSS just the ones you want to override. It does NOT allow overriding of previous settings at ALL in the font attributes.

UPDATE: There was a helpful soul on the forum that gave me a gentle shove towards the CSS documentation found here and it illuminated the bug in the CSS below. While it worked in previous versions of FireFox, it probably shouldn't have. I've preserved the original example for others to see the issue. I've made the example a little more copy & paste friendly.

Take this BUGGY example:
<style>
#p-wrapper p {
font-family: arial;
font-size: 125%;
}

#p-inner p {
font-size: 95%;
}
</style>

<div class="p-wrapper"><p>Some Wrapper Text</p>
<div class="p-inner"><p>Some inner text</p></div>
</div>

What supposed used to happen with the above snippet is that the font-size would change from 125% when in the p-wrapper class(can you spot the bug yet?), unless you happen to be in the p-inner class(there's that word again) in which case the font-size should change to 95%. In FireFox 9.0.1 this does not happen. Instead the first value for font-size wins. There's no cascading at all. It really makes the CSS engine in FireFox 9.0.1 look more like SS. And that is to be expected. That code has a bug. The # at the beginning of p-wrapper and p-inner define an id selector. What I need is a class selector. FireFox 9.0 became strict in this respect and now you must actually write VALID CSS(what a concept) like the following:

<style>
.p-wrapper p {
font-family: arial;
font-size: 125%;
}

.p-inner p {
font-size: 95%;
}
</style>

<div class="p-wrapper"><p>Some Wrapper Text</p>
<div class="p-inner"><p>Some inner text</p></div>
</div>

There is still a CSS bug in FireFox 9, but it does not appear to be mine. My bug appears to be non-standard and almost flatly invalid CSS. The good thing to come out of this episode is that I now get to harass the colleague for the sloppy code. YAY!!! However, now I have to fix up the CSS in the mediawiki skin.... BOO!!!

If you find any mistakes or errors in this post please drop a note.

Happy Hacking!!

Sunday, January 1, 2012

Haskell Platform in OpenSUSE 12.1

OpenSUSE does not ship with any support for Haskell in it's main package repositories. You can however add them using the OpenSUSE Build Service or OBS.

The best I can tell there is an existing group working on Haskell packaging for OpenSUSE. Search for Haskell on the OBS site and you'll likely run across the repository devel:languages:haskell. The first thing I noticed about this project is that there aren't any builds for OpenSUSE 12.1. After some hunting I ran across the sub-projects and found the 2010.2 haskell-platform available for 12.1. Huzzzah!

A quick little recipe like the following allowed me to add this repository:

$ sudo zypper ar http://download.opensuse.org/repositories/devel:/languages:/haskell:/platform-2010.2/openSUSE_12.1/devel\:languages\:haskell\:platform-2010.2.repo
$ sudo zypper refresh

Make sure you accept the key from the new repository so you can install signed packages and check their signatures correctly.

Now to install the 2010.2 haskell-platform for OpenSUSE 12.1 you just need to install all the packages from the new repository in zypper.

sudo zypper install --from devel_languages_haskell_platform-2010.2 '*'


By using --from in the zypper command line it will only select packages from the specified repository, but will use all configured repositories to do dependency lookup.

After requesting the install via zypper you should get a screen like the following:

The following NEW packages are going to be installed:
alex alex-doc build-compare cabal2spec cabal-install ghc ghc-cgi ghc-cgi-devel ghc-cgi-prof ghc-dataenc
ghc-dataenc-devel ghc-dataenc-prof ghc-deepseq ghc-deepseq-devel ghc-deepseq-prof ghc-doc ghc-fgl
ghc-fgl-devel ghc-fgl-prof ghc-GLUT ghc-GLUT-devel ghc-GLUT-prof ghc-haskell-src ghc-haskell-src-devel
ghc-haskell-src-prof ghc-hscolour ghc-hscolour-devel ghc-hscolour-prof ghc-hslogger ghc-hslogger-devel
ghc-hslogger-prof ghc-html ghc-html-devel ghc-html-prof ghc-HTTP ghc-HTTP-devel ghc-HTTP-prof ghc-libs
ghc-mtl ghc-mtl-devel ghc-mtl-prof ghc-network ghc-network-devel ghc-network-prof ghc-OpenGL
ghc-OpenGL-devel ghc-OpenGL-prof ghc-parallel ghc-parallel-devel ghc-parallel-prof ghc-parsec
ghc-parsec-devel ghc-parsec-prof ghc-prof ghc-QuickCheck ghc-QuickCheck-devel ghc-QuickCheck-prof
ghc-regex-base ghc-regex-base-devel ghc-regex-base-prof ghc-regex-compat ghc-regex-compat-devel
ghc-regex-compat-prof ghc-regex-posix ghc-regex-posix-devel ghc-regex-posix-prof ghc-rpm-macros ghc-stm
ghc-stm-devel ghc-stm-prof ghc-utf8-string ghc-utf8-string-devel ghc-utf8-string-prof ghc-xhtml
ghc-xhtml-devel ghc-xhtml-prof ghc-zlib ghc-zlib-devel ghc-zlib-prof glibc-devel gmp-devel happy happy-doc
hscolour libmp3 linux-glibc-devel zlib-devel

87 new packages to install.
Overall download size: 84.4 MiB. After the operation, additional 858.9 MiB will be used.


Answer yes to the prompt and, depending on your internet speed, you should have a haskell platform to kick around in a few minutes.

Hope this helps someone... The packaging for haskell in OpenSUSE is pretty bad. Debian based distros do it a little bit better by providing a haskell-platform virtual package that has all the componenets a dependencies. Since the packaging in OpenSUSE is done via the OBS and not in the main repositories this isn't likely to get better.

Also as of this writing there are no haskell-platform releases newer than 2010.2 available on the OBS. Due to the quick development of ghc, this can be limiting on the Haskell developer who needs access to features like Data Parallel Haskell or Safe Haskell systems. For users on OpenSUSE that want these features, I encourage you to install the above platform and immediately go build ghc from source code, use the instructions here.

Happy Haskelling!