-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
bug: update command breaks when tldr repo has bad merge #414
Comments
I am wondering if we should be adding files that don't adhere to the directory structure in the first place. This should be handled by a CI job in the tldr repo that verifies that the directory structure is not broken. If we can prevent this from happening in the first place, that will be even better. Because otherwise, the client can choose not to update the cache, but then it can never update any further until it has been fixed in the tldr repo. |
We shouldn't, but it's always going to be possible to do. Also, keep in mind this issue isn't just about directory structures either, it's about any unexpected non-network related IO error that could occur.
I agree we should prevent it from happening in the first place, and in Matrix it was already discussed to improve our pipelines. However, other unexpected issues my arise that aren't caught by CI even if this particular scenario is handled.
Software shouldn't trust dependencies fetched at runtime, or assume they'll return exactly what's expected. As far as this repo is concerned, tldr-pages/tldr is an external resource. Things breaking are 100% fine, but the client not resolving or guiding the user on how to run the very updates that would solve it is unsatisfactory imo. |
Yep I agree. The checks should be there in both places. |
On numerous occasions, TL;DR has accepted a merge request which doesn't follow the required directory structure.
The most recent example is accepting a file under
/pages.es/common/asar.md/asar.md
. When this happens, I would expect the client to continue to handle updates gracefully. This way, when the issue is resolved, users can get an update to the fixed version.In this instance, it impacted a user that asked a question in our Matrix chat room with the following issue:
Expected behavior
Verify integrity
The update flow could have an intermediate step to "verify file integrity", whenever an update is fetched.
When grabbing the zip file, store and extract the contents in a separate directory and make sure the directory structure looks as expected before overwriting the real cache.
When pulling from the git repo, store the last good commit hash, and after pulling if the directory structure looks off, reset back.
Clear Cache on Error
If a non-network related error occurs during an update, instruct the user to try to invalidate the cache and try again. (We shouldn't do this automatically, or at least not without doing a
HEAD
request to the download location to ensure we can connect to it.)Actual behavior
If the user performs an update and gets a bad version of tldr-pages, the update command stops working.
Log, debug output
Environment
node --version
) - ?tldr --version
) - ?The text was updated successfully, but these errors were encountered: