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

Bootstrap version fails to read implicit dependencies table #5

Open
awvwgk opened this issue Aug 28, 2020 · 3 comments
Open

Bootstrap version fails to read implicit dependencies table #5

awvwgk opened this issue Aug 28, 2020 · 3 comments

Comments

@awvwgk
Copy link
Member

awvwgk commented Aug 28, 2020

This could be an upstream issue with https://github.com/kowainik/tomland, but I don't know enough Haskell to verify this.

Steps to reproduce:

  1. Install the bootstrap version of fpm (fcb7f67 used)
  2. Create new project and add any dependency without using an inline table
> fpm new example
> cd example
> echo "[dependencies.toml-f]\ngit = \"https://github.com/awvwgk/toml-f\"" >> fpm.toml
  1. Try to build the project with the dependency
> fpm build
# gfortran (for build/gfortran_debug/example/example.o build/gfortran_debug/example/example.mod)
# ar (for build/gfortran_debug/example/libexample.a)
ar: creating build/gfortran_debug/example/libexample.a
  1. Find the dependency not recognized
> tree build
build
└── gfortran_debug
    └── example
        ├── example.mod
        ├── example.o
        └── libexample.a

Presumed source of the error:

The following two TOML documents are equivalent, except

  1. uses an inline table for dependencies.toml-f
[dependencies]
toml-f = { git = "https://github.com/awvwgk/toml-f" }
  1. dependencies is implicitly created
[dependencies.toml-f]
git = "https://github.com/awvwgk/toml-f"

Apparently, implicit tables are handled differently by the tomland parser, but this implementation detail should not leak into fpm

Additional information:

Testing this with the Python toml module:

>>> import toml
>>> table = toml.loads("[dependencies.toml-f]\ngit = \"https://github.com/awvwgk/toml-f\"")
>>> print(table)
{'dependencies': {'toml-f': {'git': 'https://github.com/awvwgk/toml-f'}}}
>>> print(toml.dumps(table))
[dependencies.toml-f]
git = "https://github.com/awvwgk/toml-f"
@everythingfunctional
Copy link
Member

I hadn't expected anybody to try using implicit tables for that, but I can confirm there is likely a bug in the upstream library with that style.

I believe the way it stores the "key path" when parsing the toml can end up slightly different depending on that style. I had to implement a feature to allow it to do the automatic conversion to the types used by fpm properly with a table like that, and it's possible it's not properly dealing with that different "key path" style.

I'll submit a bug report for that library. I'm not sure if that will be fixed before the Fortran version is done or not. We'll see.

@everythingfunctional
Copy link
Member

ok, can confirm that the bug exists in the latest version of the library as well. Going to work on a bug report to them.

@awvwgk
Copy link
Member Author

awvwgk commented Aug 28, 2020

ok, can confirm that the bug exists in the latest version of the library as well. Going to work on a bug report to them.

Thanks.

I hadn't expected anybody to try using implicit tables for that, but I can confirm there is likely a bug in the upstream library with that style.

I think it is kind of a natural choice for this, as inline tables are quite limited by the TOML specs on purpose.
Especially another kind of implicit tables is really expressive in this context:

[dependencies]
toml-f.git = "https://github.com/toml-f/toml-f"

@awvwgk awvwgk transferred this issue from fortran-lang/fpm Mar 31, 2021
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

No branches or pull requests

2 participants