refraction-networking / water

WebAssembly Transport Executables Runtime
Apache License 2.0
22 stars 1 forks source link

bug: memFS.WriteFile returned error: success #71

Closed gaukas closed 2 months ago

gaukas commented 2 months ago

Observation

When (*Config).TransportModuleConfig is set, call to (*core).Instantiate() will fail with error message: water: memFS.WriteFile returned error: success.

Expected Behavior

The call to (*core).Instantiate() should either succeed or fail with an intuitive error. "success" is not considered an intuitive error.

Problem

https://github.com/refraction-networking/water/blob/b72fffc3eff3b222c678793ddea0c98583cbb818/core.go#L394-L397

The above logic is incorrect. To ignore nil error and system errno 0, the correct condition for the if statement will be:

if !errors.Is(err, nil) && !errors.Is(err, sys.Errno(0))