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

Cannot find a valid box with a VMX file in tar archive #76

Open
ghost opened this issue Mar 29, 2021 · 5 comments
Open

Cannot find a valid box with a VMX file in tar archive #76

ghost opened this issue Mar 29, 2021 · 5 comments

Comments

@ghost
Copy link

ghost commented Mar 29, 2021

using vmware-workstation 16
debian 10(buster)
kernel 4.19
mech 0.7.6

whatever box i am trying to use, i am getting same error:

tar: Pattern matching characters used in file names
tar: Use --wildcards to enable pattern matching, or --no-wildcards to suppress this warning
tar: *.vmx: Not found in archive
tar: Exiting with failure status due to previous errors
Cannot find a valid box with a VMX file in it
@arizvisa
Copy link

when adding, or init'ing? gnu tar is only used in two places at https://github.com/mechboxes/mech/blob/v0.7.6/mech/utils.py#L422, so it'd have to be that the --wildcards parameter isn't being passed to it correctly.

@ghost
Copy link
Author

ghost commented Apr 6, 2021

when initing - i tried manually downloading the file and using it, nothing helps

@ghost
Copy link
Author

ghost commented Apr 6, 2021

there is an issue with debian gnu tar : if you place --wildcards after -tf option, it can not find anything gives error :

tar -tf --wildcards  vmware_desktop.box  "*.vmx"
tar: --wildcards: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

bit if you reverse it :

tar --wildcards -tf  vmware_desktop.box  "*.vmx"
       centos-7-1-1.x86_64.vmx

@ghost
Copy link
Author

ghost commented Apr 6, 2021

I was able to hack it by editing this function:

def tar_cmd(*args, **kwargs):
    try:
        proc = subprocess.Popen(['tar', '--help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    except OSError:
        return None
    if proc.returncode:
        return None
    stdoutdata, stderrdata = map(b2s, proc.communicate())
    tar = ['tar', '--wildcards']
    if kwargs.get('wildcards') and re.search(r'\b--wildcards\b', stdoutdata):
        tar.append('--wildcards')
    if kwargs.get('fast_read') and sys.platform.startswith('darwin'):
        tar.append('--fast-read')
    tar.extend(args)
    return tar

i just added --wildcard into tar list and seems to work but it is not by a long shot the direct answer

@ghost ghost closed this as completed Apr 21, 2021
@ColdHeat
Copy link
Collaborator

If you figure out an appropriate solution here a PR would be welcome!

@ColdHeat ColdHeat reopened this Apr 21, 2021
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

2 participants