Closed dcharkes closed 3 days ago
This was changed because google3 makes heavy use of symlinks and CLI artifacts were never guaranteed to be in the same directory as the CLI executable after the symlinks were resolved. Let me take a look, hopefully this is a simple fix.
@dcharkes, I'm unable to reproduce at HEAD:
bkonyi@bkonyi-glinux:~/dart-sdk/sdk/third_party/pkg/native/pkgs/native_assets_cli/example/build/native_add_app$ echo $DART_RELEASE
/usr/local/google/home/bkonyi/dart-sdk/sdk/out/ReleaseX64/dart-sdk/bin/dart
bkonyi@bkonyi-glinux:~/dart-sdk/sdk/third_party/pkg/native/pkgs/native_assets_cli/example/build/native_add_app$ $DART_RELEASE --enable-experiment=native-assets build bin/native_add_app.dart
Deleting output directory: /usr/local/google/home/bkonyi/dart-sdk/sdk/third_party/pkg/native/pkgs/native_assets_cli/example/build/native_add_app/bin/native_add_app/.
Building native assets.
Writing native_assets.yaml.
Copying 1 build assets: (package:native_add_library/native_add_library.dart)
Generated: /usr/local/google/home/bkonyi/dart-sdk/sdk/third_party/pkg/native/pkgs/native_assets_cli/example/build/native_add_app/bin/native_add_app/native_add_app.exe
Does this SDK need to be downloaded for the issue to be reproduced?
I'm also unable to reproduce with 3.5.0-243.0.dev
downloaded from the SDK archives page.
Does this SDK need to be downloaded for the issue to be reproduced?
It's reliably reproducing on the GitHub CI downloading the SDK, see the links in the linked issue. I haven't tried locally.
Does this SDK need to be downloaded for the issue to be reproduced?
It's reliably reproducing on the GitHub CI downloading the SDK, see the links in the linked issue. I haven't tried locally.
Without more insights into the environment (e.g., the directory structure and contents of the unzipped SDK in the context of the GitHub CI), there's unfortunately not much we can do without a reproduction. If there's symlinks involved, that could be problematic, but checkArtifactExists
should be able to follow them.
Hm, maybe we should be using FileSystemEntity.typeSync instead of File.existsSync
, which appears like it might return false
if we're checking the path to a Link
object.
Hm, maybe we should be using FileSystemEntity.typeSync instead of
File.existsSync
, which appears like it might returnfalse
if we're checking the path to aLink
object.
Ah that could be the case.
The code itself that is failing is fairly simple right. Platform.executable
or Platform.resolvedExecutable
and then checkArtifactExists
that does File(path).existsSync()
.
Unless someone messed with the current directory that should always be true (except for when it's a symlink as you point out).
It's worth giving it a shot. I don't know how to test this other than landing it, waiting for a dev build and turning the CI back to the latest dev build.
@bkonyi it seems to be still failing on 3.6.0-12.0.dev
:
Run dart --enable-experiment=native-assets build bin/native_add_app.dart
dart --enable-experiment=native-assets build bin/native_add_app.dart
shell: /usr/bin/bash -e {0}
env:
DART_HOME: /opt/hostedtoolcache/dart/3.6.0-12.0.dev/x64
PUB_CACHE: /home/runner/.pub-cache
Could not find dart. Have you built the full Dart SDK?
Error: Process completed with exit code 255.
https://github.com/dart-lang/native/actions/runs/9853109946/job/27202956400?pr=1271
So the fix unfortunately didn't work.
This was changed because google3 makes heavy use of symlinks and CLI artifacts were never guaranteed to be in the same directory as the CLI executable after the symlinks were resolved. Let me take a look, hopefully this is a simple fix.
In this case it's not a different CLI artifact, it's dart
itself.
if (!Sdk.checkArtifactExists(genKernel) ||
!Sdk.checkArtifactExists(genSnapshot) ||
!Sdk.checkArtifactExists(sdk.dart)) {
It's also weird that apparently it is able to find genKernel and genSnapshot.
Does this SDK need to be downloaded for the issue to be reproduced?
It's reliably reproducing on the GitHub CI downloading the SDK, see the links in the linked issue. I haven't tried locally.
Without more insights into the environment (e.g., the directory structure and contents of the unzipped SDK in the context of the GitHub CI), there's unfortunately not much we can do without a reproduction. If there's symlinks involved, that could be problematic, but
checkArtifactExists
should be able to follow them.
We do own the setup action: https://github.com/dart-lang/setup-dart Maybe someone who contributed to that knows how GitHub uses symlinks. cc @devoncarew
After https://github.com/dart-lang/sdk/commit/8e00ebc689354ee99d6a7fda844ade8f3701f140 the following code started failing:
https://github.com/dart-lang/sdk/blob/a8314dac745ceabc926f9d9bedb9e8692d690298/pkg/dartdev/lib/src/commands/build.dart#L70
sdk.dart
was recently changed: fromPlatform.resolvedExecutable
toPlatform.executable
. Why was it changed @bkonyi?The error only shows up when downloading a dev build of the SDK, not when running the tests with an SDK from the
out/
orxcodebuild/
directory.I believe using
Platform.resolvedExecutable
should make things working again. However, I'm open to other solutions if the build command is holding things the wrong way.