From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from re-prd-fep-044.btinternet.com (mailomta12-re.btinternet.com [213.120.69.105]) by sourceware.org (Postfix) with ESMTPS id 27F01385381F for ; Wed, 12 May 2021 15:15:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 27F01385381F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dronecode.org.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=jon.turney@dronecode.org.uk Received: from re-prd-rgout-002.btmx-prd.synchronoss.net ([10.2.54.5]) by re-prd-fep-044.btinternet.com with ESMTP id <20210512151555.JSVI335.re-prd-fep-044.btinternet.com@re-prd-rgout-002.btmx-prd.synchronoss.net>; Wed, 12 May 2021 16:15:55 +0100 Authentication-Results: btinternet.com; auth=pass (PLAIN) smtp.auth=jonturney@btinternet.com X-SNCR-Rigid: 5ED9C0CC32A7BF71 X-Originating-IP: [86.140.69.94] X-OWM-Source-IP: 86.140.69.94 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-VadeSecure-score: verdict=clean score=0/300, class=clean X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgeduledrvdehvddgkeefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuueftkffvkffujffvgffngfevqffopdfqfgfvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeflohhnucfvuhhrnhgvhicuoehjohhnrdhtuhhrnhgvhiesughrohhnvggtohguvgdrohhrghdruhhkqeenucggtffrrghtthgvrhhnpeelieegheeghfevfeevhfdviedugfdvuefhjeehteejffefhfeuudetheeugfffhfenucfkphepkeeirddugedtrdeiledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehhvghloheplgduledvrdduieekrddurdduuddungdpihhnvghtpeekiedrudegtddrieelrdelgedpmhgrihhlfhhrohhmpeeojhhonhdrthhurhhnvgihsegurhhonhgvtghouggvrdhorhhgrdhukhequceuqfffjgepkeeukffvoffkoffgpdhrtghpthhtohepoegthhhrihhsthhirghnrdhfrhgrnhhkvgesthdqohhnlhhinhgvrdguvgeqpdhrtghpthhtohepoegthihgfihinhdqrghpphhssegthihgfihinhdrtghomheq X-RazorGate-Vade-Verdict: clean 0 X-RazorGate-Vade-Classification: clean Received: from [192.168.1.111] (86.140.69.94) by re-prd-rgout-002.btmx-prd.synchronoss.net (5.8.340) (authenticated as jonturney@btinternet.com) id 5ED9C0CC32A7BF71; Wed, 12 May 2021 16:15:55 +0100 Subject: Re: [PATCH setup] Add new option '--compact-os' To: "cygwin-apps@cygwin.com" , Christian Franke References: <5d57a3f5-b595-2196-12ed-1c409d46be2a@t-online.de> From: Jon Turney Message-ID: <02f5ecb0-433b-262d-f56e-c5394c5f07bd@dronecode.org.uk> Date: Wed, 12 May 2021 16:14:41 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <5d57a3f5-b595-2196-12ed-1c409d46be2a@t-online.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1200.4 required=5.0 tests=BAYES_00, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin-apps@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin package maintainer discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 15:15:58 -0000 On 08/05/2021 21:03, Christian Franke wrote: > This experimental patch allows to reduce the footprint of a Cygwin > installation on Windows 10. Thanks. > The I/O-control itself is in a new file compactos.cc because > WIN32_LEAN_AND_MEAN (win32.h) must not be used and some required Yeah, I think "Any include of should be through this file" is more a guideline than a rule, since we already break it in other places :) > definitions are still missing in the current headers. Let me encourage you to submit those to MinGW-w64 so they end up in the w32api package. > Test results with 64bit Cygwin (Disk space used without / with > --compact-os): > > Base installation: 135MiB / 66,1 MiB (-51%) > Installation with g++, Mingw, Perl, Python, Tex, ...:  2.19GiB / 854MiB > (-62%) > > Base installation with NTFS compression: 78.7MiB (results in significant > file fragmentation, Compact OS does not) Nice. A few minor comments. > Date: Sat, 8 May 2021 21:25:07 +0200 > Subject: [PATCH] Add new option '--compact-os'. [...]> --- /dev/null > +++ b/compactos.cc > @@ -0,0 +1,62 @@ > +// > +// compactos.cc > +// > +// Copyright (C) 2021 Christian Franke > +// > +// SPDX-License-Identifier: MIT > +// > + > +#include "compactos.h" > + > +#ifndef FSCTL_SET_EXTERNAL_BACKING There should be a comment here saying "not yet provided by w32api" or similar. > diff --git a/compactos.h b/compactos.h > new file mode 100644 > index 0000000..c1470f1 > --- /dev/null > +++ b/compactos.h > @@ -0,0 +1,26 @@ > +// > +// compactos.h > +// > +// Copyright (C) 2021 Christian Franke > +// > +// SPDX-License-Identifier: MIT > +// > + > +#ifndef COMPACTOS_H > +#define COMPACTOS_H > + > +#ifndef _INC_WINDOWS I hope windows.h already has it's own include guard? > +#include > +#endif [...] > +bool io_stream_cygfile::compact_os_is_available = (OSMajorVersion () >= 10); The documentation seems a bit vague, but are we really expecting this to work on Windows 10 1507? > + > // Normalise a unix style path relative to > // cwd. > std::string > @@ -120,7 +125,22 @@ get_root_dir_now () > read_mounts (std::string ()); > } > > -io_stream_cygfile::io_stream_cygfile (const std::string& name, const std::string& mode, mode_t perms) : fp(), lasterr (0), fname(), wname (NULL) > +static bool > +compactos_is_useless (const std::string& name) Something like 'compression_useful' might be a bit clearer? > +{ > + const char * const p = name.c_str(); > + if (!(!strncmp (p, "/bin/", 5) || !strncmp (p, "/sbin/", 6) || !strncmp (p, "/usr/", 5))) > + return true; /* File is not in R/O tree. */ > + const size_t len = name.size(); /* >= 5 */ > + if (!strcmp (p + (len - 4), ".dll") || !strcmp (p + (len - 3), ".so")) > + return true; /* Rebase will open file for writing which uncompresses the file. */ > + if (!strcmp (p + (len - 3), ".gz") || !strcmp (p + (len - 3), ".xz")) > + return true; /* File is already compressed. */ Is this an assertion that there are no .bz2, .lzma, .zst etc. files in the install?