Skip Menu |

This queue is for tickets about the Astro-FITS-Header CPAN distribution.

Report information
The Basics
Id: 1785
Status: resolved
Priority: 0/
Queue: Astro-FITS-Header

People
Owner: aa [...] astro.ex.ac.uk
Requestors: djerius [...] cfa.harvard.edu
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: A::F::H::CFITSIO::configure opens file READWRITE
Astro::FITS::Header v. 2.2 The configure routine in Astro::FITS::Header::CFITSIO opens the file in READWRITE mode, rather than READONLY. It doesn't require write access for what it does (as far as I can tell), and this prevents one from using the routine on write-protected files. Thanks, Diab
It opens the file in READWRITE mode to check that it can write changes back to the HDU back to the FITS file, for the things I'm using the module for this is always necessary. I guess I could as a hash option to allow opening the HDU in READONLY mode. I'll stick it on the To Do pile for the next release. Alasdair.
Show quoted text
> From my reading of the configure() code, it doesn't do that; it simply > opens the file, slurps in the header, and closes it. writehdr() does > need write access, but configure() seems not to.
Basically if it can't open the file in readwrite mode during the configure() stage, it won't be able to do it during writehdr() either. Since in all cases I'm interested in I'm going to be updating the header it makes sense to fall over as soon as possible if the file can't be written to... I've added an "Open file in READONLY mode" hash option to the list of things To Do for version 2.3. I'm happy to accept patches if you want to fix this yourself, although any patch must preserve the current functionality as is, if you want your patch rolled back in it should add an additional hash option when creating an new Astro::FITS::Header::CFITSIO object. It should also cleanly disallow calls to writehdr(). Alasdair.