From c52dbdf9b8b9b720180b99c0935df5c9175109f2 Mon Sep 17 00:00:00 2001 From: Theodore Papadopoulo Date: Sun, 1 Jun 2025 15:03:07 +0200 Subject: [PATCH 1/4] Do not ignore the file_id. --- mne/_fiff/tag.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mne/_fiff/tag.py b/mne/_fiff/tag.py index 6a4636ef264..7f53cd21bf5 100644 --- a/mne/_fiff/tag.py +++ b/mne/_fiff/tag.py @@ -361,9 +361,9 @@ def _read_old_pack(fid, tag, shape, rlims): def _read_dir_entry_struct(fid, tag, shape, rlims): """Read dir entry struct tag.""" - pos = tag.pos + 16 + pos = tag.pos entries = list() - for offset in range(1, tag.size // 16): + for offset in range(tag.size // 16): ent = _read_tag_header(fid, pos + offset * 16) # The position of the real tag on disk is stored in the "next" entry within the # directory, so we need to overwrite ent.pos. For safety let's also overwrite From 8a05fe7c19d813c29b17d5a48f59ee2f396a51df Mon Sep 17 00:00:00 2001 From: Theodore Papadopoulo Date: Sun, 1 Jun 2025 17:33:12 +0200 Subject: [PATCH 2/4] Add ChangeLog entry. --- doc/changes/devel/13268.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changes/devel/13268.bugfix.rst diff --git a/doc/changes/devel/13268.bugfix.rst b/doc/changes/devel/13268.bugfix.rst new file mode 100644 index 00000000000..459521aa0ce --- /dev/null +++ b/doc/changes/devel/13268.bugfix.rst @@ -0,0 +1 @@ +Fixed bug where the file_id is not set when the file contains a directory at the end of the file, by :newcontrib:`Théodore Papadopoulo`. From 46d563a2e7f7f8600f508d13dbdbd241424bc3d8 Mon Sep 17 00:00:00 2001 From: Theodore Papadopoulo Date: Mon, 2 Jun 2025 11:24:57 +0200 Subject: [PATCH 3/4] Correct the reading. --- mne/_fiff/tag.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mne/_fiff/tag.py b/mne/_fiff/tag.py index 7f53cd21bf5..96fee81da20 100644 --- a/mne/_fiff/tag.py +++ b/mne/_fiff/tag.py @@ -361,7 +361,7 @@ def _read_old_pack(fid, tag, shape, rlims): def _read_dir_entry_struct(fid, tag, shape, rlims): """Read dir entry struct tag.""" - pos = tag.pos + pos = tag.pos + 16 entries = list() for offset in range(tag.size // 16): ent = _read_tag_header(fid, pos + offset * 16) From 50ddfaaeb35d49082003ceddcbbe9c98c22ac806 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 2 Jun 2025 10:37:19 -0400 Subject: [PATCH 4/4] Update doc/changes/devel/13268.bugfix.rst [ci skip] --- doc/changes/devel/13268.bugfix.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changes/devel/13268.bugfix.rst b/doc/changes/devel/13268.bugfix.rst index 459521aa0ce..b7dd5e05ea2 100644 --- a/doc/changes/devel/13268.bugfix.rst +++ b/doc/changes/devel/13268.bugfix.rst @@ -1 +1 @@ -Fixed bug where the file_id is not set when the file contains a directory at the end of the file, by :newcontrib:`Théodore Papadopoulo`. +Fixed bug where the file_id is not set when the file contains a directory at the end of the file, by `Théodore Papadopoulo`_.