DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 4AO7KJsr1131770 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 4AO7KJsr1131770 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=EdoWQS0r X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D2533858428 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1732432817; bh=qxOaNAkMgapDOJ4n2EnVbMKab0Ui0fLxToodytTYITE=; 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=EdoWQS0rl32mfwkHR4+EmhCHcyYo4WpVJ6DR3yjkq0GwTakp8VXinmKZIB5R8YBDg +78dQ+Y8hVIuiBiCT2rzBQav8icQN6QOxw5jXgsdBgbp+8UzLqWdvuW2TcXLEkx0xS D5d45WQAiJOyCAjR+DDDm4AkcHeRzsJTl2xrFYFg= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 85C063858D29 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 85C063858D29 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1732432758; cv=none; b=UCs+BJosdEaeYrKwf22SK8BnS4MqxT4R6NV1zts6gZyD1K/IDRkNqwuHP8ffxIaDMzjT98qCLviypyYXWDcFZebQqv1HCH+HgJPu+ArdvRs9wtH4JCGIUGmTMnp1R5TAmXaKGa9Yof/YeQ5QXmZ083QqVUrOGLH1PPiqHbXuCo8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1732432758; c=relaxed/simple; bh=tCDi7AhFW2nOISHtSxzxhZ643fg3LRCBw4Ovukord0s=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=xnJoQ5D2EA3DUoIUw5+RMe8B9XyaYDw7ZCwBzW6URwradTk/nZ7/HwT5J5F4v9qnph0pgStBleKH1DVe2R7BOdqR0ZQZfvXiT5vk+CkAo8GPPBHu6vlxF6Q/HBZosib9BKO9Iq15RTAYapgZMHzVzasmGHyyFLajk+3+9SaE8Lo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 85C063858D29 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732432757; x=1733037557; h=content-transfer-encoding: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=tCDi7AhFW2nOISHtSxzxhZ643fg3LRCBw4Ovukord0s=; b=vr9TZeObK9v51ZN+T/Mn7kSr1XbJmm9ohNKSObrtzzJMCCyRV46iDuPytVgVJcwlk8 kxFFI6Hwcy1+Ep2KtuLJ10Z3AzCho0tGm/QRu9N13lUJLbUjAXQhHZTzWcRK8Do+3h/2 g3CO5AwUM8eKiq86bg17ZueiL3cmW4jAmp9z+sV1jITjnC7/NCfiVmIbNK8NKuPsVtVy Q5X0Oie5DfX46m1HRbpwBg80yg8SY+7oETsBmrSOqUe1pxkY9StOWuByQ+awGQpQneUZ l3HiRHjtgkeBiUsvcbOlf6k1+FP/3X4x48ieaHbZYJ826wo1ODCy+8OaB/Rb6dGH3fRh 2W2g== X-Gm-Message-State: AOJu0Yx1yhhnyrf7AqolrHQl8Hl2jkPOvI2UAsy+sllfYmK9375CLlOq /a6tnP3CgoqQ96ympAUhwxt+k9SlfFs+6Osm1MEsEpiM5uyHvoo8/XkXQ6DQAsNxp5+hZB2jMfV id76CixJn42BtRKl3/unXuxMoSN+o5A== X-Gm-Gg: ASbGncsVbhTtgDWQR5tw3Oa0O7AoDjI15492Zj+GcfY+3JmafkLppg8vjvBoSRGtYgF xeLybJ/GDVDy+RlERl9hC3+tiNWKFS3v9 X-Google-Smtp-Source: AGHT+IGuMjRXOLEXT/neIviuJcZNlw1JNhtD4JW6by75/Htd/3OM/zlnHF9AWPQqHDU1TiqYpY40FLEpzqvj6ZkIAn0= X-Received: by 2002:a05:6402:5256:b0:5cf:cf81:c3a2 with SMTP id 4fb4d7f45d1cf-5d02069a045mr6566146a12.25.1732432756643; Sat, 23 Nov 2024 23:19:16 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 24 Nov 2024 08:19:00 +0100 Message-ID: Subject: Re: [Ms-nfs41-client-devel] Corrupted file name in Cygwin - does Cygwin do a silly rename if a file is open? To: cygwin AT cygwin DOT com, ms-nfs41-client-devel AT lists DOT sourceforge DOT net X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: Cedric Blancher via Cygwin Reply-To: Cedric Blancher Content-Type: text/plain; charset="utf-8" Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 4AO7KJsr1131770 On Sat, 23 Nov 2024 at 20:06, Roland Mainz wrote: > > On Sat, Nov 23, 2024 at 2:53 PM Cedric Blancher > 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. I now see errors in the NFS client log. Before that the NFS server was returning an error, and the client acted accordingly. So seems to be fine, except that Cygwin somehow generates a rename with an invalid destination UTF-16 file name if someone deletes a file which is still open. Ced -- Cedric Blancher [https://plus.google.com/u/0/+CedricBlancher/] Institute Pasteur -- 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