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

archive:dump can't handle filenames longer than 100 characters #6009

Closed
clemorphy opened this issue May 17, 2024 · 3 comments
Closed

archive:dump can't handle filenames longer than 100 characters #6009

clemorphy opened this issue May 17, 2024 · 3 comments

Comments

@clemorphy
Copy link

Describe the bug
The Drush command archive:dump can't handle filenames longer than 100 characters

To Reproduce
My /config/sync/ folder contains files with names longer than 100 characters. Mainly migration files like : migrate_plus.migration.upgrade_d7_metatag_field_instance_widget_settings_node_xxxxxxx_xxxxxxxxxxxxx.yml
When executing
ddev drush archive:dump --code --db --destination=../backups/archive.tar.gz
it fails, saying that some filenames are too long for the tar format.

Expected behavior
I excpect the archive:dump command to handle filenames longer than 100 characters.

Actual behavior
It fails creating the tar file, and outputs this :

In ArchiveDumpCommands.php line 172:
                                                                                                                                        
  tar-based phar "/tmp/archive.tar" cannot be created, filename "code/config/sync/migrate_plus.migration.upgrade_d7_metatag_field_inst  
  ance_widget_settings_node_xxxxxxx_xxxxxxxxxxxxx.yml" is too long for tar file format                                                  
                                                                                                                                        
Failed to run drush archive:dump --code --db --destination=../backups/archive.tar.gz: exit status 1

The limitation seems to come from Php's PharData that drush is using to generate the tar : https://stackoverflow.com/questions/24800217/phardata-limitation-of-file-name-length

Workaround
Maybe archive:dump should allow to use an alternative to the tar/PharData solution. I don't know if generating directly a zip file is something doable.

System Configuration

Q A
Drush version 12.5.1
Drupal version 10.2.5
PHP version 8.2.11
OS? Windows, WSL2, DDEV
@greg-1-anderson
Copy link
Member

This is a limitation of the tar format. The filename part can only be 100 characters long, and the entire path can only be 255 characters long. We would have to switch to a different archive format, as suggested, if we wanted to support this. To preserve backwards compatibility, this switch would have to be an option.

PRs welcome.

@clemorphy
Copy link
Author

@greg-1-anderson Actually it seems that the limitation is not on the tar format itself. I succedeed in generating a tar directly from a Linux shell with filenames longer than 100 characters. The limitation seems to be on the PHP PharData side.

@weitzman
Copy link
Member

I'm not inclined to add more code to archive commands for this. Please work on the upstream bug.

@weitzman weitzman closed this as not planned Won't fix, can't repro, duplicate, stale May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants