Pash-Project / Pash

An Open Source reimplementation of Windows PowerShell, for Mono.
https://groups.google.com/group/pash-project
BSD 3-Clause "New" or "Revised" License
516 stars 54 forks source link

Troubles with drives in Docker #425

Open ForNeVeR opened 8 years ago

ForNeVeR commented 8 years ago

A user reported a problem in our mailing list. He wasn't able to run Pash at all because of the following error:

Unhandled Exception:
System.Management.Automation.MethodInvocationException: No such provider. A provider with the name "FileSystem" doesn't exist.
  at System.Management.Automation.DriveManagementIntrinsics.GetAllForProvider (System.String providerName) <0x41839d00 + 0x0029b> in <filename unknown>:0
  at System.Management.Automation.ProviderInfo.get_Drives () <0x41839cc0 + 0x0002b> in <filename unknown>:0
  at Pash.Implementation.SessionStateGlobal.SetCurrentDrive () <0x41839520 + 0x0006f> in <filename unknown>:0
  at Pash.Implementation.LocalRunspace.InitializeDefaultSnapins () <0x41812070 + 0x0005b> in <filename unknown>:0
  at Pash.Implementation.LocalRunspace.Open () <0x41811e20 + 0x00113> in <filename unknown>:0
  at Pash.FullHost..ctor (Boolean interactive) <0x417e7770 + 0x000e1> in <filename unknown>:0
  at Pash.Program.Main (System.String[] args) <0x417e6df0 + 0x00107> in <filename unknown>:0

Here's the Dockerfile:

FROM mono:latest
RUN apt-get update && \
 apt-get install -y git
RUN mkdir /root/pash
WORKDIR /root/pash
RUN git clone https://github.com/Pash-Project/Pash.git . && \
 xbuild
CMD ["mono", "Source/PashConsole/bin/Debug/Pash.exe"]

I was able to reproduce the issue. Further investigation lead me to the conclusion that System.IO.DriveInfo.GetDrives() returns an empty array in Docker for some reason. It seems that this problem was reported and ultimately fixed by Xamarin, but it seems like the fixed version weren't released yet.

What can we do? Create a virtual virtual drive if we haven't found any real virtual drives? Recommend guys to run Docker in some special mode so it will turn off its aufs and overlay thingies (if that's possible at all)? Just give up and mark that as "known issue"?

UPD: I've misread the source. It should create that "virtual virtual drive" if running on Linux. So, again, I don't know what's happening. Reference Pash sources: FileSystemProvider.InitializeDefaultDrives and DriveManagementIntrinsics.GetAll.