-
Notifications
You must be signed in to change notification settings - Fork 46
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
add diffoscope output for ldapchai-0.8.6.jar #445
base: master
Are you sure you want to change the base?
Conversation
│ │ - switch (type.ordinal()) { | ||
│ │ - case 0: { | ||
│ │ + switch (AbstractChaiEntry.AbstractChaiEntry$1.$SwitchMap$com$novell$ldapchai$impl$AbstractChaiEntry$NetworkAddressType[type.ordinal()]) { | ||
│ │ + case 1: { |
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 is quite weird how the switch condition changes.
At bytecode level, the change is:
- 74: aload_3
- 75: invokevirtual #175 // Method com/novell/ldapchai/cr/HashSaltAnswer$VERSION.ordinal:()I
- 78: lookupswitch { // 2
- 0: 104
- 1: 123
- default: 157
+ 74: getstatic #175 // Field com/novell/ldapchai/cr/HashSaltAnswer$1.$SwitchMap$com$novell$ldapchai$cr$HashSaltAnswer$VERSION:[I
+ 77: aload_3
+ 78: invokevirtual #181 // Method com/novell/ldapchai/cr/HashSaltAnswer$VERSION.ordinal:()I
+ 81: iaload
+ 82: lookupswitch { // 2
+ 1: 108
+ 2: 127
+ default: 161
There seems to a field access, getstatic
, which is quite strange.
│ │ - 1: aload_2 | ||
│ │ - 2: putfield #1 // Field val$apacheResponse:Lorg/apache/directory/api/ldap/model/message/ExtendedResponse; | ||
│ │ + 1: aload_1 | ||
│ │ + 2: putfield #1 // Field this$0:Lcom/novell/ldapchai/provider/ApacheLdapProviderImpl; | ||
│ │ 5: aload_0 | ||
│ │ - 6: aload_1 | ||
│ │ - 7: putfield #7 // Field this$0:Lcom/novell/ldapchai/provider/ApacheLdapProviderImpl; | ||
│ │ + 6: aload_2 | ||
│ │ + 7: putfield #7 // Field val$apacheResponse:Lorg/apache/directory/api/ldap/model/message/ExtendedResponse; |
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.
The statements in the constructor are swapped. Although they are independent of each other, they are still semantically non-equivalent.
- ApacheLdapProviderImpl$2(final ApacheLdapProviderImpl this$0, final org.apache.directory.api.ldap.model.message.ExtendedResponse var2) {
+ ApacheLdapProviderImpl$2(ApacheLdapProviderImpl this$0, org.apache.directory.api.ldap.model.message.ExtendedResponse var2) {
- this.val$apacheResponse = var2;
this.this$0 = this$0;
+ this.val$apacheResponse = var2;
}
│ │ - 45: invokeinterface #49, 1 // InterfaceMethod com/novell/ldapchai/provider/ChaiProviderImplementor.getClass:()Ljava/lang/Class; | ||
│ │ - 50: invokestatic #53 // Method java/lang/reflect/Proxy.isProxyClass:(Ljava/lang/Class;)Z | ||
│ │ - 53: ifeq 76 | ||
│ │ - 56: aload_0 | ||
│ │ - 57: instanceof #28 // class com/novell/ldapchai/provider/WireTraceWrapper | ||
│ │ - 60: ifeq 76 | ||
│ │ - 63: getstatic #27 // Field LOGGER:Lcom/novell/ldapchai/util/internal/ChaiLogger; | ||
│ │ - 66: invokedynamic #59, 0 // InvokeDynamic #1:get:()Ljava/util/function/Supplier; | ||
│ │ - 71: invokevirtual #37 // Method com/novell/ldapchai/util/internal/ChaiLogger.warn:(Ljava/util/function/Supplier;)V | ||
│ │ + 45: invokevirtual #49 // Method java/lang/Object.getClass:()Ljava/lang/Class; |
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.
invokeinterface
is replaced by invokevirtual
. I thought this was a build environment problem, but when I built with jdk=8
, I got an error but I did not investigate.
@hboutemy my question is do you think any of these issues are just because of some JVM version inconsistency? Or do you think these are proper semantic differences and the developer should fix them? |
developer used a compiler: he did not do anything for that, I don't see how asking him to fix anything could make anything actionable from his perspective
this would be my fisrt investigation: try rebuilding with many different patch level jdk, and notarizing if bytecode changes at any time when some levels of patch are reached = what I suppose happens: in theory, I'm pretty sure we could track the root cause at some change in |
I thought this could be the types of change where the developer could fix by changing the code. For example, consider
Okay, validates my reasoning that this is the fault of |
@algomaster99 2 interested cases for you:
|
I am analyzing diffs that either show a difference using
javap
orprocyon
. One of the first cases I stumbled upon is that the reference and rebuild ofldapchai-0.8.6
jar. In this PR, the main goal is to discuss them. There are three reasons why build is not reproducible. I will put them as comments, but here is summary:lookupswitch
is organised differently.invokeinterface
is changed toinvokevirtual
of.getClass()
in the rebuild.Note that the diffoscope file is extremely truncated. The first commit had 50,000 lines. However, the above three are the major issues shown by
procyon
andjavap
. Also, I use a normalization tooljNorm
[1] that eliminates basic issues like constant pool ordering and numbering.[1] Stefan Schott, Serena Elisa Ponta, Wolfram Fischer, Jonas Klauke, and Eric Bodden. Java Bytecode Normalization for Code Similarity Analysis (Artifact). In Special Issue of the 38th European Conference on Object-Oriented Programming (ECOOP 2024). Dagstuhl Artifacts Series (DARTS), Volume 10, Issue 2, pp. 20:1-20:3, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2024)
https://doi.org/10.4230/DARTS.10.2.20