Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Multi-level SharedFX lookup implemented.#1241

Merged
cakine merged 2 commits into
dotnet:masterfrom
cakine:sharedFXLookup
Feb 21, 2017
Merged

Multi-level SharedFX lookup implemented.#1241
cakine merged 2 commits into
dotnet:masterfrom
cakine:sharedFXLookup

Conversation

@cakine
Copy link
Copy Markdown

@cakine cakine commented Jan 21, 2017

Framework search is done in relation to the executable directory. It would be better to be able to search for it in other directories as well. Suggested folders are the current working directory, the user location and the global .NET location. The user and global folders may vary depending on the running operational system. They are defined as follows:

User location:
• Windows 32-bit: %SystemDrive%\Users\username.dotnet\x86
• Windows 64-bit: %SystemDrive%\Users\username.dotnet\x64
• Unix 32-bit: /home/username/.dotnet/x86
• Unix 64-bit: /home/username/.dotnet/x64

Global .NET location:
• Windows 32-bit: %SystemDrive%\Program Files\dotnet
• Windows 64-bit (32-bit application): %SystemDrive%\Program Files (x86)\dotnet
• Windows 64-bit (64-bit application): %SystemDrive%\Program Files\dotnet
• Unix: the directory of “dotnet” defined in the system path.

@dnfclas
Copy link
Copy Markdown

dnfclas commented Jan 21, 2017

Hi @cakine, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by .NET Foundation and real humans are currently evaluating your PR.

TTYL, DNFBOT;

@cakine
Copy link
Copy Markdown
Author

cakine commented Jan 21, 2017

@schellap

@schellap
Copy link
Copy Markdown

Cc @gkhanna79 @ramarag

Comment thread src/corehost/cli/fxr/fx_muxer.cpp Outdated
std::vector<pal::string_t> hive_dir;

//Multi-level SharedFX lookup happens only if dotnet_lookup env var is set to 1
if (pal::getenv(_X("dotnet_lookup"), &env_lookup) && env_lookup == _X("1"))

This comment was marked as spam.

This comment was marked as spam.

@schellap
Copy link
Copy Markdown

Pls. fix spacing and the PR feedback otherwise, this looks fine to me!

@schellap
Copy link
Copy Markdown

schellap commented Jan 21, 2017

@ramarag this PR has changes ported from PR #1109, pls. decide on the merge order between the two.

Comment thread src/corehost/cli/fxr/fx_muxer.cpp Outdated

if (pal::getcwd(&cwd))
{
hive_dir.push_back(cwd);

This comment was marked as spam.

This comment was marked as spam.

Comment thread src/corehost/cli/fxr/fx_muxer.cpp Outdated
std::vector<pal::string_t> hive_dir;

//Multi-level SharedFX lookup happens only if dotnet_lookup env var is set to 1
if (pal::getenv(_X("DOTNET_ORDERED_LOOKUP"), &env_lookup) && env_lookup == _X("1"))

This comment was marked as spam.

This comment was marked as spam.

Comment thread src/corehost/cli/fxr/fx_muxer.cpp Outdated
append_path(&fx_dir, fx_name.c_str());

bool do_roll_forward = false;
if (specified_fx_version.empty())

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Comment thread src/corehost/cli/fxr/fx_muxer.cpp Outdated

if (!do_roll_forward)
{
trace::verbose(_X("Did not roll forward because specified version='%s', patch_roll_fwd=%d, chose [%s]"), specified_fx_version.c_str(), config.get_patch_roll_fwd(), fx_ver.c_str());

This comment was marked as spam.

Comment thread src/corehost/cli/fxr/fx_muxer.cpp Outdated
if (!do_roll_forward)
{
trace::verbose(_X("Did not roll forward because specified version='%s', patch_roll_fwd=%d, chose [%s]"), specified_fx_version.c_str(), config.get_patch_roll_fwd(), fx_ver.c_str());
append_path(&fx_dir, fx_ver.c_str());

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Comment thread src/corehost/common/pal.h Outdated
bool get_own_executable_path(string_t* recv);
bool getenv(const char_t* name, string_t* recv);
bool get_default_servicing_directory(string_t* recv);
bool get_local_dotnet_dir(string_t* recv);

This comment was marked as spam.

This comment was marked as spam.

Comment thread src/corehost/common/pal.unix.cpp Outdated
pal::string_t dir;
if (!pal::getenv("HOME", &dir))
{
struct passwd* pw = getpwuid(getuid());

This comment was marked as spam.

This comment was marked as spam.

Comment thread src/corehost/common/pal.unix.cpp Outdated
pal::string_t path;
if (!pal::getenv(_X("PATH"), &path))
{
return false;

This comment was marked as spam.

This comment was marked as spam.

@gkhanna79 gkhanna79 added the * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) label Jan 23, 2017
@gkhanna79
Copy link
Copy Markdown
Member

Also, can you please add tests for the new scenarios to your PR?

Comment thread src/corehost/cli/fxr/fx_muxer.cpp Outdated
std::vector<pal::string_t> hive_dir;

//Multi-level SharedFX lookup happens only if dotnet_lookup env var is set to 1
if (pal::getenv(_X("DOTNET_ORDERED_LOOKUP"), &env_lookup) && env_lookup == _X("1"))

This comment was marked as spam.

This comment was marked as spam.

@cakine cakine force-pushed the sharedFXLookup branch 4 times, most recently from 36122e8 to 22ef56d Compare January 23, 2017 22:39
@gkhanna79
Copy link
Copy Markdown
Member

@ramarag PTAL

@cakine Can you please add scenario tests as well?

Comment thread src/corehost/cli/fxr/fx_muxer.cpp Outdated
std::vector<pal::string_t> hive_dir;

//Multi-level SharedFX lookup happens only if dotnet_lookup env var is set to 1
bool multilevel_lookup = pal::getenv(_X("DOTNET_MULTILEVEL_LOOKUP"), &env_lookup) && env_lookup == _X("1");

This comment was marked as spam.

This comment was marked as spam.

@gkhanna79
Copy link
Copy Markdown
Member

Change looks good to me. Will you be able to get the tests incorporated as well?

@cakine
Copy link
Copy Markdown
Author

cakine commented Jan 24, 2017

I'm just finishing the md file right now. I still need to take a look at how the HostActivation Tests are done, though.

@cakine cakine force-pushed the sharedFXLookup branch 2 times, most recently from dd5d6e8 to 8041e96 Compare January 24, 2017 19:01
{
throw new DirectoryNotFoundException();
}
Directory.Delete(sharedFxDir, true);

This comment was marked as spam.

// completed, the folder is supposed to be empty. We're just playing safe
if (Directory.Exists(multilevelDir))
{
Directory.Delete(multilevelDir, true);

This comment was marked as spam.

@cakine
Copy link
Copy Markdown
Author

cakine commented Feb 14, 2017

@mmitche @ellismg I'm facing an issue with the Fedora23 x64 build. I was not able to reproduce the bug locally (the build succeeds in my Fedora VM). Is it possible for me to access the VM where the checks are being run?

@cakine cakine force-pushed the sharedFXLookup branch 9 times, most recently from 5c01574 to e482331 Compare February 16, 2017 22:51
@cakine
Copy link
Copy Markdown
Author

cakine commented Feb 16, 2017

@gkhanna79

Comment thread src/corehost/cli/fxr/fx_muxer.cpp Outdated
pal::string_t env_lookup;

// Multi-level SharedFX lookup happens only if DOTNET_MULTILEVEL_LOOKUP env var is set to 1
bool multilevel_lookup = pal::getenv(_X("DOTNET_MULTILEVEL_LOOKUP"), &env_lookup) && (env_lookup == _X("1"));

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@gkhanna79
Copy link
Copy Markdown
Member

I am good with this change. @ramarag Do you have anything to add?

@gkhanna79
Copy link
Copy Markdown
Member

@cakine I see your newly added test failing in the log (see https://ci.dot.net/job/dotnet_core-setup/job/master/job/release_windows_nt_x64_prtest/636/consoleFull):

11:12:18 [EXEC <] [FAIL] [00:00:17.928] D:\j\workspace\release_windo---0c55dee9\artifacts\win81-x64\tests\artifacts\dotnetMultilevelSharedFxLookup\2\cwd> D:\j\workspace\release_windo---0c55dee9\artifacts\win81-x64\tests\artifacts\dotnetMultilevelSharedFxLookup\2\exe\dotnet.exe "--fx-version" "9999.0.0-dummy1" "D:\j\workspace\release_windo---0c55dee9\artifacts\win81-x64\tests\artifacts\5\SharedFxLookupPortableApp\bin\SharedFxLookupPortableApp.dll" exited with -2147450749

Can you please take a look?

.Should()
.Fail()
.And
.HaveStdErrContaining("It was not possible to find any compatible framework version");

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@gkhanna79
Copy link
Copy Markdown
Member

I am planning to merge #1560. Once it is merged, you should rebase against it and update your negative test to invoke the Execute method as exemplified in that PR. This will keep real test passes segregated from real failures.

@gkhanna79
Copy link
Copy Markdown
Member

@cakine I have merged the PR - please rebase against it and update your test.

@cakine
Copy link
Copy Markdown
Author

cakine commented Feb 21, 2017

@gkhanna79 Done.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

* NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants