WSL: Well, it was a good 25 year streak (obscure bug in Plan9 NP)

Environment

Windows build number: Microsoft Windows [Version 10.0.19041.450]
Your Distribution version:  Ubuntu 20.04
Whether the issue is on WSL 2 and/or WSL 1: WSL2

Steps to reproduce

For the last ~25 years, I’ve maintained the Windows version of tcsh. We won’t discuss why I still do it. That’s between me and my shrink.

One of the features it has is the ability to treat UNC paths like regular paths. e.g., ls-F //server will list all the shares visible on that server.

To do that, it uses the API from the WNet family. Specifically it does

  • WNetOpenEnum(//server)
  • WNetEnumResource on the returned handle

Well, to my surprise y’all finally broke backward compatibility, because apparently your plan9 provider requires CoInitialize() to be called when calling WNetEnumResource.


onecore\vm\dv\storage\plan9\rdr\dll\p9np.cpp(14)\p9np.dll!00007FFB26AFC04F: (caller: 00007FFB26AFC1B5) Exception(1) tid(4ea8) 800401F0 CoInitialize has not been called.

Exception thrown at 0x00007FFB391E3E49 in tcsh-x64.exe: Microsoft C++ exception: wil::ResultException at memory location 0x000000000014CD70.

Exception thrown at 0x00007FFB391E3E49 in tcsh-x64.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.

onecore\vm\dv\storage\plan9\rdr\dll\p9np.cpp(78)\p9np.dll!00007FFB26B0012F: (caller: 00007FFB33F345D0) LogHr(1) tid(4ea8) 800401F0 CoInitialize has not been called.

    Msg:[onecore\vm\dv\storage\plan9\rdr\dll

I personally do not think calling forcing the application to call CoInitialize() is a great thing for an older-than-COM API.

Expected behavior

N/A

Actual behavior

N/A

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (7 by maintainers)

Most upvoted comments

This is definitely an issue. Let me sync with the team and sort out the best way to solve this. I was not aware of the implications of the WNet apis.

@Biswa96 you were calling a private API that is an implementation detail in p9np directly without explaining why.

@amoldeshpande has reported that they have this problem when they are using the public network enumeration APIs.

While they have the same root cause, I don’t blame @benhillis for reading your bug and probably thinking “why is he doing this?” and closing it because you didn’t provide a reasonable explanation… even if it could have prevented this later discovery.