Skip to content

"File name too long" on macOS during catalog backup #117

@dannykansas

Description

@dannykansas

System & Release Information

> uname -a
Darwin redacted 23.6.0 Darwin Kernel Version 23.6.0: Thu Sep 12 23:35:10 PDT 2024; root:xnu-10063.141.1.701.1~1/RELEASE_ARM64_T6030 arm64

> echo $SHELL
/bin/zsh

> cortex --version
0.27.0

Issue Description

Our Cortex instance is old (2022) and the introduction of CloudControl types - a la type=AWS:S3:Bucket vs. the former type=s3 - has required a fair bit of manual deletion of old types upon discovery.

As part of this process, I take a full instance backup using cortex catalog backup. During the most recent backup, I ran into the following error related to filename length:

OSError: [Errno 63] File name too long: '/Users/myusr/.cortex/export/2025-05-22-16-35-21-default/catalog/arn-aws-ecs-us-west-2-000000000000-task-definition-servc-production-run-ecs-scl-0000-redactl-redact-redact-redac-tred-a-ctredactedredactedredacted-redacted1redacted2redacted3-redacted4redacted5-redacted6redacted77-redacted8redacted9redac-ted10rredacted11redacted12red-acted13redacted14123456789glb-1.yaml'

Redactions above retain the overall length of the filename, for what it's worth.

The full stack trace is as follows:

Traceback (most recent call last):
  File "/opt/homebrew/bin/cortex", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/opt/homebrew/Cellar/cortexapps-cli/0.27.0/libexec/lib/python3.11/site-packages/cortexapps_cli/cortex.py", line 4068, in cli
    args.func(args)
  File "/opt/homebrew/Cellar/cortexapps-cli/0.27.0/libexec/lib/python3.11/site-packages/cortexapps_cli/cortex.py", line 827, in export
    f1 = open(catalog_directory + "/" + output_tag + ".yaml", 'w')
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Suggested Resolution

Ideally, some sort of handling for very long file names in the export would be ideal.

If this is a hard OS limitation, it'd be preferable to simply catch and handle this exception vs. aborting the backup entirely. As of the moment, this fails the backup and I'm unable to safely backup my instance prior to major changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions