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

Added top-level comaprator script #4008

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

judovana
Copy link
Contributor

Hello! I believe the #3991 was closed due to not understanding waht it is doing.

This script is not doing any rebuild, and thus is not comparing on identity, but on binary identically builds only. As it is, it do ot have any similar work present in the toolchain. Can you please reconsider its inclusion?

maybe the in file/main readme:

# This is top level script for comparing two jdks.  It 
# This script expects exactly two args - tag:os.arch/dir/archive, two times
# eg: compare_builds.sh  /usr/lib/jvm/java-21-openjdk /my/home/my_custom_tarball.tar.xz
# eg: compare_builds.sh  /my/custom/dir/with_jdk jdk-21.0.4+7:windows.x64
# if the parameter is tag, the temurin jdk of given tag:os.arch is downloaded
# yo can omit the :os.arch part, then it will be guessed... but you may know better
# It copies and creates all in CWD!!!!
# Pass the files/dirs as absolute values, it should not be that hard
# It is useful to have JAVA_HOME pointing to some other JDK used to compile and run supporting files
# otherwise one of the provided JDKs will be duplicated, and used
# for your own safety, do not run it as root
#
# The JDK you are comparing is launched to get various info about itself
# If you need to compare jdks on different platform then they are for, you need to go manually.

is misleading?

@github-actions github-actions bot added the windows Issues that affect or relate to the WINDOWS OS label Oct 25, 2024
@judovana
Copy link
Contributor Author

judovana commented Oct 31, 2024

Thje label is not correct this is cygwin (thus windows) and linux

@judovana
Copy link
Contributor Author

judovana commented Nov 5, 2024

Hello good people. Anybody around? The #3991 was closed as duplicate, and there is no duplicate toolchain. All the tools are written, but the readme is quite complex, and one must follow it. In addition there are quite a few corenr cases.

This script remains valid contribution, which is putting it all together. I found small intersection with detection of signtool, but thats all.

@karianna
Copy link
Contributor

karianna commented Nov 5, 2024

needs linter fixes to start with.

@judovana
Copy link
Contributor Author

judovana commented Nov 6, 2024

@karianna the linter is all green, but the job never finishes and timeouts:(

@karianna
Copy link
Contributor

I see:

File:[/github/workspace/tooling/compare-builds.sh]
2024-11-10 01:46:57 [WARN] Warnings found in [bash-exec] linter!
2024-11-10 01:46:57 [WARN] Error: File:[/github/workspace/tooling/compare-builds.sh] is not executable

@judovana
Copy link
Contributor Author

judovana commented Nov 11, 2024 via email

@karianna
Copy link
Contributor

OK so the linter fails on JSCPD, ew have a config file for this, have you tried running locally?

@judovana
Copy link
Contributor Author

judovana commented Nov 12, 2024

Even the local npx jscpd -v compare-builds.sh runs for ever. The method of tapsAndJunits is guilty. Up to local totalOnlyIn is ok, but then more and more lines is added, it runs longer^lines so since some 5 lines I had never seen an end. Similarly when cutting from bottom, from aprox printXmlTest "compare" "compared-files-count" "2" "${totalFile}" "../artifact/$(basename "${totalFile}")" >> "${unitFile}" it starts to go longer^lines again.

the

 if [ "${totalDiffs}" -eq 0 ] ; then
      passed=$(("${passed}"+1))
    else
      failed=$(("${failed}"+1))
    fi
    if [ "${totalFiles}" -ne 0 ] ; then
      passed=$(("${passed}"+1))
    else
      failed=$(("${failed}"+1))
    fi
    if [ "${totalOnlyIn}" -eq 0 ] ; then
      passed=$(("${passed}"+1))
    else
      failed=$(("${failed}"+1))
    fi
    total=$(("${passed}"+"${failed}"))
    printXmlHeader "${passed}" "${failed}" "${total}" 0 "compare-comparable-builds" > "${unitFile}"
    tapHeader "${total}"  "$(date)" > "${resultsTapFile}"
    if [ "${totalDiffs}" -eq 0 ] ; then
      printXmlTest "compare" "differences-count" "1" "" "../artifact/$(basename "${differencesFile}")" >> "${unitFile}"
      tapTestStart "ok" "1" "differences-count" >> "${resultsTapFile}"
      echo "-- no differences --"
    else
      printXmlTest "compare" "differences-count" "1" "${differencesFile}" "../artifact/$(basename "${differencesFile}")" >> "${unitFile}"
      tapTestStart "not ok" "1" "differences-count" >> "${resultsTapFile}"
      echo "-- differences count: $totalDiffs --"
    fi
    set +e
      tapFromWholeFile "${differencesFile}" "${differencesFile}" >> "${resultsTapFile}"
      tapTestEnd >> "${resultsTapFile}"
    set -e
    if [ "${totalFiles}" -ne 0 ] ; then
      printXmlTest "compare" "compared-files-count" "2" "" "../artifact/$(basename "${totalFile}")" >> "${unitFile}"
      tapTestStart "ok" "2" "compared-files-count" >> "${resultsTapFile}"
      echo "-- files compared: $totalFiles --"
    else
      printXmlTest "compare" "compared-files-count" "2" "${totalFile}" "../artifact/$(basename "${totalFile}")" >> "${unitFile}"
      tapTestStart "not ok" "2" "compared-files-count" >> "${resultsTapFile}"
      echo "-- no files compared --"
    fi
    set +e
      tapFromWholeFile "${totalFile}" "${totalFile}" >> "${resultsTapFile}"
      tapTestEnd >> "${resultsTapFile}"
    set -e
    if [ "${totalOnlyIn}" -eq 0 ] ; then
      printXmlTest "compare" "onlyin-count" "3" "" "../artifact/$(basename "${differencesFile}")" >> "${unitFile}"
      tapTestStart "ok" "3" "onlyin-count" >> "${resultsTapFile}"
      echo "-- no onlyin files --"
    else
      printXmlTest "compare" "onlyin-count" "3" "${differencesFile}" "../artifact/$(basename "${differencesFile}")" >> "${unitFile}"
      tapTestStart "not ok" "3" "onlyin-count" >> "${resultsTapFile}"
      echo "-- onlyin files count: $totalOnlyIn --"
    fi
    set +e
      tapFromWholeFile "${differencesFile}" "${differencesFile}" >> "${resultsTapFile}"
      tapTestEnd >> "${resultsTapFile}"
    set -e
    if [ $GLOABL_RESULT -eq 0 ] ; then
      printXmlTest "compare" "comparable-builds" "4" "" "../artifact/$(basename "${diffFileParam}")" >> "${unitFile}"
      tapTestStart "ok" "4" "comparable-builds" >> "${resultsTapFile}"
      echo "-- COMPARABLE --"
    else
      printXmlTest "compare" "comparable-builds" "4" "${diffFileParam}" "../artifact/$(basename "${diffFileParam}")" >> "${unitFile}"
      tapTestStart "not ok" "4" "comparable-builds" >> "${resultsTapFile}"
      echo "-- MISMATCH --"
    fi

Is malicious. That code is obviously so nasty it deadlocks the tool. I will decompose it a bit.

@judovana
Copy link
Contributor Author

On contrary, when rest of the file is removed, and only "that" code is left in, it is in few ms finsihed.

@judovana
Copy link
Contributor Author

No success to narrow it more. Filed kucherenko/jscpd#716

Will redactor the tapsAndJunits method to be more human (and thus JSCPD) friendly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
windows Issues that affect or relate to the WINDOWS OS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants