Possibly Useful

an occasional series of items
too large to be throwaway
too small to be projects
whimsically described
freely licensed
unlikely to be revised

Using GPG2 with a read-only .gnupg directory

Another bulletin funded by the I Just Blew An Entire Morning On This Foundation:

Suppose you want to encrypt and sign files using gpg, but without giving it ownership or write access to its own keystore. For instance, this might be necessary if the gpg process is going to be run from a low-privilege CGI user and you don’t have root privileges on the webserver. This is relatively straightforward with the classic version 1, although there’s an error message that’s harmless but impossible to suppress, but version 2 made some architectural changes that make it harder, and does not document the necessary tricks. Below the fold, how you do it.

Continued…

Do not do business with Northwest Talent Search

A depressing number of computer industry recruiters cannot be bothered to read the very first paragraph of my LinkedIn profile (which is now also the first paragraph of the contact information page of this very website—probably should have done that years ago), or else they think they are ~special snowflakes~ and it does not apply to them. For reference, this paragraph reads

I AM NOT LOOKING FOR A JOB. DO NOT CONTACT ME WITH ANY SORT OF JOB OFFER.

I get unwanted solicitations about once a month, and I reply with a polite but acerbic note about how they should’ve noticed the paragraph in ALL CAPS that says don’t contact me, and usually that’s the end of it.

Last week I got one from an outfit calling itself Northwest Talent Search, Inc. (They don’t have a website.) It does just about everything wrong:

Hello Zack

I am working with one of the fastest growing startups in the world on a Aspiring Software Engineering Manager search. They just landed a major partnership with a fortune 500 company. If you have an interest in joining a world class team and an incredible opportunity what would be a good time for a phone call and a good number to reach you at?

Thanks
[REDACTED]
[REDACTED]@northwesttalentsearch.com

Besides ignoring the request not to contact me: Why would anyone not want to know which startup, which megacorp, and at least the executive summary of the concrete job description? If you’re going to cold-contact people with job offers, these things should always appear in the initial message. And anyone who has done their due diligence on me should know that I’m not the right candidate for any sort of engineering management position and I’m allergic to startups. So I was less polite than I usually am, when replying:

Thank you for your interest, however:

  1. I have made it abundantly clear, both on my personal website, and everywhere recruiters typically trawl for interesting people, that I am not looking for a job and do not want to be cold-contacted with job offers.

  2. I have neither any interest nor any qualifications for an engineering management position, and I do not understand how you could possibly have gotten the impression that I might be an appropriate candidate for such.

  3. As a matter of basic courtesy, in your initial message you should have stated the name of the company you are recruiting for and given a couple sentences’ description of what business they are in and what the job responsibilities are.

Never contact me again. Do not even reply to this message.

Now, if that had been the end of it, you wouldn’t be reading this post. Today I received this:

Hello Zack

I am working with one of the fastest growing startups in the world on a Backend Engineer search. They just landed a major partnership with a fortune 500 company. If you have an interest in joining a world class team and an incredible opportunity what would be a good time for a phone call and a good number to reach you at?

Thanks
[SAME PERSON]
[SAME EMAIL]@northwesttalentsearch.com

The only change is the job title. Backend Engineer is less wrong than Aspiring Software Engineering Manager, but it’s still wrong. And sending another instance of what is evidently a form letter, after having been told not to contact me again, is both disrespectful and unprofessional.

Hence what I dearly hope will be my final reply to them, and this post.

You sent me a message last week which was word-for-word identical but for the job title. In my reply, I made it plain that I was not interested and I did not want to hear from you ever again.

Your continued solicitations are unprofessional, as are the vagueness of your cold-contact messages (as explained in the previous reply) and your clear lack of research on me prior to contact.

I have directed [MY MAIL CLIENT] to treat all further messages from anyone at your company as spam, and I have filed an abuse report with [YOUR BULKMAIL SERVICE]. I will also be publishing all of our communications on my website as a warning to others not to do business with your company.

My previous reply, for reference: [etc]

If you’re a company looking to hire: Don’t do business with these clowns, there are people who will do much better by you.

If you’re also getting these: I strongly suspect you don’t want any of the jobs they are soliciting for.

Operating system selection for $PROJECT, mid-2015

Presented without context, for amusement purposes only, a page from my notes:

FreeBSD NetBSD Linux
Per-process default route Poorly documented,
possibly incomplete
Probably not Poorly documented,
buggy
Can compile PhantomJS Probably Probably Yes
Jails Yes No Not really
Xen paravirtual guest Incomplete Yes Yes
System call tracing truss None? strace
pipe2 Yes Yes Yes
closefrom Yes Yes No
sysctl Yes Yes No
getauxval No No Yes
signalfd No No Yes
execvpe No Yes Yes
Reference documentation Acceptable (YMMV1) Acceptable (YMMV) Major gaps
Tutorial documentation Terrible Terrible Terrible
Package management Broken as designed Broken as designed Good
System maintenance automation I can’t find any I can’t find any Acceptable
QA reputation Excellent Good Good
Security reputation Good Good Debatable
Development community Unknown to me Unknown to me Full of assholes

1 It makes sense to me, but then, I taught myself Unix system programming and administration by reading the SunOS 4 manpages.

Programming languages and transportation

Last week there was a gag listicle making the rounds entitled If programming languages were vehicles and I lol’d along with the rest of them, but then I kept thinking about it and a bunch of the entries just seemed to miss the mark. And I’m in a silly sort of mood, so here is MY version: slightly different language selection, just as opinionated, 100% more Truth™.

Continued…

flex: input scanner rules are too complicated

If you get this error message, the Internets may lead you to believe that you have no option but to change magic numbers in the source code and recompile flex. Reader, it is not so. Try the -Ca option, before doing anything else.

No, I don’t know why an option that’s documented to be all about size/speed tradeoffs in the generated, DFA, scanner also has the effect of raising the hard limit on the number of NFA states (from 32000 to about 231), but I already feel dirty just having looked at the code enough to discover this, so I’m going to stop digging while I’m ahead.

More Notes on the Cross-Platform Availability of Header Files

You may recall a month and a half ago I posted Notes on the Cross-Platform Availability of Header Files and then promptly had to take most of it down because it was insufficiently researched. Well, the research is ongoing, but I’ve got a shiny new set of results, some high-level conclusions, and several ways Viewers Like You can help!

First, the high-level conclusions:

  • Except perhaps in deeply-embedded environments, all of C89’s library is universally available.
  • Code not intended to run on Windows can also assume most of C99 and much of POSIX. The less-ubiquitous headers from these categories are also the less-useful headers.
  • Code that is intended to run on Windows should only use C89 headers and <stdint.h>. If MSVC 2008 support is required, not even <stdint.h> can be used. (Windows compilers do provide a small handful of POSIX headers, but they do not contain the expected set of declarations!)
  • Many different Unix variants ship a similar set of nonstandard headers. We don’t yet know whether the contents of these headers are reliable cross-platform.
  • There is a large set of obsolete headers that are still widespread but should not be used in new code. This is underdocumented.

The full results may be seen here: https://hacks.owlfolio.org/header-survey/
The raw data is here: https://github.com/zackw/header-survey/

If you want to help, we need more inventories (especially for OSes further from the beaten path), and I’m also very interested in improvements to the giant generated HTML table. Y’all on Planet Mozilla can probably tell I’m not a Web designer. If you are an old beard, there are also places where I’m not entirely sure of my methodology – see the README in the source repo.

Notes on the Cross-Platform Availability of Header Files

These header files are guaranteed to be available in a C89 hosted environment. All interesting portability targets nowadays are C89 hosted environments (bare-metal environments are still relevant, but not as portability targets).

assert.h
ctype.h
errno.h
float.h
iso646.h
limits.h
locale.h
math.h
setjmp.h
signal.h
stdarg.h
stddef.h
stdio.h
stdlib.h
string.h
time.h
wchar.h
wctype.h

Beyond C89, interesting portability targets divide into three classes. Complete Unix environments are always compliant with C99 and POSIX.1-2001 nowadays, but not necessarily with all of the optional modules of the latter, nor with any more recent standard. Windows has several different competing C runtimes, some of which offer more C99 support than others, and none of which are at all conformant with POSIX. Finally, the major embedded environments are presently all cut-down versions of a specific identifiable complete Unix or of Windows. Those that are derived from Unix usually have most of the POSIX headers but may be missing a few.

EDIT: Everything after this point in the original version of this post was insufficiently thoroughly researched and may be wrong. Corrected tables will appear Real Soon. If you are interested in helping me with that, please see https://github.com/zackw/header-survey.

Making OSX Emacs less broken

If you find that Emacs on OSX fails to pick up the same $PATH setting that you get in command line shells, instead defaulting to an impoverished default that doesn’t include (for instance) anything installed via MacPorts:

(add-hook 'after-init-hook
         #'(lambda ()
             (setenv "PATH"
               (with-temp-buffer
                 (call-process "/bin/bash"
                               nil
                               (list (current-buffer) nil)
                               nil
                               "-l" "-c" "printf %s \"$PATH\"")
                 (buffer-string)))))

I am only embarrassed that I put up with the brokenness for as long as I did.

test your file locking

This PUBLIC SERVICE ANNOUNCEMENT is brought to you by the I JUST WASTED AN HOUR ON THAT Foundation:

Do you suffer from mysteriously hanging autotools processes? Or perhaps other mysteriously hanging processes? If so, you may have a problem with your file locking, and the IJWAHOT Foundation recommends you compile and run this program on the computer with the problem, preferably under strace or equivalent. If it, too, hangs, then you do indeed have a problem with your file locking. The Foundation does not presently know the cause of this problem, but we suspect that it is NFS’s fault somehow. If you do know the cause of this problem, we would love to hear about it in the comments.

URL Canonicalizer

supposing
for the sake of argument
that you had a giant list
of partial URLs
(you know, like www.example.com/blurf)
and you needed to canonicalize them
and chase redirects
and remove duplicates
and dead sites
and further you were aware
that this is much harder than it might sound
not to mention
that many websites do not like urllib
well then
you might be looking for this program
which was written by me
with a little help from serge broslavsky.