{"id":21651684,"url":"https://github.com/hoytech/gzip-unrsyncable","last_synced_at":"2025-10-27T19:03:35.675Z","repository":{"id":201709256,"uuid":"707376491","full_name":"hoytech/gzip-unrsyncable","owner":"hoytech","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-19T20:53:16.000Z","size":1,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-25T05:42:50.254Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hoytech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-19T19:09:46.000Z","updated_at":"2023-10-19T19:10:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"d91cf1ac-1328-487d-b61d-5d73b737ab22","html_url":"https://github.com/hoytech/gzip-unrsyncable","commit_stats":null,"previous_names":["hoytech/gzip-unrsyncable"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoytech%2Fgzip-unrsyncable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoytech%2Fgzip-unrsyncable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoytech%2Fgzip-unrsyncable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoytech%2Fgzip-unrsyncable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoytech","download_url":"https://codeload.github.com/hoytech/gzip-unrsyncable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244547602,"owners_count":20470103,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-25T07:49:15.758Z","updated_at":"2025-10-27T19:03:30.632Z","avatar_url":"https://github.com/hoytech.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gzip --UNrsyncable\n\nThis is a proof-of-concept perl script that manipulates a data stream in order to prevent [gzip --rsyncable](https://beeznest.wordpress.com/2005/02/03/rsyncable-gzip/) from working properly.\n\nConsider a sequence that consists of 100,000 `A` characters. Needless to say, `gzip` will compress this extremely well:\n\n    $ perl -e 'print \"A\"x100_000' | gzip -c | wc -c\n    133\n\n`gzip` provides a special `--rsyncable` option that will flush the compressed stream periodically, so that compressed blocks of data are preserved and can be found by `rsync`'s rolling checksum. This adds a small amount of overhead to the compressed stream:\n\n    $ perl -e 'print \"A\"x100_000' | gzip -c --rsyncable | wc -c\n    3020\n\nThe way `gzip --rsyncable` works is by looking for particular patterns in its input data. Specifically, it queues a stream flush whenever the last 4096 bytes sum to 0 (mod 4096).\n\nThe `gzip-unrsyncable` script also looks for these patterns and, when it detects one, modifies the last byte to break the pattern. This prevents `gzip --rsyncable` from flushing its stream:\n\n    $ perl -e 'print \"A\"x100_000' | ./gzip-unrsyncable | gzip -c --rsyncable | wc -c\n    192\n\nMark Adler's [infgen](https://github.com/madler/infgen) utility can be used to verify this. Normally the stream would be flushed 746 times (the last `end` line is the actual end):\n\n    $ perl -e 'print \"A\"x100_000' | gzip -c --rsyncable | infgen | grep ^end | wc -l\n    747\n\nHowever, with `gzip-unrsyncable`, the stream is never flushed:\n\n    $ perl -e 'print \"A\"x100_000' | ./gzip-unrsyncable | gzip -c --rsyncable | infgen | grep ^end | wc -l\n    1\n\nNote that there are also \"naturally occurring\" unrsyncable sequences, for example:\n\n    $ perl -E 'print chr($_ % 256) for (1..100_000)' | gzip -c --rsyncable | infgen | grep ^end | wc -l\n    1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoytech%2Fgzip-unrsyncable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoytech%2Fgzip-unrsyncable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoytech%2Fgzip-unrsyncable/lists"}