BurntSushi / BurntSushi/same-file

Question about Handle equality

Open
#61 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
124
Forks
26
PR merge metrics
No merged PRs in 30d

Description

I was doing some testing and noticed something weird with `stdout`. If I create 2 handles to `stdout`, shouldn't they be considered equal? I saw something similar in #36 so maybe this isn't an issue, but wanted to double check. Since both handles point to 0x2a0 and have a key of None, shouldn't they be considered equal? It's possible I'm missing something obvious, but just wanted to double check.

```rust
let stdout1 = Handle::stdout()?;
let stdout2 = Handle::stdout()?;
assert_eq!(stdout1, stdout2);

assertion `left == right` failed
left: Handle(Handle { kind: Borrowed(HandleRef(HandleRefInner(Some(File { handle: 0x2a0 })))), key: None })
right: Handle(Handle { kind: Borrowed(HandleRef(HandleRefInner(Some(File { handle: 0x2a0 })))), key: None })
```

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue does not name a source file, test, or entry point. Start by locating Handle's equality implementation and the existing discussion in issue #36, then determine whether equal stdout handles are intended behavior and document or test the resulting semantics.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.