On 3/21/20 5:12 AM, Johannes Schauer wrote:
> Hi,
> 
> is there existing code that works with busybox and replaces "readlink -m" or
> "realpath -m" from coreutils?
> 
> Resources I found online either show solution for "readlink -f" only, when
> neither readlink nor realpath exists, when Perl is available or when bash is
> available.
> 
> Specifically I want to replace the "readlink -m" invocation here [1] by
> something that works with busybox.
> 
> Thanks!
> 
> cheers, josch
> 
> [1] 
> https://sources.debian.org/src/glibc/2.30-2/debian/debhelper.in/libc.preinst/#L226

I can't think of one, but you could implement it in pure shell by
checking the return code of readlink without options (it will fail if
the file is not a symlink), and walk the path to find the first
directory that exists in order to support -m. This would be pretty
compatible with any readlink implementation, including ones without -f.

Probably the nicest option would be to submit a patch that implements
readlink -m for busybox, so that it just works. It's a nice, useful
option to have, so why not add it?

-- 
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to