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
Windows users with non-ASCII in filepath can't load LuaGlobal #1616
Comments
Windows is known to be odd with path names - and the file functions in Lua do have to be fed with the correctly slashed pathnames. In the C++ code if we do not use C++11 raw string literals (and we may be forced not to to handle a Qt bug with As it happens that path in the |
This also means I think that the |
Not sure I understand your comments or whether they were actually even directed towards me.. :) Do you see any chance of me fixing this issue, short of configuring a whole new user from scratch? |
It is more of a general observation for anyone taking a look at it. It ought to be possible to fix it by looking at the path(s) used to get the LuaGlobel.lua file loaded, specifically on the Windows platform. I have a suspicion that we have left that OS use some default value - which may be "the same directory as the executable" but which is not suitable because of the non-POSIX path. Looking at what I think is the cause of this problem:
This immediately seems a bit dodgy because A to D are all wrong for Windows, for instance A should be Remember if debugging this the on-screen |
Lua on Windows handles / as a directory separator just fine though. |
That hasn't been my somewhat limited experience - IIRC there is a configuration setting somewhere in the lua stuff that contains a 4 character array which holds the compiled in settings for, amongst other thing, the wildcard character in package names and the directory separator. I recall this because when I fixed up the (internal to) LuaGlobal.lua handling of Windows vs. *nix file paths in the past I did use a check on, I think on one C array index into the Ah, ha - yes - see the
|
'as a general rule' - that does not counter the fact that |
That is just it - for some, including myself, that does not work - it may well be that I do not have a lua installation prepared by following the normal quoted recipe (or that I have a Cygwin install around as well). I wonder - are you confusing, by any chance, the lua subsystem's (or rather the package part of it) handling of directory separators - which can be configured either way (or possibly for something else entirely for say It does confuse the heck out of me as to what is supposed to work for a lua installation compiled on a Windows platform - ah, could it be that msys is POSIX-ish but mingw is Windowish? |
So presumably that lua interpreter in the mingw from Qt is configured correctly for Windows, and it is using the same liblua that the Mudlet application gets linked to {it may not be, I suppose, for everyone}. For instance, luarocks provides a lua 5.1 interpreter which it can use if no other is found but by the same token 💡 Ah, I wonder, @Kebap what do you get if you try to get the values of
Note the first value |
I could create a new user or two, with and without special characters, just to make sure if the user name is really the issue here. Do you think it's helpful? |
Yes, please try
…On Wed, 25 Apr 2018, 6:48 pm Kebap, ***@***.***> wrote:
I could create a new user or two, with and without special characters,
just to make sure if the user name is really the issue here. Do you think
it's helpful?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1616 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAGxjN9JHbiPCOgUf3u1u8jVg0KjDiSbks5tsKj3gaJpZM4TZAbQ>
.
|
As far as I can see, the code is trying all the suggested locations for the
however from the resultant error message it seems that LUA_DEFAULT_PATH is an empty string so the used path is:
assuming (and I am still not convinced but that is hopefully just my problem) that '/' IS a workable directory separator where it is being used it means look for the file in the root of the file-system - on POSIX ones that is literally the root and on Windows it is the root on the currently active drive, probably
or if it returns the full path, possibly something like:
maybe? 😮 I see that the error message from the lua interpreter is captured in a <aside> Continue the possibly off-topic bit about what the particular lua interpreter instance is using as it's directory separator I'm just trying to think where the
from the Mudlet profile command line even with the error you are getting. This is a little speculative but as a runtime fix I wonder if it is possible to do something like:
to change the separator to |
Confirmed error with Mudlet 3.8.1 on Win 8.1 with user-name with special char: ä. |
|
Ran Changed command seperator from ; to something else Ran Ran Test with
Just to be sure |
Strange about
should work as well. Looking at the output from the first sort of working example the error output is trying to load the
I wasn't sure where the file should be located these days so I downloaded and installed the 3.8.1 binary and found that the path used is: C:\Users\Stephen\AppData\Local\Mudlet\app-3.8.1\mudlet-lua\lua also with that Windows Installer version, I have the following for the package.config:
so paths to it must use Edited: to quote the list of paths with ` rather than ' |
Why some paths are mojibake and others correctly display the Username must be because they are coming from different sources and some of them are not properly capable of I18n yet - it would be helpful if we can track those down and fix them by Mudlet 4.0 - but they may not be ones we have control over. Note that it cannot be the display code or fonts because the individual error messages all pass through the same process one they are created. |
This Q&A on Stack Exchange does not sound promising. However the MIT licenced luawinfile Windows (only compile on mingw NOT MSVC) filename translator (converts UTF-8 file names to/from the UTF-16 that must be used with the Windows file-handling API) looks a bit better - it provides replacements for the LFS module that can take UTF-8 file and path names. |
Good find. Just to throw it out there, we have https://github.com/starwing/luautf8 already in Mudlet, is there anything in that which could help us? |
SlySven, your list of 15 directory names seems wrong. For example, 13 should read |
Ah, that is the mark-up system interfering - in some contexts in here a backslash escapes the following character which is needed e.g. if you want to show a less than symbol in ordinary text like this "<" you will not be seeing the backslash there... and I'd used single ordinary quotes rather than the code quotes - edited to fix the quoting. |
The |
Hmm but we do not use |
It's not only a replacement for Edit to add: The |
Seems like we can just write our own |
How can we push this forward? |
I have raised an issue on the luawinfile repository asking about 5.1 compatibility but I have taken a look and it does actually use some 5.3 language features that are not provided by lua 5.1 - there is a separate, official, 5.3 compatibility module that attempts to provide some of the missing features to 5.2 and 5.1 but it is not without some other complications so is not a drop in solution. |
Seems related to #229 |
|
We will need to backport the MIT licensed https://github.com/cloudwu/luawinfile (a single C file of around 884 lines {808 soc} of code) from 5.3 to 5.1 to accommodate some features that are not present in the earlier version of lua that Mudlet uses. This will require someone with a better grasp of lua-C coding than I feel up to currently, I think. However it seems to be something that can be done and tested independently without worrying too much about the rest of the code-base - though it can only really be tested on a Windows development platform. |
The other issue is that people can't save their profiles on windows with non-english usernames - no history is written. Don't think we have a ticket for that. |
@SlySven |
Not really, I do think that back porting As people may have noticed my primary Windows development platform is not the most conformant (a Windows 7 laptop with a 64-bit processor but running the 32-bit version) - my main PC also has a 64-bit Windows 7 but that triple-boot machine has not run that OS for months so I have several hours of staring at a "Updating Windows... do not switch off" screen to look forward to and I am not that motivated, ATM! Although, now that the Qt on-line installer finally seems to have switched to offering only a 64-bit Mingw64 Windows install - compared to the previous 32-bit only Mingw one I might considered doing so if I have some hours to throw away... |
Looking good... This is thanks to https://gist.github.com/Egor-Skriptunoff/2458547aa3b9210a8b5f686ac08ecbf0 which was created at the beginning of the year. |
Will be available in Mudlet 3.22 |
Brief summary of issue / Description of requested feature:
Special characters in user / directory name should not influence / hinder Mudlet functionality.
This seems to have come in a somewhat recent update to Mudlet.
Also breaks much more functionality than merely Geyser.
Steps to reproduce the issue / Reasons for adding feature:
C:\Program Files\
to the user profile and I can't remember that we changed anything in that place lately. The code looks as if it should handle UTF-8 pathnames correctlyError output / Expected result of feature
[ERROR] LuaGlobal.lua compile error
Error from Lua: cannot open /LuaGlobal.lua: No such file or directory
Extra information, such as Mudlet version, operating system and ideas for how to solve / implement:
Mudlet 3.8.1 on Win7
The text was updated successfully, but these errors were encountered: