Skip to content
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

Trash bin: AbstractTrash::getSize() must be of the type integer, float returned #13160

Closed
iw0nderhow opened this issue Dec 19, 2018 · 76 comments
Closed
Labels
1. to develop Accepted and waiting to be taken care of bug feature: trashbin

Comments

@iw0nderhow
Copy link

Steps to reproduce

(I am unsure about this, as I cannot set up another test instance.)

  1. Delete any file
  2. Visit trash bin in app or web interface

Expected behaviour

The trash bin should open, showing deleted files.

Actual behaviour

In the web client, the trash bin does nothing but show the loading spinner.
The Android app shows an error instead.

Server configuration

Operating system: Raspbian stretch

Web server: Apache 2.4.25-3

Database: MariaDB 10.1.37-0

PHP version: PHP 7.0.30

Nextcloud version: 15.0.0

Updated from an older Nextcloud/ownCloud or fresh install: upgraded from 14.0.4, 13.0.6, 12.0.4

Where did you install Nextcloud from: zip file

Signing status:

Signing status
No errors have been found.

List of activated apps:

App list
Enabled:
  - accessibility: 1.1.0
  - activity: 2.8.2
  - admin_audit: 1.5.0
  - announcementcenter: 3.4.0
  - apporder: 0.6.0
  - audioplayer: 2.5.0
  - bookmarks: 0.14.3
  - bruteforcesettings: 1.3.0
  - calendar: 1.6.4
  - camerarawpreviews: 0.6.3
  - cloud_federation_api: 0.1.0
  - comments: 1.5.0
  - contacts: 3.0.0
  - data_request: 1.2.0
  - dav: 1.8.0
  - event_update_notification: 0.3.1
  - federatedfilesharing: 1.5.0
  - federation: 1.5.0
  - files: 1.10.0
  - files_downloadactivity: 1.4.0
  - files_external: 1.6.0
  - files_markdown: 2.0.5
  - files_pdfviewer: 1.4.0
  - files_sharing: 1.7.0
  - files_texteditor: 2.7.0
  - files_trashbin: 1.5.0
  - files_versions: 1.8.0
  - files_videoplayer: 1.4.0
  - firstrunwizard: 2.4.0
  - gallery: 18.2.0
  - gpxedit: 0.0.10
  - groupfolders: 2.0.2
  - logreader: 2.0.0
  - lookup_server_connector: 1.3.0
  - metadata: 0.8.0
  - news: 13.0.3
  - nextcloud_announcements: 1.4.0
  - notes: 2.5.1
  - notifications: 2.3.0
  - oauth2: 1.3.0
  - password_policy: 1.5.0
  - phonetrack: 0.4.0
  - previewgenerator: 2.0.0
  - provisioning_api: 1.5.0
  - qownnotesapi: 18.11.0
  - ransomware_protection: 1.3.0
  - serverinfo: 1.5.0
  - sharebymail: 1.5.0
  - sharerenamer: 2.3.0
  - spreed: 5.0.0
  - support: 1.0.0
  - survey_client: 1.3.0
  - systemtags: 1.5.0
  - tasks: 0.9.8
  - theming: 1.6.0
  - twofactor_admin: 0.2.0
  - twofactor_backupcodes: 1.4.1
  - twofactor_nextcloud_notification: 1.0.1
  - twofactor_totp: 2.1.0
  - updatenotification: 1.5.0
  - workflow_script: 1.0.0
  - workflowengine: 1.5.0
Disabled:
  - checksum
  - circles
  - cms_pico
  - encryption
  - files_accesscontrol
  - files_rightclick
  - flowupload
  - keeweb
  - ocdownloader
  - polls
  - socialsharing_email
  - user_external
  - user_ldap

Nextcloud configuration:

Config report
{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "1",
            "2",
            "3",
            "4",
            "5",
            "6"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/1",
        "htaccess.RewriteBase": "\/",
        "dbtype": "mysql",
        "version": "15.0.0.10",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "mail_smtpmode": "smtp",
        "mail_smtpauthtype": "LOGIN",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "filelocking.enabled": true,
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0
        },
        "loglevel": 1,
        "mail_smtpsecure": "ssl",
        "maintenance": false,
        "theme": "",
        "mysql.utf8mb4": true,
        "updater.release.channel": "stable",
        "enable_previews": true,
        "enabledPreviewProviders": [
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\BMP",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\MP3",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown",
            "OC\\Preview\\Movie"
        ],
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "debug": true
    }
}

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

Client configuration

Browser: Firefox 64

Operating system: Windows 10

Logs

Web server error log

Web server error log
(No errors)

Nextcloud log (data/nextcloud.log)

Nextcloud log
{"reqId":"cz7cQ2vFEo2wFR8K33gm","level":3,"time":"2018-12-19T13:40:33+00:00","remoteAddr":"1.2.3.4","user":"christopher","app":"remote","method":"PROPFIND","url":"\/remote.php\/dav\/trashbin\/christopher\/trash","message":{"Exception":"TypeError","Message":"Return value of OCA\\Files_Trashbin\\Sabre\\AbstractTrash::getSize() must be of the type integer, float returned","Code":0,"Trace":[{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/PropFind.php","line":98,"function":"getSize","class":"OCA\\Files_Trashbin\\Sabre\\AbstractTrash","type":"->","args":[]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php","line":797,"function":"handle","class":"Sabre\\DAV\\PropFind","type":"->","args":["{DAV:}getcontentlength",[{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFile"},"getSize"]]},{"function":"propFind","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFile"}]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"propFind"],[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFile"}]]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":1059,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["propFind",[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFile"}]]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":981,"function":"getPropertiesByNode","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFile"}]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":1666,"function":"getPropertiesIteratorForPath","class":"Sabre\\DAV\\Server","type":"->","args":["trashbin\/christopher\/trash",["{http:\/\/nextcloud.org\/ns}trashbin-filename","{http:\/\/nextcloud.org\/ns}trashbin-deletion-time","{DAV:}getlastmodified","{DAV:}getetag","{DAV:}getcontenttype","{DAV:}resourcetype","{http:\/\/owncloud.org\/ns}fileid","{http:\/\/owncloud.org\/ns}permissions","{http:\/\/owncloud.org\/ns}size","{DAV:}getcontentlength","{http:\/\/nextcloud.org\/ns}has-preview","{http:\/\/nextcloud.org\/ns}mount-type","{http:\/\/nextcloud.org\/ns}is-encrypted","{http:\/\/open-collaboration-services.org\/ns}share-permissions","{http:\/\/owncloud.org\/ns}comments-unread"],1]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php","line":355,"function":"generateMultiStatus","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Generator"},false]},{"function":"httpPropFind","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"https:\/\/1\/remote.php\/dav\/trashbin\/christopher\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpPropFind"],[{"absoluteUrl":"https:\/\/1\/remote.php\/dav\/trashbin\/christopher\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:PROPFIND",[{"absoluteUrl":"https:\/\/1\/remote.php\/dav\/trashbin\/christopher\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"https:\/\/1\/remote.php\/dav\/trashbin\/christopher\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/html\/apps\/dav\/lib\/Server.php","line":298,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/html\/apps\/dav\/appinfo\/v2\/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/html\/remote.php","line":163,"args":["\/var\/www\/html\/apps\/dav\/appinfo\/v2\/remote.php"],"function":"require_once"}],"File":"\/var\/www\/html\/apps\/files_trashbin\/lib\/Sabre\/AbstractTrash.php","Line":59,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko\/20100101 Firefox\/64.0","version":"15.0.0.10"}

Browser log

Browser log

@iw0nderhow iw0nderhow added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Dec 19, 2018
@ArkadiuszNiemiec
Copy link

ArkadiuszNiemiec commented Dec 30, 2018

Same here, fresh install Nextcloud 15. Is there a clean way to manually remove deleted files?
Edit: I had to clear some space so I just removed all files inside trash folder. The "Deleted files" in web GUI is still not loading.
Edit2: cleared database by using: sudo -u www-data php occ trashbin:cleanup --all-users

@go2sh
Copy link
Contributor

go2sh commented Dec 30, 2018

It might be related to FileInfo Size Function not converting the data field to integer properly, if it is already float.

@RailsViceRoads
Copy link

Same behaviour with Nextcloud 15.0.2.0.
In error log I found an TypeError:

Return value of OCA\Files_Trashbin\Sabre\AbstractTrash::getSize() must be of the type integer, float returned

/www/cloud/apps/files_trashbin/lib/Sabre/PropfindPlugin.php - line 78:
OCA\Files_Trashbin\Sabre\AbstractTrash->getSize()

/www/cloud/3rdparty/sabre/dav/lib/DAV/PropFind.php - line 98:
OCA\Files_Trashbin\Sabre\PropfindPlugin->OCA\Files_Trashbin\Sabre\{closure}("*** sensiti ... *")

/www/cloud/apps/files_trashbin/lib/Sabre/PropfindPlugin.php - line 79:
Sabre\DAV\PropFind->handle("{http://owncloud.org/ns}size", Closure {})

<<closure>>
OCA\Files_Trashbin\Sabre\PropfindPlugin->propFind(Sabre\DAV\PropFind {}, OCA\Files_Tr ... {})

/www/cloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105:
call_user_func_array([ OCA\Files_ ... "], [ Sabre\DAV\ ... }])

/www/cloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1059:
Sabre\Event\EventEmitter->emit("propFind", [ Sabre\DAV\ ... }])

/www/cloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 981:
Sabre\DAV\Server->getPropertiesByNode(Sabre\DAV\PropFind {}, OCA\Files_Tr ... {})

/www/cloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1666:
Sabre\DAV\Server->getPropertiesIteratorForPath("trashbin/frank/trash", [ "{http://n ... "], 1)

/www/cloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 355:
Sabre\DAV\Server->generateMultiStatus(Generator {}, false)

<<closure>>
Sabre\DAV\CorePlugin->httpPropFind(Sabre\HTTP\R ... "}, Sabre\HTTP\Response {})

/www/cloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105:
call_user_func_array([ Sabre\DAV\ ... "], [ Sabre\HTTP ... }])

/www/cloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479:
Sabre\Event\EventEmitter->emit("method:PROPFIND", [ Sabre\HTTP ... }])

/www/cloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254:
Sabre\DAV\Server->invokeMethod(Sabre\HTTP\R ... "}, Sabre\HTTP\Response {})

/www/cloud/apps/dav/lib/Server.php - line 301:
Sabre\DAV\Server->exec()

/www/cloud/apps/dav/appinfo/v2/remote.php - line 35:
OCA\DAV\Server->exec()

/www/cloud/remote.php - line 163:
require_once("/www/cloud/ ... p")`

@bzfwunde
Copy link

bzfwunde commented Feb 7, 2019

I fixed it locally by explicitly casting to int in method getSize() in AbstractTrash.php. It now looks like this now:

public function getSize(): int {
    return (int)$this->data->getSize();
}

@bdstr
Copy link

bdstr commented Feb 7, 2019

I fixed it locally by explicitly casting to int in method getSize() in AbstractTrash.php. It now looks like this now:

public function getSize(): int {
    return (int)$this->data->getSize();
}

It works for me too, thanks!

@Somebodyisnobody
Copy link

Somebodyisnobody commented Feb 9, 2019

Had the same problem, found this issue by Google, thanks for the exact Nextcloud-log. Solved it by the following answer
#13160 (comment):

Edit2: cleared database by using: sudo -u www-data php occ trashbin:cleanup --all-users

@bdstr @bzfwunde maybe do an pull request?

@manches
Copy link

manches commented Feb 25, 2019

I fixed it locally by explicitly casting to int in method getSize() in AbstractTrash.php. It now looks like this now:

public function getSize(): int {
    return (int)$this->data->getSize();
}

It works for me too, thanks!

This worked for me
Can you include this in the nextcloud code?

@kesselb
Copy link
Contributor

kesselb commented Feb 25, 2019

This worked for me
Can you include this in the nextcloud code?

Bad idea. If you running nextcloud on a raspberry pi (and use a 32bit operating system) files larger than ~4gb are to big for int. What is wrong here is the typed return type.

@itsolon
Copy link

itsolon commented Mar 1, 2019

this worked for me too but the files were 2,5 GB not bigger than 4
what happens when deleting files with over 4 GB size?

@bcutter
Copy link

bcutter commented Mar 17, 2019

Same for me, fix doesn´t work cause it´s already applied in AbstractTrash.php.
Running on a Raspberry Pi with NC v15.0.5.3, deleted files totally at least 8 to 9 GB. No way to recover... horrible, I´m lost :-(

@bcutter
Copy link

bcutter commented Mar 17, 2019

Update: When I change the "public function getSize(): int {" to "public function getSize(): float {" in AbstractTrash.php, trashbin page loads immediately. So where the int is a fix for some, it gets me in big troubles. Definitely NOT closed!

@kesselb
Copy link
Contributor

kesselb commented Mar 17, 2019

@rullzer @MorrisJobke https://github.com/brick/math could be a possible solution. I'm not affected by this problem but it would be cool to have it fixed. Keep in mind you recommend nextcloud for raspberry. Using int for $size will not work there for large files.

@jpschewe
Copy link

This is still a problem in nextcloud version 15.0.8.1. I got around it by editing AbstractTrash.php and putting intval around the return statement for getSize.

I tried using changing the return value to float and that worked too.

@Acreen
Copy link

Acreen commented Jul 2, 2019

I can confirm the problem at the image NextCloudPi_RPi_03-09-19. I updated to nextcloud 16.0.1.1. The trash bin has been unusable after I dropped a 3.8 gb file in it.

@openterprise
Copy link

I have faced the same issue.
workaroud: sudo -u www-data php occ trashbin:cleanup --all-users
Nextcloud 16.0.1
hardware: Tinkerboard S
OS: Armbian 5.77
kernel: 4.19.41-rockchip
php: 7.2.19

@Acreen
Copy link

Acreen commented Jul 4, 2019

Thx for the info! I can confirm that helped.

@kesselb kesselb added 1. to develop Accepted and waiting to be taken care of and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Jul 6, 2019
@ecejuan
Copy link

ecejuan commented Jul 19, 2019

Hello,
I have NC 16.0.3 and i detected this error. I read the thread and have no clear solution.
Please, could you clarify?
Thanks

@Acreen
Copy link

Acreen commented Jul 22, 2019

Hello,
I have NC 16.0.3 and i detected this error. I read the thread and have no clear solution.
Please, could you clarify?
Thanks

As openterprise stated the following console command forces the trashbin to empty:
sudo -u www-data php occ trashbin:cleanup --all-users

You either have to login to the nextcloud locally or via ssh.

In my case it is a nextcloudpi and it said it didn't the file occ. In that case I had to change the command to where my occ is, i. e. :
sudo -u www-data php /var/www/nextcloud/occ trashbin:cleanup --all-users

@go2sh
Copy link
Contributor

go2sh commented Oct 7, 2020

I doubt that Nextcloud is mostly used in home environments, maybe installations but not (paying) users. There are alot of high volume installations referenced on the website. (Siemens, German Goverment, French Government) Anyway, the fix has some implications. Just casting away the float means, you loose information. These implications have to be analyzed and understood and they might not be immediately visible. I guess, this issue is not on the top priority of the payed NC devs and nobody has volunteered to work on this either. If somebody is willing to make the commitment, I doubt that the patch won't get merged. ;-) Maybe it's even better to fail when reaching the 4 GB limit in the trash bin.

@miskovics
Copy link

I hope somebody will come up with a stat that shows whether home or business, 32bit or 64bit (paying) users are more. Till that time I just want to point out the non-paying users also create value for the NextCloud org by testing in various environments and reporting issues free of charge. If their needs are ignored, they might get pissed off and stop caring about NextCloud in general.

This particular issue is open since almost 2 years, and the amount of comments, workaround discussions clearly show that people are bothered.

In order to put things into perspective and continue discussing in a language that everyone understands, can an expert (NextCloud) PHP dev estimate how much effort in hours it would take to fix this clean or implement a workaround?

If this would be e.g. 1 month effort, costing 10K€, I would understand the hesitation immediately and just give up on this.

@obriat
Copy link

obriat commented Dec 14, 2020

#13160 + #13160 fix my trash issues on nextcloud 20.0.3, follow x (thanks @rwat1 & @bdstr)

@aler9
Copy link
Contributor

aler9 commented Dec 22, 2020

Hello, some days ago i decided to investigate more into issues that occur when running Nextcloud on 32-bit machines, with the hope of helping fixing the getSize() issue and a lot more.

I ran all unit tests in a 32-bit environment, and tried to fix most failures, but soon i stumbled upon some PHP functions that can't be adapted to handle large files, in particular the fseek() function, that is used to read or edit parts of a file, and on 32-bit systems is limited to 32-bit values: it can't read or edit file parts that are placed beyond the 4GB threshold.

Therefore i decided to switch to the Raspberry Pi OS 64bit (currently in beta), and this solved most of my problems.

I know that this can't be a solution for everyone, since it works only with the Raspberry Pi 3 or 4, but is PHP itself that is not fit for this application.

I'm also a little sorry since this bug was on my TODO list for years - but it's time to move on.

@chainria
Copy link

Hello, some days ago i decided to investigate more into issues that occur when running Nextcloud on 32-bit machines, with the hope of helping fixing the getSize() issue and a lot more.

I ran all unit tests in a 32-bit environment, and tried to fix most failures, but soon i stumbled upon some PHP functions that can't be adapted to handle large files, in particular the fseek() function, that is used to read or edit parts of a file, and on 32-bit systems is limited to 32-bit values: it can't read or edit file parts that are placed beyond the 4GB threshold.

Therefore i decided to switch to the Raspberry Pi OS 64bit (currently in beta), and this solved most of my problems.

I know that this can't be a solution for everyone, since it works only with the Raspberry Pi 3 or 4, but is PHP itself that is not fit for this application.

I'm also a little sorry since this bug was on my TODO list for years - but it's time to move on.

So does this basically mean the end of it? Not salty or something, just wanting to know if this is final. I have created a patch file which I will simply apply after each update. I am aware that running a 32 bit Server in 2021 is not really viable, but as I cannot just get a newer one, that's what I'll have to live with.

@JordanDIG
Copy link

I fixed it locally by explicitly casting to int in method getSize() in AbstractTrash.php. It now looks like this now:

public function getSize(): int {
    return (int)$this->data->getSize();
}

Hello

It worked for me, I can see my deleted files but there is a problem: before I have activated the encryption but the file is not decrypted how can I fix it ?

@HollowedEmpire
Copy link

Being in the field, I know there are a lot of businesses running in 32 bit environments still for multitudes of reasons. This ranges from simple cost saving to inter-software compatibility with legacy programs the businesses depend on. It will be this way for a great deal of time to come yet too.

It's only a matter of time before a business user in a 32-bit environment notices accessing their trash generates tons of errors and appears to make their files vanish. Then a patch will be rolled out to help them, and indirectly to the rest of us too.

I gotta say though, something as fundamental as the trash not working in a file-management-first software without user intervention hacks every update... does not instill a lot of confidence. It has also hurt the times I tried recommending Nextcloud (even for the users in 64-bit environments), which I otherwise highly praise.

Above all though, I'm still not sure why this is even an issue in the first place. Surely they can do a 64/32 bit check (why not PHP_INT_SIZE == 4?) and then act accordingly. This way 64-bit+ logic can stay the same as it is now, and 32-bit logic can do the casting solution so users can have working software. All at the cost of one if. Certainly a lot better than the bold and rather wishful bet that every device under the sun is 64-bit and is additionally is running a 64-bit environment.

@error420
Copy link

error420 commented Mar 3, 2021

I fixed it locally by explicitly casting to int in method getSize() in AbstractTrash.php. It now looks like this now:

public function getSize(): int {
    return (int)$this->data->getSize();
}

Worked for me too. Thank you.

@friciwolf
Copy link

I can confirm that this issue still persists with NC v22.1 on a Raspberry Pi 4, forcing the conversion to int however still fixes it, and the bin can be opened afterwords without any issues...

@milouk
Copy link

milouk commented Aug 18, 2021

I can too confirm the issue in NC 22.1 RPi4. The int casting fix solves the issue.

@DroWnThePoor

This comment has been minimized.

@t-schroeder

This comment has been minimized.

@GAS85

This comment has been minimized.

@MichaIng
Copy link
Member

MichaIng commented Nov 5, 2021

Guys, storage/Snap issues with a 64-bit system are pretty OOT here. I suggest to discuss such things on the community forum.

@darkphoenix
Copy link

darkphoenix commented Nov 10, 2021

How is it that there is a literal one-line fix for this and it hasn't been merged in well over a year? The whole "32 bit is outdated" bit seems stupid to begin with, but I'm hitting this issue on ARM, and I bet I'm not the only one - which makes this a problem on a huge amount of Pi-based setups as well as low-end NASes. Come on guys, why isn't this just merged into the actual application/if casting to int is a problem, why aren't other possible fixes being investigated? This seems like a pretty serious issue, and it just looks like nobody cares beyond the users who need their files back.

@Dubatan
Copy link

Dubatan commented Jan 7, 2022

I may have fix for this. I was forced to look into this issue after switching from nextcloudpi to snap and was unable to edit the AbstractTrash.php anymore due to the read only behavior of snap.

After I cleand the trashbin with sudo /snap/bin/nextcloud.occ trashbin:cleanup --all-users up I looked through my trash_bin directory and found some corrupted files. I was unable to delete them and get always a bad checksum error, so I unmounted the partition and let sudo fsck -v run through it. After that I made a filescan with sudo /snap/bin/nextcloud.occ files:scan --all and after that, the trashbin works fine without editing the AbstractTrash.php.

Hope this will help anyone.

@chadwellak
Copy link

chadwellak commented Jan 21, 2022

I fixed it locally by explicitly casting to int in method getSize() in AbstractTrash.php. It now looks like this now:

public function getSize(): int {
    return (int)$this->data->getSize();
}

It works for me too, thanks!


I may have fix for this. I was forced to look into this issue after switching from nextcloudpi to snap and was unable to edit the AbstractTrash.php anymore due to the read only behavior of snap.

After I cleand the trashbin with sudo /snap/bin/nextcloud.occ trashbin:cleanup --all-users up I looked through my trash_bin directory and found some corrupted files. I was unable to delete them and get always a bad checksum error, so I unmounted the partition and let sudo fsck -v run through it. After that I made a filescan with sudo /snap/bin/nextcloud.occ files:scan --all and after that, the trashbin works fine without editing the AbstractTrash.php.

Hope this will help anyone.


Thanks for these posts as always. I've had to implement this fix, not frequently, but enough over the past few years that I always remember that there's something to look for. Is there no upstream way to fix this kind of weird issue or is it something to do with all of my nextcloud instances?

fsck's are run a lot but doing full file scans seems tedious and interruptive. It really seems like there should be a fix. Am I just being a pest?

Thanks.

@Siox0911

This comment was marked as off-topic.

@chadwellak

This comment was marked as off-topic.

@Siox0911

This comment was marked as off-topic.

@chadwellak

This comment was marked as off-topic.

@szaimen
Copy link
Contributor

szaimen commented Jul 13, 2022

Closing due to nextcloud/documentation#9071

@szaimen szaimen closed this as completed Jul 13, 2022
@darkphoenix
Copy link

Closing due to nextcloud/documentation#9071

You're kidding, right? The fix is seriously just to declare Nextcloud no longer works on a large chunk of low-end NAS boxes with 32-bit ARM processors? 32-bit may be long dead on x86, but best I can tell it's still alive and well on ARM... can't tell for the latest generation, but I know plenty of NASes from just a few years ago (including mine) are now officially unsupported due to this.

@szaimen
Copy link
Contributor

szaimen commented Jul 13, 2022

I am not kidding. It was already kind of unsupported before as you can see by the duration this issue was open. Now it was made official.

@nextcloud nextcloud locked as too heated and limited conversation to collaborators Jul 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1. to develop Accepted and waiting to be taken care of bug feature: trashbin
Projects
None yet
Development

Successfully merging a pull request may close this issue.