Skip to content

Fix quota for 32 bits. Some vars could be float instead of integer - #40727

Closed
jvillafanez wants to merge 2 commits into
masterfrom
fix_32bits_quota
Closed

jvillafanez wants to merge 2 commits into
masterfrom
fix_32bits_quota

Conversation

@jvillafanez

@jvillafanez jvillafanez commented Apr 5, 2023 •

Copy link
Copy Markdown
Member

Description

The type of some variables seems to be different than the ones we expect based on some conditions.
In particular, 32 bits systems seem to use floats instead of integers in some of our "getSize" methods, which was causing problems because we expected only integers. Quota calculation was affected by this.

The problem with the quota is fixed with this PR also for 32 bits systems because we've taken into consideration that the size could be either an integer or a float.
Most of the "getSize" methods have been adjusted so the PHPDoc shows the right information. The behavior of the methods hasn't been touched (no new issues should happen)

Related Issue

#40709

Motivation and Context

How Has This Been Tested?

Not tested with 32 bits but with 64 bits. I don't see any problem

Test1

  1. Create a user with 0B quota
  2. The user can't create a folder.
  3. The user can't upload files.

Test2

  1. Create a user with 1.5GB quota
  2. Upload a 1GB file. The upload works
  3. Upload another 1GB file. Error shows not enough free space.

Test3

  1. Create a user with 2.5GB quota
  2. Upload a 1GB file to "/file.bin"
  3. Upload another 1GB file to "/t1/file.bin"
  4. Copy "/file.bin" to "/zzz/file.bin". Error shows not enough quota

Test4

  1. Create a user with 2.5GB quota
  2. Upload a 1GB file to "/file.bin"
  3. Upload another 1GB file to "/t1/file.bin"
  4. Copy "/file.bin" into "/t1/file.bin". This is successful because the file is overwritten.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

@update-docs

update-docs Bot commented Apr 5, 2023

Copy link
Copy Markdown

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@owncloud owncloud deleted a comment from ownclouders Apr 5, 2023
@sonarqubecloud

sonarqubecloud Bot commented Apr 5, 2023

Copy link
Copy Markdown

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

50.0% 50.0% Coverage
20.0% 20.0% Duplication

@jvillafanez

Copy link
Copy Markdown
Member Author

Closing in favor of #40729 , which targets the release branch.

@jvillafanez jvillafanez closed this Apr 5, 2023
@jnweiger jnweiger reopened this Apr 6, 2023
@jnweiger jnweiger closed this Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants