-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix ilasm managed resource lookup on Linux. #28104
Fix ilasm managed resource lookup on Linux. #28104
Conversation
This change has a corresponding PR on the mainline repo: dotnet/runtime#42735 |
e189533
to
97e6c8c
Compare
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.
97e6c8c
to
5beca66
Compare
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.
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 |
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.
#ifdef TARGET_UNIX
is a preferred way now, can you please change it here and at the two other places?
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.
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.
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.
Ah, I am sorry, I have not noticed this is the 3.1 port and not the original 5.0 change.
@jeffschwMSFT do you think this change would meet the bar to get accepted into 3.1? |
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. |
@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. |
@jeffschwMSFT is this critical for November servicing? |
@wtgodbe we were closing on a few details internally. We plan on considering this issue in an upcoming servicing release |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
* 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.
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.