Closed (outdated)
Project:
Drupal core
Version:
9.3.x-dev
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
17 Nov 2008 at 16:49 UTC
Updated:
26 May 2022 at 05:13 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dave reidHere's a starter patch. I hope it will pass testing. I am a little unsure of the changes made in drupalGetTestFiles().
Comment #2
mrharolda commentedNice one!
I'm wandering if the 1024 byte
fread()'s are sane candidates for the DRUPAL_KILOBYTE, though...-H-
Comment #3
dave reidWell I went for a replace-everything-I-could-find approach and figured we could narrow it down instead of trying to find more.
Comment #4
alexanderpas commentedwe also need to test with DRUPAL_KILOBYTE set to 1000, to see if there are any possible problems in the future...
quick context review
common.inc - file.inc - locale.inc
fread()andfgets()almost certainly should be working with 1024 (DRUPAL_KIBIBYTEanyone?)blogapi.module
$usersizeand$uploadsizeare probaly proper changes.filter.module
also, almost certainly should be working with
DRUPAL_KIBIBYTEsimpletest.install
Certainly should be
DRUPAL_KIBIBYTE, as it is clearly using powers of 2file.test - upload.admin.inc - upload.module - upload.test - user.module - user.test
almost certainly proper changes!
also... there are some unrelated changes in your file.
Comment #5
mrharolda commentedDefining a
DRUPAL_KIBIBYTEseems like a good idea. At first both the Kilobyte and the Kibibyte will be 1024 bytes...Later (php 6?) Drupal can change the Kilobyte to 1000...
Comment #6
mrharolda commentedLate August, even Apple decided to change Mac OS X v10.6 to use 1000 bytes per kilobyte.
Isn't it time to fix Drupal's "wrong" kilobyte define yet?
define('DRUPAL_KILOBYTE', 1000);Comment #7
alexanderpas commentedI wonder when PHP itself will be making the switch? http://bugs.php.net/bug.php?id=46534
Comment #8
mrharolda commented3 years later and Drupal 8.x is in -dev... What about correcting the kilobyte to what it should be in D8? ;)
1000!
Comment #9
pingers commentedUh, yeah, because Drupal is hosted on Mac OSX. No.
Still agree Dave Reid's patch should go in :)
Although, probably needs a re-roll.
Comment #10
mrharolda commented@pingers: what do you mean by "Uh, yeah, because Drupal is hosted on Mac OSX. No."?
For the record: 1 kilobyte equals 1000 bytes, just like 1 kilometer equals 1000 meters. The question is if Drupal should follow conventions and use the correct definition (1000) or make the same misstake as a lot of other implementations and lie about the value of a kilo (1024, which is a 'kibi').
Comment #11
jbrown commentedSee also: #1114538: Use SI and/or IEC units for byte counts?
Comment #12
alexanderpas commentedIt is my opinion, Drupal should always be using the correct SI and IEC units, except when handling a interface that does not handle those units correctly
Comment #13
pingers commented@MrHaroldA What I mean is the most sensible option is to use the unit used by the most commonly used hosting OS. I.e. Linux and 1024 bytes in a kilobyte. Also this is the value used by the IEC standard noted in #12 (IEC = 2^10, SI = 10^3). Also, it has nothing to do with this issue. Please open a new issue to debate this. Feel free to link to it from this issue.
Comment #14
mrharolda commented@pingers: IIRC, Linux uses the correct standard: 1000 bytes in a kB.
And no need for a new issue: #1114538: Use SI and/or IEC units for byte counts? covers it all...
Comment #15
pingers commented$ dd if=/dev/zero of=testfile.txt bs=1K count=1
1+0 records in
1+0 records out
1024 bytes (1.0 kB) copied, 8.552e-05 s, 12.0 MB/s
Sorry, you're wrong.
Comment #16
mrharolda commented@pingers: I notices that you use 'K' instead of 'k', which is also wrong in a SI approach. It's also silly to refer to an invalid application for the "truth" as dd should read "kiB" or "KB" for 1024 bytes as 1kB equals 1000 bytes.
The hosting OS has nothing to do with a website: the visiting OS is much more leading. I don't know what Windows is using these days, but OSX and a lot of Linux file managers already show correct SI sizes, with more to follow suit.
There are 2 options: use SI or IEC. PHP itself aready has plans to ditch IEC support and switch over to SI, why should our favorite CMS stay behind?
Comment #17
pingers commentedGot a link? If and when they do, I'd consider it a possibility.
Comment #18
mrharolda commentedSome nice reads:
http://drupal.org/node/267883#comment-1100817
https://bugs.php.net/bug.php?id=46534
And even Dries agrees we should use SI instead of IEC: http://drupal.org/node/151902#comment-858570
Comment #19
alexanderpas commentedThere are three different filesizes we need to account for.
Memory sizes expressed in base-2 (IEC) units. (1kiB = 1024 bytes)
Disk sizes expressed in base-10 (SI) units. (1kB = 1000 bytes)
Shorthand sizes returned from PHP that use the wrong type (1k for 1024) such as the memory_limit setting.
Comment #20
jbrown commented@alexanderpas #1114538: Use SI and/or IEC units for byte counts? handles all of those combinations.
Comment #31
quietone commentedI think this work has been completed in other issues, such as #3001398: format_size() fixes. I searched Drupal 10.0.x found 31 instances of 1024 (excluding files in a 'fixtures' directory) but I did not spot any one that needed to be changed. If I am wrong about that it would be better to open a new issue anyway because of the many code changes that have happened in the intervening 10 years.
I came here while triaging a related issue for bugsmash, adding tag.
Closing as outdated.