Closed megahirt closed 1 year ago
Hum, I feel like we need a way to reproduce this in order to move forward with it, otherwise it'll take forever to fix and test and we might break other stuff.
yes, I agree. Unfortunately I need to resist the temptation to work on this until after LFCon23 :)
Looked into the code involved. The null
is the commit log directory, which is a private class member set in SharedXMLBackendProvider's constructor. It's only set if MiscUtils.IsMono
is true (to either /dev/shm
to use a memory-mapped file, or to the system temp path if /dev/shm
is not present). But the Path.Combine call is also only called if MiscUtils.IsMono
is true, so it's a mystery to me how it can be getting called with a null first argument. Nevertheless, that's the code path indicated by that stack trace.
That darn IsMono check again. It sounds like someone needs to go through all the code and update all those checks. In the past IsMono also meant IsLinux or Mac, but now it doesn't and IsMono can be false when it's running on Linux and that's causing issues like this where the IsMono check should actually be an IsLinux check. This is what this PR fixed but only for that one line.
It's worth noting that I've run into cases where System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform
actually gave the wrong result, reporting Windows when LfMerge was running on Linux under Mono. (I don't think this will happen any more under .Net Core). Therefore, it may be worth being slightly paranoid about such checks, and using the approach I found in https://stackoverflow.com/a/38795621 to glean that information from the runtime environement, as follows:
windir
. Ensure its value contains a backslash and the directory exists. If so, Windows./proc/sys/kernel/ostype
. It should contain "Linux", case-insensitive (i.e., using OrdinalIgnoreCase for the comparison). If so, Linux (or Android).If it's necessary to distinguish between Linux and Android, then some further check might be necessary.
Oh wait, I just saw that I was looking at some older code in liblcm. There is no longer any mystery about why the code path was followed: in https://github.com/sillsdev/liblcm/pull/272, @hahn-dev changed one of the two checks to MiscUtils.IsLinux but missed that the other one needed to be changed as well. I'll submit another PR to liblcm to fix that.
https://github.com/sillsdev/liblcm/pull/280 will fix this issue. Haven't tested it yet, but I'm 100% confident that this will work.
ooh I see. Nice find. Though I do hope this doesn't just bubble up to another issue.
resolved by #331
A follow-up exception when trying to fix stuck projects as documented in #317