From nobody Fri Jul 29 07:52:36 2022 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4LvKVw058Cz4XJY3; Fri, 29 Jul 2022 07:52:40 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [64.62.153.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "anubis.delphij.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LvKVt6nCVz3dDR; Fri, 29 Jul 2022 07:52:38 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from [10.0.0.2] (c-141-193-140-252.rev.sailinternet.net [141.193.140.252]) by anubis.delphij.net (Postfix) with ESMTPSA id 86D5055C60; Fri, 29 Jul 2022 00:52:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=delphij.net; s=m7e2; t=1659081157; x=1659095557; bh=WakUH30bnNZ+djJWkGrfhCv8Pq6Zy3WUi1kNbeOWwCM=; h=Date:Reply-To:To:References:From:Subject:In-Reply-To; b=hZuQPHAhYvHK0TCjmtpJs1cYtvDBJP8sL/uNhK7CB9YB82m+aVpi0gYmjHKYHrhPi gDMambQGLsVDIrPP+bpW4VHr4EpVUzwgnwPLSgruwq+2enETSbuYidNkMgyvtwxxdG wmbmaICPheKj0V9b9FlQLQ7mqb/J0eBEYw9O4HxN0R1CAcAF36xOvBBg47Lp7y4v2E NcyyZVkFwTM9JHeVKevLMDoOp5oAcqWp9yHdTBfToBJnrp44Hb9y6zqVKMZ31fxg5U BmyW7h1+z9PX/fIlz65HfJOhDEfus09PbHmum8xCCpZma+jdvscDU2qiFawsya88BP G72fO6kQ4fuSg== Message-ID: Date: Fri, 29 Jul 2022 00:52:36 -0700 List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 Reply-To: d@delphij.net Content-Language: en-US To: Eugene Grosbein , d@delphij.net, freebsd-current , freebsd-hackers@freebsd.org References: <0d8e1b38-bcd2-0875-1864-3385c502646d@delphij.net> From: Xin Li Organization: The FreeBSD Project Subject: Re: Proposal: remove /usr/bin/minigzip In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4LvKVt6nCVz3dDR X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=delphij.net header.s=m7e2 header.b=hZuQPHAh; dmarc=pass (policy=reject) header.from=delphij.net; spf=pass (mx1.freebsd.org: domain of delphij@delphij.net designates 64.62.153.212 as permitted sender) smtp.mailfrom=delphij@delphij.net X-Spamd-Result: default: False [-4.00 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[delphij.net,reject]; R_SPF_ALLOW(-0.20)[+mx]; R_DKIM_ALLOW(-0.20)[delphij.net:s=m7e2]; MIME_GOOD(-0.10)[text/plain]; DKIM_TRACE(0.00)[delphij.net:+]; ASN(0.00)[asn:6939, ipnet:64.62.128.0/18, country:US]; FROM_EQ_ENVFROM(0.00)[]; MLMMJ_DEST(0.00)[freebsd-current@freebsd.org,freebsd-hackers@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; HAS_ORG_HEADER(0.00)[]; HAS_REPLYTO(0.00)[d@delphij.net]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; FREEFALL_USER(0.00)[delphij]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCPT_COUNT_THREE(0.00)[4]; MID_RHS_MATCH_FROM(0.00)[]; TO_DN_SOME(0.00)[]; REPLYTO_DOM_EQ_FROM_DOM(0.00)[]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On 7/28/22 23:24, Eugene Grosbein wrote: > 29.07.2022 13:12, Xin Li пишет: >> Hi, >> >> I'd like to remove /usr/bin/minigzip , a patch is available at: >> >> https://reviews.freebsd.org/D35979 >> >> The minigzip is originally an example application shipped with zlib to demonstrate how to use it to implement basic functionality of gzip. It was connected to the base system in 1997, mainly because there wasn't a GPL-free implementation of gzip(1): >> >> https://cgit.freebsd.org/src/commit/usr.bin/minigzip?id=85e55f7ab8473307fb16c5bce8c2e933a317215b >> >> Now we already have a GPL-free gzip(1) implementation in base system for quite a while, so it seems that there isn't much value of keeping minigzip around. A quick grep suggests that it's not being used by the base system anywhere, nor in the ports tree. >> >> Any objections? > > Have you considered embedded applications (crunchgen etc.)? Yes, but I don't think it's being used in real life anywhere, base system crunchgen examples, including rescue and tools/bsdbox, are all using the real gzip. > In 13.1/amd64, /usr/bin/minigzip binary is about 11KB and links with libc and libz only. > > OTOH, /usr/bin/gzip is about six times larger (64KB) and additionally needs libbz2, liblzma, libmd and libthr. It's a little bit unfair to compare the sizes of the executables directly :-) After all, the C library accounted for 94.4% and 75.4% of space for minigzip and gzip respectively: $ F=/usr/bin/minigzip; du -Akc $(echo ${F} $(ldd -f '%p\n' ${F} | grep ^/ | sort)) 12 /usr/bin/minigzip 1939 /lib/libc.so.7 104 /lib/libz.so.6 2054 total $ F=/usr/bin/gzip; du -Akc $(echo ${F} $(ldd -f '%p\n' ${F} | grep ^/ | sort)) 63 /usr/bin/gzip 1939 /lib/libc.so.7 107 /lib/libmd.so.6 122 /lib/libthr.so.3 104 /lib/libz.so.6 77 /usr/lib/libbz2.so.4 163 /usr/lib/liblzma.so.5 2573 total So yes, gzip is bigger, but arguably it's just about 0.5MiB, or 25% larger, and among that 2573KB, 2510KB or 97.6% was shared library. But for applications that really want to have smaller footprint, bzip2 might be a better alternative -- the binary is bigger than minigzip, but library was smaller than zlib so the total size is actually a little bit smaller: $ F=/usr/bin/bzip2; du -Akc $(echo ${F} $(ldd -f '%p\n' ${F} | grep ^/ | sort)) 34 /usr/bin/bzip2 1939 /lib/libc.so.7 77 /usr/lib/libbz2.so.4 2050 total (It's true that zlib is a much more popular library and is used in more scenarios, like ppp, etc., so in reality this might actually added 99kb (=34+77-12), I just wanted to say that there are other options, and if minigzip is not really being used, building it on every FreeBSD machines doesn't seem to be a good use of resources). Cheers,