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>
Subject: Re: chattr makes cygport slow
Date: Sun, 16 Jul 2023 17:15:27 +0100	[thread overview]
Message-ID: <0eb00e42-372f-3aa7-d161-c2e62a1e9d91@dronecode.org.uk> (raw)
In-Reply-To: <87bkgma3ek.fsf@Rainer.invalid>

[-- Attachment #1: Type: text/plain, Size: 1598 bytes --]

On 08/07/2023 15:22, ASSI via Cygwin-apps wrote:
> Jon Turney via Cygwin-apps writes:
>> So, the idea here is that we try to ensure it's on, at least for the
>> working directory.
> 
> That IMHO should only be done when the working directory is created, but
> not retroactively applied to an existing workdir.

Yeah, that's just a side effect of where I put it.

>> Skipping it when 'finish' is used isn't right, because then 'finish
>> all' wouldn't work as desired.  But yeah, it seems that this is in the
>> wrong place.  I'll look into moving it.
> 
> Meanwhile I've done this:
> 
> --8<---------------cut here---------------start------------->8---
>   if [ $OSTYPE = "cygwin" ]
>   then
> +	[ -n "$(find ${workdir} -maxdepth 0 -empty)" ] &&
>   	chattr -fR +C ${workdir} >/dev/null 2>&1 || true

This seems a bit nuts as we've just done the mkdir a few lines above, we 
could just check if the directory doesn't exist and apply 
case-sensitivity if we are creating it.

>   fi
> --8<---------------cut here---------------end--------------->8---
> 
> I think it should be moved into a function that can be called before the
> prep command, but I haven't actually tried it for a longer time or
> checked what tests need changing due to the extra output:

The warning (error if RESTRICT=case_insensitive) should occur for all 
commands, not just prep.

How about the attached.

>> I think there's possibly something else going wrong if it's taking 5
>> minutes, as that seems excessive.
> 
> Try it on the gcc build dir…

Even then, it should only be modifying every directory, not every file.

[-- Attachment #2: 0001-cygport.in-only-try-to-turn-on-case-sensitivity-when.patch --]
[-- Type: text/plain, Size: 2238 bytes --]

From 0e4c4261122d3b2373734816c9620c5c44eb72a5 Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.turney@dronecode.org.uk>
Date: Sun, 9 Jul 2023 18:35:51 +0100
Subject: [PATCH cygport] cygport.in: only try to turn on case-sensitivity when
 we create workdir

Only try to turn on case-sensitivity when we create workdir: this avoids
grovelling over all the files on subsequent runs.

Make sure to check for case-sensitivity required on subsequent runs,
though.
---
 bin/cygport.in | 33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)

diff --git a/bin/cygport.in b/bin/cygport.in
index 1791e5b3..3f89ac67 100755
--- a/bin/cygport.in
+++ b/bin/cygport.in
@@ -573,18 +573,34 @@ declare -ar pkg_name=(${PKG_NAMES:-${PN}});
 declare -r  pkg_count=${#pkg_name[*]};
 
 # this requires workdir to be already defined
-mkdir -p ${workdir}
 
-if [ $OSTYPE = "cygwin" ]
+__probe_case_sensitivity() {
+	mkdir -p ${workdir}
+	rm -f ${workdir}/.probe_case_sensitivity
+	touch ${workdir}/.PROBE_CASE_SENSITIVITY
+	local probe=$( [ -f ${workdir}/.probe_case_sensitivity ] && echo 1 || echo 0 )
+	rm -f ${workdir}/.PROBE_CASE_SENSITIVITY
+	return $probe
+}
+
+__enable_case_sensitivity() {
+	if [ $OSTYPE = "cygwin" ]
+	then
+		inform "Trying to enable case sensitivity on ${workdir}"
+		chattr -fR +C ${workdir} >/dev/null 2>&1 || true
+	fi
+}
+
+# create workdir if it doesn't already exist, and try to enable case-sensitivity
+# if it appears to be absent
+if [ ! -d ${workdir} ]
 then
-	chattr -fR +C ${workdir} >/dev/null 2>&1 || true
+	mkdir -p ${workdir}
+	__probe_case_sensitivity || __enable_case_sensitivity
 fi
 
-rm -f ${workdir}/.probe_case_sensitivity
-touch ${workdir}/.PROBE_CASE_SENSITIVITY
-probe=$( [ -f ${workdir}/.probe_case_sensitivity ] && echo "failed" || echo "" )
-rm -f ${workdir}/.PROBE_CASE_SENSITIVITY
-if [ -n "$probe" ]
+# in any case, probe for case sensitivity, stop if required but missing
+if ! __probe_case_sensitivity
 then
 	if defined _CYGPORT_RESTRICT_case_insensitive_
 	then
@@ -593,7 +609,6 @@ then
 		warning "Building on a case-insensitive filesystem";
 	fi
 fi
-unset probe
 
 # this requires S and B to be already defined
 if ! defined _CYGPORT_RESTRICT_debuginfo_
-- 
2.39.0


  reply	other threads:[~2023-07-16 16:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-06 12:19 Andrew Schulman
2023-07-06 16:18 ` Brian Inglis
2023-07-08 12:19   ` Jon Turney
2023-07-06 17:36 ` Andrew Schulman
2023-07-08 12:16   ` Jon Turney
2023-07-08 13:23     ` Andrew Schulman
2023-07-08 14:22     ` ASSI
2023-07-16 16:15       ` Jon Turney [this message]
2023-07-16 19:32         ` ASSI
2023-07-23 15:33           ` Jon Turney
2023-07-23 19:13             ` ASSI
2023-07-24 21:07               ` Jon Turney
2023-07-28 11:35             ` Andrew Schulman

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=0eb00e42-372f-3aa7-d161-c2e62a1e9d91@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --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).