delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/03/03/09:24:06

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 523EO5oi2858415
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 523EO5oi2858415
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=GYPMmVtO
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 045BA385828B
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1741011844;
bh=isL9VzDrge3S/zdvL7OBwVCO4M9hl3s2/zPzpTTTVAc=;
h=References:In-Reply-To:Date:Subject:To:Cc:List-Id:
List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
From:Reply-To:From;
b=GYPMmVtOUCasFc1APIHM7R1Tm2E3iw6GxS0APHTXr0MjHVsf4riNJDENsIjc8j68J
h0vmw3p8TRgqfvV3gYkbwYbJ+dXVHJwG1h+3jgoipBZIo3khDOyRu8WmMVvBO6CAuy
HfJdt8ayYJ+HZv9XsQ785n/rsiSh0uxU9/3KJPxg=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 548713858D28
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 548713858D28
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1741011775; cv=none;
b=EqzrkW8mgErx8ILYmx817VNoYBJaf2IeP9qbwxgIxgspsu5nPthFh9K77VVGLwTgR1he4CJk3L2Y32sB94PgZDRuOBjS8OC11bTmbf0bDCbMQWb2eh4dmUVt0Q+eqfLvIuZ76CbFAHYWJT/fPOjPXlO5o1UnkyFLMlRmY2R/pkw=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1741011775; c=relaxed/simple;
bh=UJj6GqdOFehtpuRCBH34LkJv5Vq28IJpRU3vSy0q3xs=;
h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;
b=hmbRYVi49rnVHc2vsGI0b8EegLhS0SDm8TLnV1uZjmf7HeCWcZpj37abeAm0ClRmhN5YyKjFGtNyHQHNZ4WXU1bzGchVg8CHvizI+t2s23x0jp0qAgfsqtjaHYXicbtva/VwpvbKdisWIvzRIVWBmSK1DAXJxedRebPN+HuWr58=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 548713858D28
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1741011774; x=1741616574;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=tk+CWCOXvSPqaVqfv0eiIttzgpVh4r6CVQmv7mclNAU=;
b=vuhwbKx4r5ei2PJbJmvFcbT32Wga44D7cFJsyhLJb23ZmYi8OVG/AyPgAcVaPhhjd8
leRdrR3wGDxgoedfYW/ShiuJu3/ivFZqMypSDjBJ8lGzqM4vM0HJwMiE7Y37TINObV5H
X9dLCqz5JsIENV7D6knFMA9jKUjG9b+jHPAYHRXaqeJV4DKpVsdxeqPBIh2pS4t73HvJ
ma1mQzkYAJ6b3jzo8dTkZ4YkpJoIyZZHF5JvQF/kgoyY5GMpKIl210l6I5YH7zAdvGAh
h/8ZcNxResXUajTfO/sl6XO3kdhkgYhXeEMwa4GKofOP6N2BjgAnZ5teC99zdGvcgHVv
XuqQ==
X-Gm-Message-State: AOJu0Yy78chx/kjYaxnJu1jo3CFpynZd1X30fftqx2BShD7nfXSHpcXS
Pl2n1y/dTCmOQL34ZpGENrok4K52BcYiPYOdHW4JVUxSy0yN2xVKwdfTsarLtWqXmU2NC7iy4V1
uuf2dFYnnFOfgPFPjlJru1zBDq3c/KQ==
X-Gm-Gg: ASbGncsUO9Q7hDXZ76gF5UjBpf854LyLGl5WA3wfuVkxviqLHpNyFcXE4fOyvH6DpNb
l8vZqpF5/6FNF0wkOuILy09vZKoHJK4qk1g35jV5ry5mFCBt2pz+wlxxnKodlKZpb6luhYMQaio
3mA0SPdbD35Vd/i3syZH6BsDCzets=
X-Google-Smtp-Source: AGHT+IEHz//B8pi56mLS8nXjvuTMICIB827W1u8sgWdeYWABUjiotHQb9ClkTeRVUFueBGJEeGBe+8VmRkpr9XflivY=
X-Received: by 2002:a17:903:1987:b0:223:517a:d5a9 with SMTP id
d9443c01a7336-223517ad897mr271931345ad.15.1741011774074; Mon, 03 Mar 2025
06:22:54 -0800 (PST)
MIME-Version: 1.0
References: <da7896a3-bf3c-8580-03bf-2ac485e898c4 AT jdrake DOT com>
<2a781007-8b06-db4d-7bcc-59f45fbae8b8 AT jdrake DOT com>
<881a1bd4-112c-9c9e-0dfa-babad34ddd55 AT jdrake DOT com>
In-Reply-To: <881a1bd4-112c-9c9e-0dfa-babad34ddd55@jdrake.com>
Date: Mon, 3 Mar 2025 06:22:43 -0800
X-Gm-Features: AQ5f1Jr52ddtjjelVnM1cow3Yx6eGJehCXWuJR_o4wgzGZ3h-eQNKT3JGRFvmDY
Message-ID: <CAJtSMgsyOOr9vJW-hDE+c=ff+DrTzN30GqPniJWRW=_ny=s1pw@mail.gmail.com>
Subject: Re: cleanup of in-use files moved to recycle bin
To: Jeremy Drake <cygwin AT jdrake DOT com>
Cc: cygwin AT cygwin DOT com
X-Content-Filtered-By: Mailman/MimeDel 2.1.30
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: David Dyck via Cygwin <cygwin AT cygwin DOT com>
Reply-To: David Dyck <david DOT dyck AT gmail DOT com>
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 523EO5oi2858415

Is the format of /proc/mounts changing from being space delimited to being
null delimited?
where can I read more about this change?

On Sun, Mar 2, 2025 at 10:57 PM Jeremy Drake via Cygwin <cygwin AT cygwin DOT com>
wrote:

> On Sun, 2 Mar 2025, Jeremy Drake via Cygwin wrote:
>
> > > 2) assuming there is not, I want to make a script using only things
> > > present in a "base system" to clean them up.
> >
> > Now that the mount points are escaped and contain the Windows volume
> roots
> > starting with 3.6, here's my script.  It uses bash/find/gawk.  I'd
> welcome
> > any ideas on improving it, I've only just started messing with gawk.
> (I'd
> > started out doing grep/cut then xargs printf "%b\0" to unescape, but with
> > gawk I can do that all in one program).
> >
> > It's in
> > https://gist.github.com/jeremyd2019/4984ff0fa1f6fd8c99d7b8b244c52088
>
> I decided to try the grep/cut/xargs/printf method again, and found it
> shorter, so here it is.  I also set up LC_CTYPE and LC_COLLATE to C.UTF-8
> up front, in case some other locale/encoding is set up.  I still have to
> override this to C for the find, because it doesn't seem to like the
> invalid unicode used by older Cygwin/MSYS2 versions for the binned files.
>
> #!/bin/bash -ex
>
> export LC_CTYPE=C.UTF-8 LC_COLLATE=C.UTF-8
>
> IFS=. read -r cygmajor cygminor _ < <(uname -r)
>
> declare -a roots
>
> if [ "${cygmajor}" -gt 3 -o "${cygmajor}" -eq 3 -a "${cygminor}" -ge 6 ];
> then
>   # as of cygwin 3.6, volume roots are parsable from /proc/mounts
>   # (noumount is the option that indicates a cygdrive mount)
>   readarray -t -d $'\0' roots < <(
>     cut -d' ' -f2,4 /proc/mounts | grep '\<noumount\>[^ ]*$' |
>     cut -d' ' -f1 | xargs -d'\n' printf '%b\0')
> else
>   # before that, just punt and look at the root of the drive / is mounted
> on
>   root="$(cygpath -w /)"
>   roots=("$(cygpath -u "${root:0:2}")")
>   unset root
> fi
>
> declare -a trash
> readarray -t -d $'\0' trash < <(
>   LC_CTYPE=C LC_COLLATE=C \
>   find "${roots[@]}" -maxdepth 1 -iname '$Recycle.Bin' -print0 |
>   LC_CTYPE=C LC_COLLATE=C \
>   find -files0-from - -maxdepth 2 \( -name $'.\uDC6D\uDC73\uDC79\uDC73*'
> -o \
>                                      -name $'.\uF76D\uF773\uF779\uF773*'
> -o \
>                                      -name '.msys*' -o \
>                                      -name $'.\uDC63\uDC79\uDC67*' -o \
>                                      -name $'.\uF763\uF779\uF767*' -o \
>                                      -name '.cyg*' \) -print0)
> if (( ${#trash[@]} )); then
>   ls -la "${trash[@]}"
>   read -r -p "Remove? (y/N) "
>
>   if [[ "${REPLY^^}" == "Y" ]]; then
>     rm -f "${trash[@]}"
>   fi
> fi
>
> --
> Problem reports:      https://cygwin.com/problems.html
> FAQ:                  https://cygwin.com/faq/
> Documentation:        https://cygwin.com/docs.html
> Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
>

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019