dub icon indicating copy to clipboard operation
dub copied to clipboard

Querying dub with --print-builds or --print-configs builds the package

Open zorael opened this issue 2 years ago • 2 comments

System information

  • dub version: 1.32.1
  • OS Platform and distribution: Manjaro/Arch x86_64
  • compiler version ldc 1.32.1, dmd 2.104.0

Bug Description

It is not possible to query dub --print-builds nor --print-configs without it starting to build the package.

How to reproduce?

  1. Be someone unfamiliar with dub and do dub --help, which faithfully displays the help screen without the build process starting
  2. See mention of --print-builds and --print-configs, and invoke dub with either to learn more about the package and the build system to plan your build
  3. The required information is displayed, but the default build configuration starts building while you're trying to read
  4. In the worst-case scenario, you're on a memory-constrained system, dub starts building a non -lowmem configuration and the system is now dead to the world swapping to an sdcard until the OOM killer finally kicks in 20 minutes later (has happened on a Raspberry Pi and is why I'm filing this)

Expected Behavior

  1. --print-configs and --print-builds exhibits behaviour consistent with --help, and only prints the information requested before exiting

Logs

$ dub --print-configs
        Available configurations:
          application [default]
          application-lowmem
          lowmem
          twitch
          twitch-lowmem
          dev
          dev-lowmem
          unittest
          unittest-lowmem

    Starting Performing "debug" build using /usr/bin/dmd for x86_64.
    Building arsd-official:characterencodings 10.9.10: building configuration [library]
    Building arsd-official:dom 10.9.10: building configuration [library]
    Building arsd-official:http 10.9.10: building configuration [with_openssl]
    Building lu 1.2.5: building configuration [library]
Deprecation: `-dip25` no longer has any effect
    Building dialect 2.0.2: building configuration [bot]
Deprecation: `-dip25` no longer has any effect
Deprecation: `-dip25` no longer has any effect
    Building automem 0.6.9: building configuration [library]
../../.dub/packages/automem-0.6.9/automem/source/automem/vector.d-mixin-211(211,7): Deprecation: cannot throw object of qualified type `immutable(BoundsException)`
../../.dub/packages/automem-0.6.9/automem/source/automem/vector.d-mixin-211(211,7): Deprecation: cannot throw object of qualified type `immutable(BoundsException)`
    Building cachetools 0.4.1: building configuration [library]
    Building requests 2.0.9: building configuration [std]
    Building kameloso 3.9.0+commit.79.gb997750f5: building configuration [application]
Deprecation: `-dip25` no longer has any effect
Deprecation: `-dip25` no longer has any effect
Deprecation: `-dip25` no longer has any effect
Deprecation: `-dip25` no longer has any effect
    Linking kameloso
    Running kameloso
[...]

zorael avatar Jun 05 '23 15:06 zorael

To perform a dry run use the flag: --annotate.

As to if the default behavior is correct for those flags, idk.

rikkimax avatar Jun 05 '23 15:06 rikkimax

Disclaimer: I did not look at the source.

Is --annotate fully implemented? In many cases it seems ignored outright.

Trying with the various dub verbs:

  • run: silently exits, outputs nothing
  • build: silently exits, outputs nothing
  • test: proceeds to test despite --annotate
  • lint: silently exits, outputs nothing
  • generate: silently exits, outputs nothing
  • describe: proceeds to describe despite --annotate
  • clean: proceeds to clean despite --annotate
  • dustmite: proceeds to dustmite despite --annotate
  • fetch: proceeds to fetch despite --annotate
  • add: proceeds to add despite --annotate
  • remove: proceeds to remove despite --annotate
  • upgrade: proceeds to upgrade despite --annotate
  • add-path: did not test
  • remove-path: did not test
  • add-local: silently exits, outputs nothing
  • remove-local: silently exits, outputs nothing
  • search: proceeds to search despite --annotate
  • add-override: did not test
  • remove-override: did not test
  • list-overrides: did not test
  • clean-caches: did not test
  • convert: proceeds to convert despite --annotate

At no point did it say what would be done as the flag description suggests. In this limited testing --annotate only seemed to have any sort of use with things like --print-builds and --print-configs (that in turn do not make sense unless used with it).

zorael avatar Jun 06 '23 13:06 zorael