public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Invalid request code when removing files
@ 2020-05-03  0:09 Sean Baker
  2020-05-05 17:12 ` Sean Baker
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Baker @ 2020-05-03  0:09 UTC (permalink / raw)
  To: cygwin

I just installed Cygwin on a new Windows 10 machine. I am getting an error
"Invalid request code" whenever I try to remove a file. Every other file
operation that I have tested so far seems to work fine.

Using a Windows CMD prompt, I can remove the file with the normal windows
DEL command. However, if I try to execute C:\cygwin64\bin\rm.exe it still
fails with "Invalid request code".

This problem does not just occur with the 'rm' command. For example. 'vi'
and 'git' cannot remove the lock files that they create. Also custom
programs that I write myself and compile under Cygwin fail with the same
error code when trying to remove files, even when executed from a Windows
CMD prompt or clicked on in Windows explorer. The location of the file does
not matter either, since I have tried files in the Cygwin home dir, my
Users directory, My Documents, etc with the same result.

However I have also installed MinGW, and in both the Cygwin terminal and
Windows CMD prompt I can remove files successfully by calling the rm.exe
installed there (see examples).

Example under Cygwin:

sbaker@FWA002495 ~ >$ echo test > foo
sbaker@FWA002495 ~ >$ ls -l foo
-rw-r--r-- 1 sbaker Domain Users 5 May  2 19:47 foo
sbaker@FWA002495 ~ >$ cat foo
test
sbaker@FWA002495 ~ >$ rm foo
rm: remove regular file 'foo'? y
rm: cannot remove 'foo': Invalid request code
sbaker@FWA002495 ~ >$ /cygdrive/c/MinGW/msys/1.0/bin/rm.exe -v foo
removed `foo'

Example under Windows CMD:

C:\Users\sbaker>echo test > foo
C:\Users\sbaker>c:\cygwin64\bin\rm.exe -v foo
/usr/bin/rm: cannot remove 'foo': Invalid request code
C:\Users\sbaker>c:\MinGW\msys\1.0\bin\rm.exe -v foo
removed `foo'

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Invalid request code when removing files
  2020-05-03  0:09 Invalid request code when removing files Sean Baker
@ 2020-05-05 17:12 ` Sean Baker
  2020-05-05 19:34   ` David Macek
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Baker @ 2020-05-05 17:12 UTC (permalink / raw)
  To: cygwin

strace shows this failure:

   68  368896 [main] rm 1823 _unlink_nt: Trying to delete \??\C:\Test\test,
isdir = 0
  458  369354 [main] rm 1823 _unlink_nt: \??\C:\Test\test, return status =
0xC0000002
   70  369424 [main] rm 1823 seterrno_from_nt_status:
/home/corinna/src/cygwin/cygwin-3.1.4/cygwin-3.1.4-1.x86_64/src/newlib-cygwin/winsup/cygwin/syscalls.cc:1116
status 0xC0000002 -> windows error 1
   70  369494 [main] rm 1823 geterrno_from_win_error: windows error 1 ==
errno 54
   64  369558 [main] rm 1823 unlink: -1 = unlink(/cygdrive/c/Test/test),
errno 54

The full strace is available here: https://pastebin.com/S2iQ7UEN

Also, this is what shows up in Procmon:

<event>
<ProcessIndex>912</ProcessIndex>
<Time_of_Day>12:49:56.5313995 PM</Time_of_Day>
<Process_Name>rm.exe</Process_Name>
<PID>16120</PID>
<Operation>SetDispositionInformationEx</Operation>
<Path>C:\Test\test</Path>
<Result>NOT IMPLEMENTED</Result>
<Detail>Flags: FILE_DISPOSITION_DELETE,
FILE_DISPOSITION_POSIX_SEMANTICS</Detail>
</event>


I should mention that I also cannot delete files with Windows 10 WSL. It
fails with that "Function not implemented" rather than "Invalid request
code", though it seems like it must be related.

PS C:\Windows\system32> wsl
sbaker@FWA002495 /mnt/c/Windows/system32 $ rm -f /mnt/c/Test/test
rm: cannot remove '/mnt/c/Test/test': Function not implemented



On Sat, May 2, 2020 at 8:09 PM Sean Baker <sbaker48@gmail.com> wrote:

> I just installed Cygwin on a new Windows 10 machine. I am getting an error
> "Invalid request code" whenever I try to remove a file. Every other file
> operation that I have tested so far seems to work fine.
>
> Using a Windows CMD prompt, I can remove the file with the normal windows
> DEL command. However, if I try to execute C:\cygwin64\bin\rm.exe it still
> fails with "Invalid request code".
>
> This problem does not just occur with the 'rm' command. For example. 'vi'
> and 'git' cannot remove the lock files that they create. Also custom
> programs that I write myself and compile under Cygwin fail with the same
> error code when trying to remove files, even when executed from a Windows
> CMD prompt or clicked on in Windows explorer. The location of the file does
> not matter either, since I have tried files in the Cygwin home dir, my
> Users directory, My Documents, etc with the same result.
>
> However I have also installed MinGW, and in both the Cygwin terminal and
> Windows CMD prompt I can remove files successfully by calling the rm.exe
> installed there (see examples).
>
> Example under Cygwin:
>
> sbaker@FWA002495 ~ >$ echo test > foo
> sbaker@FWA002495 ~ >$ ls -l foo
> -rw-r--r-- 1 sbaker Domain Users 5 May  2 19:47 foo
> sbaker@FWA002495 ~ >$ cat foo
> test
> sbaker@FWA002495 ~ >$ rm foo
> rm: remove regular file 'foo'? y
> rm: cannot remove 'foo': Invalid request code
> sbaker@FWA002495 ~ >$ /cygdrive/c/MinGW/msys/1.0/bin/rm.exe -v foo
> removed `foo'
>
> Example under Windows CMD:
>
> C:\Users\sbaker>echo test > foo
> C:\Users\sbaker>c:\cygwin64\bin\rm.exe -v foo
> /usr/bin/rm: cannot remove 'foo': Invalid request code
> C:\Users\sbaker>c:\MinGW\msys\1.0\bin\rm.exe -v foo
> removed `foo'
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Invalid request code when removing files
  2020-05-05 17:12 ` Sean Baker
@ 2020-05-05 19:34   ` David Macek
  0 siblings, 0 replies; 3+ messages in thread
From: David Macek @ 2020-05-05 19:34 UTC (permalink / raw)
  To: Sean Baker; +Cc: cygwin

I would ask about your Cygwin and Windows versions, but unless you're
running an Insiders build, I don't think WSL is supposed to be this
broken. Are you by any chance running a third-party antivirus or
security suite or some uncommon driver, file system software? Consult
the BLODA<https://cygwin.com/faq/faq.html#faq.using.bloda> for the
worst offenders, but note that this list is not exhaustive.

-- 
David Macek

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-05 19:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-03  0:09 Invalid request code when removing files Sean Baker
2020-05-05 17:12 ` Sean Baker
2020-05-05 19:34   ` David Macek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).