Skip to content

Commit

Permalink
Open HDF5 files in read-only mode for readObject()-dispatched functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
LTLA committed Jun 21, 2024
1 parent d5c82b2 commit 3d04935
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: alabaster.matrix
Title: Load and Save Artifacts from File
Version: 1.5.3
Date: 2024-06-07
Version: 1.5.4
Date: 2024-06-21
Authors@R: person("Aaron", "Lun", role=c("aut", "cre"), email="[email protected]")
License: MIT + file LICENSE
Description:
Expand Down
2 changes: 1 addition & 1 deletion R/readArray.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ readArray <- function(path, metadata, ...) {
fpath <- file.path(path, "array.h5")

details <- local({
fhandle <- H5Fopen(fpath)
fhandle <- H5Fopen(fpath, flags="H5F_ACC_RDONLY")
on.exit(H5Fclose(fhandle), add=TRUE, after=FALSE)
ghandle <- H5Gopen(fhandle, "dense_array")
on.exit(H5Gclose(ghandle), add=TRUE, after=FALSE)
Expand Down
2 changes: 1 addition & 1 deletion R/readSparseMatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ readSparseMatrix <- function(path, metadata, ...) {
name <- "compressed_sparse_matrix"

details <- local({
fhandle <- H5Fopen(fpath)
fhandle <- H5Fopen(fpath, flags="H5F_ACC_RDONLY")
on.exit(H5Fclose(fhandle), add=TRUE, after=FALSE)
ghandle <- H5Gopen(fhandle, name)
on.exit(H5Gclose(ghandle), add=TRUE, after=FALSE)
Expand Down
2 changes: 2 additions & 0 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ However, note that this was not implemented for the soft-deprecated \code{writeS
\item Added a \code{extract_sparse_array()} method for the \code{WrapperArraySeed} class, for some future-proofing when the seeds eventually make the switch.

\item Bugfix for integer overflow when saving large sparse matrices in \code{saveObject()}.

\item Open all HDF5 files in read-only mode for \code{readObject()} dispatch functions, to avoid permission-related issues.
}}

0 comments on commit 3d04935

Please sign in to comment.