On Sat, Nov 23, 2024 at 2:53 PM Cedric Blancher
<cedric.blanc...@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.ma...@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

Reply via email to