Closed takusuman closed 1 year ago
Both readlink binaries compile on OpenBSD 7.1 (in spite of some of the other issues I've yet to fix) and Ubuntu Lunar Lobster/23.04. They also appear to have expected behavior (UCB not taking more than one file while GNU does) and neither have any issues from what I can tell. I say it looks good to me.
Both readlink binaries compile on OpenBSD 7.1
Well, that was my doubt in the first place, thanks.
Still, it has a bug (and the code's looking terrible too, because of the preprocessor hacks): some files aren't printed on the screen, even with the -f
option.
For instance, there's a comparison between toybox's readlink
and Heirloom NG's:
luiz@S145:/tmp% ls -l /proc/self/fd/*
/proc/self/fd/10: No such file or directory
/proc/self/fd/3: No such file or directory
lrwx------ 1 luiz luiz 64 Apr 11 16:16 /proc/self/fd/0 -> /dev/pts/4
lrwx------ 1 luiz luiz 64 Apr 11 16:16 /proc/self/fd/1 -> /dev/pts/4
lrwx------ 1 luiz luiz 64 Apr 11 16:16 /proc/self/fd/2 -> /dev/pts/4
luiz@S145:/tmp% ./toybox-x86_64 readlink -f /proc/self/fd/*
/dev/pts/4
/dev/pts/4
/proc/9943/fd/10
/dev/pts/4
/proc/9943/fd/3
luiz@S145:/tmp% ./heirloom-toolchest/readlink/readlink -f /proc/self/fd/*
/dev/pts/4
/dev/pts/4
Beside this, I'll be pushing into master, since this branch is only about the implementation.
If there's any idea of fix, you can push into a new branch called "readlink-fix
" or anything like that.
"Pinging" all the contributors: @tch69 @arthurbacci @mamccollum
What do you think? Can it enter the main source tree?
Just to clarify: now we have two variants of the
readlink
command, one that goes toUCBBIN
and behaves exactly like original OpenBSD's, and one that goes toDEFBIN
and behaves more like the GNU implementation (which is mimicked by toybox and probably others), what means that it supports multiple files as input.This may be useful for Shell scripting compatibility, mostly because folks doesn't usually follow the "system call kiosk" way that readlink was originally designed. For example, while it would be more correct to write:
It is usually done this:
EDIT: By the way, I hope I'm not breaking any of McCollum's hacks on OpenBSD compatibility.