Skip to content

ensure *nix platforms add an initial / rooted drive - #2679

Merged
Andy Jordan (andyleejordan) merged 1 commit into
PowerShell:masterfrom
mwrock:linux_root
Nov 15, 2016
Merged

Andy Jordan (andyleejordan) merged 1 commit into
PowerShell:masterfrom
mwrock:linux_root

Conversation

@mwrock

Copy link
Copy Markdown
Contributor

This is certainly an edge case but I am working in a docker container that has no / mount point:

[181][default:/src:0]# cat /proc/mounts
tmpfs /dev tmpfs rw,nosuid,mode=755 0 0
devpts /dev/pts devpts rw,relatime,gid=5,mode=620,ptmxmode=000 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
tmpfs /run tmpfs rw,relatime 0 0
tmpfs /var/run/docker.sock tmpfs rw,nodev,relatime,size=201160k,mode=755 0 0
//10.0.75.1/C /src cifs rw,relatime,vers=3.02,sec=ntlmssp,cache=strict,username=matt,domain=ULTRAWROCK,uid=0,noforceuid,gid=0,noforcegid,addr=10.0.75.1,file_mode=0755,dir_mode=0755,iocharset=utf8,nounix,serverino,mapposix,nobrl,mfsymlinks,noperm,rsize=1048576,wsize=1048576,actimeo=1 0 0

This results in an "automounted" PS Drive named / but with a Root of /dev which causes Get-Location, $pwd and auto module loading to fail.

This ensures that a / dirive is added during the file system provider drive initialization and rooted to /.

@mwrock

Copy link
Copy Markdown
Contributor Author

To further clarify this, without this change, a PSDrive is still created for / but that happens later in AutoMountFileSystemDrive. However the root is not adjusted so in the above case it points to /dev but in any case it would point to the first mount in proc/mounts and on *nix, VolumeSeparatedByColon is not set to false which results in malformed path resolution and a Get-Location looking like /:/.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, that is an edge case indeed. This LGTM.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, use { } even for one-line if bodies.

@mwrock

Copy link
Copy Markdown
Contributor Author

Sure thing sergei (@vors). Done!

@andyleejordan

Copy link
Copy Markdown
Member

Looks like the Travis CI queue filled up. I canceled some irrelevant jobs, this should run soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants