eclipse-iceoryx / eclipse-iceoryx/iceoryx2

Windows `shm_unlink` return wrong `errno`

Open
#9 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
2.5k
Forks
185
Avg merge
2d 13h
Merged PRs (30d)
32

Description

## Required information

**Operating system:**
* OS Windows 2019 Server

**Rust version:**
Output of: rustc 1.73

**Cargo version:**
Output of: cargo 1.73

**elkodon version:**
`main` branch

**Observed result or behaviour:**
In `iceoryx2_pal/posix/src/windows/mman.rs` the `shm_unlink` call uses `DeleteFileA`. When a file is opened and deleted with this call it successfully returns. If `DeleteFileA` is again called while the file is opened it will set the `GetLastError` to `ERROR_ACCESS_DENIED` instead of `ERROR_FILE_NOT_FOUND`, see: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-deletefilea

This causes all `iceoryx2_cal` tests to fail that are using shared memory. Whenever `std::mem::forget` is called in such a concept, the file descriptor is leaked and a subsequent second `remove` call will return permission denied instead of false.

The quick-fix `Errno::set(Errno::ENOENT);` in `iceoryx2_pal/posix/src/windows/mman.rs` (`shm_unlink`) shall be removed and the concept tests must be adjusted.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.