Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Cannot Detect Files in Nested Symlinked Folders #402

Open
3 tasks done
garrettmflynn opened this issue Sep 14, 2023 · 0 comments
Open
3 tasks done

[Bug]: Cannot Detect Files in Nested Symlinked Folders #402

garrettmflynn opened this issue Sep 14, 2023 · 0 comments
Labels
category: bug errors in the code or code behavior

Comments

@garrettmflynn
Copy link
Member

garrettmflynn commented Sep 14, 2023

What happened?

The following code is a demo that shows NWB files in nested symlinked folders are not found by the NWB Inspector—though these same files are found when inspect_all is run directly on the base folder as well as a direct symlink to that folder.

from datetime import datetime
from shutil import rmtree
from pathlib import Path

from nwbinspector import inspect_all
from nwbinspector.nwbinspector import InspectorOutputJSONEncoder

paths = [
   # Path(s) to directories containing NWB files
]

tmp_base_folder_path =  Path(__file__).parent / ".temp"
def get_temp_folder_path():
    return tmp_base_folder_path / f"temp_{datetime.now().strftime('%Y%m%d-%H%M%S')}"

tmp_folder_path = get_temp_folder_path()
tmp_folder_path.mkdir(parents=True)

for path in paths:
    path = Path(path)
    (tmp_folder_path / path.name).symlink_to(path, path.is_dir())

messages = inspect_all(path=tmp_folder_path)

print('Messages (nested symlink)', len(list(messages)))

direct_path = Path(paths[0])
print('Messages (direct)', len(list(inspect_all(path=direct_path))))

direct_symlink_path = tmp_base_folder_path / direct_path.name
direct_symlink_path.symlink_to(direct_path, direct_path.is_dir())
print('Messages (symlink)', len(list(inspect_all(path=direct_symlink_path))))
rmtree(tmp_base_folder_path)

Operating System

macOS

Python Version

3.10

Were you streaming with ROS3?

No

Package Versions

Package Version


altgraph 0.17.3
aniso8601 9.0.1
annotated-types 0.5.0
appdirs 1.4.4
arrow 1.2.3
asciitree 0.3.3
attrs 23.1.0
bidsschematools 0.7.1
blessed 1.20.0
blinker 1.6.2
boto3 1.28.23
botocore 1.31.23
certifi 2023.7.22
chardet 5.1.0
charset-normalizer 3.2.0
ci-info 0.3.0
click 8.1.6
click-didyoumean 0.3.0
configparser 6.0.0
contourpy 1.1.0
cycler 0.11.0
dandi 0.55.1
dandischema 0.8.4
dnspython 2.4.2
elephant 0.13.0
email-validator 2.0.0.post2
entrypoints 0.4
etelemetry 0.3.0
exceptiongroup 1.1.2
fasteners 0.18
Flask 2.3.2
Flask-Cors 4.0.0
flask-restx 1.1.0
fonttools 4.42.0
fparse 1.20.1
fqdn 1.5.1
fscacher 0.3.0
h5py 3.9.0
hdf5storage 0.1.19
hdmf 3.8.1
humanize 4.7.0
idna 3.4
importlib-metadata 6.8.0
importlib-resources 6.0.1
iniconfig 2.0.0
interleave 0.2.1
isodate 0.6.1
isoduration 20.11.0
itsdangerous 2.1.2
jaraco.classes 3.3.0
Jinja2 3.1.2
jmespath 1.0.1
joblib 1.3.2
jsonpointer 2.4
jsonschema 4.18.0
jsonschema-specifications 2023.7.1
keyring 24.2.0
keyrings.alt 5.0.0
kiwisolver 1.4.4
lazy-ops 0.2.0
lxml 4.9.3
macholib 1.16.2
MarkupSafe 2.1.3
matplotlib 3.7.2
MEArec 1.9.0
MEAutility 1.5.1
more-itertools 10.1.0
msgpack 1.0.5
natsort 8.4.0
neo 0.12.0
neuroconv 0.4.2
numcodecs 0.11.0
numpy 1.25.2
nwbinspector 0.4.29
packaging 21.3
pandas 2.0.3
Pillow 10.0.0
pip 23.2.1
pkgutil_resolve_name 1.3.10
pluggy 1.2.0
probeinterface 0.2.17
psutil 5.9.5
pycryptodomex 3.18.0
pydantic 1.10.12
pydantic_core 2.1.2
pyEDFlib 0.1.32
pyinstaller 5.13.0
pyinstaller-hooks-contrib 2023.6
pyintan 0.3.0
pymatreader 0.0.32
pynwb 2.4.0
pyopenephys 1.1.6
pyout 0.7.3
pyparsing 3.0.9
pytest 7.4.0
python-dateutil 2.8.2
pytz 2023.3
PyYAML 6.0.1
quantities 0.14.1
referencing 0.30.2
requests 2.31.0
rfc3339-validator 0.1.4
rfc3987 1.3.8
rpds-py 0.9.2
ruamel.yaml 0.17.32
ruamel.yaml.clib 0.2.7
s3transfer 0.6.1
scipy 1.11.2
semantic-version 2.10.0
setuptools 68.0.0
six 1.16.0
spikeextractors 0.9.11
spikeinterface 0.98.2
tenacity 8.2.2
threadpoolctl 3.2.0
tomli 2.0.1
tqdm 4.66.0
typing_extensions 4.7.1
tzdata 2023.3
uri-template 1.3.0
urllib3 1.26.16
wcwidth 0.2.6
webcolors 1.13
Werkzeug 2.3.6
wheel 0.41.1
xmltodict 0.13.0
zarr 2.16.0
zarr-checksum 0.2.9
zipp 3.16.2

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • Have you ensured this bug was not already reported?
  • To the best of your ability, have you ensured this is a bug within the code that checks the NWBFile, rather than a bug in the NWBFile reader (e.g., PyNWB or MatNWB)?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: bug errors in the code or code behavior
Projects
None yet
Development

No branches or pull requests

1 participant