Package.extract_file: determine basename using lsar

Fixes #6764.