public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Brian Dolbec <dolsen@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-portage-dev] [PATCH] AbstractEbuildProcess: disable ipc_daemon under Windows Subsystem for Linux
Date: Thu, 22 Sep 2016 19:50:04 -0700	[thread overview]
Message-ID: <20160922195004.37f418e4.dolsen@gentoo.org> (raw)
In-Reply-To: <20160923032225.74dc9398a248c4f150393cf9@plushkava.net>

On Fri, 23 Sep 2016 03:22:25 +0100
Kerin Millar <kfm@plushkava.net> wrote:

> Hi,
> 
> The attached patch renders portage functional under WSL, as tested
> with the "current branch" of Windows 10. Further details can be found
> in the commit message.
> 

commit fc706e5b21829cdeab2c40749639c4fceccd225a
Author: Kerin Millar <kfm@plushkava.net>
Date:   Fri Sep 23 01:55:10 2016 +0000

    AbstractEbuildProcess: disable ipc_daemon under Windows Subsystem for Linux
    
    As of Windows 10 build 14393, WSL is unable to support EbuildIpcDaemon
    correctly. The presence of /dev/lxss - as a character device - indicates that we
    are running under WSL, in which case the use of the daemon should be disabled.
    
    Note that stat calls directed at /dev/lxss are currently doomed to fail with
    EPERM. Thus, this specific error is also used as a means to detect WSL. Should
    Microsoft render this device node accessible in future builds, WSL will still
    be detected correctly.

diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
index 8bd30a6..7c8fc18 100644
--- a/pym/_emerge/AbstractEbuildProcess.py
+++ b/pym/_emerge/AbstractEbuildProcess.py
@@ -128,7 +128,17 @@ class AbstractEbuildProcess(SpawnProcess):
 			# since we're not displaying to a terminal anyway.
 			self.settings['NOCOLOR'] = 'true'
 
-		if self._enable_ipc_daemon:
+		# Determine whether we are running under WSL (Windows Subsystem for Linux).
+		# Trying to stat /dev/lxss under WSL will always fail with EPERM (for now).
+		running_wsl = False
+		try:
+			if platform.system() == 'Linux' and stat.S_ISCHR(os.stat('/dev/lxss')):


Using "in" comparisons is faster than doing == comparisons, even for a list or tuple of one length.  
It also allows easier expansion of the qualifiers.

                        if platform.system() in ['Linux'] and ...


+				running_wsl = True
+		except OSError as e:
+			if (e.errno == errno.EPERM):

Same for this one                   ^^


+				running_wsl = True
+
+		if self._enable_ipc_daemon and not running_wsl:
 			self.settings.pop('PORTAGE_EBUILD_EXIT_FILE', None)
 			if self.phase not in self._phases_without_builddir:
 				if 'PORTAGE_BUILDDIR_LOCKED' not in self.settings:

-- 
Brian Dolbec <dolsen>



      reply	other threads:[~2016-09-23  2:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-23  2:22 [gentoo-portage-dev] [PATCH] AbstractEbuildProcess: disable ipc_daemon under Windows Subsystem for Linux Kerin Millar
2016-09-23  2:50 ` Brian Dolbec [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160922195004.37f418e4.dolsen@gentoo.org \
    --to=dolsen@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox