Running "occ files:scan" ignores request to scan (and clear) a missing file
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
Steps to reproduce
- Upload a test file to the Nextcloud instance
- Delete the file from the underlying file store (NOT via Nextcloud)
- Run "occ files:scan --path=[path to now missing file] to make it realize the file is gone
- Observe that occ errors out with "Path not found: [path to missing file]" error rather than completing the requested action and updating/removing the missing file.
Expected behaviour
Nextcloud should recognize that while the file it thinks is there is gone from the underlying datastore, it still needs to correct its records and remove it from the filesystem view it presents to users/apps.
Actual behaviour
The occ command errors out with "Path not found: " error, yet continues to show that the file exists through webdav, which is an incorrect and unwanted inconsistency.
Attempts to access the file that appears to be there but isn't will continue to produce errors.
Additional Notes
This worked as expected on Nextcloud 9.0.58, which is what I was running before updating to Nextcloud 15 and then 16. Both Nextcloud 15 and 16 have this problem. I haven't tested later versions, but I would guess it might still be there as well.
There is an obvious workaround, which is to scan the whole directory that contains the missing file, rather than to specify that occ should scan just the file that is trying to be fixed/cleared. That is not a reasonable workaround though, because the scan takes a prohibitively long time and severely impacts performance of the system for that time if the containing directory has many other subfolders and hundreds of thousands of files.
Server configuration
Operating system: Debian Buster 10 (stock)
Web server: N/A
Database: mariadb-server-10.3 1:10.3.22-0+deb10u1 (stock Debian)
PHP version: php7.3 7.3.11-1~deb10u1
Nextcloud version: Nextcloud 16.0.8
(I verified this issue also occurred on 15.0.14)
Updated from an older Nextcloud/ownCloud or fresh install: Updated originally from Nextcloud 9.0.58
Where did you install Nextcloud from: https://download.nextcloud.com/server/releases/nextcloud-16.0.8.tar.bz2
Signing status:
Signing status
No errors have been found.
Are you using external storage, if yes which one: no
Are you using encryption: no
Are you using an external user-backend, if yes which one: no
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the occ files:scan command and reproduce the missing-file case using a targeted path rather than scanning its entire directory. Trace how the command handles a file absent from the underlying file store; done means the stale filesystem view is removed without the command failing on the missing path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100