DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 4ANJ75pq909866
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 4ANJ75pq909866
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=fNMvsHKS
X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 332743858027
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1732388823;
	bh=EIr8QFVDmfVB4gmO80HqV3CuP4KdqccrR+LNjFivk84=;
	h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
	 From;
	b=fNMvsHKSovK5uI7m3KXpdSEZ2tQVXDjzZ+haSzhjYtpb2xWT+FU7CGt7eJdanH0du
	 +Hk91/S+VLQko1bVwBOsgOwLQmf9Xp7ZEF6IEPpBa/paLj1ooE1RjU0dSbY4PCgaAx
	 oO/h7vtKz+0ae7RrrYPQCuvdhxuP6H5woK+V5nF8=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 82DFC3858C42
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 82DFC3858C42
ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1732388797; cv=pass;
 b=G1RPUc4YopEBcYuuwvajTq8enAL7sFzszSnDz/SN8op6LIwmJOCNLhM8Bj0E0lEQ5Lzg+kzPxdfIGR/oeveQeyS5fgBwKjzgSIy+a9hbKJJRBPbg3nQoE7s3J6t2n8LOPPr2xU7Yi03miNhlVj9nO38R4ppal41V+WdKFU1YWgk=
ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key;
 t=1732388797; c=relaxed/simple;
 bh=qQHm6jfnOv4DDRG7oFmCof3Ue1efrrFmARONN0ALWDs=;
 h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;
 b=CqAgvsdh447/SVpbrSjFj3KLmTrXzNaGEm9O6JpbMBhOxOq6Zz22nYioYkQ7vrF9JRAEfCmiitEvbemqgN3N44DhmvZXUsmKBzntPfob373sC5oZNeQDlViDNoxzqx0w/qi3tE6foUt6KPD6l99rH76PawsVQ2FS2QV4ImPghEs=
ARC-Authentication-Results: i=2; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 82DFC3858C42
X-Sender-Id: dreamhost|x-authsender|gisburn@nrubsig.org
ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1732388796; a=rsa-sha256;
 cv=none;
 b=zgizCJFVflzQKwuV3s3irH6oPgpL/Yfa8qPTCgaK8I8urbPBjbvMaecI4uvxy7qEA8Qs4s
 eUKySi6/qr4++fIt0IKyFpAhviCR7nKqcgO+oWQVkb5oaDqb8g3TRVw96aiwb69+uXV4Q6
 uwc0HDZPTqqUu20vovmFruvYTn7Q5OriLw7prqYNLNQpO6Beef0rCSubY9l6qCKPzzO+se
 tpq3ZdviXEkR2AIXZL9NTj00pyIl6CkYRCElDFhxcDBUsyK2YsJoFJJYtHCKT+MFWaP8TU
 ENdQTnAeM3iifRk2jRGkkOCbbw2tnewVNIopIt2uF50AQhhXKIe+yzq+Sz+fPQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
 d=mailchannels.net; s=arc-2022; t=1732388796;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references:dkim-signature;
 bh=gyyoFXxqGWS1GSoEMCZKdwWbNqT6H7uAT8/kU1MPAfU=;
 b=23Mop9wiD1FxDRvxEAcWuG0aFctZfAAyV8DvJEK+TrvSBOBSXjkSfAFSPu/P30XkVtpHwq
 9cMfUq6G5T935RER0L66jSLwxIErFHw0WMnEGJKD1LetwDfpMaavDUzlN3geVFzfEKMwwy
 cbI0QU4wiCrrkWxoix7x8aCQ8NEiBOhRuMIeA5PIXLS90dlVQukoB5ZHxHgbSOcy0/6KnG
 CaMoGdK9QNrUldOtlbslS9JGbtEALyL8UvK/wbJ2rF4WUuehOno4ShCKEDqHsS153d4a4d
 JTmN1fu8/R/y5FiAKXGlLCg4bxcZItnQl06ASfB5KL3rMCW6nYkRa93eDo4HQA==
ARC-Authentication-Results: i=1; rspamd-868968d99d-mkkh4;
 auth=pass smtp.auth=dreamhost smtp.mailfrom=roland.mainz@nrubsig.org
X-Sender-Id: dreamhost|x-authsender|gisburn@nrubsig.org
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|gisburn@nrubsig.org
X-MailChannels-Auth-Id: dreamhost
X-Tank-Descriptive: 7ea850e52774a2ad_1732388796403_490802564
X-MC-Loop-Signature: 1732388796403:4109678338
X-MC-Ingress-Time: 1732388796403
X-Gm-Message-State: AOJu0Yx291KmxA4W06AMt/gPbGTdoCSzCggzkp5iJxT3UupajjdESi3P
 wb13QpPhOMJWGfq6Adcn+D269b0Vaf61I+7dBNNzDJweW3Yf45f3N2MnE+pNwFUXQBAE9o5Q+4S
 MYQBdGp4zaxGIKZtvCTbGi6nOk6A=
X-Google-Smtp-Source: AGHT+IGrDEHMp4W0YH0nGlTnxXU6DjtNJNQwvyZEtCZ2RexoDDhacW+a5u8o24d1yD4CAkmC0mmVAgW4aVAuznCSNBY=
X-Received: by 2002:a05:600c:a49:b0:431:4f29:9539 with SMTP id
 5b1f17b1804b1-433ce4af26bmr68129425e9.32.1732388794819; Sat, 23 Nov 2024
 11:06:34 -0800 (PST)
MIME-Version: 1.0
References: <CALXu0Uc=wOUbEaTzpfrYdn3Q8rXcaR-if84ZWXPgFJ1qxQbizQ@mail.gmail.com>
In-Reply-To: <CALXu0Uc=wOUbEaTzpfrYdn3Q8rXcaR-if84ZWXPgFJ1qxQbizQ@mail.gmail.com>
Date: Sat, 23 Nov 2024 20:06:00 +0100
X-Gmail-Original-Message-ID: <CAKAoaQmyDKBUkTpYJWeuNh-rUttwHg2_-Qns0di=bbgH=+LqQg@mail.gmail.com>
Message-ID: <CAKAoaQmyDKBUkTpYJWeuNh-rUttwHg2_-Qns0di=bbgH=+LqQg@mail.gmail.com>
Subject: Re: [Ms-nfs41-client-devel] Corrupted file name in Cygwin - does
 Cygwin do a silly rename if a file is open?
To: cygwin@cygwin.com, ms-nfs41-client-devel@lists.sourceforge.net
X-BeenThere: cygwin@cygwin.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@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Roland Mainz via Cygwin <cygwin@cygwin.com>
Reply-To: Roland Mainz <roland.mainz@nrubsig.org>
Content-Type: text/plain; charset="utf-8"
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie.com@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 4ANJ75pq909866

On Sat, Nov 23, 2024 at 2:53 PM Cedric Blancher
<cedric.blancher@gmail.com> wrote:
>
> Good afternoon!
>
> Does Cygwin do a silly rename if a Cygwin file is open but gets
> /bin/rm at the same time?
>
> What I see is that on a NFSv4.1 filesystem a
>
> bash -c 'touch sillytest ; ls -l ; ( command exec {n}<"sillytest" ;
> print $n ; sleep 10) & sleep 1 ; ls -la ; rm -f sillytest ; ls -la ;
> wait'
>
> will send invalid characters over the network.
> At first I thought it's a bug in the ms-nfs41-client filesystem
> driver, but if I replace the rm -f sillytest with a cmd /C "del
> sillytest" the garbage filename data goes away:
>
> bash -c 'touch sillytest ; ls -l ; ( command exec {n}<"sillytest" ;
> printf "fd=%d\n" $n ; sleep 10) & sleep 1 ; ls -la ; cmd /C "del
> sillytest" ; ls -la ; wait'
>
> I think doing a /bin/rm on an opened file causes Cygwin to rename the
> file, but the destination file name is corrupted or comes from
> uninitialized memory.

Please update ms-nfs-41-client to
https://github.com/kofemann/ms-nfs41-client/commit/2ed7d65d99d134e78782c183aa39c270f7e7f07e
(or better "HEAD"), that should reject any attempts to write/rename
filenames which are not valid Windows characters.
NFSv4.1 only uses UTF-8 in the protocol, so the Windows NFSv4.1 client
side has to do a |WideCharToMultiByte(CP_UTF8, ...)|, and commit
"2ed7d65d99d134e78782c183aa39c270f7e7f07e" enforces that it only uses
valid UTF-8 OR returns an error.

If there is any Windows application generating invalid Win32
|wchar_t|-strings, then this should catch it and complain about it in
the client log and return an |ERROR_INVALID_PARAMETER| to the client.

----

Bye,
Roland
-- 
  __ .  . __
 (o.\ \/ /.o) roland.mainz@nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)

-- 
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

