As possible, correctly handle lumi sections split across multiple files

See #5181 and #5183; this is just a partially squashed branch.