basename: use fail instead of writeln to stderr