Debian

Virtually having fun

Submitted by gwolf on Wed, 07/23/2008 - 13:50

Several weeks ago, the people in charge of maintaining the Windows machines in my institute were desperate because of a series of virus outbreaks - Specially, as expected, in the public lab - but the whole network smell virulent. After seeing their desperation, I asked Rolman to help me come up with a solution. He suggested me to try replacing the Windows workstations by substituting local installations by a server having several virtual machines, all regenerated from a clean image every day, and exporting rdesktop sessions. He suggested using Xen for this, as it is the virtualization/paravirtualization solution until now best offered and supported by most Linux distributions (including, of course, RedHat, towards which he is biased, and Debian, towards I am... more than biased, even bent). So far, no hassle, right?
Of course, I could just stay clear of this mess, as everything related to Windows is off my hands... But in October, we will be renewing ~150 antivirus licences. I want to save that money by giving a better solution, even if part of that money gets translated to a big server.
Get the hardware
But problems soon arose. The first issue was hardware. Xen can act in its paravirtualization mode on basically any x86 machine - but it requires a patched guest kernel. That means, I can paravitualize many several different free OSs on just any computer I lay my hands on here, but Windows requires full- or hardware-assisted- virtualization. And, of course, only one of the over 300 computers we have (around 100 of which are recent enough for me to expect to be usable as a proof-of-concept for this) has a CPU with VT extensions - And I'm not going to de-comission my firewall to become a test server! ;-)
When software gets confused for hardware
So, I requested a Intel® Core™2 Quad Q9300 CPU, which I could just drop in any box with a fitting motherboard. But, of course, I'm not the only person requiring computer-related stuff. So, after pestering the people in charge for buying stuff on a daily basis for three weeks, the head of acquisitions came smiling to my office with a little box in his hands.
But no, it was not my Core 2 Quad CPU.
It was a box containing... Microsoft Visio. Yes, they spent their effort looking for the wrong computer-related thingy :-/ And meanwhile, Debconf 8 is getting nearer and nearer. Why does that matter? Because I have a deadline: By October, I want the institute to decide not to buy 150 antivirus licenses! Debconf will take some time off that target from me.
Anyway... The university vacations started on July 5. The first week of vacations I went to sweat my ass off at Monterrey, by Monday 14 I came back to my office, and that same day I finally got the box, together with two 2GB DIMMs.
Experiences with a nice looking potential disaster
Anyway, by Tuesday I got the CPU running, and a regular Debian install in place. A very nice workhorse: 5GB RAM, quad core CPU at 2.5GHz, 6MB cache (which seems to be split in two 3MB banks, each for two cores - but that's pure speculation from me). I installed Lenny (Debian testing), which is very soon going to freeze and by the time this becomes a production server will be very close to being a stable release, and I wanted to take advantage of the newest Xen administration tools. Of course, the installation was for AMD64 - Because 64 bitness is a terrible thing to waste.
But I started playing with Xen - And all kind of disasters stroke. First, although there is a Xen-enabled 2.6.25 Linux kernel, it is -686 only (i.e. no 64 bit support). Ok, install a second system on a second partition. Oh, but this kernel is only domU-able (this is, it will correctly run in a Xen paravirtualized host), but not dom0-able (it cannot act as a root domain). Grmbl.
So, get Etch's 2.6.18 AMD64 Xen-enabled kernel, and hope for the best. After all, up to this point, I was basically aware of many of the facts I mentioned (i.e. up to this point I did reinstall once, but not three times)... And I hoped the kernel team would have good news regarding a forward-port of the Xen dom0 patches to 2.6.25 - because losing dom0 support was IMO a big regression.
But quite on time, this revealing thread came up on the debian-devel mailing list. In short: Xen is a disaster. The Xen developers have done their work quite far away from the kernel developers, and the last decent synchronization that was made was in 2.6.18, over two years ago. Not surprisingly, enterprise-editions of other Linux distributions also ship that kernel version. There are some forward-patches, but current support in Xen is... Lacking, to say the least. From my POV, Xen's future in the Linux kernel looks bleakish.
Now, on the lightweight side...
Xen is also a bit too complicated - Of course, its role is also complicated as well, and it has a great deal of tunability. But I decided to keep a clean Lenny AMD64 install, and give KVM, the Kernel Virtual Machine a go. My first gripe? What a bad choice of name. Not only Google searches for KVM gives completely unrelated answers (to a name that's already well known, even in the same context, even in the same community).
KVM takes a much, much simpler approach to virtualization (both para- and full-): We don't need no stinkin' hypervisors. The kernel can just do that task. And then, kvm becomes just another almost-regular process. How nice!
In fact, KVM borrows so very much from qemu that it even refers to qemu's manpage for everything but two command-line switches.
Qemu is a completely different project, which gets to a very similar place but from the other extreme - Qemu started off as Bochs, a very slow but very useful multi-architecture emulator. Qemu started adding all kinds of optimizations, and it is nearly useful (i.e. I use it in my desktop whenever I need a W2K machine).
Instead of a heavyweight framework... KVM is just a modprobe away - Just ask Linux to modprobe kvm, and kvm -hda /path/to/your/hd/image gets you a working machine.
Anyway - I was immediatly happy with KVM. It took me a week to get a whole "lab" of 15 virtual computers (256MB RAM works surprisingly well for a regular XP install!) configured to start at boot time off a single master image over qcow images.
KVM's shortcomings
Xen has already been a long time in the enterprise, and has a nice suite of administrative tools. While Xen depends on having a configuration file for each host, KVM expects them to be passed at the command line. To get a bird-eye view of the system, xen has a load of utilities - KVM does not. And although RedHat's virt-manager is said to support KVM and qemu virtualization (besides its native Xen, of course), it falls short of what I need (i.e. it relies on a configuration file... which lacks expresivity to specify a snapshot-based HD image).
To my surprise, KVM has attained much of Xen's most amazing capabilities, such as the live migration. And although it's easier to just use fully virtualized devices (i.e. to use an emulation of the RTL8139 network card), as they require no drivers extraneous to the operating system, performance can be greatly enhanced by using the VirtIO devices. KVM is quickly evolving, and I predict it will largely overtake Xen's (and of course, vmware and others) places.
Where I am now
So... Well, those of us that adopt KVM and want to get it into production now will have some work of building the tools to gracefully manage and report it, it seems. I won't be touching much my setup until after Debconf, but so far I've done some work over Freddie Cash's kvmctl script. I'm submitting him some patches to make his script (IMHO) more reliable and automatizable (if you are interested, you can get my current version of the script as well). And... Starting September, I expect to start working on a control interface able to cover my other needs (such as distributing configuration to the terminals-to-be, or centrally managing the configurations).

No, it's not

Submitted by gwolf on Wed, 06/11/2008 - 10:30

Several people have approached me (or I've stumbled upon their sites) asking me about something called Debian 5.0 Beta 2.
It. Is. Not. That.
Please read clearly the announcement for Debian Installer lenny beta 2 - Yes, I understand this reached many people who are not involved in Debian but are enthusiastic users nevertheless. In short: The only thing that reached the beta is the debian-installer program (usually called just d-i), the amazing piece of code that handles a Debian installation in your system. And yes, it is meant for wide testing and work.
But please, do not take this as a preview of the new Debian release - it is not. If you install a system using this version of d-i, you will be tracking the Testing branch of Debian, and your system will be in a continuous state of flux. Yes, we do expect a freeze of Lenny in the next couple of weeks, after what it will be quite close to a Beta release (i.e. almost no new versions, no fresh software, just bug fixes). But hey - A Beta is supposed to be close to release quality. And if you look at the release-critical bugs affecting the Testing branch (green line), you will clearly see we have over 400 bugs to fix before Lenny is allowed to be called stable. And that's only one of the criteria needed to reach Lenny - Glance over at the Debian Release Management page to quickly understand the nature of changes still to come.
Oh, and of course - Even if it is not necessarily up-to-date, I have found the Wiki page created by Peter Eisentraut as an excellent place to start working whenever I have some free time: Lenny Release Goals.
so... If you are not yet working towards making Debian the best distribution ever, and Lenny the best Debian release ever, you now know where we need your help ;-)
(side note: d-i team, maybe the next announcement could use some words pointing out we are not doing a Debian beta program, just a d-i beta release?)

( categories: )

Proud as a father would be

Submitted by gwolf on Mon, 05/19/2008 - 20:54

The recent OpenSSL incident can not be hidden. It was a very important blow to the Debian project's public face and reputation. A major hole slipped under the door in the form of a bugfix - and with all the good intention. This was not a deliberate attack, nor was it the result of a bad or sloppy maintainer - It was a honest, although painful, human mistake.
Several people started laughing at our processes and supposed strengths right away. I do, however, feel this shows how Debian is stronger security-wise than any other system. And it also shows how this saying, with enough eyeballs, all bugs are shallow, not only didn't lose validity, but was reaffirmed. Free Software development was also proved to be better than security through obscurity again.
Why?
Because were it not because of OpenSSL (and in this case in particular, Debian's packaging) being Free and subject to a code audit, this problem would have never been found. I have been asking to some friends who are part of different black-hat groups, and looking for this kind of information on the Web, it seems that -were it not for Luciano's work, we would still be running cryptographically weakened versions of OpenSSL for a long time. After all, 32768 possible keys is still quite a lot for a black-hat group to find as uneven noise, as a lead to showing the undeniable weakness.
It took two years to find the bug, yes. But it was found doing quality assurance work on publicly available source code. It was promptly fixed, mitigating (as far as possible) as much damage as could be caused. Tools for finding and fixing the defective keys were crafted and freed together with the announcement. Yes, there will be some compromises due to this, I'm sure, but an embarassing hole has been dealt with in the best way possible.
Anyway... I am very happy - I was going over Luciano's NM report, and found something I only suspected but was not sure about. I can now state clearly: I have never been so happy to advocate somebody to become a DD.
Luciano wrote a very good blog post (in Spanish) with his viewpoints on the Debian OpenSSL incident. If you happen to understand Spanish and are reading this blog, please drop over Luciano's.
Luciano: Once again, my hat goes off for you :-)

( categories: )

Ruby has a distribution problem

Submitted by gwolf on Tue, 05/06/2008 - 11:30

I usually don't like me too comments... But this is something that really disappoints me of my otherwise-favorite development framework. I must echo Matt Palmer's comment on Luke Kanies' entry:
Ruby. Has. A. Distribution. Problem.
Nice, good read. Sadly, many Rails pushers see distributability as something very minor, something that should not worry Rails developers right now, as there is too much other serious work to be done - Better UTF8, a clearer language, better performance... And besides, any programmer can live well with gems. (yes, that's all taken from a rant I had with a very convinced person)
My gripe is that... Rails is no longer a small, fringe project. Rails is an enterprise-grade development framework, with thousands of deployed production systems. And if they don't start to act responsably, if the Rails developers keep pushing said problems as low-priority, the Rails developers' (that is, their users) culture will become rigid - and will constitute a serious harm to Rails' future.
Distributability and packageability is not only for OS distributors. Not only we Debian zealots care about software being easily packageable. By using Ruby Gems, you dramatically increase entropy and harm your systems' security.
Read Luke's text for more details. It is quite worth the time.

( categories: )

FLISOL 2008 - Monterrey, NL

Submitted by gwolf on Fri, 04/25/2008 - 15:06

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!

What's a blog planet for?

Submitted by gwolf on Mon, 04/21/2008 - 10:52

It seems everybody is ranting in Planet Debian about what our planet should be about, what content should be acceptable, whether technical-only, Debian-only, everything-goes... Even archiving the posts via a mailing-list interface has been mentioned. Besides, following the planet seems to have become mandatory to people linked to Debian, almost as mandatory as following debian-devel-announce.
I won't bother linking to other posts in this topic, as they are far too many. The whole discussion seems childlike and sterile to me. For different people, Debian means different things - This topic has come up in the planet a couple of times in the past (funny, hah, using posts in mutually-unlinked personal blogs as a way to follow a discussion). And a planet should IMHO cover a specific use case: Providing a place for those of us who think of Debian as a social frame, and value knowing -exactly- the type of information each of us publishes in his/her blog: What's up with Debian-related people's lifes.
Of course, a large fraction of this information should be somehow technical or Debian-related. But I do value having a place to learn about my peers' life accomplishments. To know if they are going through a hard time. To understand the personal interests of them. Maybe to learn I'm not the only DD who enjoys running (although I'm far under Dirk's or Christian's league) or cycling in a big city (although I lack MJ's political involvement and dedication). I actually like trying to find some logic in senseless Steve-like messages, there are some funny bits in his stuff. I like knowing I can share what I feel important about my life in a simple way with my peers, without having them drop over to my site. And yes, of course I do enjoy learning about the ongoing technical work of the bunch, even if it is often in fields I would not wander into at all (i.e. Simon's frustration with writing device drivers for Windows, Michal's advances on Gammu).
So... Please stop over-regulation. Leave the planet as it is. If you don't like it, come up with a way to filter and maybe adjust its content based on user profiles. But don't try to censor it.

( categories: )

Dear lazyweb: Large volumes strategy?

Submitted by gwolf on Thu, 04/17/2008 - 07:28

Wouter, you seem to enjoy using huge filesystem volumes. So, dear lazyweb...
I have a 500GB disk for my users' home partitions - they mainly use it to back up their desktop data, but I do expect them to give it more usage. Anyway - I am currently using around 350GB of it, leaving the rest still unpartitioned. I have switched over to ReiserFS, as online resizing it is way faster than online resizing ext3 - it's basically instantaneous.
It seems I do belong to the old sysadmin school, and I value highly the reliability that comes from not having filesystems too large for their own good - After all, recovering from failure in 10GB is way more probable than doing the same in 100 or 1000, isn't it? But then again, it's just impractical to create /home/samba/{1,2,3,4,5,6,7,8,9}/ and randomly split users' directories inside them. Most users won't use more than a couple MB, but some users (legitimately!) back up tens of GB... It's hard for me to anticipate their needs.
Does any of you have scary stories regarding huge volumes? Or any data supporting the idea that I'm just too old fashioned and that half a TB is a good partition size?
Note that I _am_ holding full backups :)
[update]: So I'm undoubtley an old fart? Everybody seems to have partitions larger than me. Ok, I will stop crying...

( categories: )

Nice electoral results

Submitted by gwolf on Sun, 04/13/2008 - 12:17

Of course, this post is about the results for the recent Debian Project Leader elections. Although I've written quite a bit about politics in my country, I cannot sadly hold any hopes for decent electoral (or post-electoral, or political in general) results here in Banana-land. All hail our de-facto president, BTW.
Anyway, on to happier realms. The DPL elections are over. Voter turnout was low, as Manoj pointed out, but it's not as low as I feared. And, /methinks, not only because of the shortened period - but because this was generally an easy-going election, with three quite good candidates. As CMOT pointed out in my previous posting on this topic, many people would have voted 111- (which means, for the casual reader, any of them is quite OK with me). Debian elections are voted with a very interesting system, the Condorcet method. Developers don't vote just for their favorite option, but rank all of the available options (including none of the above, or NOTA) according to their personal preference.
The final numbers are very worth noting - Excuse me for hot-linking the image, but I know many non-Debian people read this:

What is so unique this time? First, as I anticipated on my previous posting, all of the candidates are above NOTA. Not only that, they are all well over NOTA, with the smallest distance being 237 votes (out of a 401 total votes received).
Second, something very positive as well, the distance between the three candidates is quite large this time. In 2006, the distance between first and second place was 6 votes (reason for which, together with the proximity in their platforms of course, Steve was appointed Second in Command or 2IC by AJ). In 2007, Steve was (again) second place, eight votes under Sam. Looking a bit into the history, in 2003, the closest election we have had, Martin beat Bdale by four and Branden by 11 votes... No, the distance is not really that important in the end, as we are quite far from having political quarrels over vote results - But still, having nice, clear numbers feels much better. And as I said in a previous message as well, it somehow speaks of Debian being a more mature, stable project.
Anyway - Congratulations, Steve! Best wishes for a stressful year, quite probably full of travelling, presentations and work in general!

( categories: )

Vote casted!

Submitted by gwolf on Fri, 04/04/2008 - 18:47

Some readers might not now that Debian is in this annual process where we vote for our Leader for the following next year.
I just submitted my vote.
I think it is worth mention that this year there is very little discussion on this subject among DDs. Also, I've practically seen nobody publicly posting their votes or preferences, as it is usual (well, usually we get maybe 10 votes posted to the planet or the different lists).
It must be related to the fact that this year we have neither a candidate or quasi-candidate who raises passions for or against (as the two last years), nor there are very significant differences between the three candidates. They are all quite OK, IMHO, uncontroversial.
This years' elections will probably be the first (at least, since I was accepted in the project) where no candidate is ranked below None of the above. And that, I think, is a good sign. It might be more boring, but shows maturity ;-) And yes, it also shows off good work from our current (and active, and much loved) leader, Sam.
...And yes, I'm not posting my vote either. As things are, the platforms/rebuttals/debate did shape my vote a bit, but the main differentiator ended up being... My personal relationship and opinion towards each of them.

( categories: )

Happy meme, happy meme

Submitted by gwolf on Fri, 03/28/2008 - 17:49

Can I do anything but to smile while posting?


I'm going to DebConf8, edition 2008 of the annual Debian<br />
     developers meeting

( categories: )

Perl6 and sigils

Submitted by gwolf on Tue, 03/25/2008 - 01:51

Zack, Wouter: Yup, Perl 6's scheme changes to reduce confusion to the programmer and to make the language better Huffman coded. Why?
As for the programmer, it comes out of observation - Changing the sigil depending on what you are expecting to get back (i.e. a hash has a '%' sigil, but if you only want one value off it, you use the '$' sigil, as it indicates a scalar variable) confuses more often than it helps - Specially newcomers. Besides, it will be easier for the interpreter itself - The sigil will become an invariant but required part of the variable name itself. Hence, Martin will be happier, as there will no longer be different namespaces under which to store your variables. Oh, BTW, Martin: Not only Perl behaves this way. Ruby also uses that concept - There, you have local variables (no sigil), instance variables ('@'), class variables (ugly '@@') and global variables ('$'). I remember in old (Quick|GW)BASIC you had numeric variables (no sigil) and string variables (postfix sigil '$') as well. Any others?
Now, about the Huffman coding part, WTF?
It is one of the design goals of Perl 6 to make the most often used operators be the shortest, so you, programmer, don't wear out your keyboard and lose your valuable fractions of seconds typing i.e. '->' for a method call when you can just type a '.' - Similarly, currently you have to type too many characters for the (too common) dereferencing - If you have a reference to a hash of arrays of arrays of objects on which you want to call methods, you have to do $something->{key}[0][0]->boo - Whereas with Perl 6 you will only have to do $something{key}[0][0].boo
Anyway, I cannot elaborate much further, as I've been -at best- just a bystander. But yes, large changes loom in Perl's future. Let see what comes on...
And when. Sigh.

( categories: )

Sudo: Windowsifying unix, step by step!

Submitted by gwolf on Thu, 03/20/2008 - 01:13

Like many people interested in bringing computer security awareness to the public at large, some eight years ago I was thrilled to get acquinted with sudo. A great tool for giving specific admin rights to specific users in a very granular way, with great semantics... And allowing for a degree of flexibility much higher than my needs, honestly.
I think it was the Canonical crew who first thougt of using it backwards, "solving" (for some definition of solution, of course) the long-known problem that desktop users cannot be bothered to understand they are using a normal account which is, for their own personal security, completely separated from the priviledged account.
So, in short, Ubuntu uses a passwordless sudo to grant users (at least I understand it is limited to the first system user, am I right?) access to whatever and whatnot... And most users seem to like this.
Yes, the same way they like Windows: Because it is the no-brainer solution. Now, give a person with no brains some choices... Guess which choice they will pick.
Now, it's assumed by most semi-newbie Linux users that sudo basically means "go ahead". I have tried to get this point across to people complaining that Debian ships a b0rken sudo because it is not basically a ALL ALL = NOPASSWD: ALL
So, as it is currently used... I do feel sadness: Unix systems tend to Windowsification, where real administrator privileges are just a matter of asking whether you are sure. Assuming single, local users for local machines.
[update] Oops! lots of comments explaining my world-view is somewhat flawed... Anyway, I'll reply to the comments themselves.

( categories: )

German and APT::Acquire::Translation

Submitted by gwolf on Mon, 03/10/2008 - 13:25

Rhonda,

The webinterface for it doesn't require any authentication at all, leading technically to anonymous translations all over the place. The so-called "review" process consists of the same not-existing authentication, leading to a situation where unknown people can put in whatever they like and have other (or potentially the same) unknown people acknowledge that.
The language team has actively chosen that way because it was said that bad translations simply won't happen and that the review (three people opening the page and clicking onto a button) will not let that happen. Well, it happened. And is happening all over the place.

Hmmm... That sounds quite like a definition of Wiki in my book. Just add a version-control layer underneath, and...
Oh, you didn't? Umh... Tough luck! :-(

( categories: )

cat STDERR | rot13

Submitted by gwolf on Fri, 02/08/2008 - 11:52

Cannot help but laugh and share.
I've been triaging and trying to reproduce some oldish bugs on pkg-perl's packages. Some bugs are no longer there, some have to be forwarded upstream, and so on. Usual tasks, yes.
Until I stumbled with #406227. I just have to laugh and share! Hope nobody feels ashamed - The bug is the result of different people coding maybe under pressure and with quite different mindsets :)
For some reason I fail to understand, the submitter's test case (rot13 implemented over a HTTP proxy) is invoked in the report as ./rot13 2>/dev/null. Of course, when trying to debug a bug report, the first thing to do is not to ignore STDERR. So, off goes the 2>/dev/null. What happens next?

  1. 0 gwolf@mosca[2]/tmp$ perl ./rot13 &
  2. [1] 4394
  3. 0 gwolf@mosca[3]/tmp$ GET -p <a href="http://localhost:8080/" title="http://localhost:8080/">http://localhost:8080/</a> <a href="http://www.debian.org/<br />
  4. Can't" title="http://www.debian.org/<br />
  5. Can't">http://www.debian.org/<br />
  6. Can't</a> locate object method "filter" via package "UGGC::Cebkl::ObqlSvygre::fvzcyr=UNFU(0k604160)" (perhaps you forgot to load "UGGC::Cebkl::ObqlSvygre::fvzcyr=UNFU(0k604160)"?) at /usr/share/perl5/HTTP/Proxy/FilterStack.pm line 126.
  7. 500 EOF when chunk header expected

WTF... Well, at least the program name gives me a clue... Lets try to "decrypt" the error message...

  1. gwolf@mosca[4]/tmp$ echo 'UGGC::Cebkl::ObqlSvygre::fvzcyr=UNFU(0k604160)' | rot13
  2. HTTP::Proxy::BodyFilter::simple=HASH(0x604160)

hrm... How comes the filter is filtering its own code and only then refusing to find itself!? Ok, time to open up the manpage - Remember, I'm only group-maintaining this pacakge, I am not yet at all familiar with it! Ok, so the core of the filter is when the submitter states:

  1. my $proxy = new HTTP::Proxy();
  2. $proxy->push_filter(response => new HTTP::Proxy::BodyFilter::simple(sub { tr/a-zA-z/n-za-mN-ZA-M/; }));

While the manpage states it should be invoked as:

  1. my $filter = HTTP::Proxy::BodyFilter::simple->new( sub { ${ $_[1] } =~ s/foo/bar/g; } );
  2. $proxy->push_filter( response => $filter );

Of course, once looking at it, the answer is simple: The submitter left out which element to act on in the anonymous function body - The ${ $_[1] } =~ part. Adding it makes gur svygre jbex nf rkcrpgrq... Err, sorry - makes the filter work as expected.

Now, bonus points: For the non-Perlers out ther: How come we get the namespace translated as well? Oh, that's very simple: In Perl, as in Python (and concievably other languages I'm unaware of), the object is passed to any of its methods as the first argument. Functions in Perl receive their arguments via @_ (read: the default array). And, of course, the tr (regex-based transliteration) takes by default the first thing it sees - the object itself. And what happens when you apply a (string-oriented) regex to an object? Of course, it gets stringified - which, by default, in Perl means converting it to the closest possible description: "a hash reference blessed as an object of the class such-and-such at this memory location". That string gets worked on, and we get UGGC::Cebkl::ObqlSvygre::fvzcyr=UNFU(0k604160). This proxy does not die on very-very-short web pages, where the whole content fits on one iteration of the code (although it does not work correctly - the text remains unaltered, of course, as it was not worked on), but if the request spans several chunks, the second time the filter is called, it will be... just gibberish.

Oh, and what about the extra ${ (...) } around $_[1]? Oh, simple: The string is passed as a scalar reference, so it can be modified in place. Yes, it's the Perl way of pass-by-reference instead of pass-by-value (the default behaviour): Of course the parameter is only passed as a value. Only that the value is incidentally a reference - but who cares? ;-)

Anyway... Many oddities. I would implement the module in a completely different way, and it looks quite backwardish in my book. But then again, TIMTOWTDI.

( categories: )

Converting incoherent sets of data between charsets

Submitted by gwolf on Mon, 02/04/2008 - 23:33

Dato complains that converting changelogs to be UTF8-clean is not always as simple as running iconv - One of the reasons that took me so long to migrate my blog is that, due to having migrated (at different points in time) my previous CMS (Jaws 0.4->0.5->0.7), its underlying database (MySQL 3.4 -> 4.0 -> 5.0 IIRC), the distribution (Debian Woody -> Sarge -> Etch+backports), several reinstalls and all... Well, I had a completely mixed-up database, with some tables in UTF, some tables in latin1, some tables with mixed rows, some tables that for some strange reason had double-mixed rows (that is, that had UTF8 misrepresented as latin1 and then re-encoded into UTF8)... No, it was not fun to sort out.

( categories: )
Syndicate content