Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

bug: WebCatalog fails to update apps, deleting the entire app in the process. #1381

Closed
profucius opened this issue Mar 16, 2021 · 19 comments · Fixed by #1384
Closed

bug: WebCatalog fails to update apps, deleting the entire app in the process. #1381

profucius opened this issue Mar 16, 2021 · 19 comments · Fixed by #1384
Labels
bug Something isn't working

Comments

@profucius
Copy link

Bug Report

Specifications:

  • App Version: 30.1.0 (issue occurs as far back as v26 in my memory)
  • OS: Windows 10.

Description:
Installing a NEW app works perfectly fine. However, when clicking "Update" within WebCatalog on apps, it appears to start updating, then produces the error "Failed to update APP". Upon investigation, the folder where the app was once installed is now completely empty.

Steps to Reproduce:

  1. Install a new app. Open it and use it fine.
  2. WebCatalog informs there is a new update. Install it.
  3. Error is notified at top-right.
  4. Folder is empty.
  5. Close and reopen WebCatalog, the app will appear to not be installed at all.
  6. Restore a .zip backup of the app from prior to update. WebCatalog sees it again, but still suggests an update is needed.
  7. Unable to actually update any apps.

Additional Context
image

image

image

image

image

@quanglam2807 quanglam2807 added the bug Something isn't working label Mar 16, 2021
@quanglam2807
Copy link
Member

I'm sorry for this, @profucius. Would you mind switching on "Allow the app to send anonymous crash reports" in the app preferences and try again so WebCatalog can automatically report what happens?

I'm certain that while the app is damaged, your data remains intact.

@profucius
Copy link
Author

Okay I have done that, and tried to update 5 separate apps in my installed list. All failed. You should have the bug reports now.

@quanglam2807
Copy link
Member

Currently, when you update an app, WebCatalog would wipe the old app folder and create a new one with new files.

In this case, somehow, WebCatalog managed to remove all the files in the app folders but failed to remove the folders.

@quanglam2807
Copy link
Member

Btw, thank you so much for providing the bug reports.

@profucius
Copy link
Author

profucius commented Mar 16, 2021

No problem, let me know if you want me to test anything.

I checked the folder permissions where I have the apps install to, and there is nothing unusual. In fact I have the ownership of the folder set to "Everyone" and it is not set to read-only, therefore any app and user should be able to view and modify files and folders with no issue.

I also tried this workflow, and it still failed:

  1. Open WebCatalog, it sees the app to update.
  2. Manually delete the app-to-be-updated's folder.
  3. Click Update within WebCatalog.
  4. Notification produces the same error.
  5. The app folder is still deleted, never showed any signs of WebCatalog creating it at all.

The odd thing to me is that installing new apps has no issue whatsoever.

@quanglam2807
Copy link
Member

Here is the error

Error: EPERM: operation not permitted, rmdir 'D:...\WebCatalog Apps\YouTube'

Updating & installing use the same code so I'm not sure what happens exactly.

The only thing that updating does differently is replacing the old folder (overwriting) and somehow that step fails.

https://github.com/webcatalog/webcatalog-app/blob/4220f56ea1f288cca6f435c71b6d402e77a79092/main-src/libs/app-management/install-app-async/install-app-forked-electron-v2.js#L338

Have you tried to restart your computer?

I couldn't reproduce the bug on my system. So it would be quite difficult to figure it out.

@quanglam2807
Copy link
Member

Btw, can you check the version of WebCatalog Engine that your apps are running?

@profucius
Copy link
Author

profucius commented Mar 16, 2021

It is certainly an odd one, sounds like. Yes I have rebooted multiple times. As I said in the original post, this has been going on across multiple version of WebCatalog, as far back as I think v26, sometime last year. I had just relegated to not updating my apps, until recently when I decided to try it again on the newest 30.1.0 and it was still happening, I thought I would create this ticket about it.

Here are the versions that might help you:

image

image

Note: This app, I had totally re-created on WebCatalog v29, in hopes that maybe my older version were just bugged. However that was not the case.

Anything else I can provide you, test out, answer, etc? Do you think a total uninstall and reinstall could help?

@quanglam2807
Copy link
Member

This bug is related to: npm/npm#10826, electron/packager#597, https://github.com/isaacs/rimraf/blob/master/rimraf.js#L338

I think Windows itself is the problem: it doesn't handle file operations well.

@profucius
Copy link
Author

profucius commented Mar 17, 2021

So am I supposed to just do nothing about the issue? I'm a paying customer for WebCatalog, and you're telling me I just cannot update my own apps?

@quanglam2807
Copy link
Member

@profucius Probably, GitHub didn’t notify you about the fix? #1384

Can you update to v30.2.0 and try again, please?

@profucius
Copy link
Author

You've prematurely closed the ticket; You should have asked me to test it prior.

I have tested 30.2.0 and the same issue occurs. The only difference is that during the update process, it seems to hang at "Installing" for significantly longer than prior to 30.2.0, but then ultimately fails the same way, with an empty app folder.

image

image

What else can I do to help? It is unacceptable as a paying customer to simply close this ticket. I should be able to either upgrade apps properly, or have a functional workaround for upgrading apps. I cannot be expected to manually uninstall and recreate each of my 10 apps each time a new engine version is released.

@quanglam2807 quanglam2807 reopened this Mar 17, 2021
@quanglam2807
Copy link
Member

quanglam2807 commented Mar 17, 2021

I'm sorry if you disagree with how I work. If you'd like a full refund, please feel free to send an email to [email protected]

Tickets can be closed and reopened if necessary. It didn't mean I refused to resolve the bug.

I didn't see similar cases with WebCatalog in other Windows computers, so it would take a while to figure it out exactly what's going on.

Have you tried to run WebCatalog as admin?

@profucius
Copy link
Author

profucius commented Mar 17, 2021

I just tried running as admin, same effect.

It is odd that no other Windows computers are having this trouble. I can't think of anything that I have running that would be causing this. I don't have any other filesystem or permissions issues with any other apps.

Here is a question, would it be possible to do this? When a new engine update is released, I create a new "blank" app within WebCatalog, for the purpose of having a folder with the engine files, and then copy/paste those engine files into my pre-existing apps. Would that upgrade the engine for those apps? Or, is part of the engine or upgrade process baked into the executable for the app? If it is copy/pastable, I could write my own macro for handling this as a workaround so that we can be done with the trouble. If this wouldn't work, can you think of any other workaround that I can try?

One more question, is there a way to preserve the appdata of each app, so that if I did end up needing to uninstall and reinstall each app with each update, that I could just have the app resume using the prior appdata? It sounds like this might be similar to the way the WebCatalog app already does it, it deletes and re-creates the app preserving the appdata.

@quanglam2807
Copy link
Member

Also, if possible, would you mind checking if the empty app folder has any hidden files?

Here is a question, would it be possible to do this? When a new engine update is released, I create a new "blank" app within WebCatalog, for the purpose of having a folder with the engine files, and then copy/paste those engine files into my pre-existing apps. Would that upgrade the engine for those apps? Or, is part of the engine or upgrade process baked into the executable for the app? If it is copy/pastable, I could write my own macro for handling this as a workaround so that we can be done with the trouble. If this wouldn't work, can you think of any other workaround that I can try?

One more question, is there a way to preserve the appdata of each app, so that if I did end up needing to uninstall and reinstall each app with each update, that I could just have the app resume using the prior appdata? It sounds like this might be similar to the way the WebCatalog app already does it, it deletes and re-creates the app preserving the appdata.

Thanks for bringing this up. Yes, the simplest workaround (if you're not using custom apps) is to manually delete the app folders in D:\<username>\WebCatalog Apps\ and then reinstall the apps. You won't lose your data as they're stored elsewhere and the updating/installing processes don't do anything to interfere with the app data.

FYI, if you click on an app's card, a popup dialog will show up, you can scroll to the bottom of the dialog to check where the app stores its data:

Screen Shot 2021-03-17 at 10 17 58 PM

Developers literally put the text "Life is suffering" in the code that handles file removal operations on Windows (https://github.com/isaacs/rimraf/blob/8c10fb8d685d5cc35708e0ffc4dac9ec5dd5b444/rimraf.js#L140) so this is quite a tricky problem.

@profucius
Copy link
Author

profucius commented Mar 17, 2021

Also, if possible, would you mind checking if the empty app folder has any hidden files?

That resolved the issue! I found that there was a hidden "desktop.ini" file, which was storing a reference to custom folder icon. By re-creating the folder, moving non-hidden files to that folder, deleting the original, I was able to make WebCatalog update all my apps successfully.

The odd thing about this is that before this, when I updated an app and it failed, the folder would be totally empty, that hidden file was not there at all. It's as if WebCatalog could delete the hidden file, but then hit a snag right after that?

Before update app via WebCatalog:
image

After update app via WebCatalog:
image

@quanglam2807
Copy link
Member

Awesome, @profucius. Thank you for your patience.

In this case, I guess it's likely that the folders' permissions were somehow set to "read-only" (but not the files in them) so WebCatalog could delete files, but not the folders. Similar case: electron/packager#402

@profucius
Copy link
Author

Would it be possible for WebCatalog to not be required to empty the entire folder? I do want to keep a couple of non-related files inside the apps folders. One example is the folder icon, another example is a "VisualElements" file and folder, which stylizes the icons in my start menu (via the app called "Tile Iconifier". These files do not cause any harm being in the folder with the app, and would be nice if these files would persist across app updates, instead of being deleted when the app is updated.

@quanglam2807
Copy link
Member

Would it be possible for WebCatalog to not be required to empty the entire folder? I do want to keep a couple of non-related files inside the apps folders. One example is the folder icon, another example is a "VisualElements" file and folder, which stylizes the icons in my start menu (via the app called "Tile Iconifier". These files do not cause any harm being in the folder with the app, and would be nice if these files would persist across app updates, instead of being deleted when the app is updated.

Definitely possible. I'll try to work on this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants