Search Results: "ema"

17 May 2010

Julien Danjou: Entering the Emacs world

In February 2009, my friend dim tried to force me using Emacs. I know a couple of people using it and Gnus for reading their mail, and it always made me curious. At that time, more than a year ago, Emacs 22 and Gnus did not seem usable from my point of view. But around mid February, with the help of dim, I tried again to start using Emacs. Actually, this was not something new for me. I (very basically) used Emacs between 2000 and 2006. In 2006, when I finished the university and started working at Easter-eggs, I met a couple of vim enthusiasts. They taught me how to use it in various ways, and I started to know more about vim than Emacs, so I switched. This time, I started by configuring it, but reading the manual and also learning a bit of Lisp. It took me several weeks, but step by step I learned many, many things. And I must admit, I liked it. I've configured and starting to use some very important mode, like Gnus, Muse, the famous Org mode or even ERC. I'll probably talk about various Emacs related things in the near future, since I already wrote more than a thousand lines of Lisp in the last 2 months. Anyhow, I'd just conclude by asserting that my new Emacs/Gnus/Org/ERC setup beats my old vim/mutt/nothing/irssi to the death with a baseball bat. :-)

Michael Casadevall: Mailing Lists and Newsreaders ....

So for awhile, I've been questioning on why very few FOSS programs use newsgroups (or USENET on moderated groups) as their primary means of communication between developers. I personally find email to be a clunky way dealing with mass-mailings, and while switching to alpine and mutt have helped, I feel newsgroups would work better in place of mailing lists.

In this spirit, I'm going to try to replace reading most of my public facing mailing lists with Gmane and see if my opinion actually holds true; if newsgroups are superior to bog-standard mailing lists, and post back in some time. I'm currently looking at various GUI and console based newsreaders to see which works best to meet my needs.

I also need to blow the dust off the memories and remember how to setup leafnode so I can mimic OfflineIMAP. Any suggestions are welcome.

16 May 2010

Matt Zimmerman: A farewell to Facebook

Actually, on second thought, this isn t a farewell. There is no goodwill on either side of this bitter parting. Facebook doesn t care about my privacy or consent, and I don t care about their shady and anti-competitive profiteering. It s over between us. So, here s what I did:
  1. made a list of all of my connections on Facebook (via copy and paste from a browser window)
  2. confirmed that I have alternate contact information for all of them, either by email or other social media
  3. deleted all of my photo albums
  4. deleted all of the information from all sections of my profile
  5. removed all applications
  6. deleted everything under My Links
  7. deleted all of my notes (this was tedious, as my blog was syndicated there)
  8. followed the WikiHow instructions to delete my account
Obviously, I can t really control whether they hold onto my data in spite of this. This should provide a clear statement of intent on my part, though, if it comes up in future shenanigans.

Russell Coker: systemd a Replacement for init etc

The systemd projecct is an interesting concept for replacing init and related code [1]. There have been a few attempts to replace the old init system, upstart is getting some market share in Linux distributions and Solaris has made some interesting changes too. But systemd is more radical and offers more benefits. While it s nice to be able to start multiple daemons at the same time with dependencies and doing so offers improvements to the boot times on some systems that really doesn t lead to optimal boot times or necessarily correct behavior. Systemd is designed around a similar concept to the wait option in inetd where the service manager (formerly inetd and now the init that comes with systemd) binds to the TCP, UDP, and Unix sockets and then starts daemons when needed. It apparently can start the daemons as needed which means you don t have a daemon running for months without serving a single request. It also implements some functionality similar to automount which means you can start a daemon before a filesystem that it might need has been fscked. This means that a large part of the boot process could be performed in reverse. The current process is to run fsck on all filesystems, mount them, run back-end server processes such as database servers and then run servers that need back-end services (EG a web server using a database server). The systemd way would be for process 1 to listen on port 80 and it could then start the web server when a connection is established to port 80, start the database server when a connection is made to the Unix domain socket, and then mount the filesystem when the database server tries to access it s files. Now it wouldn t be a good idea to start all services on demand. Fsck can take hours on some filesystems and is never quick at the best of times. Starting a major daemon such as a database server can also take some time. So a daemon that is known to be necessary for normal functionality and which takes some time to start could be started before a request comes in. As fsck is not only slow but usually has little scope for parallelisation (EG there s no point running two instances of fsck when you only have one hard disk), so hints as to which filesystem to be checked first would need to be used. Systemd will require more SE Linux integration than any current init system. There is ongoing debate about whether init should load the SE Linux policy, Debian has init loading the policy while Fedora and Ubuntu have the initramfs do it. Systemd will have to assign the correct SE Linux context to Unix domain socket files and listening sockets for all the daemons that support it (which means that the policy will have to be changed to allow all domains to talk to init). It will also have to manage dbus communication in an appropriate way which includes SE Linux access controls on messages. These features mean that the amount of SE Linux specific code in systemd will dwarf that in sysvinit or Upstart which among other things means that it really wouldn t make sense to have an initramfs load the policy. They have a qemu image prepared to demonstrate what systemd can do. I was disappointed that they prepared the image with SE Linux disabled. All I had to do to get it working correctly was to run the command chcon -t init_exec_t /usr/local/sbin/systemd and then configure GRUB to not use selinux=0 on the kernel command line. Another idea is to have systemd start up background processes for GUI systems such as KDE and GNOME. Faster startup for KDE and GNOME is a good thing, but I really hope that no-one wants to have process 1 manage this! Having one copy of systemd run as root with PID 1 to start daemons and another copy of the same executable run as non-root with a PID other than 1 to start user background processes is the current design which makes a lot of sense. But I expect that some misguided person will try to save some memory by combining two significantly different uses for process management.

14 May 2010

Petter Reinholdtsen: Parallellized boot is now the default in Debian/unstable

Since this evening, parallel booting is the default in Debian/unstable for machines using dependency based boot sequencing. Apparently the testing of concurrent booting has been wider than expected, if I am to believe the input on debian-devel@, and I concluded a few days ago to move forward with the feature this weekend, to give us some time to detect any remaining problems before Squeeze is frozen. If serious problems are detected, it is simple to change the default back to sequential boot. The upload of the new sysvinit package also activate a new upstream version. More information about dependency based boot sequencing is available from the Debian wiki. It is currently possible to disable parallel booting when one run into problems caused by it, by adding this line to /etc/default/rcS:
CONCURRENCY=none
If you report any problems with dependencies in init.d scripts to the BTS, please usertag the report to get it to show up at the list of usertagged bugs related to this.

Lucas Nussbaum: Receive Ubuntu bugs by mail with the Debian PTS

It is now possible to subscribe to Ubuntu bugmail for the packages you care about, without having to use Launchpad (and subscribe on a per-package basis there). This is implemented as a new opt-in Package Tracking System keyword: derivatives-bugs. To subscribe for all your packages, use keyword [email] + derivatives-bugs (as documented in the Developers Reference). You might also want to subscribe to derivatives (Ubuntu diff, etc. also opt-in). Of course, if other derivative distributions are interested in providing such data, don t hesitate to contact me or the Debian QA team. Also, if you are like me and never remember about subscribing to packages you maintain, you can use that UDD script to check for missing subscriptions.

13 May 2010

Aigars Mahinovs: Hacker Neo caught in Latvia

A scandal has been brewing in Latvia over the last half year and yesterday the activity spiked shocking the media and some IT people in the country. I ll go back and explain what happened first, what is happening now and why this could have a heavy impact on IT and journalists in Latvia. At the end of last year, there were rumours that the IT system of Latvia s Internal Revenue System was hacked and millions of documents had been downloaded by multiple organizations. Shortly thereafter more details on the glaring security hole became public (after it was closed). There is a full electronic interface to give all reports to the IRS electronically (at http://eds.vid.gov.lv) and as part of that system you could also view and export monthly report summaries about your organization into XML and PDF files. After the system checked that you are authorized to access the report, you were redirected to the URL to actually download the report by report ID (as a single param in a GET request). Unfortunately, report IDs were predicable and the script that gave the reports for download did not check if you were authorized to get that report. It did not even check if were logged into the system. There were suspicions that the authorization was disabled on purpose to allow to leak data on purpose, but apparently it was an error of forgetting to disable debug code in production environment. The error was discovered only because the firewall administrator noticed an unexplained stable increase of traffic, especially during night hours when typically the traffic fully stopped. Apparently a single hacker (who later identified himself as Neo to the press) discovered the flaw and wrote a script to just try all possible report ids and get as much data out as possible. This had been going on for months, before someone noticed. After the flaw was discovered and a bit of time passed, Neo made his first move he published the list of top salaries in a governmental company, that clearly showed that the top leadership of this company failed to cut their salary by 40%, like everyone elses during harsh budget cuts of 2009. He stripped the names and ids of the specific employees, but named the company which made it pretty easy to figure out who was who. The society was outraged that the top managers in a government owned company failed to comply with the strict pay cut that everyone else in government had to endure. But after a few weeks the outrage subsided and no action followed from the government or law enforcement. Neo continued to release documents detailing salaries of top managers in different Latvian government companies. And each time after short outrage, nothing happened. Neo gave an interview where he said that he was disappointed in the passivity of the Latvian people in face of such blatant injustices. After a few month Neo went silent, promising to return before parliamentary elections this fall. However, this week a new development shocked everyone in the middle of the night two police SWAT teams went into action: one detained Ilm rs Poik ns, a researcher in artificial intelligence at the University of Latvia s Computer Science department and another raided the home of a Latvian TV journalist Ilze Nagle who interviewed Neo. Poik ns confessed of being Neo the next day and was released (with travel restrictions, pending trial) today. Politicians reacted immediately opposition demanded the resignation of the Interior Minister over such blatant disregard of freedom of press and another politician (who is also a famous lawyer) Aleksejs Loskutovs volunteered to defend Neo pro-bono (on Twitter, no less). Almost all Latvian online media have the arrest of Neo and the raid on the home of a journalist as main stories of the day. As a legal titbit, we also know that Neo is being charged with breaking statutes 145 and and 244p2 of the criminal law. Statute 145 is hard to find applicable in this situation as talks about actions done by people authorized (..) to access [private] information . Statute 244p2 will also be hard to pin down as it mentions influencing system resources of (an IT system) and if such action caused severe harm . It looks like the first part talks about at least a DoS attack (which did not happen in this case) and also there was no measurable harm from these leaks. Also Neo was careful to strip all personally identifying information (such as names, social security numbers and addresses of the employees in question), so it will be hard to pin him on that. Also no actual breaking or other modification of an IT system occurred. And no specialized software was used beyond a trivial script such as :
for i in range(0,7000000):
    wget('https://eds.vid.gov.lv/getRep.aspx?id='+str(i))
A lot of commentators on the Internet likened the situation to walking trough an unlocked door and stealing something. I think that analogy is very incorrect there was no door, and nothing went missing after the action. I came up with a different analogy there was this corridor with a lot of doors in IRS, locked steel doors. You were instructed to go to a room with a specified number and given a key to that room to unlock it and see your secret info. However, that corridor opened out to the street on one end, oh and also the walls of the rooms with all the secrets were transparent. So Neo walked into the corridor, looked at some of the secrets, wrote them down (to remember them better) and then went out and discussed the worst examples abuses of power he saw. In the end IRS had to learn their lesson if you have to put naked photos of yourself on the Internet (or something equally embarrassing), then make damn sure you password protect that, but if you don t then don t cry that someone hacked you and stole you pictures. What other people think:
http://freespeechlatvia.blogspot.com/2010/05/neo-released-under-restrictions.html We ll see how the story develops soon.

Petter Reinholdtsen: systemd, an interesting alternative to upstart

The last few days a new boot system called systemd has been introduced to the free software world. I have not yet had time to play around with it, but it seem to be a very interesting alternative to upstart, and might prove to be a good alternative for Debian when we are able to switch to an event based boot system. Tollef is in the process of getting systemd into Debian, and I look forward to seeing how well it work. I like the fact that systemd handles init.d scripts with dependency information natively, allowing them to run in parallel where upstart at the moment do not. Unfortunately do systemd have the same problem as upstart regarding platform support. It only work on recent Linux kernels, and also need some new kernel features enabled to function properly. This means kFreeBSD and Hurd ports of Debian will need a port or a different boot system. Not sure how that will be handled if systemd proves to be the way forward. In the mean time, based on the input on debian-devel@ regarding parallel booting in Debian, I have decided to enable full parallel booting as the default in Debian as soon as possible (probably this weekend or early next week), to see if there are any remaining serious bugs in the init.d dependencies. A new version of the sysvinit package implementing this change is already in experimental. If all go well, Squeeze will be released with parallel booting enabled by default.

Bdale Garbee: Debian and LWN

Since October of 2002, HP has sponsored a "corporate subscription" to LWN on behalf of Debian, and I recently renewed the subscription through April of 2011. As of this moment, 571 Debian Developers and Debian Maintainers are enabled to take advantage of this subscription. From discussion on IRC this morning, I gather one recent change hasn't been adequately communicated: I now allow Debian Maintainers to access the subscription. The process remains unchanged: If you are a Debian Developer or Debian Maintainer and want full LWN access at HP's expense, just go to lwn.net and create an account for yourself (no money is required to create a user account). Then, send email to
lwn-subscription@debian.org
containing your LWN account name. Sign this email with your key on the appropriate Debian keyring. Then, exercise patience. Eventually, I will process your request, and add you to the "Debian Project group" and send you an email acknowledgement. Likewise, if you retire from being a DD or DM, please let me know at the same address so that I can take you off the Debian subscription. I believe I've caught up on all pending requests, but sometimes things get mis-filed, so if you're still waiting and I haven't replied, please re-send your request.

11 May 2010

Biella Coleman: The end of a (V)era

The end of (V)era I did not think this day would come anytime soon. When the time came when the time came for my mom to pass on I thought I would be not only be accepting and ready but would welcome it with open arms. After a decade with Alzheimers, after two years bound in bed, and after months of barely able to sculpt even a word, I thought I was ready to see my mom breathe her last breath. But when the end came, the surprise, shock, and sadness were unmistakably there and I was silently urging my mother to keep fighting to breathe. In the end, it was her lungs that took her from this life as most everything else was still running smoothly and strong. She smoked like a chimney, so when she got pneumonia in late April, her diminished lung capacity made it hard for her to breathe, to get the oxygen needed to be present. But I expected a full recovery as she had reacted almost immediately and positively to the antibiotic treatment. She was still physically strong as a horse, for example, during this hospital stay, three of us had to hold her down when we did various tests. But one day to the next her blood pressure plummeted. Since I was unaware of this, I thought she was just (and finally) sleeping deeply after two days of barely doing so. After 8 hours of barely moving, the nurse let me know that in fact her vital signs were dim as were her chances of living. That evening, I crawled into bed with her for one last night together. Finally the next morning, as I was stroking her face, I witnessed her final breath. This is what I read at her service.

Biella Coleman: The end of a (V)era

The end of (V)era I did not think this day would come anytime soon. When the time came when the time came for my mom to pass on I thought I would be not only be accepting and ready but would welcome it with open arms. After a decade with Alzheimers, after two years bound in bed, and after months of barely able to sculpt even a word, I thought I was ready to see my mom breathe her last breath. But when the end came, the surprise, shock, and sadness were unmistakably there and I was silently urging my mother to keep fighting to breathe. In the end, it was her lungs that took her from this life as most everything else was still running smoothly and strong. She smoked like a chimney, so when she got pneumonia in late April, her diminished lung capacity made it hard for her to breathe, to get the oxygen needed to be present. But I expected a full recovery as she had reacted almost immediately and positively to the antibiotic treatment. She was still physically strong as a horse, for example, during this hospital stay, three of us had to hold her down when we did various tests. But one day to the next her blood pressure plummeted. Since I was unaware of this, I thought she was just (and finally) sleeping deeply after two days of barely doing so. After 8 hours of barely moving, the nurse let me know that in fact her vital signs were dim as were her chances of living. That evening, I crawled into bed with her for one last night together. Finally the next morning, as I was stroking her face, I witnessed her final breath. This is what I read at her service.

Torsten Werner: Ubuntu Developer Summit

That is my second day at the UDS in Brussels. I have attended some sessions about server and cloud yesterday. The Ubuntu people are better organized than the Debian people during Debconf. They are collaboratively preparing the sessions in Launchpad and make notes with the Gobby editor during the session. Gobby allows group editing via Internet. The release date helps to keep the focus on stuff that can be done within the time frame and helps to concentrate on getting results.

It will probably be only 5 months for Maverick because Mark asked for a release on 10.10.10 which is an interesting date after removing the dots and converting it to a decimal number. I am comparing it to Debian: Toy Story 3 will be shown in cinemas soon and the Squeeze character is promoting the film. Will we use such a coincidence for more public attention and will will we release our Squeeze soon? I am afraid that it won't happen.

Our last session yesterday was about Tomcat packaging improvements. Debian and Ubuntu are using and maintaining identical packages of tomcat6 using the alioth infrastructure of the pkg-java team. Some of our plans are:

Biella Coleman: Means and Ends Must Match (and it is already limited btw)

Would you hit it? (by which I mean would you go to this conference?). The title is Limiting Knowledge in a Democracy and check out the list of speakers. Wait a minute, are there just 2 Women listed out of 27 (7.4%)? The conference boldly states and asks:
There is no question that the free access to knowledge and information are the bedrock of all democratic societies, yet no democratic society can function without limits on what can be known, what ought to be kept confidential and what must remain secret. The tension among these competing ends is ever present and continuously raises questions about the legitimacy of limits. What limits are necessary to safe guard and protect a democratic polity? What limits undermine it?
An answer (in the form of action) is simple. Form must meet function, means must match ends or else these questions strike me as terribly hollow. Start at the start and then ask some questions.

Biella Coleman: Means and Ends Must Match (and it is already limited btw)

Would you hit it? (by which I mean would you go to this conference?). The title is Limiting Knowledge in a Democracy and check out the list of speakers. Wait a minute, are there just 2 Women listed out of 27 (7.4%)? The conference boldly states and asks:
There is no question that the free access to knowledge and information are the bedrock of all democratic societies, yet no democratic society can function without limits on what can be known, what ought to be kept confidential and what must remain secret. The tension among these competing ends is ever present and continuously raises questions about the legitimacy of limits. What limits are necessary to safe guard and protect a democratic polity? What limits undermine it?
An answer (in the form of action) is simple. Form must meet function, means must match ends or else these questions strike me as terribly hollow. Start at the start and then ask some questions.

10 May 2010

Romain Beauxis: Ubuntu, the firm and its employees

This post is not meant to be offensive in any way. I would just like to write down things that came to my mind recently. It all started when I was considering applying for the right to upload the package I maintain into Ubuntu. Looking at the procedure, I realized that this needs to be present during an IRC meeting at a given date online. This stopped me immediately. I am working most of my day-time and, given the time zone I am living now, this was not an option. But, since I had registered to the corresponding mailing list, I started receiving mails of other applicants that where trying to arrange things with their work and private life to be able to participate. Now, today, I stumbled upon these notes of Mark's presentation in Bruxelles, relayed by a friend that is not either working for Ubuntu. Reading it gave me a strong taste of management-oriented presentation, with all this sort of "yeah we want our product in every box next year" propaganda. Not like Steve Ballmer, fortunately, but not far perhaps. So, yeah, there is something that makes me uncomfortable with Ubuntu. I am really happy by its success and I will continue to recommend it to friends around me. However, I wonder if, in a way, Ubuntu is not a model of commercial company where a minimal core of developers are actually payed, while a second layer of developers are fan-boys that are willing to participate as if there were employees but without being actually payed, and a third layer being the open-source developers whose work is actually what makes 90% of the core of the OS. A very good illustration is at the end of the note from Mark's presentation. It reads:
Somebody asks about advertising Ubuntu, looks like there are no plans for the moment to actually advertise Ubuntu across traditional media. Mark uses the Ubuntu Manual as an example of how Ubuntu gets advertised and will reach the mainstream, Mark points out myself and the room applauds the Ubuntu Manual Project! Woohoo!
Now, guess what:
About Us We are a group of individuals trying to promote the use of Ubuntu and its variants. This is a private web site that is not connected in any official or financial way with Ubuntu, Canonical PL or Ubuntu.com. Official Ubuntu guides and downloads are freely available at www.ubuntu.com. Ubuntu is a registered trademark of Canonical PL
Source: http://ubuntumanual.org/about-us

Stefano Zacchiroli: tickler file for maildir

snooze your INBOX A few days ago Chris made me realize that my GTD setup was still missing a piece: a proper tickler file implementation. As I wanted an IMAP-free implementation, I've rolled up my own: rotate-tickler. Nothing too fancy: shell script triggered by cron, which moves mails around a set of DELAYED. 1,.. maildir-s. Still, it is careful about clashes (which shouldn't happen according to the maildir specs, but better be paranoid with mails), and properly cleans up the "seen" flag for the final (re)delivery in INBOX. Give it a try and feel free to git format-patch-me your improvements. (BTW, does it make any sense today to publish any piece of software, no matter how small, without shelving it into some DVCS?)

9 May 2010

Gregor Herrmann: RC bugs 2010/17, 2010/18

the usual short overview about my RC bug activities: luckily the count of RC bugs is going down; but some more people tackling the remaining ones would be great!

Robert Collins: Maintainable pyunit test suites

There s a test code maintenance issue I ve been grappling with, and watching others grapple with for a while now. I ve blogged about some infrastructural things related to it before, but now I think its time to talk about the problem itself. The problem shows up as soon as you start writing setUp functions, or custom assertThing functions. And the problem is where do you put this code?
If you have a single TestCase, its easy. But as soon as you have two test classes it becomes more difficult. If you choose either class, the other class cannot use your setUp or assertion code. If you create a base class for your tests and put the code there you end up with a huge base class, and every test paying the total overhead of your test needs, rather than just the overhead needed to test the particular system you want to test. Or with a large and growing list of assertions most of which are irrelevant for most tests.
The reason the choices have to be made is because test code is just code; and all the normal issues there separation of concerns, composition often being better than inheritance, do-one-thing-well all apply to our test code. These issues are exacerbated by pyunit (that is the Python unittest module included with the standard library and extended by various projects)
Lets look some (some) of the concerns involved in a test environment: Test execution, fixture management, outcome decision making. I m using slightly abstract terms here because I don t want to bind the discussion down to an existing implementation. However the down side is that I need to define these terms a little.
Test execution by this I mean the basic machinery of running a single test: the test framework calling into user code and receiving back an outcome with details. E.g. in pyunit your test_method() code is called, success is determined by it returning successfully, and other outcomes by raising specific exceptions. Other languages without exceptions might do this returning an outcome object, or passing some object into the user code to be called by the test.
Fixture management the non trivial code that prepares a situation where you can make assertions. On the small side, creating a few object instances and glueing them together, on the large end, loading data into a database (and creating the database instance at the same time). Isolation issues such as masking out environment variables and creating temp directories are included in this category in my opinion.
Outcome decision making possibly the most obtuse label I ve ever given this, I m referring the process of deciding *what* outcome you wish to have happen. This takes different forms depending on your testing framework. For instance, in Python s doctest:
>>> x
45
provides a specification the test framework calls str(x) and then compares that to the string 45 . In pyunit assertions are typically used:
self.assertEqual(45, x)
Will call 45 == x and if the result is not True, raise an exception indicating a Failure has occured. Unexpected exceptions cause Errors, and in the most recent pyunit, and some extensions, other exceptions can signal that a test should not be run, or should have failed.
So, those are the three concerns that we have when testing; where should each be expressed (in pyunit)? Pragmatically the test execution code is the hardest to separate out: Its partly outside of user control , in that the contract is with the test framework. So lets start by saying that this core facility, which we should very rarely need to change, should be in TestCase.
That leaves fixture management and outcome decision making. Lets tackle decision making if you consider the earlier doctest and assertion examples, I think its fairly clear that there are multiple discrete components at play. Two in particular I d like to highlight are: matching and signalling. In the doctest example the matching is done by string matching the reference object(s) are stringified and compared to an example the test writer provides. In the pyunit example the matching is done by the __eq__ protocol. The signalling in the doctest example is done inside the test framework (so we don t see any evidence of it at all). In the pyunit example the signalling is done by the assertion method calling self.fail(), that being the defined contract for causing a failure. Now for a more complex example: testing a float. In doctest:
>>> %0.3f % x
0.123
In pyunit:
self.assertAlmostEqual(0.123, x, places=3)
This very simple check that a floating point number is effectively 0.123 exposes two problems immediately. The first, in doctest, is that literal string comparisons are extremely limited. A regex or other language would be much more powerful (and there are some extensions to doctest; the point remains though the operator is not enough). The second problem is in pyunit. It is that the contract of assertEqual and assertAlmostEqual are different: you cannot substitute one in where the other was expected without partial function application something that while powerful is not the most obvious thing to reach for, or to read in code. The JUnit folk came up with a nice way to address this: they decoupled /matching/ and /deciding/ with a new assertion called assertThat and a language for matching expressed as classes. The initial matcher library, hamcrest, is pretty ugly in Python; I don t use it because it tries too hard to be english like rather than being honest about being code. (Aside, what would is_() in a python library mean to you? Unless you ve read the hamcrest code, or are not a Python programmer, you ll probably get it wrong. However the concept is totally sound. So, outcome decision making should be done by using a matching language totally seperate from testing, and a small bit of glue for your test framework. In testtools that glue is assertThat , and the matching language is a narrow Matcher contract (in testtools.matchers) which I m going to describe here, in case you cannot or don t want to use the testtools one.
class Matcher:
    def __str__(self):
        "Describe this matcher."""
    def match(self, something):
        """Determine if something is matched.
        :param something: Something to match.
        :return: None if something matched, or a Mismatch object otherwise.
        """
class Mismatch:
    def describe(self):
        """Describe a mismatch that has occured."""
This permits composition and inheritance within your matching code in a pretty clean way. Using == only permits this if you can simultaneously define an __eq__ for your objects that matches with arbitrarily sensitivity (e.g. you might not want to be examining the process_id value for a process a test ran, but do want to check other fields).
Now for fixture management. This one is pretty simple really: stop using setUp (and other similar on-TestCase methods). If you use them, you will end up with a hierarchy like this:
BaseTestCase1
 +TestCase1
 +TestCase2
 +BaseTestCase2
   +TestCase3
   +TestCase4
   +BaseTestCase3
     +TestCase5
     ...
That is, you ll have a tree of base classes, and hanging off them actual test cases. Instead, write on your base TestCase a single glue method e.g.
def useFixture(self, fixture):
      fixture.setUp()
      self.addCleanup(fixture.tearDown)
      return fixture
And then rather than having a setUp function which performs complex operations, define a fixture an object with a setUp and a tearDown method. Use this in tests that need that code::
def test_foo(self):
      server = self.useFixture(NewServerWithUsers())
      self.assertThat(server, HasUser('fred'))
Note that there are some things around that offer this sort of convention already: thats all it is convention. Pick one, and run with it. But please don t use setUp; it was a conflated idea in the first place and is a concrete problem. Something like testresources or testscenarios may fit your needs if it does, great! However they are not the last word they aren t convenient enough to replace just calling a simple helper like I ve presented here.
To conclude, the short story is:
  • use assertThat and have a seperate hierarchy of composable matchers
  • use or create a fixture/resouce framework rather than setUp/tearDown
  • any old TestCase that has the outcomes you want should do at this point (but I love testtools).

Craig Small: JFFNMS 0.8.5 released

After my usual battle with PHP and database exports, jffnms 0.8.5 is now released. This program is a network management system written in PHP. The worst part about the whole maintaining process for it would have to be is the release.

Why is it so difficult to track changes within a database and PHP code? You don't get that nice compile-time versus run-time error problems and the database is just diabolical to keep up to date with what you have changed. Someone needs to invent a git for database states!

Looking around other PHP based programs, I don't think anyone else has solved this issue. Well, its out there, enjoy it or not and if you have comments about the program let me know.
<script defer="defer" src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script>

6 May 2010

Petter Reinholdtsen: Parallellizing the boot in Debian Squeeze - ready for wider testing

These days, the init.d script dependencies in Squeeze are quite complete, so complete that it is actually possible to run all the init.d scripts in parallell based on these dependencies. If you want to test your Squeeze system, make sure dependency based boot sequencing is enabled, and add this line to /etc/default/rcS:
CONCURRENCY=makefile
That is it. It will cause sysv-rc to use the startpar tool to run scripts in parallel using the dependency information stored in /etc/init.d/.depend.boot, /etc/init.d/.depend.start and /etc/init.d/.depend.stop to order the scripts. Startpar is configured to try to start the kdm and gdm scripts as early as possible, and will start the facilities required by kdm or gdm as early as possible to make this happen. Give it a try, and see if you like the result. If some services fail to start properly, it is most likely because they have incomplete init.d script dependencies in their startup script (or some of their dependent scripts have incomplete dependencies). Report bugs and get the package maintainers to fix it. :) Running scripts in parallel could be the default in Debian when we manage to get the init.d script dependencies complete and correct. I expect we will get there in Squeeze+1, if we get manage to test and fix the remaining issues. If you report any problems with dependencies in init.d scripts to the BTS, please usertag the report to get it to show up at the list of usertagged bugs related to this.

Next.

Previous.