Closed Bug 1566159 Opened 5 years ago Closed 5 years ago

generic-worker: user: Current not implemented on darwin/amd64

Categories

(Taskcluster :: Workers, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: pmoore, Assigned: pmoore)

References

Details

Attachments

(1 file)

When installing release build generic-worker 15.x.x on macOS, we get the error:

user: Current not implemented on darwin/amd64

This is because we are using user.Current here which requires CGO to work on darwin. The error comes from here.

We didn't notice this before, because until now we've been installing generic-worker from source on the macOS workers used by the taskcluster team (building with CGO enabled). However, in setting up a new macOS CI worker in macstadium from a release binary of generic-worker (built with CGO disabled), I stumbled on the issue!

The options we have are:

  • Since the root user account of a posix system always has uid and gid 0, we can avoid the user.Current function call entirely, and just pass in zeros
  • We could execute /usr/bin/id [-u|-g] to get the uid / gid which works on both Linux and macOS
  • We could build with CGO enabled

I'm going for the second option, as that gives us more freedom to run generic-worker as a non-root user in future. I avoided the third option, mostly from a purity standpoint, mostly inspired by this article which in fairness really relates more to the perils of linking in third party C code, rather than trusted C code from the go standard library intetionally designed to interface with go (so the article may not be so relevant).

Assignee: nobody → pmoore
Status: NEW → ASSIGNED
Blocks: 1530732

Released in generic-worker 15.1.2.

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: