Bug 8276 - package/dropbear: symlink resolution incorrect
Summary: package/dropbear: symlink resolution incorrect
Status: RESOLVED FIXED
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: Yann E. MORIN
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-11 01:49 UTC by nospam+busybox
Modified: 2015-08-24 20:13 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments
Fix dropbear when readling is busybox (2.36 KB, patch)
2015-08-17 16:02 UTC, Yann E. MORIN
Details

Note You need to log in before you can comment on or make changes to this bug.
Description nospam+busybox 2015-08-11 01:49:52 UTC
Commit 6dc5c7ff changed how the /etc/dropbear symlink is detected, by using readlink to resolve the target location. When using coreutils's readlink, "readlink -f /etc/dropbear" will return /var/run/dropbear. However, if using busybox's readlink, the same "readlink -f /etc/dropbear" returns an empty string. I am not sure if this is a bug in the /etc/init.d/S50dropbear script, or if busybox is not honoring the "-f" flag.
Comment 1 Yann E. MORIN 2015-08-11 09:09:30 UTC
Hello,

I've tried to reproduce the issue, but it just works for me here.
But I've looked, and our default busybox configuration has
CONFIG_FEATURE_READLINK_FOLLOW enabled.

Did you customise your Busybox configuration?

Regards,
Yann E. MORIN.
Comment 2 nospam+busybox 2015-08-11 11:18:33 UTC
Yes, FEATURE_READLINK_FOLLOW is set. If it makes a difference, this is using the raspberrypi2_defconfig, with uClibc-ng.
Comment 3 nospam+busybox 2015-08-11 22:43:00 UTC
I investigated this further, and it may be a difference between Busybox/uClibc and coreutils/glibc. If the target of the symlink does not exist, in coreutils "readlink -f" will display as much as possible. In Busybox, "readlink -f" will result in an error, specifically ENOENT.

Test case:

ln -s /tmp/no_such_file /tmp/some_symlink


On my Debian desktop:

 $ readlink /tmp/some_symlink 
 /tmp/no_such_file
 $ readlink -f /tmp/some_symlink 
 /tmp/no_such_file


On my Raspberry Pi:

 # readlink /tmp/some_symlink
 /tmp/no_such_file
 # readlink -f /tmp/some_symlink 
 # touch /tmp/no_such_file
 # readlink -f /tmp/some_symlink 
 /tmp/no_such_file
Comment 4 Yann E. MORIN 2015-08-17 16:02:30 UTC
Created attachment 6141 [details]
Fix dropbear when readling is busybox

CAre to test the attached patch and report back, please?
Comment 5 nospam+busybox 2015-08-18 02:12:52 UTC
Yes, this patch worked for me.

Tested-by: Jason Tang <tang@jtang.org>