libelektra
libelektra copied to clipboard
proposal: change behavior of kdb mount for non-existing mountpoints
- Currently,
kdb mountaccepts mountpoints, regardless of whether these mountpoints actually exist. - Example:
kdb mount ~/thisfiledoesnotexist.ni spec:/test nihas return code 0 and prints nothing to stdout/err. - This can be irritating, if one wants to actually mount an existing file, but by accident specifies a wrong path. Then
kdb mountdoes not fail or warn about the mountpoint not existing, so the user won't know they made a mistake. - The fact that
kdb mountexpects an absolute path makes this even a bigger problem, because users might try tocd ~/existingdirectory && kdb mount thisfiledoesexist.ni spec:/test nito mount~/thisfiledoesexist.ni. This won't work, because the path to the file was not given as absolute. - I was "tricked" by this behavior of kdb mount many times :) It's especially tricky in mingw builds, where paths are irritating already (e.g. are you supposed to use "C:/Users/..." or "C:\Users..." or "/c/Users", ...). If
kdb mountwarned about the mountpoint not existing, it would be easier to pick the right "path style". - I guess it is a feature to use
kdb mountwith a non existing mountpoint and have Elektra create a file once akdb setoccurs. Maybe it could default to fail and only accept non-existing mountpoints, if a new flag (e.g. a shortened version ofkdb --allow-non-existing-mountpoint) is set?
Thank you so much for reporting this usability problem! :revolving_hearts:
Yes, I agree that checkFile in src/plugins/resolver/filename.c and also src/plugins/wresolver/wresolver.c would be much more useful if it also checks if a file is present.
But I am afraid that printing a warning in src/libs/tools/src/backend.cpp is the most what we can do. Aborting on non-existing files would be too much as this is a 100% valid operation: empty files are the representation for an empty KeySet. Furthermore, the checking functionality only makes sense for non-cascading mountpoints.
Thanks for your comment!
I think a warning - that includes the absolute file path that was tried - would suffice and be of great help already: It would help users that wanted to mount an existing file with troubleshooting the issue.
I mark this stale as it did not have any activity for one year. I'll close it in two weeks if no further activity occurs. If you want it to be alive again, ping by writing a message here or create a new issue with the remainder of this issue. Thank you for your contributions :sparkling_heart:
I closed this now because it has been inactive for more than one year. If I closed it by mistake, please do not hesitate to reopen it or create a new issue with the remainder of this issue. Thank you for your contributions :sparkling_heart: