[CentOS] Need help to fix bug in rsync

Thu Mar 26 06:40:56 UTC 2020
Simon Matter <simon.matter at invoca.ch>

> On Wed, Mar 25, 2020 at 02:49:24PM +0100, Simon Matter via CentOS wrote:
>> Hi,
>>
>> I've discovered a bug in rsync which leads to increased CPU usage and
>> slower transfers in many situations.
>>
>> When syncing with compression (-z), certain file types should not be
>> compressed during the transfer because they are already compressed. The
>> file types which are not to be compressed can be seen in the man page
>> section --skip-compress.
>>
>> Unfortunately skipping the default file types doesn't work and all
>> transferred data is being compressed during the transfer. This is true
>> for
>> all versions since 3.1.0.
>>
>> Steps to Reproduce:
>> 1. run 'rm -f Z ; rsync -azv alpha:z.gz Z'
>>
>> Actual results, transferred data was compressed during the transfer:
>> sent 43 bytes  received 63,873 bytes  25,566.40 bytes/sec
>> total size is 628,952  speedup is 9.84
>>
>> Expected results:
>> No compression should happen for .gz file.
>>
>> Additional info:
>> Note that the source file 'z.gz' was an ascii text file to show clearly
>> that compression took place.
>
> That may invalidate your testing.
>
> rsync may not depend upon the filename extension
> but instead check the magic numbers within the file
> to determine whether to compress or not.

One could think so but it's not the case, rsync just uses the file suffix
to decide which files to compress. It even lower cases them, leaving good
old UNIX .Z file behind... Also a bug IMHO but not so important.

Simon