This is an interesting issue. The reason this works as described in the bug description is indeed because ~/ and ~foo/ resolve to the home directory of the current user and of the foo user, respectively. It seems that the former is expanded using $HOME while the other using the home variable stored in the user entry record.
I'm not sure if this bug can be addressed easily. I'm marking it as confirmed though.
This is an interesting issue. The reason this works as described in the bug description is indeed because ~/ and ~foo/ resolve to the home directory of the current user and of the foo user, respectively. It seems that the former is expanded using $HOME while the other using the home variable stored in the user entry record.
I'm not sure if this bug can be addressed easily. I'm marking it as confirmed though.