Skip to content

Precompiling executable failing using PUB_CACHE env variable #2483

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
pY4x3g opened this issue May 6, 2020 · 2 comments · Fixed by #2486
Closed

Precompiling executable failing using PUB_CACHE env variable #2483

pY4x3g opened this issue May 6, 2020 · 2 comments · Fixed by #2486
Assignees

Comments

@pY4x3g
Copy link

pY4x3g commented May 6, 2020

Environment

  • pub version: Pub 2.8.0-20.11.beta
  • OS version: Debian 10 (docker image google/dart:latest and google/dart:beta are failing)

Problem

Running tests with a new version of dart is failing when using env variable PUB_CACHE.
The precompiling executable command is running with wrong path to the dart file, see below.

The image is based on google/dart and this problem first occurred after using a newer version of the docker image. The image google/dart:2.6 is running fine.

Expected behavior

Tests should run without error as in google/dart:2.6.

Actual behavior

Precompiling executable failing

--trace output

I used PUB_CACHE=.pub-cache and obtain the error:

pub run -v test
FINE: Pub 2.8.0-20.11.beta
MSG : Precompiling executable...
IO  : Spawning "/usr/lib/dart/bin/dart --packages=file:///***/.packages --snapshot=./.dart_tool/pub/bin/test/test.dart.snapshot.dart2 .pub-cache/hosted/pub.dartlang.org/test-1.14.3/.pub-cache/hosted/pub.dartlang.org/test-1.14.3/bin/test.dart" in ***.
IO  : Finished /usr/lib/dart/bin/dart. Exit code 254.
    | Nothing output on stdout.
    | stderr:
    | | Error: Error when reading '.pub-cache/hosted/pub.dartlang.org/test-1.14.3/.pub-cache/hosted/pub.dartlang.org/test-1.14.3/bin/test.dart': No such file or directory
ERR : Failed to precompile test:test:
    | Error: Error when reading '.pub-cache/hosted/pub.dartlang.org/test-1.14.3/.pub-cache/hosted/pub.dartlang.org/test-1.14.3/bin/test.dart': No such file or directory
FINE: Exception type: ApplicationException
FINE: package:pub/src/dart.dart 64:5              snapshot
    | ===== asynchronous gap ===========================
    | dart:async                                  Future.catchError
    | package:pub/src/utils.dart 149:19           waitAndPrintErrors.<fn>
    | dart:async                                  Future.wait
    | package:pub/src/utils.dart 148:17           waitAndPrintErrors
    | package:pub/src/entrypoint.dart 318:14      Entrypoint.precompileExecutable.<fn>
    | package:pub/src/entrypoint.dart 315:58      Entrypoint.precompileExecutable.<fn>
    | package:pub/src/log.dart 394:18             progress
    | package:pub/src/entrypoint.dart 315:18      Entrypoint.precompileExecutable
    | package:pub/src/command/run.dart 85:25      RunCommand.run.<fn>
    | package:pub/src/executable.dart 131:20      _runOrCompileSnapshot
    | package:pub/src/executable.dart 71:26       runExecutable.<fn>
    | package:pub/src/executable.dart 64:47       runExecutable.<fn>
    | package:pub/src/log.dart 377:32             warningsOnlyUnlessTerminal
    | package:pub/src/executable.dart 64:16       runExecutable
    | package:pub/src/command/run.dart 78:26      RunCommand.run
    | package:args/command_runner.dart 197:27     CommandRunner.runCommand
    | package:pub/src/command_runner.dart 191:39  PubCommandRunner.runCommand.<fn>
    | dart:async                                  new Future.sync
    | package:pub/src/utils.dart 113:12           captureErrors.wrappedCallback
    | package:stack_trace                         Chain.capture
    | package:pub/src/utils.dart 126:11           captureErrors
    | package:pub/src/command_runner.dart 191:13  PubCommandRunner.runCommand
FINE: Precompiling executable finished (0.417s).

The problem lies already inside the

Spawning "/usr/lib/dart/bin/dart --packages=file:///***/.packages --snapshot=./.dart_tool/pub/bin/test/test.dart.snapshot.dart2 .pub-cache/hosted/pub.dartlang.org/test-1.14.3/.pub-cache/hosted/pub.dartlang.org/test-1.14.3/bin/test.dart" in ***.```

part. The path to the dart file seems to be wrong (twice the path?). All was running fine using older versions of dart docker image.

@pY4x3g pY4x3g changed the title Precompiling executable failing Precompiling executable failing using PUB_CACHE env variable May 6, 2020
@pY4x3g
Copy link
Author

pY4x3g commented May 6, 2020

I was able to track down the dart version: Dart version 2.6 and 2.7 are running fine, it seems to start with the 2.8 branch. The error already occurs in google/dart:2.8.0-dev.1.0.

@sigurdm sigurdm self-assigned this May 7, 2020
@sigurdm
Copy link
Contributor

sigurdm commented May 7, 2020

This was indeed introduced in #2277 we calculate the path of the executable wrongly, basically doubling it by something that ends up likejoin(a, a). But if it is an absolute path it still works.

Until a fix is out you can work around this with pub get --precompile it doesn't have the same issue.

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

Successfully merging a pull request may close this issue.

2 participants