-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Don't fail loading subprojects if subprojects_dir is in a subdirectory #2943
Conversation
The appveyor test failure seems relevant. |
@jpakkane Hmm... Is it really? I unfortunately have no idea on Windows things. To me it looks like Meson works as intended (the output is perfectly okay, since some subprojects are expected to fail / not be found), but then for some reason the VisualStudio solution fails to compile, and I don't see any actual reason for that in the logs. I briefly thought it would just grep for "error" in the logs, but that can't be the case as well. |
@jpakkane According to the AppVeyor matrix, the only difference between a working build and a successful one is a different MSVC version (MSVC2015 works, MSVC2017 fails) - therefore, I don't think the issue is related to this PR. |
Retriggered build to see if it was sporadic. |
Is this still needed after #2890? |
@nirbheek Yes, this is a different bug of subprojects failing to configure if they are referenced by another project and are using a non-standard project directory. The previous bug was about subprojects failing to configure if they were using a subproject_dir in general. @jpakkane The Travis build fails in one of the matrix builds while trying to fetch the container, so that one is definitely not related to this PR. The AppVeyer CI succeeds for all builds except the vs2017 backend on Windows (ninja works), and I have no idea why - so, if this is indeed related to this PR, I would need some help to figure out what is wrong, because I have no idea on how the vs2017 (or even Visual Studio) works here and also no way to test anything. |
mesonbuild/interpreter.py
Outdated
depth += 1 | ||
subproj_name = segs[1] | ||
segs = segs[2:] | ||
segs_spd = subproject_dirname.split(os.path.sep) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use pathlib.PurePath
for all path manipulation. This will break if you use 'foo/bar' on Windows.
Hmm, now the vs2015 backend failed as well in AppVeyor, while previously only the vs2017 backend test failed - and the only change was using PurePath now, as suggested by Nirbheek. |
Strange, I can't see why only some of the backends would fail. |
Also, this needs a test or it'll get broken again. |
Added test (fails with EDIT: Also rebased patches on master |
Previously, Meson was showing a subproject being downloaded after later claiming it doesn't exist. This patch shows the actual error to clarify why the given subproject can not be used.
I poked around a bit, and we are back to only one AppVeyor configuration failing, but this still does not make any sense to me. |
The reason this fails is the following: Starting with VS 2017 if the output of any command run by VS contains the word If you change the error text from |
@jpakkane Haha, that's awesome ^^ - thank you for looking into this! |
Starting with VS 2017 if the output of any command run by VS contains the word Error it will interpret that as a fatal error, even if the exit error code is zero. This messes up the unit tests on VS 2017, because we sometimes want to deliberately ignore error messages. Change "Error" to "Problem" to mitigate this issue until a more permanent solution is found.
This did the trick :-) |
0.44.1 should happen in the next few days. |
Nice, thanks! :-) - That will help a lot of projects running into these subproject issues on their CI. |
This resolves an error introduced in Meson 0.44.
If project B defines a
subproject_dir
of e.g.stuff/subprojects
, and depends on a project A that gets pulled in via a wrapfile, which itself tries to compile a filedefs.c
that belongs to project A, Meson will fail to configure the project with the very helpful message:Upon further investigation, it becomes clear that the real issue is
Sandbox violation: Tried to grab file defs.c from a nested subproject.
which is a wrong assumption from Meson, asdefs.c
clearly belongs to the right project.This PR will make Meson display a nicer error message in these scenarios, as well as fix the actual sandbox issue.
The whole process might need a bit more work though - or I don't understand it fully yet ;-)
The check contains the following line:
Supposedly, this is protecting the user from a subproject trying to access a file from a different nested subproject. But the previous code that generates
num_sps
as far as I can see doesn't prevent that:If the subproject A being loaded has overridden its
subproject_dir
to something that is not the exact same directory as the one from the main project, we will never get adepth
(==num_sps
) that is > 1.The third check there though, seems to prevent most of the errors and makes a lot of sense:
If the subproject configuration is executed recursively (what I assume), this check will reliably prevent people fro tampering with subproject files.
So, tl;dr: This PR fixes the regression from Meson 0.44, but might not also resolve the original issue that led to the regression in the first place (unless I don't fully understand how the subprojects logic works, which is very likely ^^).
See also issue #2719 , CC: @jpakkane