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

Exception on non-existent directory for :plt_core_path #398

Open
jrmnl opened this issue Jul 8, 2020 · 4 comments
Open

Exception on non-existent directory for :plt_core_path #398

jrmnl opened this issue Jul 8, 2020 · 4 comments

Comments

@jrmnl
Copy link

jrmnl commented Jul 8, 2020

Environment

elixir: 1.10.3
otp_release: 23.0

Current behavior

When you set :plt_core_path to non existent folder you will get following exceiption on mix dialyzer:

...
Creating dialyxir_erlang-23.0.plt
:dialyzer.run error:     The PLT file ./my_non_existent_folder/dialyxir_erlang-23.0.plt is not writable
Looking up modules in dialyxir_erlang-23.0.plt
** (Mix) Could not open ./my_non_existent_folder/dialyxir_erlang-23.0.plt: no such file or directory

Expected behavior

You can successfully create plt files in non existent folder.

@jeremyjh
Copy link
Owner

jeremyjh commented Jul 8, 2020

You can successfully create plt files in non existent folder.

Is this what people would really expect? Is there another mix task that handles non-existent paths that way for example? I'm just not really sure that the expectation should be to silently create the full path.

@asummers
Copy link
Collaborator

asummers commented Jul 9, 2020

I would support a --create-if-not-exists type flag but creating by default is surprising behavior to me as a user.

@jrmnl
Copy link
Author

jrmnl commented Jul 9, 2020

You can successfully create plt files in non existent folder.

Is this what people would really expect? Is there another mix task that handles non-existent paths that way for example? I'm just not really sure that the expectation should be to silently create the full path.

If I specify :plt_file in non-existent path it will create it, for example. And here :plt_core_path sounds like output folder if it's empty or not exists.

--create-if-not-exists makes usage less obvious.

When this error was occured my first thoughts were:

  1. Is provided path correct?
  2. Do I have rights to create folders here?

@jeremyjh
Copy link
Owner

@asummers after looking at this more closely I've kind of come around to @jrmnl point of view here - since this is a file we create, it may not be surprising to create its path and we already do this when we copy the base PLT's to the target directory.

Pavinati added a commit to Pavinati/edgehog that referenced this issue Mar 17, 2022
dialyxir fails when core directory does not exist.
see jeremyjh/dialyxir#398
and it's PR jeremyjh/dialyxir#399

Signed-off-by: Mattia <[email protected]>
Pavinati added a commit to Pavinati/edgehog that referenced this issue Mar 17, 2022
dialyxir fails when core directory does not exist.
see jeremyjh/dialyxir#398
and it's PR jeremyjh/dialyxir#399

Signed-off-by: Mattia <[email protected]>
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

3 participants