[pacman-dev] [PATCH] Replace @SIZECMD@ with POSIX-compatible command

Allan McRae allan at archlinux.org
Tue Apr 4 02:20:54 UTC 2017


On 25/03/17 10:26, Mike Swanson wrote:
> On Mon, 2017-03-20 at 15:19 +1000, Allan McRae wrote:
>> On 20/03/17 12:55, Drew DeVault wrote:
>>> Now uses wc -c $file | cut -d' ' -f1, which works using only POSIX
>>> commands and removes the need for any platform-specific usages.
>>>
>>
>> I'm sure we had this in the past and changed to what we have
>> currently.
>>  Can't remember why...   compressing filesystems maybe?
>>
>> A
> 
> `wc -c` always shows the true size of a file -- that is, the number of
> bytes of information it contains, not a multiple of the block size.  The
> compressed size can only be calculated by looking at the number of
> blocks allocated.  This command is safe for all compressing/sparse-
> supporting file systems.
> 

I have more time now so looked into the history of this.  I submitted a
patch to do this in makepkg for calculating file sizes.  We moved away
from this to using something like "du -sk  --apparent-size $pkgdir"
instead.  That is only used for displaying installed sizes so does not
need to be byte level accurate.

I am fine to include this change to reduce cross platform complexity.

A


More information about the pacman-dev mailing list