Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn the user when in a path that contains special characters #4966

Closed
sethvargo opened this issue Dec 13, 2014 · 8 comments
Closed

Warn the user when in a path that contains special characters #4966

sethvargo opened this issue Dec 13, 2014 · 8 comments

Comments

@sethvargo
Copy link
Contributor

@sethvargo sethvargo commented Dec 13, 2014

There are a number of things, namely on Windows, where any non-UTF-8 character (and sometimes even non-alpnum characters) cause things to fail.

For gem installations that require compiling native extensions, any non-alphnum character will cause the build to fail - that means paths with spaces (like C:\My User) or parenthesis (like Program Files (x86)) will cause the installation to fail.

Similarly, there are known issues in VirtualBox where non-UTF-8 characters in paths cause strange things to happen (#2113).

Given the breadth, span, and nature of these issues, I do not think it is possible to "fix" Vagrant. Instead, I propose we add a function early in Vagrant's initialization stage that sanity checks important paths and prints a helpful warning message (perhaps linking to more verbose documentation) when those paths contain "invalid" characters. Namely:

  • VAGRANT_HOME
  • GEM_HOME
  • GEM_PATH
  • GEM_ROOT
  • PWD
@koseki
Copy link

@koseki koseki commented Jan 17, 2015

I think VBOX_USER_HOME is also required to be checked.

In my environment, non-ASCII home (C:\Users\健吾\VirtualBox VMs) causes error.

Command: ["import", "C:/vagrant/boxes/chef-VAGRANTSLASH-centos-6.5/1.0.0/virtualbox/box.ovf", "--vsys", "0", "--vmname", "packer-centos-6.5-x86_64_1421281388083_71845", "--vsys", "0", "--unit", "7", "--disk", "C:\\Users\\\u5065\u543E\\VirtualBox VMs\\packer-centos-6.5-x86_64_1421281388083_71845\\packer-centos-6.5-x86_64-disk1.vmdk"]

Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interpreting C:\vagrant\boxes\chef-VAGRANTSLASH-centos-6.5\1.0.0\virtualbox\box.ovf...
OK.
0%...
Progress state: VBOX_E_IPRT_ERROR
VBoxManage.exe: error: Appliance import failed
VBoxManage.exe: error: Could not create the directory 'C:\Users\蛛・蜷セ\VirtualBox VMs\packer-centos-6.5-x86_64_1421281388083_71845' (VERR_ACCESS_DENIED)
                                                                ^^^^^ garbled
VBoxManage.exe: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component Appliance, interface IAppliance
VBoxManage.exe: error: Context: "int __cdecl handleImportAppliance(struct HandlerArg *)" at line 779 of file VBoxManageAppliance.cpp

I added

disk_params.last.encode!('Shift_JIS')

to here, and it worked. 😩

May be relevant to current code page.

C:\>chcp
現在のコード ページ: 932
  • Windows 8.1
  • Vagrant 1.7.2
  • VirtualBox 4.3.20
@koseki
Copy link

@koseki koseki commented Jan 19, 2015

Ah, I was getting confused between VBOX_USER_HOME and machinefolder. I mean machinefolder.

The default machinefolder in C:\Users\健吾\.VirtualBox\VirtualBox.xml is like below. Vagrant doesn't work with this configuration.

  <SystemProperties defaultMachineFolder="C:\Users\&#x5065;&#x543E;\VirtualBox VMs" defaultHardDiskFormat="VDI" VRDEAuthLibrary="VBoxAuth" webServiceAuthLibrary="VBoxAuth" LogHistoryCount="3" exclusiveHwVirt="false"/>

This works.

  <SystemProperties defaultMachineFolder="C:\VMs" defaultHardDiskFormat="VDI" VRDEAuthLibrary="VBoxAuth" webServiceAuthLibrary="VBoxAuth" LogHistoryCount="3" exclusiveHwVirt="false"/>
@neichen
Copy link

@neichen neichen commented Apr 28, 2015

vagrant version 1.7.2

I discovered a method to "solve" this problem if someone doesn't want to change the real path to VAGRANT_HOME like I do.
The answer is to create a soft link ( which called junction in windows ) to the non-ASCII directory, then use the link instead of it.
I used to use a shortcut to do this but failed, and a junction did it! To use it, just type the falling command in cmd ( not in powershell, will cause an error, don't know why )

MKLINK /J Link Target

Take this for an example:

MKLINK /J C:\Devs\links\i C:\Users\宁

You can place the link wherever you like ( a path that does not contain non-ASCII encoding characters ), then add VAGRANT_HOME's new directory in the User Environment. If you vagrant init in a non-ASCII directory too, cd it in the link instead, everything will be fine.
The VirtualBox defaultMachineFolder can also benefit from it.

What's more, I think vagrant can also use this method to solve the problem as you can mklink when user vagrant init in a non-ASCII directory automatically. ( Don't know whether it's a good or bad idea. )

Hope this will help 😃

@sethvargo
Copy link
Contributor Author

@sethvargo sethvargo commented Jun 7, 2016

We are going to fix the paths instead.

@atorstling
Copy link

@atorstling atorstling commented Mar 26, 2018

@sethvargo Have you discussed this further? I ran into the user folder with special chars problems with 2.0.3...

@briancain
Copy link
Member

@briancain briancain commented Mar 26, 2018

@atorstling - Please open a new issue. Thanks!

@ElecTreeFrying
Copy link

@ElecTreeFrying ElecTreeFrying commented Aug 29, 2018

0%...
Progress state: VBOX_E_IPRT_ERROR
VBoxManage.exe: error: Appliance import failed
VBoxManage.exe: error: Could not create the directory 'C:\Users\ermita?o\VirtualBox VMs\ubuntu-cloudimg-trusty-vagrant-amd64_1535503347815_15119' (VERR_INVALID_NAME)
VBoxManage.exe: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component ApplianceWrap, interface IAppliance
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleImportAppliance(struct HandlerArg *)" at line 886 of file VBoxManageAppliance.cpp
@hashibot
Copy link

@hashibot hashibot bot commented Mar 29, 2020

I'm going to lock this issue because it has been closed for 30 days . This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@hashibot hashibot bot locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants