bulk-downloader-for-reddit icon indicating copy to clipboard operation
bulk-downloader-for-reddit copied to clipboard

[BUG] Errno 63 - File name too long on MacOS when writing to APFS

Open MilesKleiber opened this issue 1 year ago • 4 comments

  • [ X ] I am reporting a bug.
  • [ X ] I am running the latest version of BDfR
  • [ X ] I have read the Opening an issue

Description

File name too long on Mac OS when writing to external APFS drive. Specified as '[Errno 63]' Log attached below.

Command

python3 -m pip install bdfr --upgrade
python3 -m bdfr clone '<DIR>' --folder-scheme '{SUBREDDIT}/{TITLE}-{POSTID}' --format yaml --user me --saved --authenticate --no-dupes --file-scheme '{POSTID}-{DATE}'

Environment (please complete the following information):

  • OS: macOS Monterey Version 12.5.1
  • Python version: Python 3.9.6 (v3.9.6)
  • Target Drive Format: APFS

Logs

`Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/bdfr/__main__.py", line 154, in <module>
    cli()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/bdfr/__main__.py", line 120, in cli_clone
    reddit_scraper.download()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/bdfr/cloner.py", line 20, in download
    self._download_submission(submission)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/bdfr/downloader.py", line 84, in _download_submission
    if destination.exists():
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py", line 1414, in exists
    self.stat()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py", line 1222, in stat
    return self._accessor.stat(self)
OSError: [Errno 63] File name too long: '/<OP_REDACTED>/homelab/Got a PowerEdge from work decked out with 96GB of RAM and added in my drives. After hours over a couple of nights of tinkering, got UNRAID configured for the first time in a year and got the RAID card in IT mode. A little dated but so nice having the HDD carriages.-vi6mq3/vi6mq3-2022-06-22T09:32:03.jpg'`

MilesKleiber avatar Sep 09 '22 06:09 MilesKleiber

I understand this was already an issue, though it was is in a different environment than the previous (Windows) and with different variable given that APFS is limited to "255 UTF-8 characters".

MilesKleiber avatar Sep 09 '22 06:09 MilesKleiber

I'm not entirely sure what we can do to fix this issue. There's no way for us to tell what the path limit is if you're writing to an external drive with a different filesystem and different constraints. Maybe it can be a configuration file option?

Serene-Arc avatar Sep 09 '22 07:09 Serene-Arc

I'm not entirely sure what we can do to fix this issue. There's no way for us to tell what the path limit is if you're writing to an external drive with a different filesystem and different constraints. Maybe it can be a configuration file option?

That would be awesome. I know you implemented it to auto rename, but if there were a way to just hard trim with a flag, or replace the grabbed entry for {TITLE} with a standard NAME_EXCEEDS_LIMIT configurable name?

MilesKleiber avatar Sep 09 '22 20:09 MilesKleiber

It already does hard trim, to what it thinks is the limit for the system. The macOS is returning one limit which isn't the same as the limit on the drive. I guess this only comes up when the limit on the drive is less than what is on the system, which is why this is the first I've heard of it.

I suppose a CLI flag and a configuration option would be pretty easy to do.

Serene-Arc avatar Sep 09 '22 23:09 Serene-Arc