Msys2-packages: Msys not handling correclty Windows users

Created on 17 Apr 2016  路  11Comments  路  Source: msys2/MSYS2-packages

Alexpux told me I had to open this issue here.

I am opening this issue because it seems to me the installer setups everything as if Windows is a single user system. Well, maybe a lot of people are doing that, but this is a wrong way to do things and no software should encourage this (dumb) behavior.

It seems the installer does a single user installation because:

  • shortcuts are added in installing user menu rather than "all users" menu.
  • when running "mingw64_shell.bat" with non administrator user, I keep getting chmod errors because it cannot change permissions of '/dev/shm' and '/dev/mqueue'. When I look authorizations in the matching Windows folders it seem to me normal I cannot do that with my current Windows user.

So, I propose to fix things by implementing the following enhancements:

  • do not default to single user installation. Either give the choice between single user installation and all users installation, or provide only all users installation.
  • if single user installation is possible, it should not require admin privileges. Elevation prompt should occur only once you select all users installation. If elevation prompt cannot be shown after start, so the choice between single user and all users installation should be done by selecting another installer, and the single user installer should not show elevation prompt.
  • after a all user installation, running MSYS2 prompts should not requires write access to common files or folders. Each user should write only his own files.
  • after a all user installation, only a user with admin privileges should be able to run pacman.

Fixing this issue seems mandatory to me. So far I used MSYS2 only to download packages, and I won't do more if this issue is not solved.

If you lack time to solve it, I may try to see if I can participate to MSYS2 development and fix it.

Most helpful comment

MSYS2 should also avoid creating a home directory with spaces. It's pretty common for Windows user names to have spaces, and MSYS2 just goes ahead in creating home directories like "C:\msys32\home\Bob Smith". This is not always handled well, particularly with automake configure scripts. I've run into countless errors in MSYS2 because my user name has a space in it. Changing the spaces to underscores in a username might be a good idea.

All 11 comments

A few quick points:

  1. We don't want MSYS2 installed to a path with spaces (for example gnu make doesn't work in paths with spaces and MSYS2, as is a full software distribution that includes gnu make - mingw32-make - and many other tools).
  2. We don't want MSYS2 installed into deep paths for the same reason that it's a full software distribution and eating away at MAX_PATH (260) for everything from the get-go is obviously a bad thing. I'm aware that there are various caveats and workarounds that allow exceeding the 260 limit and an executable here or there that MSYS2 provides may be take advantage of these but but they're not relevant to the full software distro.
  3. MSYS2 is not tested with Unicode and in-fact our path conversion code is ascii-based, so if we install MSYS2 to %UserProfile% and %UserProfile% contains Unicode characters bad things may happen.

Some of these are fixable (3 for example) but some of them are fairly constricting. So with these in mind, what are our options?

@mingwandroid
Respecting these constraints should not be a problem. Maybe Msys should create a msys64\%Username% directory and use msys64\%Username%\dev instead of msys64\dev for instance. Is dev the only directory users need to be able to write into?

@mingwandroid
We could also change ACLs to msys\dev\mqueue and msys\dev\shm, provided we are sure this would not create a security hole and be used by malwares.

Also in msys64\home I only have a Admin directory, on installation Msys64 should change ACLs to msys64\home so that other users could create their own home directory.

Well, generally speaking so far, users have been allowed to update the system; we've just never really considered non-Administrator users very much yet. To be honest with you, I don't really know the ins-and-outs of non-Administrator Windows users since I never run Windows like that so please bear with me.

Does "single user installation" necessitate installing into a subfolder of %UserProfile%? Does "all users" necessitate installing to "Users\Public"? I guess not as you said we'd still be able to use C:\msys64 .. Can you point me to a URL that explains this stuff?

Regarding the MSYS2 home folder, for me, I delete C:\msys64\home\ray then use mklink /D ray C:\Users\ray after installation to make my msys2 home the same as my Windows home. I'd like this option to be presented to the user in the installer ideally, but this is further complicated by the fact that we have a tarball instead of an installer and that tarball alternative will remain (this first-run specialization could be unified to read some env. vars that are set by the installer or in the env. prior to the first run after untarring the tarball).

You'll need to learn about the Qt Installer Framework to work on this which I can help with.

We don't use the POSIX-y ACL implementation of Cygwin, instead just using Windows permissions only (mounting with noacl).

This is stuff I'm far from comfortable with so it might be wise to join #msys2 on the oftc IRC network for useful people to chat to, but overall, we would welcome changes that make things work for non-Administrator-users if they don't make things worse for us Administrator-users.

Only using Windows with admin privileges? That's beyond my understanding.

The "single user" installation can be done anywhere. By default Windows does not forbid any user to create folder in C:\, D:\ or the root of any disk. I see only one reason why the current installer requires administrator privileges: this is because it adds MSYS in the Windows programs list, the list you can see in Configuration Panel. And no, a single user program has nothing to do in this list! Each user should be able to install his own copy of MSYS.

I guess next thing to do for me is to start examining Qt Installer Framework, just to get sure what we can do or cannot.

When you put shorcuts in a user's menu, well its really not convenient for other users to find them. They need to search in your home folder, and by default another non administrator user can't go there. The "all users" menu is precisely done for that, for shortcuts to be available to all users.

MSYS2 should also avoid creating a home directory with spaces. It's pretty common for Windows user names to have spaces, and MSYS2 just goes ahead in creating home directories like "C:\msys32\home\Bob Smith". This is not always handled well, particularly with automake configure scripts. I've run into countless errors in MSYS2 because my user name has a space in it. Changing the spaces to underscores in a username might be a good idea.

This is much needed! A simple slugify function, combined with an alias set up in /etc/profile, could be an easy and understandable fix.

Just ran into this, purely because of experience we all know it is related to the space. But a lot of newcomers probably won't and definately will run into problems sooner rather then later.

Like @mingwandroid, went straight for an mklink to C:\Users and customized the symbolic link to my liking, but i understand that the need for elevated access, is not the preferred way.

on windows systems it's normal to install for all users; and furthermore it's the same on linux. On windows systems it's good practice to work as non admin, because your software will likely run on other machines without system admin privileges; so it's perfectly normal to use msys2 to develop and test as non-admin user. The point is that if you install msys2 as non-admin user, and then you try to uninstall it, the uninstall process fails, because some of the folders have been anyway installed with admin privileges, and then are protected by the User Account Control system. The best thing would be to install as windows admin but having then the installation for all users.

The installer script at msys2/msys2-installer in qt-ifw/packages/com.msys2.root.base/meta/installscript.js needs to be adjusted to allow all users (see QtIFW documentation here: https://doc-snapshots.qt.io/qtifw-master/scripting.html).

on windows systems it's normal to install for all users

That is true for normal software but for software distributions on Windows the opposite is true. Allowing user installation gives users freedom to update and install more software without needing to request an admin to do these tasks for them.

You can install msys2 as a user in your user directory if you do not have permissions to install elsewhere.

You can install msys2 as an admin to anywhere you want (including Program Files) if you run the installer as administrator.

I don't see that anything really needs to be done here. Both cases work fine. I've used msys2 in a huge range of windows installations with no problem and believe user freedom more important than administrator permissions. We're not trying to sell msys2 to corporate customers after all!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

quanah picture quanah  路  5Comments

EdVanDance picture EdVanDance  路  6Comments

trapd00r picture trapd00r  路  3Comments

Arnold1 picture Arnold1  路  8Comments

hiroakit picture hiroakit  路  5Comments