{"id":19687160,"url":"https://github.com/trinitronx/tar-test","last_synced_at":"2025-02-27T07:51:13.861Z","repository":{"id":2744710,"uuid":"3740818","full_name":"trinitronx/tar-test","owner":"trinitronx","description":"A test case for a tricky Bash tar extraction problem.","archived":false,"fork":false,"pushed_at":"2012-03-16T17:12:01.000Z","size":100,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-10T07:47:11.772Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trinitronx.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-16T16:39:58.000Z","updated_at":"2014-09-23T03:20:45.000Z","dependencies_parsed_at":"2022-09-08T05:50:13.454Z","dependency_job_id":null,"html_url":"https://github.com/trinitronx/tar-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trinitronx%2Ftar-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trinitronx%2Ftar-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trinitronx%2Ftar-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trinitronx%2Ftar-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trinitronx","download_url":"https://codeload.github.com/trinitronx/tar-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240993952,"owners_count":19890419,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T18:33:16.920Z","updated_at":"2025-02-27T07:51:13.840Z","avatar_url":"https://github.com/trinitronx.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"Tar extraction problem\n======================\n\nOverview\n--------\n\nWhen extracting different types of tar archives into a target directory,\nwe ran into troubles depending on the version of Bash that we were using.\nIn particular, these were the target platforms to support:\n\n\t$ lsb_release -a\n\tLSB Version:\t:core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch\n\tDistributor ID:\tCentOS\n\tDescription:\tCentOS release 5.7 (Final)\n\tRelease:\t5.7\n\tCodename:\tFinal\n\t\n\t$ bash --version\n    GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)\n    Copyright (C) 2005 Free Software Foundation, Inc.\n\n    ### AND...\n\t$ lsb_release -a\n\tDistributor ID:\tUbuntu\n\tDescription:\tUbuntu 10.04.4 LTS\n\tRelease:\t10.04\n\tCodename:\tlucid\n\t\n    $ bash --version\n\tGNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)\n\tCopyright (C) 2009 Free Software Foundation, Inc.\n\tLicense GPLv3+: GNU GPL version 3 or later \u003chttp://gnu.org/licenses/gpl.html\u003e\n\n\nThe problem: \n------------\n\nExtract an archive into a target directory (ie: htdocs)\nwith the following constraints:\n\n - Extract directly into the target dir while overwriting files\n - Extract only a selected directory from the archive while supporting:\n   - Single top-level directory\n   - \"tar-bombs\" (archives with no top-level dir)\n   - Archives where target files reside in multiple top-level dirs\n     - with spaces OR\n\t - without spaces\n   - Archives where selected directory can be selected by wildcards\n - Extraction must work on both target versions of Bash (above)\n\nThe main issue is that most solutions for 'multiple dirs with spaces'\nand the 'tar-bomb' style (dir-to-extract=NULL) are mutually exclusive \nwith one another across Bash versions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrinitronx%2Ftar-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrinitronx%2Ftar-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrinitronx%2Ftar-test/lists"}