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

Conversation

MarkpageBxl
Copy link

ILAsm did not properly find managed resources if they were not in the
working directory of ILAsm itself. While there was a provision for
Windows-based systems using backslashes as directory separators, there
was no such provision for *nix-based systems using forward slashes.

This commit enables ILAsm to lookup both types of directory separators.

@MarkpageBxl
Copy link
Author

This change has a corresponding PR on the mainline repo: dotnet/runtime#42735

@MarkpageBxl MarkpageBxl force-pushed the ilasm-managed-resources-path-fix-3.1 branch 2 times, most recently from e189533 to 97e6c8c Compare October 4, 2020 20:32
ILAsm did not properly parse paths on *nix systems, which notably broke
the inclusion of managed resources in an assembly. This commit enables
ILAsm to support both types of directory separators by relying on the
DIRECTORY_SEPARATOR_CHAR_A macro where relevant.
We rely on the FEATURE_PAL macro to determine whether we are targeting a
*nix platform.
@MarkpageBxl MarkpageBxl force-pushed the ilasm-managed-resources-path-fix-3.1 branch from 97e6c8c to 5beca66 Compare October 4, 2020 21:01
Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good after fixing the ifdef.

wcscpy_s(wzFileName,2048,pwzInputFiles[j]);
pwz = wcsrchr(wzFileName,'\\');
pwz = wcsrchr(wzFileName,DIRECTORY_SEPARATOR_CHAR_A);
#ifndef FEATURE_PAL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#ifdef TARGET_UNIX is a preferred way now, can you please change it here and at the two other places?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Jan, it looks like the TARGET_UNIX macro doesn't exist on the 3.1 branch, only on the mainline. FEATURE_PAL seemed to be the equivalent test on the older 3.1 codebase.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I am sorry, I have not noticed this is the 3.1 port and not the original 5.0 change.

@janvorli
Copy link
Member

janvorli commented Oct 5, 2020

@jeffschwMSFT do you think this change would meet the bar to get accepted into 3.1?

@jeffschwMSFT
Copy link
Member

Common questions we ask around assessing if this meets the bar is - is there a workaround and how blocking is this?

@janvorli is there a workaround?
@mlindstr is this blocking for you?

@janvorli
Copy link
Member

janvorli commented Oct 5, 2020

It seems that a workaround could be to copy the managed resources into the working directory of the ilasm. @mlindstr please correct me if I am wrong.

@MarkpageBxl
Copy link
Author

MarkpageBxl commented Oct 5, 2020

@janvorli That is correct, or otherwise making sure that ilasm is called with the expected working directory.

@jeffschwMSFT The workaround outlined by Jan would do the trick, but it would force us to hack a different behavior for the Windows and Linux platforms in our products. Our legacy language compilers target .NET Core, and we intend to only track LTS releases for maintenance purposes. We believe this fix is minor and low risk, and it would greatly help us to have it land to enable our compiler stack to work properly on Linux without having to hack a solution until 6.0 LTS is released.

@wtgodbe
Copy link
Member

wtgodbe commented Oct 19, 2020

@jeffschwMSFT is this critical for November servicing?

@jeffschwMSFT jeffschwMSFT added area-CodeGen Servicing-consider Issue for next servicing release review labels Oct 21, 2020
@jeffschwMSFT jeffschwMSFT added this to the 3.1.x milestone Oct 21, 2020
@jeffschwMSFT
Copy link
Member

@wtgodbe we were closing on a few details internally. We plan on considering this issue in an upcoming servicing release

@leecow leecow added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Oct 22, 2020
@leecow leecow modified the milestones: 3.1.x, 3.1.11 Oct 22, 2020
@wtgodbe
Copy link
Member

wtgodbe commented Nov 13, 2020

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@wtgodbe wtgodbe merged commit 96193fb into dotnet:release/3.1 Nov 16, 2020
sdmaclea pushed a commit to sdmaclea/coreclr that referenced this pull request Jan 12, 2021
* Fix ilasm path parsing on *nix.

ILAsm did not properly parse paths on *nix systems, which notably broke
the inclusion of managed resources in an assembly. This commit enables
ILAsm to support both types of directory separators by relying on the
DIRECTORY_SEPARATOR_CHAR_A macro where relevant.

* Only consider colon as a special path character on Windows.

We rely on the FEATURE_PAL macro to determine whether we are targeting a
*nix platform.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants