A Problem with Magit

Two or three weeks ago I noticed a problem with Magit. When I executed magit-status, I no longer got a list of the untracked files. That meant that I couldn’t add new files to a repository with Magit. The thing was if I switched to Eshell and called git directly, everything worked correctly. “Well, no problem,” I thought, “the latest commit must have broken something. They’ll get it fixed soon.” In the mean time, I just added the new files by calling git directly. But despite almost daily updates to Magit, the problem didn’t go away, so I asked DuckDuckGo what it knew about the problem. Answer: nothing. Nobody else was having the problem so it must be something local. I hadn’t changed anything in my init.el or messed with the Emacs or git configurations in any way so I decided to jump into the code to figure out where I was failing.

Initially I thought I would run the debugger but it was pretty clear from the code that the problem had to be in magit-insert-untracked-files, which in turn meant that magit-git-lines was failing. The magit-git-lines function just calls git with the specified parameters (via process-file) so it looked like git was failing but it worked fine when I called it with the same parameters that magit-insert-untracked-files was using.

There are two points to this post. Here’s the first: Because Emacs is a Lisp machine-like environment, I could make the same call to process-file that magit-git-lines was making by typing 【Meta+:】 and entering the call in the minibuffer. That call failed as expected but I was able to play with the parameters to git to see where the problem lay. The actual call that was failing was

git --no-pager status --porcelain -u

and by eliminating the parameters one by one I discovered that it was the --porcelain parameter that was causing the problem. That parameter asks git to output the results in a machine-parsable format that is guaranteed to be backward compatible. Just what you need for an application like Magit.

It became pretty clear what the problem was. There must be an old version of git that didn’t implement the --porcelain option on my machine. I checked that by changing the parameter to the git call to --version and discovered it was calling version 1.6.5.7. When I called

git --version

from Eshell, I got 1.8.3.4.

So here’s what happened. These days git is either included in the OS or gets loaded with Xcode but that didn’t use to happen so I built my own version and installed it in ~/bin, a directory where I keep my executables. Because I add ~/bin to (the head of) exec-path, Emacs was finding the old version. Eshell doesn’t use exec-path so it was finding the newer version. That brings me to the second point: I’m telling you all this in case you experience the same problem. Just get rid of the old git executables and you’ll be fine.

It’s worth reiterating the first point. The wonderful Emacs Lisp environment makes it easy to debug problems like this. You can just try executing code until you find where it’s failing. No recompiling, no reloading, just try it and see what happens. Think what it would be like solving this problem if it were a C program.

Posted in General | Tagged | 5 Comments

Obama and the NSA

Over at The New Yorker, Ryan Lizza has a fascinating article on the history of the NSA’s latest extra-legal surveillance on Americans. These programs all started under the Bush administration as a reaction to 9-11 and, significantly, over the strenuous objections of senators Barack Obama and Joe Biden. Since assuming the presidency, Obama has been steadfast in his support of the NSA and its spying on Americans.

The article is lengthy but well worth your time. You’ll learn, among other things, how the FISA court nearly shut down some of the programs because of the NSA’s violation of the court’s restrictions and their deceptions to the court. The hero in this story is Senator Ron Wyden of Oregon who has fought this nonsense for years despite being legally forbidden to discuss the reasons for his concern.

Wyden is currently battling with his friend and fellow senator, Dianne Feinstein over how (or, indeed, whether) to rein in the NSA. Both have offered bills to “fix the problem” but Feinstein’s bill is generally considered ineffective and lets the NSA continue their spying. At this point, neither bill has the requisite 60 supporters to force a vote. In the meantime, Americans and non-Americans will have to get used to life under the microscope. The NSA has been clear in its desire to expand their programs.

Posted in General | Tagged | Leave a comment

Uncommon Lisp Functions

Over at WordPress on cneufeld.ca, Christopher Neufeld is writing a nice series on the less familiar Common Lisp functions. The idea is to give Lisp beginners an idea of how to leverage the power of some of the less commonly used functions. It’s meant particularly for those with a C++ background. All the posts so far are here.

As I write this, he has posts on

  • acons
  • add-method
  • adjoin
  • adjust-array
  • allocate-instance, and
  • block

These are interesting posts and unless you’re an expert Lisper you’re sure to learn some things you didn’t know.

While you’re there, you might want to check out his other posts on Lisp.

Posted in Programming | Tagged , | Leave a comment

Your Government at Work

Here in the U.S. we have something called the Federal Register. It’s the official journal of the U.S. Government in which are published public notices and other routine publications of the various government agencies. It’s published daily except for holidays and is also available on-line.

None of that would be of much interest to Irreal except for this fact: The agencies that publish in the Federal Register submit their material on floppy disks. It wouldn’t surprise me if some Irreal readers have never used a floppy disk. Certainly, I haven’t seen a new computer with a floppy drive in years.

It gets worse. The agencies must submit the material on paper with original signatures. They can also submit it on floppies and CDs that are delivered each day by courier to the Register’s Office. It’s bad enough that the government is using sneaker net to get information from the agencies to the Federal Register but they can’t even use flash drives or SD cards—it’s not permitted.

The final chapter of this unhappy story is that the agencies can use secure email but many do not because, they say, Public Key Infrastructure software is expensive and they have not yet upgraded to it. I’m pretty sure that every Irreal reader could implement such a system for a dollar ninety five or less. This whole thing with healthcare.gov is beginning to make sense.

Posted in General | Leave a comment

A Simple EmacsGolf Challenge

We haven’t had an EmacsGolf challenge for a while so here’s something simple that was suggested by Xah Lee based on a Stack Overflow question. The Stack Overflow questioner wanted a solution in Vim so the whole thing fits right in with our never ending quest to solve problems more efficiently in Emacs. The best answer at Stack Overflow using Vim was 53 keystrokes. Let’s see if we can beat that.

The starting buffer is 10 lines each beginning with a time in minutes:seconds as shown.

05:16 more line 1 text
06:32 more line 2 text
13:50 more line 3 text
27:36 more line 4 text
33:07 more line 5 text
33:12 more line 6 text
41:03 more line 7 text
48:22 more line 8 text
51:05 more line 9 text
57:58 more line 10 text

We want to change the time into seconds

316 more line 1 text
392 more line 2 text
830 more line 3 text
1656 more line 4 text
1987 more line 5 text
1992 more line 6 text
2463 more line 7 text
2902 more line 8 text
3065 more line 9 text
3478 more line 10 text

There are a couple of ways of doing this. One uses query-replace-regexp and works with stock Emacs. The other uses Magnar Sveen’s terrific multiple cursors in a way similar to his last example in the multiple cursors video. Using multiple cursors takes me 22 keystrokes. Can you do better?

Posted in General | Tagged , | 6 Comments

Mickey on Magit

As many of you know, I’m a long time user of Magit and really like it. I’m not, however, a power user and haven’t bothered to learn all the details. It’s hard to find documentation that describes how you go about actually using it in your day-to-day work.

Mickey to the rescue. Mickey always does a good job, of course, but Part 1 of his Magit tutorial is especially good. He approaches the topic from the point of view of integrating it into your work flow. That’s just what was missing from the current documentation.

In Part 1 he covers the basics: the status window, staging/unstaging files, committing, and history. If you’ve been thinking of trying out Magit but were put off by the difficulty of learning to use it, you will want to rush over to Mastering Emacs and read this excellent post. While you’re there, take a moment to look around the site. Mickey has lots of really good articles on using Emacs. I’ve learned a lot from his articles and I’m sure you will too.

Posted in General | Tagged , | 2 Comments

The Importance of Mathematical Literacy

The other day, I saw this amusing posting on Headlines from a Mathematically Literate World. I chuckled and moved on but then I read an article saying that American students had slipped to 26th place in world-wide mathematics test results and thought maybe those headlines were more generally applicable than I thought.

Still later the same day I saw an O’Reilly Factor1 clip in which he was in high dudgeon over the fact that arrests for marijuana DUIs in Washington state, which recently legalized pot for personal use, had increased 50%. This was a perfect example of the point the Mathematical Headlines post was trying to make.

What, exactly, does “increased 50%” really mean? Did it go from 2 arrests to 3 or did it go from 10,000 to 15,000 or something else? A 50 per cent increase sounds really bad but there’s no way of knowing from the statement alone whether it really is or not. This is where mathematical literacy comes in. Mathematically literate people would ask themselves what that 50% increase really meant and whether or not it should have public policy implications. The mathematically illiterate simply get stampeded in whatever direction someone using such a phrase desires.

I have no doubt, given Irreal’s subject matter, that most people reading this are in fact mathematically literate but consider the implications of having a large percentage of the population that is not. Among other things, we end up with bad laws and suboptimal public policy.

Footnotes:

1

Bill O’Reilly is a conservative American commentator who, among other things, opposes the legalization of pot on public health grounds. The O’Reilly Factor is his nightly Fox show.

Posted in General | Leave a comment

Stacking the Deck

Just when I thought the surveillance establishment couldn’t get more Orwellian or that I couldn’t get more cynical, I came across this story. Here in the U.S. we have the infamous no-fly list. It’s right out of Kafka: no one knows how they got on the list or even if they are on the list. They just know that the airlines say they can’t fly. Once you get on the list, you can’t get off. Everything about the list and how it operates is secret.

Finally, one of the list’s targets has struck back and managed to get her case into court. Because the target is not an American citizen the State Department has kept her from testifying by refusing to give her a visa. Her daughter, who is an American citizen was also scheduled to testify. Unfortunately, she was visiting her mother in Kuala Lumpur and when she tried to board a plane home she discovered that the Department of Homeland Security (DHS) had placed her on the no-fly list as well.

When the judge queried the government’s lawyers about this they denied that it had happened and said the daughter was lying. It turned out, though, that it was the government that was lying. Malaysia Airlines, against DHS protocol, supplied the daughter with the DHS orders putting the lie to the government’s denials.

The link above is to a short Boing Boing story but you should follow the link to Edward Hasbrouck’s day-by-day reporting on the trial. The government’s position can only be described as surreal. At one point they insisted that publicly available information could not be introduced because the TSA considered it secret. This despite the fact that the information was available to anyone who asked. Really, the government’s actions challenged even my well entrenched cynicism.

But follow the link and see for yourself. I don’t have the words to describe what you’ll find there. Bad faith on the government’s part is the least of it.

I should note, by the way, that I have no way of knowing whether placing the mother on the no-fly list was justified or not. My objection is the government’s lying and obstruction.

Posted in General | Tagged | Leave a comment

SSL and the NSA

If you’re a crypto-nerd or even have a passing interest, you might enjoy Matthew Green‘s post speculating on how the NSA breaks SSL. We know, courtesy of Edward Snowden’s leaked documents, that they’ve had some sort of success with SSL but we’re not sure exactly what it is or how they’re doing it. It could be anything from stealing/coercing server keys to an actual crypto break.

Green breaks his analysis into two parts:

  1. Attacks using known techniques
  2. Tin foil hat speculations

The really interesting parts, of course, are the tin foil hat speculations. These range from breaking RSA keys, breaking RC4, new side-channel attacks, and other even more far out things. Green and others believe that if the NSA has indeed broken a crypto system it is most likely RC4. It’s an aging system with several known weaknesses and is probably ripe for major attacks.

The post doesn’t tell us what the NSA knows or what their capabilities with respect to SSL are, of course, but it’s an informed and interesting read on the security of SSL and how an organization like the NSA might go about trying to defeat it.

Posted in General | Tagged , | Leave a comment

Why Python Replaced Scheme in MIT’s Undergraduate CS Course

If you who have spent anytime at all on Irreal, you know that I’m a huge fan of SICP (Structure and Interpretation of Computer Programs) the seminal work by Gerry Sussman and Hal Abelson that was used for years in MIT’s EECS 6.01. MIT’s decision to replace SICP and Scheme with Python was met with cries of outrage from many in the CS community.

Chas Emerick attended an impromptu talk at the International Lisp Conference at MIT by Gerry Sussman on why MIT replaced Scheme with Python and reports on Sussman’s remarks. As I’ve said before, I find myself less than persuaded but it’s nice to get Sussman’s take on the matter; he surely knows more about it than me or most others commenting on it. If, like me, you believe SICP to be one of the best CS book every written and that learning its lessons—and Scheme, for that matter—is required for anyone who wants to be a competent programmer, you will find Sussman’s remarks interesting.

Posted in General | Tagged , | 2 Comments