lxc-start-ephemeral: Parse passwd directly #667

Merged
merged 1 commit into from Sep 30, 2015

Conversation

Projects
None yet
2 participants
Contributor

cjwatson commented Sep 30, 2015

On Ubuntu 15.04, lxc-start-ephemeral's call to pwd.getpwnam always
fails. While I haven't been able to prove it or track down an exact
cause, I strongly suspect that glibc does not guarantee that you can
call NSS functions after a context switch without re-execing. (Running
"id root" in a subprocess from the same point works fine.)

It's safer to use getent to extract the relevant line from the passwd
file and parse it directly.

Signed-off-by: Colin Watson cjwatson@ubuntu.com

lxc-start-ephemeral: Parse passwd directly
On Ubuntu 15.04, lxc-start-ephemeral's call to pwd.getpwnam always
fails.  While I haven't been able to prove it or track down an exact
cause, I strongly suspect that glibc does not guarantee that you can
call NSS functions after a context switch without re-execing.  (Running
"id root" in a subprocess from the same point works fine.)

It's safer to use getent to extract the relevant line from the passwd
file and parse it directly.

Signed-off-by: Colin Watson <cjwatson@ubuntu.com>

stgraber added a commit that referenced this pull request Sep 30, 2015

Merge pull request #667 from cjwatson/ephemeral-parse-passwd
lxc-start-ephemeral: Parse passwd directly

@stgraber stgraber merged commit e209cdd into lxc:master Sep 30, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

z-image pushed a commit to z-image/lxc that referenced this pull request Oct 16, 2016

Merge pull request #667 from cjwatson/ephemeral-parse-passwd
lxc-start-ephemeral: Parse passwd directly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment