Skip to content
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

dune init exec foo src --lib=lwt.unix fails #3443

Closed
bikallem opened this issue May 2, 2020 · 3 comments · Fixed by ocaml/opam-repository#16585
Closed

dune init exec foo src --lib=lwt.unix fails #3443

bikallem opened this issue May 2, 2020 · 3 comments · Fixed by ocaml/opam-repository#16585

Comments

@bikallem
Copy link
Contributor

bikallem commented May 2, 2020

Expected Behavior

dune init exec foo src --lib=lwt.unix to succeed and create a dune file and src folder.

Actual Behavior

Error below.

dune: option `--libs': invalid element in list (`lwt.unix'): invalid
      component name `lwt.unix'
      Library names must be non-empty and composed only of the
      following
      characters: 'A'..'Z', 'a'..'z', '_' or '0'..'9'.
Usage: dune init [OPTION]... INIT_KIND NAME [PATH]
Try `dune init --help' or `dune --help' for more information.

Reproduction

Any lib name with that has characters other than 'A - Z', 'a - z', '_', '0-9'.

dune init exec foo src --lib=lwt.unix

Specifications

  • Version of dune (output of dune --version): 2.5.0
  • Version of ocaml (output of ocamlc --version): 4.10.0
  • Operating system (distribution and version): red hat linux 8.2
@bikallem bikallem mentioned this issue May 2, 2020
@bikallem
Copy link
Contributor Author

bikallem commented May 3, 2020

Also it seems the dune exec init accepts both options --lib and --libs. --lib is not documented so shouldn't it fail?? PR #3444 just fixes the first part of the bug. Should we remove --lib from being accepted?

@shonfeder
Copy link
Collaborator

@bikallem thanks for reporting this and fixing it! :)

The latter is not a bug in implementation, it's just part of how cmdliner works:

Long names can be specified by any non ambiguous prefix

So dune exec init foo src --li foo will also work! We could add this to the inline documentation somewhere, so we could at least point to that for future bug reports?

@ghost
Copy link

ghost commented May 5, 2020

Documenting it seems good, but we should make it clear that this is not something we encourage users doing, or at least not in scripts given that it is not future proof.

rgrinberg added a commit to rgrinberg/opam-repository that referenced this issue Jun 6, 2020
…lugin, dune-private-libs and dune-glob (2.6.0)

CHANGES:

- Fix a bug where valid lib names in `dune init exec --libs=lib1,lib2`
  results in an error. (ocaml/dune#3444, fix ocaml/dune#3443, @bikallem)

- Add and `enabled_ if` field to the `install` stanza. Enforce the same variable
  restrictions for `enabled_if` fields in the `executable` and `install` stanzas
  than in the `library` stanza. When using dune lang < 2.6, the usage of
  forbidden variables in executables stanzas with only trigger a warning to
  maintain compatibility. (ocaml/dune#3408 and ocaml/dune#3496, fixes ocaml/dune#3354, @voodoos)

- Insert a constraint one the version of dune when the user explicitly
  specify the dependency on dune in the `dune-project` file (ocaml/dune#3434 ,
  fixes ocaml/dune#3427, @diml)

- Generate correct META files for sub-libraries (of the form `lib.foo`) that
  contain .js runtime files. (ocaml/dune#3445, @hhugo)

- Add a `(no-infer ...)` action that prevents inference of targets and
  dependencies in actions. (ocaml/dune#3456, fixes ocaml/dune#2006, @roddyyaga)

- Correctly infer targets for the `diff?` action. (ocaml/dune#3457, fixes ocaml/dune#2990, @greedy)

- Fix `$ dune print-rules` crashing (ocaml/dune#3459, fixes ocaml/dune#3440, @rgrinberg)

- Simplify js_of_ocaml rules using js_of_ocaml.3.6 (ocaml/dune#3375, @hhugo)

- Add a new `ocaml-merlin` subcommand that can be used by Merlin to get
  configuration directly from dune instead of using `.merlin` files. (ocaml/dune#3395,
  @voodoos)

- Remove experimental variants feature and make default implementations part of
  the language (ocaml/dune#3491, fixes ocaml/dune#3483, @rgrinberg)
rgrinberg added a commit to rgrinberg/opam-repository that referenced this issue Jun 7, 2020
…lugin, dune-private-libs and dune-glob (2.6.0)

CHANGES:

- Fix a bug where valid lib names in `dune init exec --libs=lib1,lib2`
  results in an error. (ocaml/dune#3444, fix ocaml/dune#3443, @bikallem)

- Add and `enabled_ if` field to the `install` stanza. Enforce the same variable
  restrictions for `enabled_if` fields in the `executable` and `install` stanzas
  than in the `library` stanza. When using dune lang < 2.6, the usage of
  forbidden variables in executables stanzas with only trigger a warning to
  maintain compatibility. (ocaml/dune#3408 and ocaml/dune#3496, fixes ocaml/dune#3354, @voodoos)

- Insert a constraint one the version of dune when the user explicitly
  specify the dependency on dune in the `dune-project` file (ocaml/dune#3434 ,
  fixes ocaml/dune#3427, @diml)

- Generate correct META files for sub-libraries (of the form `lib.foo`) that
  contain .js runtime files. (ocaml/dune#3445, @hhugo)

- Add a `(no-infer ...)` action that prevents inference of targets and
  dependencies in actions. (ocaml/dune#3456, fixes ocaml/dune#2006, @roddyyaga)

- Correctly infer targets for the `diff?` action. (ocaml/dune#3457, fixes ocaml/dune#2990, @greedy)

- Fix `$ dune print-rules` crashing (ocaml/dune#3459, fixes ocaml/dune#3440, @rgrinberg)

- Simplify js_of_ocaml rules using js_of_ocaml.3.6 (ocaml/dune#3375, @hhugo)

- Add a new `ocaml-merlin` subcommand that can be used by Merlin to get
  configuration directly from dune instead of using `.merlin` files. (ocaml/dune#3395,
  @voodoos)

- Remove experimental variants feature and make default implementations part of
  the language (ocaml/dune#3491, fixes ocaml/dune#3483, @rgrinberg)
rgrinberg added a commit to rgrinberg/opam-repository that referenced this issue Jun 7, 2020
…lugin, dune-private-libs and dune-glob (2.6.0)

CHANGES:

- Fix a bug where valid lib names in `dune init exec --libs=lib1,lib2`
  results in an error. (ocaml/dune#3444, fix ocaml/dune#3443, @bikallem)

- Add and `enabled_ if` field to the `install` stanza. Enforce the same variable
  restrictions for `enabled_if` fields in the `executable` and `install` stanzas
  than in the `library` stanza. When using dune lang < 2.6, the usage of
  forbidden variables in executables stanzas with only trigger a warning to
  maintain compatibility. (ocaml/dune#3408 and ocaml/dune#3496, fixes ocaml/dune#3354, @voodoos)

- Insert a constraint one the version of dune when the user explicitly
  specify the dependency on dune in the `dune-project` file (ocaml/dune#3434 ,
  fixes ocaml/dune#3427, @diml)

- Generate correct META files for sub-libraries (of the form `lib.foo`) that
  contain .js runtime files. (ocaml/dune#3445, @hhugo)

- Add a `(no-infer ...)` action that prevents inference of targets and
  dependencies in actions. (ocaml/dune#3456, fixes ocaml/dune#2006, @roddyyaga)

- Correctly infer targets for the `diff?` action. (ocaml/dune#3457, fixes ocaml/dune#2990, @greedy)

- Fix `$ dune print-rules` crashing (ocaml/dune#3459, fixes ocaml/dune#3440, @rgrinberg)

- Simplify js_of_ocaml rules using js_of_ocaml.3.6 (ocaml/dune#3375, @hhugo)

- Add a new `ocaml-merlin` subcommand that can be used by Merlin to get
  configuration directly from dune instead of using `.merlin` files. (ocaml/dune#3395,
  @voodoos)

- Remove experimental variants feature and make default implementations part of
  the language (ocaml/dune#3491, fixes ocaml/dune#3483, @rgrinberg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants