[FFmpeg-devel] [PATCH] configure: Include quotes around pkg_version
Alexander Strasser
eclipse7 at gmx.net
Sat Dec 28 13:56:06 EET 2024
Hi Leo and Joe!
On 2024-12-27 08:13 -0500, Leo Izen wrote:
> On 12/26/24 6:12 PM, J Shiff wrote:
> > On Wed, Dec 25, 2024 at 5:03 PM Alexander Strasser via ffmpeg-devel
> > <ffmpeg-devel at ffmpeg.org> wrote:
> > >
> > > On 2024-12-21 19:29 -0500, J Shiff wrote:
> > > > On Sat, Dec 21, 2024 at 5:44 PM Alexander Strasser via ffmpeg-devel
> > > > <ffmpeg-devel at ffmpeg.org> wrote:
> > > > >
> > > > > On 2024-12-16 16:19 -0500, Joe Schiffler wrote:
> > > > > > Since $pkg_version includes spaces, builds can fail in some MSYS environments.
> > > > >
> > > > > Could you show what the pkg_version with spaces was in your case?
> > > >
> > > > The value of pkg_version would be: `aom >= 2.0.0`
> > >
> > > Ok, thanks for coming back to this!
> > >
> > > What is still strange about it: What changed and where?
> > >
> > > These values for pkg_version should come up on every platform
> > > and AFAICT it works just fine for me and many others.
> > >
> > > Didn't spot any relevant changes in ffmpeg configure on a quick
> > > look.
> > >
> > > Would be better to understand why it fails only in some
> > > environments and not others.
> >
> > Thank you for showing interest in this topic.
> >
> > Yeah, I also find it strange.
> > If you have any recommendations for narrowing it down further, I'm
> > open to suggestions.
> >
>
> I did a bit of testing and I believe the issue is >=, specifically, it's
> being interpreted as a redirect-out to a file named "=". pkg-config works on
> my system if I run `pkg-config --libs 'aom >= 2.0'` but also it works if I
> run `pkg-config --libs aom '>=' 2.0` but if I don't quote the redirect, the
> shell expands it.
>
> I could not say why MSYS appears to be interpreting the redirect differently
> when expanding the variable, but if I had to guess, it may be a bug in its
> path-mangling (i.e. converting /foo/bar to C:\foo\bar) where it's
> interpreting "=" as a filename. I could not say for certain if this is the
> case.
Leo's theory seems to provide a plausible explanation of the behavior.
According to POSIX[1] the high level algo goes like this:
4. For each word within a command, the shell processes <backslash>-escape
sequences inside dollar-single-quotes (see 2.2.4 Dollar-Single-Quotes)
and then performs various word expansions (see 2.6 Word Expansions).
In the case of a simple command, the results usually include a list of
pathnames and fields to be treated as a command name and arguments;
see 2.9 Shell Commands.
5. The shell performs redirection (see 2.7 Redirection) and removes redirection
operators and their operands from the parameter list.
To my understanding word expansions in step 4 should quote results
and thus >= shouldn't have an effect like it seems it now has on MSYS.
Presumably that is caused by the suspected MSYS path mangling mechanisms.
> In either case, I don't see issue with quoting it as that works on every
> system.
I would like to look a bit more into this. Especially what is
documented for pkg-config regarding its argument syntax.
If it's accepting the single argument syntax since a long time,
than I see no harm in including your patch Joe and would push
it soon'ish.
Alexander
1. https://pubs.opengroup.org/onlinepubs/9799919799/
More information about the ffmpeg-devel
mailing list