bin/misc-functions.sh: normalize ${D%/}${D} slash

This will fix bug #467886.