Skip to content

Inconsistent behavior of dart pub global activate on Desktop and GitLab #3290

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

Closed
Stargator opened this issue Jan 22, 2022 · 9 comments
Closed
Labels
needs-info Additional information needed from the issue author

Comments

@Stargator
Copy link

Environment

  • pub version: Pub 2.15.1
  • OS version: N/A, I think Linux. It's the environment of a GitLab job
  • Are you using the Chinese community mirror or a corporate firewall? No

Problem

Please describe the problem in detail, including the specific command that is
failing.
I'm running dart pub global activate junitreport --verbose

But the executable tojunit is support to run bin/tojunit.dart which does not exist in the .pub-cache/global_packages/junitreport/. In face, junitreport does not have a bin directory.

WARN: Warning: Executable "tojunit" runs "bin/tojunit.dart", which was not found in junitreport

Was the problem with a specific package you were trying to fetch? junitreport

If relevant, what does the pubspec.yaml file for your project look like: pubspec.yaml

environment:
  sdk: '>=2.15.0 <3.0.0'

executables:
  repomod: 0.0.1-alpha

dependencies:
  args: ^2.3.0
  dart_style: ^2.2.0
  logging: ^1.0.2
  path: ^1.8.1
  yaml: ^3.1.0

dev_dependencies:
  test: '<2.0.0'

Expected behavior

I expected .pub-cache/global_packages/junitreport would have a bin directory and all other necessary files to allow the tojunit command to work properly.

I tested this locally on my MacOS and it works fine. As far as I can tell in the logs, running the above locally has only one section that does not exist in the GitLab job:

MSG : Building package executables...
IO : Deleting directory /Users/Stargator/Workspace/GitLab/repomod/.pub_cache/global_packages/junitreport/bin.
MSG : Built junitreport:tojunit.
FINE: Building package executables finished (1.014s).

So I would expect to see the above output when running the command in a GitLab job

Actual behavior

The .pub-cache/global_packages/junitreport directory is missing its bin directory and unable to allow the tojunit executable to run properly.

--trace output

job_output.txt

@sigurdm
Copy link
Contributor

sigurdm commented Jan 27, 2022

Perhaps your cache has been corrupted somehow?

Try removing the folder: file:///builds/mcmahonjohn/repomod/.pub-cache/hosted/pub.dartlang.org/junitreport-2.0.2/ and activate again.

@sigurdm sigurdm added the needs-info Additional information needed from the issue author label Jan 27, 2022
@Stargator
Copy link
Author

@sigurdm I removed any caching so that folder no longer exists before the job executes.

The same result occurs. Could it be that it's related to the detect platform?

@sigurdm
Copy link
Contributor

sigurdm commented Feb 7, 2022

Is your /builds/mcmahonjohn/repomod/ inside a git repo?

Maybe our file-listing is doing tricks here...

@Stargator
Copy link
Author

@sigurdm repomod is the git repository directory's root.

I can't reproduce this locally, but I can inside a GitLab job.

@sigurdm
Copy link
Contributor

sigurdm commented Feb 10, 2022

Does repomod have any '.gitignore' or '.pubignore' files?

@Stargator
Copy link
Author

@sigurdm Yes just a .gitignore file:

# Files and directories created by dart pub
.dart_tool/
.idea/
.pub-cache/
.packages
build/
coverage/

# Directory created by dartdoc
doc/api/

@Stargator
Copy link
Author

Stargator commented Feb 19, 2022

I was able to resolve the issue. The issue was related to how I was using .gitlab-ci.yaml

I had a variable defined as:

PUB_VARS: "--platform vm --coverage=./coverage --reporter json" | tojunit -o ./report.xml

And using it as such:

dart test $PUB_VARS

But I shouldn't have embed the tojunit command in the variable.

However, I am still getting this error/warning notice:

Warning: Executable "tojunit" runs "bin/tojunit.dart", which was not found in junitreport.

But the report seems to still be able to be parsed into the proper format

@appAutoTesting
Copy link

appAutoTesting commented Mar 19, 2022

I have the same problem when i run my test on Bitbar... Did u find any solution?

Warning: Executable "tojunit" runs "bin/tojunit.dart", which was not found in junitreport.
Activated junitreport 2.0.2.
No active package junitreport.
No active package junitreport.
Unhandled exception:
FileSystemException: writeFrom failed, path = '' (OS Error: Broken pipe, errno = 32)
#0 _RandomAccessFile.writeFromSync (dart:io/file_impl.dart:873:7)
#1 _StdConsumer.addStream. (dart:io/stdio.dart:286:15)
#2 _RootZone.runUnaryGuarded (dart:async/zone.dart:1618:10)
#3 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#4 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#5 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19)
#6 _StreamController._add (dart:async/stream_controller.dart:648:7)
#7 _StreamController.add (dart:async/stream_controller.dart:596:5)
#8 _StreamSinkImpl.add (dart:io/io_sink.dart:136:17)
#9 _IOSinkImpl.write (dart:io/io_sink.dart:269:5)
#10 _IOSinkImpl.writeln (dart:io/io_sink.dart:289:5)
#11 _StdSink.writeln (dart:io/stdio.dart:319:11)
#12 FlutterAppRunnerHook._runApp (package:flutter_gherkin/src/flutter/hooks/app_runner_hook.dart:86:14)
#13 FlutterAppRunnerHook.onBeforeRun (package:flutter_gherkin/src/flutter/hooks/app_runner_hook.dart:19:11)
#14 AggregatedHook.onBeforeRun. (package:gherkin/src/hooks/aggregated_hook.dart:19:35)
#15 AggregatedHook._invokeHooks (package:gherkin/src/hooks/aggregated_hook.dart:92:21)
#16 AggregatedHook.onBeforeRun (package:gherkin/src/hooks/aggregated_hook.dart:19:13)
#17 GherkinRunner.execute (package:gherkin/src/test_runner.dart:63:17)

@Stargator
Copy link
Author

@appAutoTesting As I mentioned "But I shouldn't have embed the tojunit command in the variable"

I had the tojunit as part of a variable command line argument. For me the fix was to separate them like this:

TEST_VARS: "--platform vm --coverage=./coverage --reporter json""
JUNIT_VARS: "tojunit -o ./report.xml

That way I would run it in my .gitlab-ci.yaml like this:

script: dart test $TEST_VARS | $JUNIT_VARS

I do still get

Warning: Executable "tojunit" runs "bin/tojunit.dart", which was not found in junitreport.

But that isn't breaking the functionality for me, I still get the converted report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-info Additional information needed from the issue author
Projects
None yet
Development

No branches or pull requests

3 participants