Although readlink(1) may seem like a subset of stat(1), it is such a
small subset that the added complexity of supporting two commands in a
single codebase far outweighs the cost of duplicating what little code
they have in common. This implementation is also much closer to POSIX
conformance than the previous one.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 72732 Build 69615: arc lint + arc unit
Event Timeline
| usr.bin/readlink/readlink.c | ||
|---|---|---|
| 52 | I realize this is incorrect, but it is not a regression as the current implementation has the exact same bug. Fixing it is non-trivial. | |
| usr.bin/readlink/readlink.c | ||
|---|---|---|
| 52 | The current implementation's behaviour is different though: $ ls /foo ls: /foo: No such file or directory $ readlink -f /foo/bar/baz /foo $ echo $? 0 vs. the current behaviour on main: $ ls /foo ls: /foo: No such file or directory $ readlink -f /foo/bar/baz $ echo $? 1 | |
| usr.bin/readlink/readlink.c | ||
|---|---|---|
| 52 | They are both supposed to print an error message and return a non-zero exit code, but that requires determining which component failed, which essentially means implementing at least part of realpath(3) ourselves. | |
| usr.bin/readlink/readlink.c | ||
|---|---|---|
| 52 | Uh sorry I was thinking of a different test case than what you are showing here. This can be fixed with an lstat(2). | |