Subject: | A:F:H:CFITSIO::configure doesn't pass ReadOnly flag when opening extensions |
If a FITS file without an extension is opened with ReadOnly => 1,
configure doesn't pass along the ReadOnly flag to its subsequent opens
of the individual extensions. The relevant code is here:
140 foreach my $ihdu (1 .. $nhdus-1) {
141 my $subfr = sprintf("%s[%d]",$args{File},$ihdu);
142 my $sself = $self->new(File=>$subfr);
143 push @subfrms,$sself;
144 }
If the file is read-only on disk, line 142 will fail, as it will attempt
to open it read-write. Changing line 142 to
142 my $sself = $self->new(File=>$subfr, ReadOnly =>
$args{ReadOnly});
fixes the problem. Attached is a tiny patch which does this.
Diab
Subject: | Astro-FITS-Header-3.06.patch |
# This is a patch for Astro-FITS-Header-3.06.orig to update it to Astro-FITS-Header-3.06
#
# To apply this patch:
# STEP 1: Chdir to the source directory.
# STEP 2: Run the 'applypatch' program with this patch file as input.
#
# If you do not have 'applypatch', it is part of the 'makepatch' package
# that you can fetch from the Comprehensive Perl Archive Network:
# http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz
# In the above URL, 'x' should be 2 or higher.
#
# To apply this patch without the use of 'applypatch':
# STEP 1: Chdir to the source directory.
# STEP 2: Run the 'patch' program with this file as input.
#
#### End of Preamble ####
#### Patch data follows ####
diff -c 'Astro-FITS-Header-3.06.orig/lib/Astro/FITS/Header/CFITSIO.pm' 'Astro-FITS-Header-3.06/lib/Astro/FITS/Header/CFITSIO.pm'
Index: ./lib/Astro/FITS/Header/CFITSIO.pm
*** ./lib/Astro/FITS/Header/CFITSIO.pm Fri Jul 13 19:58:55 2012
--- ./lib/Astro/FITS/Header/CFITSIO.pm Thu Aug 2 14:47:22 2012
***************
*** 139,145 ****
$ifits->get_num_hdus($nhdus,$status);
foreach my $ihdu (1 .. $nhdus-1) {
my $subfr = sprintf("%s[%d]",$args{File},$ihdu);
! my $sself = $self->new(File=>$subfr);
push @subfrms,$sself;
}
}
--- 139,145 ----
$ifits->get_num_hdus($nhdus,$status);
foreach my $ihdu (1 .. $nhdus-1) {
my $subfr = sprintf("%s[%d]",$args{File},$ihdu);
! my $sself = $self->new(File=>$subfr, ReadOnly => $args{ReadOnly});
push @subfrms,$sself;
}
}
#### End of Patch data ####
#### ApplyPatch data follows ####
# Data version : 1.0
# Date generated : Thu Aug 2 14:48:15 2012
# Generated by : makepatch 2.04
# Recurse directories : Yes
# Excluded files : (\A|/).*\~\Z
# (\A|/).*\.a\Z
# (\A|/).*\.bak\Z
# (\A|/).*\.BAK\Z
# (\A|/).*\.elc\Z
# (\A|/).*\.exe\Z
# (\A|/).*\.gz\Z
# (\A|/).*\.ln\Z
# (\A|/).*\.o\Z
# (\A|/).*\.obj\Z
# (\A|/).*\.olb\Z
# (\A|/).*\.old\Z
# (\A|/).*\.orig\Z
# (\A|/).*\.rej\Z
# (\A|/).*\.so\Z
# (\A|/).*\.Z\Z
# (\A|/)\.del\-.*\Z
# (\A|/)\.make\.state\Z
# (\A|/)\.nse_depinfo\Z
# (\A|/)core\Z
# (\A|/)tags\Z
# (\A|/)TAGS\Z
# p 'lib/Astro/FITS/Header/CFITSIO.pm' 7555 1343933242 0100444
#### End of ApplyPatch data ####
#### End of Patch kit [created: Thu Aug 2 14:48:15 2012] ####
#### Patch checksum: 55 2140 1442 ####
#### Checksum: 73 2849 60102 ####