On Thu, Oct 8, 2020 at 12:43 AM Paolo Bonzini <
pbonzini@redhat.com> wrote:
>
> On 07/10/20 18:23, 罗勇刚(Yonggang Luo) wrote:
> >> + if not pkgversion and os.path.exists('.git'):
> >> + # The quote of v* should preserve, otherwise git command
> > would fail
> >> + pc = subprocess.run(['git', 'describe', '--match', "'v*'",
> > '--dirty', '--always'],
> >> + stdout=subprocess.PIPE,
> > stderr=subprocess.DEVNULL, encoding='utf8')
>
> It's a total mess.
>
> On Linux, if you use 'v*' git is invoked with an argument that looks
> like 'v*', that is as if you used \'v\*\' on bash.
>
> On Windows, wildcard expansion is done by the program so you need to
> pass a quoted value to stop the wildcard expansion.
>
> I have no idea how to fix it. Probably it can be made to work using a
> string argument and "shell=True", but at this point it makes more sense
> to keep the shell script version.
Even though the shell script version are work, but it's not working in good shape, when I running
the shell script, it's executed very slow, and so with python shell=True, I guess it's because
the v* character cause the program doing a lot IO operation. So i still think
'--match=v*' is a better solution, filename with --match=v123 are rare, even sart with -- are rare.
so this is acceptable, and also I've creating a pull request on python to resolve this issue completely