dart-lang / pub

The pub command line tool
https://dart.dev/tools/pub/cmd
BSD 3-Clause "New" or "Revised" License
1.04k stars 224 forks source link

Package Publish Fails (Possibly Involving Symlinks) #4057

Open getBoolean opened 9 months ago

getBoolean commented 9 months ago

Environment

Problem

I'm attempting to run dart pub publish --dry-run in my dart_holodex_api repo, but I am getting an error. I am using Puro here, but @pingbird was able to reproduce without puro

name: dart_holodex_api
description: A Dart wrapper for ...
version: 2.0.0
homepage: https://github.com/getBoolean/dart_holodex_api
environment:
  sdk: ">=3.0.0 <4.0.0"

dependencies:
  freezed_annotation: ^2.2.0
  http: ">=0.13.4 <2.0.0"
  intl: ">=0.17.0 <0.19.0"
  json_annotation: ^4.8.0

dev_dependencies:
  build_runner: ^2.3.3
  dotenv: ^4.1.0
  freezed: ^2.3.2
  json_serializable: ^6.6.0
  lints: "^3.0.0"
  test: ^1.16.0

Expected behavior

The publish command should work when symlinks are involved.

Actual behavior

The publish command seems to fail because of a symlink. @pingbird was able to reproduce it when the repo was inside a symlink (see https://github.com/pingbird/puro/issues/61#issuecomment-1826411458), but that is still odd because I do not have the repo in a symlink.

PowerShell script to check for symlinks:

$ ((get-item B:\dev).Attributes.ToString())
Directory
$ ((get-item B:\dev\GitHub).Attributes.ToString())
Directory
$ ((get-item B:\dev\GitHub\dart_holodex_api).Attributes.ToString())
Directory

--trace output

$ dart pub publish --dry-run --trace
Resolving dependencies... 
Got dependencies!
Invalid argument (beneath): ../../../../dev/GitHub/dart_holodex_api: "must be relative and normalized"
package:pub/src/ignore.dart 229:7         Ignore.listFiles
package:pub/src/package.dart 232:19       Package.listFiles
package:pub/src/command/lish.dart 268:33  LishCommand.runProtected
This is an unexpected error. The full log and other details are collected in:

    C:\Users\Boolean\.puro\shared\pub_cache\log\pub_log.txt

Consider creating an issue on https://github.com/dart-lang/pub/issues/new
and attaching the relevant parts of that log file.

pub_log.txt

getBoolean commented 9 months ago

I also downloaded the Dart SDK 3.2.0 and 3.2.1 standalone and ran this command and got the same error B:\tools\dart-sdk\bin\dart.exe pub publish --dry-run

sigurdm commented 9 months ago

We don't support symlinks inside the package when publishing. https://github.com/dart-lang/pub/issues/3143

In this case the package is just inside a symlinked folder? I would have thought that should work...

Is it possible to create a reproduction?

getBoolean commented 9 months ago

I'm not sure what's going on. I can reproduce it on my machine:

  1. Cloning my repo into a new folder, which is not in a symlink folder B:\dart_holodex_api
  2. Download the Dart SDK to B:\dart-sdk
  3. In B:\dart_holodex_api, run the command B:\dart-sdk\bin\dart.exe pub publish --dry-run

    I get the same exception even though it is impossible to be in a symlink folder. There should also not be any symlinks in the repository.

Correct-Syntax commented 1 month ago

I'm also getting this error when trying to publish a new version of my package.

Invalid argument (beneath): ../../../../../Users/Acer/Documents/get_storage_info: "must be relative and normalized"
package:pub/src/ignore.dart 229:7                      Ignore.listFiles
package:pub/src/package.dart 261:19                    Package.listFiles
package:pub/src/command/lish.dart 307:40               LishCommand._publicationFromEntrypoint
===== asynchronous gap ===========================
package:pub/src/command/lish.dart 440:25               LishCommand.runProtected
===== asynchronous gap ===========================
package:pub/src/command.dart 196:7                     PubCommand.run
===== asynchronous gap ===========================
package:args/command_runner.dart 212:13                CommandRunner.runCommand
===== asynchronous gap ===========================
package:dartdev/dartdev.dart 232:18                    DartdevRunner.runCommand
===== asynchronous gap ===========================
package:dartdev/dartdev.dart 46:16                     runDartdev
===== asynchronous gap ===========================
C:\b\s\w\ir\x\w\sdk\pkg\dartdev\bin\dartdev.dart 13:5  main
This is an unexpected error. The full log and other details are collected in:

    C:\Users\Acer\AppData\Local\Pub\Cache\log\pub_log.txt

Consider creating an issue on https://github.com/dart-lang/pub/issues/new
and attaching the relevant parts of that log file.

Windows 10

Source code: https://github.com/Correct-Syntax/get_storage_info Published here: https://pub.dev/packages/get_storage_info