Skip to content
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

Fix ber scanf/printf, fix for a reverted PR. #52178

Merged
merged 4 commits into from
May 8, 2021

Conversation

sandreenko
Copy link
Contributor

#51205 was reverted because of the failures on arm64 Linux.

@jkoritzinsky, @AaronRobinsonMSFT PTAL at the last commit here. Thanks for pointing me to https://docs.microsoft.com/en-us/dotnet/standard/native-interop/best-practices#cc-long, I have tried to use CULong but it is supported only by 6.0, so I would have to delete netcoreapp2.0 and netstandard2.0 support
from

<TargetFrameworks>$(NetCoreAppCurrent)-windows;netcoreapp2.0-windows;$(NetCoreAppCurrent)-OSX;netcoreapp2.0-OSX;$(NetCoreAppCurrent)-Linux;netcoreapp2.0-Linux;netstandard2.0</TargetFrameworks>

and
<TargetFrameworks>$(NetCoreAppCurrent)-windows;netstandard2.0;netcoreapp2.0-windows</TargetFrameworks>

and I guess it is not desired?

The fix was to use nuint instead of unit so the default tag value is passed as 0xffffffffffffffff on Linux. This parameter is not used for Windows, so we don't care about it there.

Fixes #49105.

@sandreenko
Copy link
Contributor Author

/azp run runtime-libraries-coreclr outerloop-osx, runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@sandreenko
Copy link
Contributor Author

The tests involving the new code have passed on windows x64/linux x64/linux arm64/MacOS x64/MacOS arm64.
The failures are unrelated.

@sandreenko
Copy link
Contributor Author

I would like to merge this PR this week if possible, could somebody please take a look? @AaronRobinsonMSFT, @jkoritzinsky

Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT left a comment

Choose a reason for hiding this comment

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

I think there is a place where tag is used when it should be passed as a 32-bit integer not 64-bit. Overall I don't see anything of concern.

@@ -15,19 +15,19 @@ internal static class BerPal

internal static int FlattenBerElement(SafeBerHandle berElement, ref IntPtr flattenptr) => Interop.Ldap.ber_flatten(berElement, ref flattenptr);

internal static int PrintBerArray(SafeBerHandle berElement, string format, IntPtr value, int tag) => Interop.Ldap.ber_printf(berElement, format, __arglist(value));
internal static int PrintBerArray(SafeBerHandle berElement, string format, IntPtr value, nuint tag) => Interop.Ldap.ber_printf(berElement, format, __arglist(value));
Copy link
Member

Choose a reason for hiding this comment

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

Do we want nuint on Windows? If the type is defined to be C unsigned long then it should be uint since on Windows a C unsigned long is 32-bits

Copy link
Member

Choose a reason for hiding this comment

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

Oops. I misread the comments in the PR. Let's change tag to _ since it isn't used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can I have several args named "_", like:

public static int ber_printf_tag(SafeBerHandle _, string _, nuint _)

?


internal static int ScanNext(SafeBerHandle berElement, string format) => Interop.Ldap.ber_scanf(berElement, format);
internal static int PrintTag(SafeBerHandle berElement, string format, nuint tag) => Interop.Ldap.ber_printf(berElement, format, __arglist(tag));
Copy link
Member

Choose a reason for hiding this comment

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

Is it supposed to be used here? Cast to uint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you are right, fixed, don't understand why x86 Libraries tests passed with this.

@sandreenko
Copy link
Contributor Author

/azp run runtime-libraries-coreclr outerloop-osx, runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@sandreenko
Copy link
Contributor Author

runtime-libraries-coreclr outerloop had 32 failures, runtime-libraries-coreclr outerloop-osx had 8 failures. They all were marked as new but looked unrelated but I did not see some of them in the previous so I decided to double-check and triggered the main testing and it showed the same results without my changes runtime-libraries-coreclr outerloop 38 failures, runtime-libraries-coreclr outerloop-osx 6 failures and the set was ~the same.
So I think the failures are not related.

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

Successfully merging this pull request may close these issues.

[macOS-arm64] 55 System.DirectoryServices.Protocols.Tests fail on CoreCLR
3 participants