-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Luarocks: use cmd mkdir #12002
Luarocks: use cmd mkdir #12002
Conversation
@ImperatorS79 any thoughts on this? |
I am not an expert about luarocks, the patch was adapted from a PR that was never merged into luarocks. Last time I worked on luarocks on msys2, there were not any problem and I could install packages, but luarocks was updated in the mean time. I tested installing I agree with the last comment from OP, but I think it should be an issue on the luarocks side. They could certainly pinpoint what needs to be done to use luarocks both from cmd and msys shell (does it fails at the moment ?). Is it possible to add a |
I would like to separate the following two issues:
For 2. I would like to create a new issue for further discussion. |
BTW: uninstallation of To be shure that
|
To be sure I just re-checked the problem with a fresh install of MSYS2 under Steps to reproduce
|
Is there any workaround for this? I've not been able to deploy/update a machine image that needs to install modules using Luarocks for a few months. Haven't managed to get it to work using mkdir/cygpath wrapper scripts or similar hacks. Thanks |
It would be easier, if my provided patch would by applied. There seems only little interest to have working luarocks in msys2, so for now luarocks remains unusable in msys2, at least in a fresh install, as my above example shows :-( As a workaroud you could try to create all needed directories for |
For a crude workaround I use this - actually it is a fragment that I use in a neededPath=$(luarocks $@ install ${rock} 2>&1 | grep "failed making directory" | cut -c 32-)
until [ -z ${neededPath} ]; do
echo "Inserting a needed directory: ${neededPath} ..."
mkdir -p ${neededPath}
neededPath=$(luarocks $@ install ${rock} 2>&1 | grep "failed making directory" | cut -c 32-)
done It might be because I am working with Lua 5.1 rocks (so I am passing |
Yeah, that is confirmed - with the Lua 5.4 |
AFAIK, this is true for Is the msys shell picking up a different |
Yes of course.
Yes, see my first post in this pull request where everything is explained: The problem is caused by the msys2 patch: This patch is executed by the msys2 build/installsystem when luarocks is installed with the command My pull request is a quick fix to correct the msys2 patch such that luarocks is using again CMD.EXE instead of using the unix like This is a very simple solution for a trivial problem to just get it working and it's sad that I had written so much text about it, filed a pull request und also a problem report #15458 and no one seems to be interested to merge this pull requst since 7/2022 :-( As I also wrote above this is only a quick fix to just get luarocks working again. In the future there should be more work done, to make luarocks a real MINGW package. In msys2 there are different environments (see also https://www.msys2.org/docs/environments/): MSYS packages (applications that are running under unix like environment in windows) and MINGW*/CLANG* packages (application that are running without any unix environment and without any hardcoded location). For this there must no unix like environment be used and no hardcoded path where packages etc. are located. For Example the msys2 lua package (https://github.com/msys2/MINGW-packages/tree/e09173589270815a80e287dfe7c98e5f8880b7e4/mingw-w64-lua) is a real MINGW package. You can copy the binary lua.exe and needed dlls or lua packages to any location under any windows system and it works as long as the relative directory structure regarding to the lua binary lua.exe is preserved. I would have started to work on this problem and to provide patches for the luarocks msys2 package but I'm not willing to invest further work here if there is no chance that the msys2 community has interest on a working luarocks :-( The main point for this work would be to have a possibility for lua script code to get the location of the lua.exe. The lua.exe knows this location since it can replace the |
fixed in #20166 |
<!-- Keep the title short & concise so anyone non-technical can understand it, the title appears in PTB changelogs --> #### Brief overview of PR changes/additions Simplify Luarocks setup on Windows #### Motivation for adding to Mudlet Less is more and msys2/MINGW-packages#12002 is fixed #### Other info (issues closed, discussion etc) To be tested if Windows setup still works after this
Here comes a fix for the following situation: Luarocks cannot create missing parent directories if the Lua package "lfs" is not installed.
Steps to reproduce:
1.) Assure that Lua package "lfs" (luafilesystem) is not installed (P.S. uninstallation may by tricky, see below #12002 (comment)):
2.) Install some package (e.g. "lpeg")
The reason for this is, that Luarocks has a fallback for mkdir if "lfs" is not installed, see the code for Windows:
https://github.com/luarocks/luarocks/blob/ecb63347bf7d44c68210befc9d03c013350c7831/src/luarocks/fs/win32/tools.lua#L36-L44
However it is assumed here for Windows, that mkdir creates missing parent directories. Compare the above code with this code for Linux:
https://github.com/luarocks/luarocks/blob/ecb63347bf7d44c68210befc9d03c013350c7831/src/luarocks/fs/unix/tools.lua#L24-L31
Note the "-p" here.
The problem is caused by:
MINGW-packages/mingw-w64-lua-luarocks/0001-luarocks_msys2_mingw_w64.patch
Lines 48 to 51 in e091735
IMHO this seems to be wrong in several ways, e.g. cygpath is invoked here. This was also discussed in #9037, see #9037 (comment)
One solution could be to append a " -p" to MKDIR here. The solution in this pull request is to use the cmd mkdir as it is done without the invocation of "cygpath --windows /usr/bin/mkdir".
So IMHO this pull request is only a temporary fix to keep this package working as it is if lfs is not installed. A better solution is needed in the long term. Best would be to make the Luarocks package a "real" mingw package that does also work if not invoked under MSYS environment.