Friday, November 17, 2017

Fixing 'VOC' testing on Windows

Over the Veteran's Day weekend, I was looking at the issue tracker for VOC and noticed several similar issues relating to testing on Windows. So I brought out a Windows (XP) machine, and set to work installing dependencies. Because it was XP, some of the components were not the most up-to-date.
  • Python 3.4.4 is the latest version build for XP.
  • Java 1.8 (u152) works, but warns loudly that it is not really supported on XP.
  • Apache Ant 1.10.1 is the latest, and seems to work fine.
  • Git 2.10.0 is this is the latest available for XP.
After getting these all configured, and the environment variables set up...
  1. The shlex module from ouroboros was failing to build. This was because of UTF-8 characters that were not being accounted for in voc\transpiler.py. I have submitted a PR for this, and it has been merged.
  2. I ran into an issue that appears to be a problem with the flush() in runAsJava. Once I dug down far enough to find the actual error, I found a StackOverflow question that pointed me in the right direction. Popen(['java'], ...) was picking up java.exe from C:\Windows\System32 instead of the one in the %PATH%, so I had to rename the former.
  3. Due to performing this work on an under-powered machine, I had to increase the timeout for calling 'ant java' from tests\utils.py from 30 seconds to a minute.
After this, I finally got to the issue that was being experienced by so many others. For test_str tests, Python was emitting a UnicodeEncodeError because it was trying to use the encoding 'cp437' and some of the characters in the test do not map. The Java version was emitting UTF-8 characters, and while the console doesn't understand that encoding and displays them incorrectly, it does not throw an exception. It is this difference which causes the tests to fail.

While Python 3.6 apparently gets UTF-8 working correctly, a work-around for this issue on earlier versions of Python is done by setting the environment variable PYTHONIOENCODING to 'UTF-8'. I have had a fix ready for several days but have only had a little time here and there to test it. I have submitted a PR and will just see where it goes.

Friday, October 13, 2017

Bitten by cdrkit bug

At work, I recently ran into a problem that I eventually tracked down to a bug in cdrkit.  This glosses over a few steps, but should capture the essentials.

A computer that, among other things, is used for burning DVD's recently made the move from RHEL (Red Hat Enterprise Linux) version 5 to version 7.  We realized shortly there-after that it was failing to burn DVD's successfully.  After some testing, we found that the same problem occurred on another box with the exact same model of DVD drive.

After confirming that the model of DVD drive would still write using RHEL5, I took the cdrecord binary from RHEL5, ran it under RHEL7, and it worked.  Clearly the difference was between cdrecord (from cdrtools, used on RHEL5) and wodim (from cdrkit, which is aliased to cdrecord on RHEL7).

I ran both through strace, and found that for fixating (finalizing) the disc, cdrecord was using a timeout of 1000 seconds, while wodim was using 200 seconds.  On the drive in question, fixating the drive takes about 240 seconds.  So with wodim, the timeout is hit, some diagnostic codes are dumped, and wodim reports that the fixate process failed.

Digging into source code, I found that one of Red Hat's patches for cdrtools was injecting a function (fixate_mdvd) that extends the timeout to 1000 seconds, calls the original cdrecord fixate function (fixate_mmc), and restores the 200-second timeout.

That Red Hat patch became part of the cdrkit fork, but additional changes 1 made in 1.1.6 interfere with it.  In cdrtools, the time-consuming part of the operation is happening inside of scsi_flush_cache, which is called by fixate_mmc.  The change in 1.1.6 makes an additional call to scsi_flush_cache from fixate_mdvd, before it extends the timeout.  This essentially negates the effect of the timeout change for Disk-At-Once sessions.  This 1.1.6 change appears to have been made to solve a Debian bug 2, but I don't see the evidence that it helped anything. Even if it did appear to help, it may have just been hiding the real cause.

I believe the 1.1.6 change to fixate_mdvd should be reverted to fix the present bug.  If the bug in the Debian report is encountered again, more rigor needs to go into determining the root cause.


1 It's hard to find code history for cdrkit, but the change can be seen here: http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/gutsy/cdrkit/gutsy/revision/8/wodim/drv_mmc.c
2 Debian Bug #411362: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=411362

Thursday, October 12, 2017

Book Summary: Do Over by Jon Acuff


While I'm only commuting 4-5 hours in total most weeks, I want to make better use of that time, and I am getting a bit tired of just music on the radio.  Last week, I decided to start with listening to Do Over by Jon Acuff, and because I'm no quitter, I just reached the finish line with it.  As indicated by the title, this is not so much a review, as just a summary to help me remember some key points.


The core of the book is about making investments into your CSA.  That would be your Career Savings Account.  The components of the CSA are skills, relationships, character, and hustle.  Any time you encounter a career transition, voluntary or not, a healthy CSA will be a valuable asset.

That old phrase "it's not what you know, it's who you know" speaks to the importance of relationships to your career.  There is a lot of truth to this.  You may think you can pull yourself up by your own bootstraps, but the world was not designed that way.  We all need each other.


The skills that you know are still important though.  Relationships may help you get your foot in the door, but without skills, you'll still have a hard time getting to the next one.  In addition to the technical skills we may think of, soft skills like showing up reliably, diplomacy, and flexibility are valuable.

Character is who you are.  It will bleed into everything you do and touch everyone you know.  Jon likens it to an orchard, as it takes time and constant tending to develop it.  You won't see the fruit for a while, but it will come.

Hustle will have an amplifying effect on the other investments.  Frequency is key to strong relationships.  Time and effort are essential to sharpen and build new skills.  Constancy is required to grow character.  Hustle is about putting in the time, and time is key.

With a healthy, diversified CSA, you will be ready for any career transition, whether that be breaking through a ceiling, making a jump, recovering from a bump, or taking advantage of an opportunity.