SIGAVDI #91: Sweet Potato Pie Edition

Hello friends,

What’s this? Two SIGAVDIs in two weeks??? OK yes I admit it, I’m using this to procrastinate on my email.

Schnappi, my self-appointed “pet”, has been growing bolder. Does anyone know what to feed an anole?

Read More

SIGAVDI #90: Chicken soup edition

Hello friends,

I’m back in Tennessee, having recently weathered a (gorgeous) mountain snowfall and a (less gorgeous) fever over Christmas. In my client work I’ve been working a lot on Rails test profiling and optimization, something I’m hoping to bring to RubyTapas in upcoming weeks.

Read More

SIGAVDI #89: Apple Pie Funnel Cake Edition

Hello friends,

There’s a shiny red convertible in my garage. Some mornings I look out the window and it’s sunny and bright and I think, what a perfect day to go for a drive. Then I discover that since the last time I took the car out, one tire has gone soft, the battery is dead, and someone (me) deposited three milk crates of old Dr. Dobbs’ Journals on the seats for lack of a better place to put them.

Read More

Featured Video Play Icon

That’s So Fetch

It’s time for another dip into the RubyTapas archives! In this third and last episode on Ruby’s #fetch family of methods, now free to all, we get into some advanced #fetch usage. Including: deep fetching, using the name of the missing key in fallbacks code, and why I never use the two-argument form of #fetch.

Read More

Re-Use SSH Config Inside Docker Containers with WSL2

Docker and WSL have been getting more and more chummy lately. The Docker Desktop WSL2 backend integrates Docker containers with the “official” integrated Windows/Linux ecosystem (boy that still feels a little weird to write…) and gains performance perks in the process.

However, I ran into some trouble recently getting SSH to work inside of a Docker container. As I’ve written about before, I like to bind-in my credentials from my host machine, rather than proliferating credentials into containers. When a container needs to SSH out to the wider world, that means binding in my .ssh directory from the host, e.g. with a docker-compose.yml:

      - type: bind
        source: ${HOME}${USERPROFILE}/.ssh
        target: /home/${DEV_USER:-abapa}/.ssh

Only one problem: volumes mounted from the Windows side are mounted via drvfs, which by default projects all files as having mode 777 on the Linux side. And SSH will refuse to use certificate files that are world-writeable.

After a bunch of research and some trial-and-error, I found a solution that’s working right now (2020-10-24). Recent versions of drvfs allow NTFS-hosted files to have fake Linux-side effective permissions attached to them, via NTFS extended attributes. And the docker-desktop distro that Docker Desktop installs has this feature enabled:

PS> wsl -d docker-desktop
# cat /etc/wsl.conf
root = /mnt/host
crossDistro = true
options = "metadata"

Notice the options = "metadata" line in /etc/wsl.conf.

So the trick was to open a WSL terminal in that distro and set the desired effective owner and file permissions:

PS> wsl -d docker-desktop
caroline:/tmp/docker-desktop-root/mnt/host/c/Users/avdi_000/.ssh# chown -R 1000:1000 .
caroline:/tmp/docker-desktop-root/mnt/host/c/Users/avdi_000/.ssh# chmod -R u=rwX .

These aren’t “real” file attributes, since Windows has a very different permissions model from Linux. But they get saved as file attributes and treated as the effective file permissions inside WSL distros with metadata enabled.


  • -R makes the change recursive through directories.
  • User/group 1000 are a common default user/group ID for containers.
  • File mode u=rwX recursively sets files to readable/writeable by owner, and directories read/write/traversable by owner.
Featured Video Play Icon

Controlling superclass argument pass-through in Ruby

In Ruby class-based programming, superclass versions of subclass methods are always invoked explicitly using the super keyword. There are some nuances to using super though, particularly when it comes to passing (or not passing) arguments and blocks along to the base class. In this sample from from the RubyTapas archives, we’ll talk about some of those “gotchas”.

Read More

Featured Video Play Icon

Ruby Singleton Objects

Here’s another freebie from the deep RubyTapas stacks. This one is about a truth of object modeling that we don’t often talk about: not every object needs to have state. If an object has no state, there’s no need to have more than one of it. And for stateless objects, having a class just to generate a single instance may be superfluous!

Read More