If the data directory (or a parent) is a symlink, also log the path it resolves to, so debug.log files show the actual location for that run.
This patch would mostly help developers. I've been testing a potential performance PR across different data directories (for example, SSD versus HDD). Yes, we can specify -datadir= on the command line, but if a script starts bitcoind (e.g., on an RPi with a whole infrastructure, like Umbrel or myNode), changing the startup command arguments may be inconvenient or not even possible. But it's easy to change the default directory to be a symlink.
If the resolved directory matches the specified directory, there's no need to log both (so no change from today). On macOS, /tmp and /var are symlinks into /private, so a datadir under those (like the functional test temp dirs) would show both.
I don't think a separate test is needed. I haven't tested on all platforms, but this patch uses primitives already used elsewhere, so it should work everywhere.
Here's a before and after example; this line occurs within the first few lines after startup (omitting the timestamp prefix):
- Using data directory /home/larry/.bitcoin
+ Using data directory /home/larry/.bitcoin (/sd/.bitcoin)