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

alr index reports the most frustrating error message: "Not a readable directory" #1251

Closed
stephe-ada-guru opened this issue Nov 29, 2022 · 7 comments
Labels
type: enhancement Improvements to existing functionality type: usability User-friendliness
Milestone

Comments

@stephe-ada-guru
Copy link

Running on Windows:

alr -v index --add [email protected]:stephe-ada-guru/alire-index.git#stephe-patches --name stephepatches --before community

-> Using default value for configuration 'distribution.disable_detection': 'FALSE'
-> Found 1 indexes
ERROR: Not a readable directory
-> alr index unsuccessful

which directory? the program knows perfectly well what directory it is trying to read; include it in the error message!

Happens both in an Alire workspace and out.

@stephe-ada-guru
Copy link
Author

stephe-ada-guru commented Nov 29, 2022

I tried running alr under the debugger. I compiled it with --development, so assertions are enabled. Now it's raising Assertion_Error in Alire.Config.Edit.Set_Path in the main elaboration code. So I did not find the code that reported the frustrating error message.

Platform.Folders.Config is returning "C:\home\stephe.config\alire" because that's where HOME is, when I'm running in a mingw32 shell. However, I first ran alr in a PowerShell, where HOME is either not defined or is c:\Users\Stephe, so it setup alire config in c:\Users\Stephe.config\alire, and C:\home\stephe.config\alire doesn't exist.

And yet when I run "alr index" (the non-assertions build) with HOME=c:/home/stephe, it reports:

NAME URL PATH
1 community git+https://github.com/alire-project/alire-index#stable-1.2.1 C:\Users\Stephe.config\alire\indexes\community\repo

Very confusing. Apparently with assertions disabled, it falls back to the Windows default home?

I'll delete the c:\Users\Stephe.config\alire, and try to start over, always with HOME set properly.

@mosteo
Copy link
Member

mosteo commented Nov 29, 2022

The lacking error message is at alire-index_on_disk.adb:176 (in master). You can add some log output, but I expect it to be the local path to which the checkout is being attempted.

There are some other similarly improvable errors close by, so filing this one for enhancement.

@mosteo mosteo added type: enhancement Improvements to existing functionality type: usability User-friendliness labels Nov 29, 2022
@mosteo mosteo added this to the 1.3 milestone Nov 29, 2022
@stephe-ada-guru
Copy link
Author

Well that didn't work. alr toolchain --select ended up creating c:\Users\Stephe.config\alire, even though HOME pointed somewhere else.

Setting ALR_CONFIG=c:/home/stephe/.config/alire makes 'alr toolchain' use that directory. So I'll use that as a workaround on Windows for now.

Something is not using HOME consistently. Hmm. Maybe because it's "/home/stephe" instead of "c:/home/stephe"? Nope, that did not help.

Running 'alr toolchain' with the assertions enabled build raises the assertion error, before it tries to install the default config. So that's not consistent either.

@stephe-ada-guru
Copy link
Author

Setting ALR_CONFIG did not solve the original problem with "alr index --add ...". More debugging later.

@stephe-ada-guru
Copy link
Author

The assertion failure is from the Dynamic _Predicate on type Absolute_Path. That calls Alire.Check_Absolute_Path. The version compiled is in os_linux, but I'm on Windows! So the alr environment is wrong for this build.

That's because there are several settings of "*OS" in the various *.gpr; alr_env.gpr is not with'd by any other gpr. so they all end up as "unix". I'll submit a separate issue on this.

@stephe-ada-guru
Copy link
Author

After using the recommended build procedure for alr (issue 1255), I managed to get a better error message (patch attached):
$ c:/Projects/Alire/alire-main/bin/alr.exe index --add [email protected]:stephe-ada-guru/alire-index.git#stephe-patches --name stephepatches --before community
ERROR: '[email protected]:stephe-ada-guru\alire-index.git#stephe-patches' is not a readable directory

"alr index --help" does not say what the url argument should point to; I assumed this would work.

Ah; I changed the url to use https instead of git@github:

$ c:/Projects/Alire/alire-main/bin/alr.exe index --add https://github.com/stephe-ada-guru/alire-index.git#stephe-patches --name stephepatches --before community
ERROR: HTTP/HTTPS URLs are not valid index origins. You may want git+https://github.com/stephe-ada-guru/alire-index.git#stephe-patches instead.

One more try:

$ c:/Projects/Alire/alire-main/bin/alr.exe index --add git+https://github.com/stephe-ada-guru/alire-index.git#stephe-patches --name stephepatches --before community

That seems to have worked. So this issue is a request for three things:

  1. Include the directory in the "Not a readable directory" error message.
  2. A similar error message about the url scheme when given git@github:user (and use "scheme", not "origin"). Or make git@github work; then I can use that workspace to commit changes.
  3. In "alr index --help", a description of what the url argument should be. Perhaps:

The url should use the git+https or file: scheme, and point to a git repository containing the index.

error_message.diff.txt

@mosteo mosteo modified the milestones: 1.3, 2.0 Sep 12, 2023
@Fabien-Chouteau
Copy link
Member

This error message was improved by #1523.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Improvements to existing functionality type: usability User-friendliness
Projects
None yet
Development

No branches or pull requests

3 participants