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

[0.7.4] Cannot access input property externalReports$kover_gradle_plugin of task #478

Closed
wezley98 opened this issue Oct 11, 2023 · 20 comments · Fixed by #506
Closed

[0.7.4] Cannot access input property externalReports$kover_gradle_plugin of task #478

wezley98 opened this issue Oct 11, 2023 · 20 comments · Fixed by #506
Assignees
Labels
Bug Bug issue type S: ready for release Status: merged in the main branch

Comments

@wezley98
Copy link

Describe the bug
Upgrade from 0.7.3 -> 0.7.4 (0.7.3 works as expected with no errors)

Errors
Cannot access input property 'externalReports$kover_gradle_plugin' of task ':kover:koverHtmlReportDebug'. Accessing unreadable inputs or outputs is not supported. Declare the task as untracked by using Task.doNotTrackState(). For more information, please refer to https://docs.gradle.org/8.4/userguide/incremental_build.html#disable-state-tracking in the Gradle documentation.

Expected behavior
Build passes with no errors

Environment

  • Kover Gradle Plugin version: 0.7.4
  • Gradle version: 8.4
  • Kotlin project type: Kotlin/Android
  • Coverage Toolset : default
@wezley98 wezley98 added Bug Bug issue type S: untriaged Status: issue reported but unprocessed labels Oct 11, 2023
@wezley98 wezley98 changed the title Cannot access input property 'externalReports$kover_gradle_plugin' of task Cannot access input property externalReports$kover_gradle_plugin of task Oct 11, 2023
@wezley98 wezley98 changed the title Cannot access input property externalReports$kover_gradle_plugin of task [0.7.4] Cannot access input property externalReports$kover_gradle_plugin of task Oct 11, 2023
@shanshin
Copy link
Collaborator

Hi,
It seems that this problem is not directly related to the version of Kover, because it has already been encountered before.

It is not possible to reproduce this problem locally, so a small project producer would really help us (if anyone encounters this error on a small open source project).

@shanshin shanshin added S: waiting for clarification Status: additional information required to proceed and removed S: untriaged Status: issue reported but unprocessed labels Oct 11, 2023
@guerrerorodrigo
Copy link

@shanshin we have the same issue. It appeared only when bumping to version 0.7.4. Nothing else changed, just the version.

@HarisHoulis
Copy link

We have the same exact issue.

Also, we noticed that Release 0.7.4 CI build fails here which seems it could be related to the suggestion Gradle prints (Incremental builds & Gradle cache)

@shanshin
Copy link
Collaborator

Also, we noticed that Release 0.7.4 CI build fails here which seems it could be related to the suggestion Gradle prints (Incremental builds & Gradle cache)

There are a lot of tests on the build cache, but only this one fell (it was unstable before), besides, it fell before using the cache.
It is unlikely that it is related to the current problem.

@shanshin
Copy link
Collaborator

@guerrerorodrigo, is it reproduced only on CI or also locally?
Is there a more detailed error ? For example like

> Cannot access input property 'externalSources$kover_gradle_plugin' of task ':app:koverXmlReportBetaPreProdDebug'. Accessing unreadable inputs or outputs is not supported. Declare the task as untracked by using Task.doNotTrackState(). See https://docs.gradle.org/8.1.1/userguide/incremental_build.html#disable-state-tracking for more details.
   > Failed to create MD5 hash for file '/usr/bin/sudo' as it does not exist.

in #391 (comment)

@HarisHoulis
Copy link

HarisHoulis commented Oct 11, 2023

@shanshin Weirdly it fails both locally. (reproduced across multiple machines) and on our CI but with different errors:

CI:

Cannot access input property 'externalReports$kover_gradle_plugin' of task ':app:koverXmlReportDebug'. Accessing unreadable inputs or outputs is not supported. Declare the task as untracked by using Task.doNotTrackState(). For more information, please refer to https://docs.gradle.org/8.4/userguide/incremental_build.html#disable-state-tracking in the Gradle documentation.

...
(stacktrace)
...

Could not stat file /__w/myProject/��9|���_��\fY\x03�g\c?*#�\v\x1E�S�ݒ`7�IE��\x0F��\f'��T�`F1��5�$�E��o5.>|\eߑ�-|��n�狘�i\x1E/***�\x1C���G���\x05��j*$/!�c~�I�5�\c?<�\a��8C��\x1A��v�HSc����Wr�pH+K��O?b�\x17(�ǹ��H�.�c��R��YY򳘣�\x11w��\x1D�\x15h�;w�\x03>\x0F\vx\x02���we����u�|��_***�v��������\x13��z��,�***�䞒�\x0F***���H�***����ttx\x05�1\a�<�W��p\a�9�)�***�***��\x15���j�yc***ۜ��+�sh�\x16Ӿz\f\x1C$\x1E�\x10q�\x19s�"Y\c?�&�y�.�\x1D:k��J\x115[��d�*c�I�

...
(stacktrace)
...

net.rubygrapefruit.platform.NativeException: Could not get file details of /__w/myproject/��9|���_��\fY\x03�g\c?*#�\v\x1E�S�ݒ`7�IE��\x0F��\f'��T�`F1��5�$�E��o5.>|\eߑ�-|��n�狘�i\x1E/***�\x1C���G���\x05��j*$/!�c~�I�5�\c?<�\a��8C��\x1A��v�HSc����Wr�pH+K��O?b�\x17(�ǹ��H�.�c��R��YY򳘣�\x11w��\x1D�\x15h�;w�\x03>\x0F\vx\x02���we����u�|��_***�v��������\x13��z��,�***�䞒�\x0F***���H�***����ttx\x05�1\a�<�W��p\a�9�)�***�***��\x15���j�yc***ۜ��+�sh�\x16Ӿz\f\x1C$\x1E�\x10q�\x19s�"Y\c?�&�y�.�\x1D:k��J\x115[��d�*c�I�: could not convert string to current locale

ℹ️ (the file path is exactly how it's being printed on our CI logs)

Locally:

Execution failed for task ':app:koverHtmlReportDebug'
Null byte present in file/path name. There are no known legitimate use cases for such data, but several injection attacks may use it

🤷🏻

@shanshin
Copy link
Collaborator

@HarisHoulis, if I publish a special version with advanced logging, could you run this version locally to test multiple versions?

There is an assumption that random files fall into the list of Kover artifacts, which Kover tries to read as a text file and parse file names from there.

@HarisHoulis
Copy link

@shanshin I will try to reproduce it in an open-source demo project and share it with you.

In the meantime, @wezley98 will @shanshin's proposal be of interest in your affected project?

@sureshg
Copy link

sureshg commented Oct 11, 2023

@shanshin got the same error when upgrading from 0.7.3 to 0.7.4. The thing is CI build is failing only for windows - https://github.com/sureshg/openjdk-playground/actions/runs/6488852919/job/17622062272#step:8:1352 . Linux and mac builds are working as expected.

* What went wrong:
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
Execution failed for task ':koverHtmlReport'.

> Cannot access input property 'externalReports$kover_gradle_plugin' of task ':koverHtmlReport'. Accessing unreadable inputs or outputs is not supported. Declare the task as untracked by using Task.doNotTrackState(). For more information, please refer to https://docs.gradle.org/8.4/userguide/incremental_build.html#disable-state-tracking in the Gradle documentation.

@shanshin
Copy link
Collaborator

shanshin commented Oct 12, 2023

@HarisHoulis, @wezley98 , @sureshg
It looks like this is a problem with the relative paths used after the #440 fix.
In this case, it would help to look at the contents of the build/kover/*.artifact files from the root project and the subprojects it depends on.

@HarisHoulis
Copy link

@shanshin I will look into a way to pull those artifacts from our CI, since we can't run Kover locally.

@HarisHoulis
Copy link

HarisHoulis commented Oct 19, 2023

@shanshin Can you please provide me a secure way to share our **/build/kover/*.artifact
files with you?

@shanshin
Copy link
Collaborator

@HarisHoulis, by e-mail sergey.shanshin@jetbrains.com

You may also replace all sensitive names: so that the same substituted name corresponds to the same source directory name.

@DevNatan
Copy link

DevNatan commented Oct 25, 2023

@shanshin Exactly same issue but with 0.7.3 and only happens when using kover for "Single report over several projects". All reports works but modules with kover(...) in dependencies block are broken. Kover v0.7.3, Gradle v8.4.

On CI fails with (ubuntu-22.04)

java.io.IOException: Cannot snapshot /dev/core: not a regular file

Locally fails with (macOS Sonoma)

Failed to create MD5 hash for file '/usr/bin/sudo' as it does not exist.

Tried to bump kover to 0.7.4. Same error on CI. Now local fails with

Null byte present in file/path name. There are no known legitimate use cases for such data, but several injection attacks may use it

@shanshin
Copy link
Collaborator

@HarisHoulis, thanks for the files!
Unfortunately, there is nothing unusual in the contents of this file.

@sureshg, thanks for the project! I will try to reproduce locally if the problem still repeats!

@bmarty
Copy link

bmarty commented Nov 10, 2023

Hello,

I have also the issue with Kover 0.7.4, both locally and on the CI.

* What went wrong:
Execution failed for task ':app:koverHtmlReportRelease'.
> Null byte present in file/path name. There are no known legitimate use cases for such data, but several injection attacks may use it

The project is open source, here is the PR: element-hq/element-x-android#1782

And the CI build https://github.com/vector-im/element-x-android/actions/runs/6815987723/job/18536289873?pr=1782

If I use Kover 0.7.3, this error is not observed (but I have other issue I am working on right now).

@r4phab
Copy link

r4phab commented Nov 10, 2023

Hello,

I have also the issue with Kover 0.7.4, both locally and on the CI.

* What went wrong:
Execution failed for task ':app:koverHtmlReportRelease'.
> Null byte present in file/path name. There are no known legitimate use cases for such data, but several injection attacks may use it

The project is open source, here is the PR: element-hq/element-x-android#1782

And the CI build https://github.com/vector-im/element-x-android/actions/runs/6815987723/job/18536289873?pr=1782

If I use Kover 0.7.3, this error is not observed (but I have other issue I am working on right now).

Exactly the same error on my side and it is raised only with a mix of JVM and Android reports with the mergedWith property. If I run Kover with only JVM or only Android reports, everything works fine ..

@shanshin
Copy link
Collaborator

@bmarty, thanks for the reproducer!
It stably reproduces the error locally

@shanshin
Copy link
Collaborator

Finally, I think I've found the reason.

The reason is that in some cases, when there is a merge of subprojects in which there are no overlapping variants (e.g. default variant, and Android build variant), a this error appears.
For example, in project element-hq/element-x-android#1782, project appconfig is added to the merged report :app:koverHtmlReportRelease, this error happens, because variant release is missing in JVM-only subprojects.

Unfortunately, so far I have not found a completely correct solution using Gradle, and I have created related Gradle issue: gradle/gradle#27019

I'll try to get rid of the fall by workarounds, however, the primary issue is in the configuration of the build.
When mixed types of Kotlin projects (Android + JVM) are used in the build at the same time, it is better to use koverHtmlReport task, and merging variants in Android subprojects:

koverReport {
    defaults {
        // adds the contents of the reports of `release` Android build variant to default reports
        mergeWith("release")
    }
}

also in docs

shanshin added a commit that referenced this issue Nov 15, 2023
If an artifact that completely matches the attributes is not found in the dependency, then a random artifact is taken, the processing of which can lead to unpredictable errors.
An additional check of the dependency resolution is needed to exclude such a situation.

Fixes #478
This was referenced Nov 15, 2023
shanshin added a commit that referenced this issue Nov 27, 2023
If an artifact that completely matches the attributes is not found in the dependency, then a random artifact is taken, the processing of which can lead to unpredictable errors.
An additional check of the dependency resolution is needed to exclude such a situation.

Fixes #478
PR #506
@shanshin shanshin reopened this Nov 27, 2023
@shanshin shanshin added S: ready for release Status: merged in the main branch and removed S: waiting for clarification Status: additional information required to proceed labels Nov 27, 2023
@shanshin
Copy link
Collaborator

Fixed in 0.7.5

Now, in case of an incorrect Kover configuration, a more meaningful message is thrown out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug issue type S: ready for release Status: merged in the main branch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants