server icon indicating copy to clipboard operation
server copied to clipboard

[Bug]: scan-app-data conversion

Open bwmravec opened this issue 2 years ago • 6 comments

⚠️ This issue respects the following points: ⚠️

  • [X] This is a bug, not a question or a configuration/webserver/proxy issue.
  • [X] This issue is not already reported on Github (I've searched it).
  • [X] Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • [X] Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • [X] I agree to follow Nextcloud's Code of Conduct.

Bug description

After running occ files:scan-app-data on server v24.0.5, I'm getting

In ScanAppData.php line 242: Implicit conversion from float 0.4666666666666667 to int loses precision

Steps to reproduce

  1. Install nextcloud
  2. run occ files:scan-app-data
  3. get error message

Expected behavior

Not getting error message

Installation method

Community Manual installation with Archive

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Nginx

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Updated to a major version (ex. 22.2.3 to 23.0.1)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • [X] Default user-backend (database)
  • [ ] LDAP/ Active Directory
  • [ ] SSO - SAML
  • [ ] Other

Configuration report

No response

List of activated Apps

Enabled:
  - accessibility: 1.10.0
  - activity: 2.16.0
  - admin_audit: 1.14.0
  - bruteforcesettings: 2.4.0
  - cloud_federation_api: 1.7.0
  - comments: 1.14.0
  - dav: 1.22.0
  - federatedfilesharing: 1.14.0
  - files: 1.19.0
  - files_downloadactivity: 1.13.0
  - files_sharing: 1.16.2
  - files_trashbin: 1.14.0
  - lookup_server_connector: 1.12.0
  - provisioning_api: 1.14.0
  - serverinfo: 1.14.0
  - settings: 1.6.0
  - theming: 1.15.0
  - viewer: 1.8.0
  - workflowengine: 2.6.0

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

bwmravec avatar Sep 27 '22 09:09 bwmravec

Hi, is this instance running with 64bit PHP? Can you show a screenshot of the serverinfo app?

szaimen avatar Sep 27 '22 10:09 szaimen

I managed to find a fix due to the deprecation with php 8+.

I don't know how to use Github properly so I'll post my fix here. Hopefully someone who's more skilled than me can pull this.

File in question: https://github.com/nextcloud/server/blob/master/apps/files/lib/Command/ScanAppData.php

Line 242: Currently - return sprintf('%02d:%02d:%02d', ($secs / 3600), ($secs / 60 % 60), $secs % 60);

Changed to- return sprintf('%02d:%02d:%02d', intdiv($secs, 3600), intdiv($secs, 60) % 60, $secs % 60);

occ files:scan-app-data works after this change is made.

Hiyoal avatar Oct 23 '22 10:10 Hiyoal

@Hiyoal mind to make a PR to review? Thanks.

solracsf avatar Nov 08 '22 18:11 solracsf

I also have this problem in v25.0.1 not every time i run the scan but often.

Cebrain avatar Nov 09 '22 20:11 Cebrain

I have also seen this problem on two recent NC updates:

NC 25.0.0

sudo -u apache php /var/www/html/nextcloud/console.php files:scan-app-data
  Scanning AppData for files
  In ScanAppData.php line 242:                                                               
    Implicit conversion from float 3.5 to int loses precision  
  files:scan-app-data [--output [OUTPUT]] [--] [<folder>]

NC 25.0.2 RC3

sudo -u apache php /var/www/html/nextcloud/console.php files:scan-app-data
  Scanning AppData for files
  In ScanAppData.php line 242:                                                               
    Implicit conversion from float 2.783333333333333 to int loses precision  
  files:scan-app-data [--output [OUTPUT]] [--] [<folder>]

PHP is 64-bit

file /usr/bin/php
/usr/bin/php: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=89ac9777b046d0efb754ca46d060854b91033745, for GNU/Linux 3.2.0, stripped

Bockeman avatar Dec 07 '22 19:12 Bockeman

root@xxxx:/var/www/nc# sudo -u www-data php ./occ files:scan-app-data
Scanning AppData for files
In ScanAppData.php line 242:

  Implicit conversion from float 8.5 to int loses precision


files:scan-app-data [--output [OUTPUT]] [--] [<folder>]
PHP 8.1.13 (cli) (built: Nov 26 2022 14:07:36) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.13, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.13, Copyright (c), by Zend Technologies

Nextcloud Version is 25.0.2.

not sure how to check if php executable is 32/64 yet

bahoop avatar Dec 24 '22 18:12 bahoop

@st3iny We can close this now, right?

come-nc avatar Jan 02 '23 10:01 come-nc

@st3iny We can close this now, right?

Not yet. The command scan-app-data is still affected by the deprecation. Only scan was fixed.

st3iny avatar Jan 02 '23 10:01 st3iny

Hi, please update to 24.0.9 or better 25.0.3 and report back if it fixes the issue. Thank you!

My goal is to add a label like e.g. 25-feedback to this ticket of an up-to-date major Nextcloud version where the bug could be reproduced. However this is not going to work without your help. So thanks for all your effort!

If you don't manage to reproduce the issue in time and the issue gets closed but you can reproduce the issue afterwards, feel free to create a new bug report with up-to-date information by following this link: https://github.com/nextcloud/server/issues/new?assignees=&labels=bug%2C0.+Needs+triage&template=BUG_REPORT.yml&title=%5BBug%5D%3A+

szaimen avatar Jan 23 '23 15:01 szaimen

@szaimen The bug is fixed and pending for merge/release.

Someone please merge the PR at https://github.com/nextcloud/server/pull/35935.

st3iny avatar Jan 23 '23 16:01 st3iny

Merged 👍

szaimen avatar Jan 23 '23 16:01 szaimen