Search Results: "ag"

25 April 2008

Gunnar Wolf: FLISOL 2008 - Monterrey, NL

I'm about to leave for Monterrey, Nuevo Le n, some 700Km North. Why? Because I was invited to be at the Monterrey FLISOL. And what exactly is a FLISOL? A very nice and interesting idea: Festival Latinoamericano de Instalaci n de Software Libre, Latin American Free Software Install Festival.

So far, I have stayed away from install-fests. I don't like them. And I will keep what I have always said: I am going because I was invited to talk about network security (of course, giving more than a little bit of relevance to Free Software as the IMHO only way to get to a decent level of security). But I do want to be part of this. It is large. Very large. So large, you don't want to miss out.
According to Beatriz Busaniche, FLISOL will be simultaneously held in 210 cities all over Latin America, in Argentina, Bolivia, Brasil, Chile, Colombia, Costa Rica, Cuba, Ecuador, El Salvador, Guatemala, Honduras, Mexico, Nicaragua, Panama, Paraguay, Peru, Uruguay and Venezuela. In short: everywhere.
Spread the word. Spread the love. Spread the fun!

Bernhard R. Link: Some basics about make

Till today I thought make was a very simple concept, but looking at other people's debian/rules files I start to lose that faith. So let's begin with some basics (as I guess many reading this are maintainers for Debian packages, and you might need some of this knowledge): As you will already know, the most important part of a Makefile is a rule. Each rule is there to produce something and has prerequisites, i.e. things that have to be done before. So far so simple. When you think about this way, the first pitfall is already no pitfall anymore:
   build: patch build-indep
   build-indep: build-indep-stamp
   build-indep-stamp:
   	$(MAKE) doc
   	touch build-indep-stamp
   
There are two mistakes in this. First of all, the clean is only called on ./debian/rules build, but not on ./debian/rules build-indep. And then patch is only called by the build target. But what you really want is that the source is patched before you do something, so it is something do be done before build-indep-stamp. The pitfall with this error is that you will not see it most of the time. As make usually processes targets in the order it finds them, it usually runs patch first. Except when you have multiple processors and tell make to make sure of them (and even then there is a chance it might work as the command to run first is fast enough) or if someone trusting on what he learned about make does call ./debian/rules build-indep-stamp build. I guess a reason one sees this so often is the next pitfall. Most likely previous the following was tried:
   build-indep: build-indep-stamp
   build-indep-stamp: patch
   	$(MAKE) doc
   	touch build-indep-stamp
   patch: patch-stamp
   patch-stamp:
   	whatever
   	touch patch-stamp
   
The pitfall with this is some new concept. The problem is that the patch rule is phony. A rule is called phony when it does not produce the target it claims to do. The classical example is a clean target. You do not want that a clean target creates a file clean and the next time it is called says "already everything done". Targets get phony by telling make it is (via .PHONY:) or by just not producing the file it tells to produce or (suprising to many, it seems) by having a phony target as prerequisite. In the above example the patch target gets implicitly phony, as it does not produce a file called patch. Thus after having build the source and calling binary to create packages, this will most likely in some way depend on build-indep-stamp. But when make thus looks at build-indep-stamp to decide if it already there and even though it sees the file produces there with the touch command, it cannot determine if that is up to date. It depends on patch and there is no file called this, thus make must assume it is not up to date, thus build-indep-stamp has become effectively also phony, in the sense of having to be called every time it is depended on. (In case you have not noticed, the fix would have been to make build-indep-stamp depend on patch-stamp instead or to go without patch-stamp and make patch the file to be generated). Thus, you can put as many -stamp files as you want in a row, as long as you have a single phony prerequisite in them, it is all void.

Jan Wagner: security: wordpress 2.5.1 which fixes CVE-2008-1930

Cause the subject, I did build a new package which can be installed on etch, lenny and of course sid. You can fetch it from http://ftp.cyconet.org/debian/archive/bpo/wordpress/2.5.1-1~bpo40+1/ or get via

deb http://ftp.cyconet.org/debian etch-backports main non-free contrib Selfnote: Dump the wordpress user into separate domU

Erich Schubert: Alsa and pluggable devices

Any ALSA experts around that can help me with the following setup?I want to create a virtual device that does the following: - send the audio data to my regular onboard sound devices - when I plug in some USB audio device, send it there as well OR just thereThe difficult part is the plugging part. There is an example in the Wiki how to use two cards as one. This works, but only if the USB audio device was plugged in before starting the audio application and it is not unplugged either.Obviously, switching the configuration files on plug events is another possibility, but again this requires applications to be restarted. :-(What I want to achieve is simple: when I plug in the USB device, I want to switch my music playback there (since it will be connected to my stereo). System events, voice calls etc. however should remain on the system audio.If you have any solution, please send me an email at erich AT debian DOT org.(And yes, I know about PulseAudio, and I use it. But only on top of ALSA)

Julian Andres Klode: Work on ubuimg / debimg for Ubuntu started


The work on the Ubuntu version of debimg has begun. The majority of changes will be the following ones (in the order they will be done):
  1. Change debimg to use germinate to calculate dependencies (package lists)
  2. Add the additional stuff (live, etc.)
Once we can recreate the Ubuntu hardy i386 and amd64 alternate disks, work starts on the live filesystem and on merging these features back into debimg master, which will also get support for more archs. debimg uses germinate directly on the Python level. debimg 0.0.3ubuntu1 is sheduled for this Sunday. This will be more or less really hacks.
  • [master] Move the fetching of packages from packages to media, so we can use it for all files
  • Add libdebimg.germinate as a wrapper around germinate, providing functions to build the disks
  • Modify libdebimg to build all disks in one run, multiple architectures and multiple seeds.
The basic code structure will look like the following:
  1. For each architecture:
    1. seeds = Run germinate
    2. For seed in seeds:
      1. Get the packages
      2. Get extra files
      3. Build the disk
The Debian version may switch to seed files too, in version 0.2.

Kartik Mistry: pyslide story


* Someday back, it was decided that python-xml is no longer updated in Debian and Ubuntu, so it will be removed and this bug #468610 was filed (with many similar bugs). Good enough. I was searching and looking into it with my limited knowledge of Python and so on. Accidentally, I found that this bug has been ‘fixed’ into Ubuntu LP: #199014. Nice. I tried that solution and it wasn’t really working. So, Onkar opened it quickly with confirmation. Thanks to him for quick work. So, I requested for ‘help’ of this bug. Nothing came from submitter. Now, it was closed again (9th April) with saying that python-xml dependency has been re-added. But, this diff is saying different story. It may be slipped in hurry of releasing Hardy! Moral of the story: Ubuntu needs more QA work. PS: Ubuntu users, please report grave bug if pyslide is not working without python-xml. PS II: pyslide is nice little package to create nice presentations :)

Lior Kaplan: Continuing the 2nd Debian Openoffice.org bug triage


Short version: 155 bugs processed, 130 bugs to go… Reminder: The target of this triage is to clean all bugs not relevant for version 2.4.0 in Debian. Openoffice.org 2.4.0 entered Lenny (testing) two weeks ago, and last week Rene created a backport for Etch (stable). This means our users can test 2.4.0 on whatever (recent) Debian version the use. So it seems like a good time to revive the 2nd Debian Openoffice.org bug triage. The previous round ended with ~150 open bugs. After another manual scan of the bugs, the count is 130 open bugs. Seems that some people insist on replying my mails to the BTS alone and not CC me to their answers. Thank god for the “last modified X days ago” line in the BTS… otherwise I counldn’t have caught those so easily. From the remaining 130 bugs, only 10 are marked against versions 2.3.x. Meaning we have much info to collect in this triage (or a lot of bugs to close if we fail to do so).

Lucas Nussbaum: Various stuff

New QA website I modified qa.debian.org’s stylesheet/template, using the PTS’s stylesheet as a basis. It looks a bit better. The content was also updated, so we should stop receiving totally outdated answers to the “What does the QA team do?” question in NM. Now, who is going to do the same thing with www.debian.org? :-) Closing bugs in removed packages When packages are removed from unstable and testing, their bugs are not necessarly marked as closed, so they can’t be archived. A few days ago, there was about 3300 open bugs filed against removed packages. Thanks to the work of Barry deFreese, Marco Rodrigues and Raphael Geissert, we are now down to ~2500 bugs. If you want to help, just drop in #debian-qa and ask about our scripts/process. (There are some tricky details) DEP #1: NMUs With Bas Wijnen, we finally announced the DEP about NMUs we have been working on. Please join the (currently very quiet) discussion!

David Welton: Sometimes I'm reminded just how cool the internet is

I'm just old enough to have only discovered the internet at about the time I graduated from high school, and have been using it for about 15 years. Every once in a while though, it comes back and hits me just how cool the whole thing is. Not "yeah, neat", but a serious wow at just how amazing it is to be able to communicate with people the world over. I think the first time that happened was when I had been exploring some of the early nineties internet - gopher and the web with lynx. Which was neat, but not in the "wow" sense. Then I stumbled on to IRC somehow, and since at the time I'd already started taking Italian courses, I thought I'd see if there was an Italian channel. There was, and I think the conversation went something like this:
me: so, where are you guys? someone: Italy, and you? me: Oregon, but, no, seriously, where are you? someone: Italy! me: Seriously?!
It was a very concrete demonstration of the fact, that, thanks to this new thing, I could talk to people all over the world, for free! Of course I've grown used to this, and take for granted that I can call my parents in Oregon via Skype for free, and a lot of other cool things, but once in a while something makes me take a step back and say "cool!". Most recently, a web site I follow that I follow has had an interesting back and forth between Paul Graham and David Heinemeier Hansson, with additional comments by the likes of Paul Buchheit, which, agree or disagree with their modus operandi, is an impressive cast of characters to be able to interact with, and learn from, without moving from my perch up here in the middle of the Tyrolean Alps.

24 April 2008

Dirk Eddelbuettel: smtm maintenance release 1.6.9.1

A new version of smtm went to Debian yesterday. And after some pondering, I also just uploaded it to CPAN even though it only contains minor Debian packaging fixes rather than genuine code changes. In order to signal that the core Perl code hasn't changed, I simply added a new minor to move the version from 1.6.9 to 1.6.9.1.

Joachim Breitner: Pausable IO actions for better GUI responsiveness

For a university seminar I m currently writing a GUI program to view fractals based on simple iterated function systems (only similaritudes allowed). It supports three different drawing algorithms and you can edit the IFS by dragging squares around on the screen. But this post is not about this program (I might present it later), but how Haskell allowed me to solve a problem very nicely:The first instances of the code had a problem that a lot of GUI programmers know: The drawing of the fractal took quite some time, and during that time the gtk main loop is blocked and the program becomes unresponsive. At first I avoided this problem by manually splitting the drawing function (e.g. by repeatedly increasing the resolution) and kept re-drawing it at higher resolutions in an idle handler, so at least I could interact whenever one resolution has finished drawing. It worked somewhat but it was not easily done for the other, not pixel based, algorithms and it was ugly.So I wanted a way to (a) pause the drawing at any convenient point, to resume it later, and (b) safely abort the drawing if what I m drawing has changed and I need to restart.A common solution to this would be to do the drawing in a separate thread, so (a) is actually not needed, but I did not know if I can safely do (b), and I have heard that threads cause problems with gtk.So I tried to dig deeper for the hidden treasures of advanced haskell programming: I need a monad transformer! I expected the infamous ContT monad transformer to help, but I couldn t figure out how, and I started to create my own monad transformer, called CoroutineT.I tried to figure out what an action of type (CoroutineT IO a) should do, and I came up with this type signature:
pausingAction :: IO (Either (CoroutineT IO a) a)
which means that after the pausingAction is done, it is Either paused (and I get back another pausingAction to run when I want it), or it is done (and I get the result). Note that I m writing IO here, but it can be any monad.The definition of the datatype and the monad instance came mostly from trying to make this type work (yay to haskell s type system, less thinking required), and looks like this:
data CoroutineT m a = CoroutineT  unCoroutineT :: (m (Either (CoroutineT m a) a))  

instance (Monad m) => Monad (CoroutineT m) where
return v = CoroutineT (return (Right v))
a >>= b = CoroutineT $ do
r <- unCoroutineT a
case r of
Left paused -> return $ Left (paused >>= b)
Right unpaused -> unCoroutineT (b unpaused)
This translates to english like this: A call to return is not paused. When an action is already paused, further actions should be run after the paused action is resumed. When an action is not paused, further actions can happen now.Like every well behaving monad transfomer, I also need a "runCoroutineT" function to start the coroutine. I probably could have used unCoroutineT directly, but for my use case (GUI drawing) I did not need a return value, so this function is more handy:
runCoroutineT :: Monad m => CoroutineT m () -> m (Maybe (CoroutineT m ()))
runCoroutineT a = either (Just) (const Nothing) liftM unCoroutineT a
Nothing surprising here, basically just turning the Either into a Maybe. So it becomes clear how to do (b): We can just throw away the resume action returned by runCoroutineT (if any). The more interesting thing is how we do (a): We need a pause action of type (Coroutine m ()). But how should it work? I did not really try to understand why it works, but by looking at the types, I came up with this:
pause :: Monad m => CoroutineT m ()
pause = CoroutineT (return (Left (CoroutineT (return (Right ())))))
Yes, it sounds like some dance step instructions (read the second line out aloud!), but it works somehow.So here is some example code: I have a pausable IO action that counts from one to ten, pausing after each number. I also have function that resumes an pausable action up to n times:
example n = keepGoingFor n $ do
        liftIO $ putStrLn "This is the coroutine"
        forM_ [1..10] $ \i -> do
            liftIO $ putStrLn $ "Counting to "++ show i ++" while you keep calling it"
            pause
  where --keepGoing :: Monad m => CoroutineT m () -> m ()
      keepGoingFor 0 _   = putStrLn "Here I just abort the run"
      keepGoingFor n cor = do
        resume <- runCoroutineT cor
        case resume of
            Just runAgain -> keepGoingFor (n-1) runAgain
            Nothing       -> putStrLn "Finally stopped"
And here is the output of two different runs:
*CouroutineT> example 5
This is the coroutine
Counting to 1 while you keep calling it
Counting to 2 while you keep calling it
Counting to 3 while you keep calling it
Counting to 4 while you keep calling it
Counting to 5 while you keep calling it
Here I just abort the run
*CouroutineT> example 14
This is the coroutine
Counting to 1 while you keep calling it
Counting to 2 while you keep calling it
Counting to 3 while you keep calling it
Counting to 4 while you keep calling it
Counting to 5 while you keep calling it
Counting to 6 while you keep calling it
Counting to 7 while you keep calling it
Counting to 8 while you keep calling it
Counting to 9 while you keep calling it
Counting to 10 while you keep calling it
Finally stopped
So it does really works fine, and it proved very useful in my GUI drawing problem. For that, I created this nice control structure which works like mapM_, but calls pause every n iterations, and therefore hides the pausing stuff almost completely:
pausingForM_ :: Monad m => Int -> [a] -> (a -> CoroutineT m ()) -> CoroutineT m ()
pausingForM_ period list action = pausing' 0 list
where pausing' _ [] = return ()
pausing' n (x:xs) = do action x
if n==period then pause >> pausing' 0 xs
else pausing' (n+1) xs
I have put the complete module (including instances omitted here) in the darcs repository that might later also contain the fractal drawing program.

Gunnar Wolf: Password security, data safety - A government perspective

One week ago, I went to a branch office of Servicio de Administraci n Tributaria, the government office in charge of processing taxes. This year, I plan on doing something quite bold, as my Mexican friends will acknowledge: I will prepare my (quite simple, I hope) tax declaration by myself. I do not want to be held hostage of the accountant guild - So I might end doing some fuckup which in the end costs me money or time. I hope it is not the case.
Anyway... Last week I went to this office, as I needed either a CIECF (Clave de Identificaci n Electr nica Confidencial Fortalecida - Strengthened Confidential Electronic Identification Key) or a FIEL (Firma Electr nica Avanzada - Advanced Electronic Signature). No, please don't believe it is a security token, a card with printed numbers, a one-time-pad or the sort - The CIECF is... A password. Why is it strengthened? Because it has the feature of including a question, in case you forget the key, to allow you to change it. I guess the FIEL is a more reliable device, but I prefer not to even request it.
And as far as the questions go, the emergency questions for CIECF suck. First, I was not even asked the meta-question - I was not told why this information was needed. So imagine the clerk saying: Full name? ... Date of birth? ... RFC (Tax ID)? ... Favorite color? I was there just... Stunned. Why do you need it? Oh, just in case you forget your password. Ok... Don't you have any other questions which I am not prone to answer a different thing, and that are not dead obvious for a casual passer-by? (I guess that at least 1/4 of the public will say blue. Feel like brute-forcing SAT to its knees?) Other questions include your fathers' second family name, your favorite soccer team, your pet's name... It seems they took the first "security dos and don'ts" book off the wall, and started reading backwards.
But anyway, that's the system, and I must play nice with it. So I get back home, and decide to start hacking up my declaration. No, Mr. Policeman, I'm not saying I would try to break into the SAT - I just say it is a complex and non-obvious task to do. Now please release me. Thanks.
And I enter the system. Of course, I tried first with Iceweasel, knowing it would fail (it is documented: MSIE 5.5 recommended). I tried again with Konqueror. I tried, sigh, with MSIE from inside Wine. No luck. Well, even from within qemu's Windows 2000. Wrong password. WTF?! Stranger: It worked with SAT's My portal, although it didn't with the declaration, which is what matters now.
I cannot take the time every day to come to the SAT and move my data - It was a full week until I came back again. I insisted on fully logging in to the system, to be sure the password I entered this time was right. As well as my ber-secret safety question, of course.
And it failed.
Twice.
Until the clerk noticed something strange in the way I typed...
Sir, excuse me..., he muttered, why are you typing such a long password? Well, basically because I value my tax declaration, and I know brute force is a powerful force. (explain it, of course, in simple terms) Oh... No, the password must be eight characters long.
No wonder.
So I entered the first eight characters of my password, which was a true work of prose for their standards, at around 20 characters. And it worked.
Now, for bonus points: What do we gather from the fact that the long password works fine in one system, but in another system it only the short version? Why, but of course! I guess the passwords for every economically active Mexican is stored in their master database in plain text. Isn't it just beautiful?
Anyway, it seems I have a lot of work to do. If all goes as planned, maybe next year I will be for hire as a public accountant? Hmh, does not sound too much like fun, does it?

Amaya Rodrigo: You know you've had enough to drink when...

You know you ve had enough to drink when... you have been using mutt and vim with capslock on for half an hour and have even managed, quite confused though.
Heh.

David Welton: XML handling for Hecl

We received an interesting contribution to Hecl recently: Martin Mainusch put together a Hecl interface to kxml, and also sent in some demo code that fetches and parses weather forecast information. I thought it was pretty cool: Hecl Weather Forecast Note that it's not compiled into the default build, so you have to change a property from 0 to 1 and recompile, and...being new there might be some issues, but still, it's nice to have that to let people play around with simple "web service" type things that use XML. Of course, another strategy might be to have a 'proxy' server that fetches the actual XML, and returns a tagged Hecl list so that Hecl can parse it directly, but that requires a server and has more overhead.

Julian Andres Klode: April Updates


This is a summary of most of my activities since end of march. BTW, I’m still at the T&S step in NM since January (I completed P&P in about 3 days). Also, thank you Tolimar for being the second DD signing my key! GNOME 2.22 (Python) / Updated Packages At the end of march, I updated some GNOME packages. These packages were gnome-python and gnome-python-desktop. The upload of gnome-python-desktop was really important, because the old version depended on libtotem-plparser7, which was not available anymore, and FTBFS because the metacity API changed. This upload made other packages building and running again! That time, I also uploaded new releases of dir2ogg and ndisgtk, which fixed some bugs. On the first of April, I updated aufs to a new upstream snapshot, which fixed linux-modules-extra-2.6’s FTBFS on armel, removed bashism in shell scripts, added a hack for limited splice support, and enabled building on -rt kernel (if the required functions are exported). Packages To-Do In the next week, I will upload a new aufs snapshot with support for kernel 2.6.25 and re-added support for kernels < 2.6.23. I will also update app-install-data to the current state of the archive. Other stuff includes my ITA upload of gimmie and the upload of jockey, a tool to install drivers. Jockey will also be modified to provide the functionality from ndisgtk, which development has been discontinued as it is feature-complete (bug fixes will still be provided). Another package will be, of course, debimg 0.1 once it’s released and of course the python-libisofs bindings. Ubuntu packages I requested syncs for dir2ogg and ndisgtk (after I uploaded sync’able versions to Debian) and for aria2, which was not installable before. I have also reported some bugs and used 8.04 for some time. debimg stuff I released debimg 0.0.3 on 4th April. This is the first release to require Python 2.5 and also the first release which uses the new media module, which provides a generic interface to disk creation. I actually have not worked on debimg since that day, mainly because I did not have enough time. In May, I hope to add support for more architectures (at least theoretically, by providing a generic way of handling bootloaders and other non-packages and non-dists files) and release 0.1. debimg 0.1 will not contain any features related to python-libisofs, because the focus is getting the basic functionality. I have also not uploaded any new netinst build on jak-linux.org, since March. debimg and the Debian Project News Debimg will appear in the second issue of the Debian Project News, I’m currently working on the text for it. (BTW, I have also fixed one link in the first issue of the DPN) debimg and Ubuntu I have suggested to switch Ubuntu’s image building to debimg, and offered to do everything needed to do this. Given the speed of debimg and that the current features almost match the requirements of Ubuntu, this seems to be a great idea. python-libisofs As you may know, I released a first preview of the python-libisofs bindings some days ago, with almost complete support for creating image files. The next steps will be reading and growing images and of course, the bindings for libburn and libisoburn. Switching from Ubuntu 8.04 to Debian unstable I am currently working on migrating my laptop from Ubuntu 8.04 to Debian unstable, in order to be able to work better on my packages. Since most of my packages are sync’able now, this enables more efficient development. Another reason is to help the lenny release. This does not mean that I will be less active on the Ubuntu side, at least not much. Let’s make Debian Lenny and Ubuntu Intrepid the best releases ever.

Enrico Zini: How to not start a service by default

How to not start a service by default Use case: in my laptop, I sometimes need MySQL, PostgreSQL or Apache in order to test some software that I'm developing, but I do not want them on all the time. The solution is: rm /etc/rc*.d/S*mysql* (thanks to Wouter) update-rc.d will not touch your symlinks as long as there is at least one still around for a package. Also, this leaves the stop symlinks around, so that when I start one of these services for development, it will still be properly stopped on shutdown.

Benjamin Mako Hill: Talks at CommunityOne

In the last leg of what has been marathon traveling over the last two months, I'm going to be heading back to San Francisco to give two talks at CommunityOne. CommunityOne is a new one-day conference that Sun is putting on -- along side it's massive JavaOne conference -- that focuses on free software, open source, and non-Sun projects. I'm going to be there talking about free software and free culture. I will be giving updated versions of the two talks that I have at the FSF members meetings over first two years. In the first talk, I'll be making the case for a strong free culture movement and in the second I'll be talking about liberating network services. If you will be at the conference, or just in the Bay area, and would like to meet up, I'll be in the area for most of a week and would love to arrange something. Just get in contact.

Jordi Mallach: Filtering Planet Debian authors

Several people have been discussing what material is appropriate or not for feeds syndicated by Planet Debian. It's basically the same discussion that also pops up every now and then in any big planet like GNOME's, KDE's, Ubuntu's or ours, with some people advocating for Free Software or techie stuff content only, and an apparent majority liking and defending that people write about their latest Debian hack, but also how wonderful their vacation in Paris were, or how their favourite politician did this or that. For some time now, Planet Debian has a small new feature that might have gone unnoticed by many, and could help some readers get rid of undesired content from the post listings. Steve Kemp added a cookie-based per-author filtering system to Planet a few weeks ago. Next to each author name you'll see a link which can be used to collapse all entries by the author. This setting will be saved in a browser cookie, and can be reverted by clicking on the + link next to the collapsed author. To expand all hidden posts, use the Show all link in the Planet's right column above the subscription list. So, if reading about baby Jesus annoys you, just click on and be happy.

Stefano Zacchiroli: unexpected kudos from TBL

Sir Tim Berners-Lee kudos the Debian packaging system I'm currently in Beijing to deliver a talk at the WWW2008 conference, and I just came back from the usual magnificent banquet of big conferences. Before the banquet it was scheduled a keynote talk by Sir Tim Berners-Lee. What is the least thing you expect to hear from Sir Tim mouth in such a talk? I for sure hadn't expected to hear kudos to the Debian packaging system! But in fact I did hear that and apparently I was not the only one (though probably I was the only one who got excited about it, attracting the attention of my table-mates). He was talking about various shortcoming to be addressed in the future of the Web, and one was the hackish way in which Javascript/AJAX applications are deployed on the web, with no encapsulation/packaging of libraries. Well, as an example to tend to he then mentioned the packaging system of our beloved distribution. It is really the time to say: we are just one step away from the total world (wide web) domination.

David Pashley: Violating Perl Module Namespaces

Perl doesn't enforce access to modules' namespaces. This would usually be considered a bad thing, but sometimes it allows us to work around problems in modules without changing their code. Here's a perfect example: I've been writing a script to talk to an XML-RPC endpoint, using Frontier::Client but for one of the requests, the script throws the following error:
wanted a data type, got  ex:i8'
Turning on debugging showed the response type was indeed ex:i8, which isn't one of the types that Frontier::Client supports.
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse xmlns:ex="http://ws.apache.org/xmlrpc/namespaces/extensions">
  <params>
    <param>
      <value>
        <ex:i8>161</ex:i8>
      </value>
    </param>
  </params>
</methodResponse>
Searching through the code shows Frontier::Client is a wrapper around Frontier::RPC2 and the error message happens at the following section:
     elsif ($scalars $tag )  
       $expat-> 'rpc_text'  = "";
       push @  $expat-> 'rpc_state'   , 'cdata';
     else  
       Frontier::RPC2::die($expat, "wanted a data type, got \ $tag'\n");
    
So we can see that it's looking up the tag into a hash called %scalars to see if the type is a scalar type, otherwise throws the error we saw. Looking at the top, we can see this hash:
%scalars = (
    'base64' => 1,
    'boolean' => 1,
    'dateTime.iso8601' => 1,
    'double' => 1,
    'int' => 1,
    'i4' => 1,
    'string' => 1,
);
So, if we could add ex:i8 to this scalar, we could fix the problem. We could fix the module, but that would require every user of the script to patch their copy of the module. The alternative is to inject something into that hash across module boundaries, which we can do by just refering to the hash by it's complete name including the package name. We can use:
$Frontier::RPC2::scalars 'ex:i8'  = 1;
Now when we run the script, everything works. It's not nice and it's dependent on Frontier::RPC2 not changing. but it allows us to get on with our script.
Read Comments (1)

Next.

Previous.