Hi Stefano,
The behaviour you describe is incorrect. It is better explained using
a longer topic - let's set sensors/temperature sensors/humidity etc.
A subscription to sensors/# would match on sensors/temperature,
sensors/humidity *and* sensors. If we imagine that a subscription to
/# is actually a subscription to ""/# (i.e. an empty topic followed by
/ followed by #) then a subscription to /# should match against "" as
well as anything below it such as /foo/bar (""/foo/bar). A
subscription to # on the other hand will match everything, including
""/foo/bar.
The slightly confounding bit is that topics must be at least one
character long, so it is not possible to publish to "", which would
match against ""/#.
The current mosquitto code (you really should upgrade) works correctly
for subscriptions to # but not for retained messages when subscribing
to /# (it returns messages with topics without a leading slash). I'll
get that fixed.