chattr makes cygport slow
Jon Turney
jon.turney@dronecode.org.uk
Sun Jul 16 16:15:27 GMT 2023
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.
-------------- next part --------------
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
More information about the Cygwin-apps
mailing list