Skip to content

Passing missing --reference incorrectly reports cram file missing as well #1723

Description

@ASLeonard

Hi,
This is more of a user error, but maybe a helpful bug to fix. This is on

samtools 1.19-1-ga4c73e4-dirty
Using htslib 1.19-1-g61b037bb-dirty

If I try to do something with a cram, but pass a non-existant reference (in this case a typo) samtools stats --reference <ref_with_typo> sample.cram, I get the following output that misleadingly suggests the cram file itself doesn't exist.

[E::refs_load_fai] Failed to open reference file '<ref_with_typo>'
[E::hts_open_format] Failed to open file "sample.cram" : No such file or directory
samtools stats: failed to open "sample.cram": No such file or directory

Oddly, in the case of stats I get a segfault, but in other operations like view I just get the errors that the reference can't be opened and the cram doesn't exist. I would guess the expected behaviour would be error out when the reference couldn't be loaded and avoid misleading the user the cram file doesn't exist (and potentially segfault).

Best,
Alex

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions