public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: "cygwin-apps@cygwin.com" <cygwin-apps@cygwin.com>,
	Christian Franke <christian.franke@t-online.de>
Subject: Re: [PATCH setup] Add new option '--compact-os'
Date: Wed, 12 May 2021 16:14:41 +0100	[thread overview]
Message-ID: <02f5ecb0-433b-262d-f56e-c5394c5f07bd@dronecode.org.uk> (raw)
In-Reply-To: <5d57a3f5-b595-2196-12ed-1c409d46be2a@t-online.de>

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 <windows.h> 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 <windows.h>
> +#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?

  reply	other threads:[~2021-05-12 15:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-08 20:03 Christian Franke
2021-05-12 15:14 ` Jon Turney [this message]
2021-05-12 17:50   ` Christian Franke
2021-05-12 18:35     ` ASSI
2021-05-12 18:48       ` Achim Gratz
2021-05-13 15:09         ` Christian Franke
2021-05-13 14:55     ` Jon Turney
2021-05-14  7:27       ` Christian Franke
2021-05-14  7:55         ` Christian Franke
2021-07-18 13:44           ` Jon Turney
2021-05-12 18:04   ` Corinna Vinschen
2021-05-13 14:42     ` Christian Franke
2021-05-13 14:45       ` Christian Franke
2021-05-17 10:17       ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=02f5ecb0-433b-262d-f56e-c5394c5f07bd@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=christian.franke@t-online.de \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).