xbps icon indicating copy to clipboard operation
xbps copied to clipboard

xbps-install: Print error message when `dir` in `-r dir` does not exist

Open camoz opened this issue 2 years ago • 4 comments

When running xbps-install -S -r /path/does/not/exist <somepackage> (and perhaps similar commands) an error message would be nice, saying that the path does not exist.

camoz avatar Dec 29 '21 10:12 camoz

I think in that case xbps is unhappy that there is no confdir in /path/does/not/exist (specifying -C /usr/share/xbps.d/ works), maybe it should complain about that then. But IMO it should complain about something. Right now it just returns 95, which is not documented on the man page of xbps-install.

camoz avatar Dec 29 '21 11:12 camoz

This fails because there is no repository and -S is used to sync the repository pool, the function that loops through the repository pool returns ENOTSUP (95) if there is no repository. I think that function should not return an error if there is nothing to loop through, then instead of that error, xbps-install would complain about the package <somepackage> not being found.

Duncaen avatar Dec 29 '21 12:12 Duncaen

I see. Also I just learned that -r ./dir will just create ./dir (including missing parents) if it does not exist (that kind of surprises me). I should rename this issue but I don´t know of a better name yet.

I understand that the specific problem I described in my OP would be solved by what you suggest. But, wouldn't it be nice for the user to be notified that there is no repo to sync with, when they explicitly asked xbps-install to sync via the -S option? What if a user runs xbps-install -S -r /path/does/not/exist?

camoz avatar Dec 29 '21 13:12 camoz

I see. Also I just learned that -r ./dir will just create ./dir (including missing parents) if it does not exist (that kind of surprises me). I should rename this issue but I don´t know of a better name yet.

Not sure if I see that as an issue, creating the root directory seems convenient, we could maybe change this to only create only the root directory itself and not missing parent directories anything else would seem like a regression to me.

I understand that the specific problem I described in my OP would be solved by what you suggest. But, wouldn't it be nice for the user to be notified that there is no repo to sync with, when they explicitly asked xbps-install to sync via the -S option? What if a user runs xbps-install -S -r /path/does/not/exist?

I think that would be reasonable, xbps_rpool_sync could just return an error if there are no repositories.

Duncaen avatar Dec 29 '21 14:12 Duncaen