Skip to content

Parsing the "AC_ARG_WITH" parameter in the "config.m4" file will be wrong. #240

@nick322

Description

@nick322
pickle install gnupg

After the program is executed, pickle will parse the gpg package config.m4

Log:

 ~$ pickle install gnupg
  - Installing gnupg (latest-stable): Downloading (100%)
+-----------------------------------+--------+
| Package name                      | gnupg  |
| Package version (current release) | 1.5.0  |
| Package status                    | stable |
+-----------------------------------+--------+
AS_HELP_STRING([--with-gpg (default: ):
The following error(s) happened: configure failed, see log at /var/folders/6h/qhrmc0wx0cng0kdbvqs_p_1m0000gn/T/pickle-f4a5ad04f74bfdf425e2ea448bb78834678d7c15\config.log
Would you like to read the log?
1: phpize
2: Configuring for:
2: PHP Api Version:         20200930
2: Zend Module Api No:      20200930
2: Zend Extension Api No:   420200930
2: configure.ac:18: warning: $as_echo is obsolete; use AS_ECHO(["message"]) instead
2: build/php.m4:2072: PHP_CONFIG_NICE is expanded from...
2: configure.ac:18: the top level
2: configure.ac:161: warning: The macro `AC_LANG_C' is obsolete.
2: configure.ac:161: You should run autoupdate.
2: ./lib/autoconf/c.m4:72: AC_LANG_C is expanded from...
2: build/libtool.m4:2728: _LT_AC_LANG_C_CONFIG is expanded from...
2: build/libtool.m4:2727: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
2: build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
2: build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
2: build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
2: configure.ac:161: the top level
2: configure.ac:161: warning: The macro `AC_LANG_C' is obsolete.
2: configure.ac:161: You should run autoupdate.
2: ./lib/autoconf/c.m4:72: AC_LANG_C is expanded from...
2: lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
2: lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
2: ./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
2: ./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
2: build/libtool.m4:561: _LT_AC_LOCK is expanded from...
2: build/libtool.m4:1185: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
2: build/libtool.m4:2728: _LT_AC_LANG_C_CONFIG is expanded from...
2: build/libtool.m4:2727: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
2: build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
2: build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
2: build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
2: configure.ac:161: the top level
2: configure.ac:161: warning: The macro `AC_TRY_LINK' is obsolete.
2: configure.ac:161: You should run autoupdate.
2: ./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
2: lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
2: lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
2: ./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
2: ./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
2: build/libtool.m4:561: _LT_AC_LOCK is expanded from...
2: build/libtool.m4:1185: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
2: build/libtool.m4:2728: _LT_AC_LANG_C_CONFIG is expanded from...
2: build/libtool.m4:2727: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
2: build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
2: build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
2: build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
2: configure.ac:161: the top level
2: configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
2: build/libtool.m4:1185: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
2: build/libtool.m4:2728: _LT_AC_LANG_C_CONFIG is expanded from...
2: build/libtool.m4:2727: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
2: build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
2: build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
2: build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
2: configure.ac:161: the top level
2: configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
2: build/libtool.m4:1185: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
2: build/libtool.m4:2728: _LT_AC_LANG_C_CONFIG is expanded from...
2: build/libtool.m4:2727: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
2: build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
2: build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
2: build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
2: configure.ac:161: the top level
2: configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: output file \`$ofile' does not exist
2: build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
2: build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
2: build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
2: build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
2: configure.ac:161: the top level
2: configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: output file \`$ofile' does not exist
2: build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
2: build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
2: build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
2: build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
2: configure.ac:161: the top level
2: configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: output file \`$ofile' does not look like a libtool script
2: build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
2: build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
2: build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
2: build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
2: configure.ac:161: the top level
2: configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: output file \`$ofile' does not look like a libtool script
2: build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
2: build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
2: build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
2: build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
2: configure.ac:161: the top level
2: configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'
2: build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
2: build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
2: build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
2: build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
2: configure.ac:161: the top level
2: configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'
2: build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
2: build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
2: build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
2: build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
2: configure.ac:161: the top level
2: configure.ac:161: warning: back quotes and double quotes must not be escaped in: tag name \"$tagname\" already exists
2: build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
2: build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
2: build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
2: build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
2: configure.ac:161: the top level
2: configure.ac:161: warning: The macro `AC_LANG_CPLUSPLUS' is obsolete.
2: configure.ac:161: You should run autoupdate.
2: ./lib/autoconf/c.m4:262: AC_LANG_CPLUSPLUS is expanded from...
2: build/libtool.m4:2810: _LT_AC_LANG_CXX_CONFIG is expanded from...
2: build/libtool.m4:2809: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from...
2: build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
2: build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
2: build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
2: build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
2: configure.ac:161: the top level
2: configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
2: build/libtool.m4:1185: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
2: build/libtool.m4:2810: _LT_AC_LANG_CXX_CONFIG is expanded from...
2: build/libtool.m4:2809: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from...
2: build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
2: build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
2: build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
2: build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
2: configure.ac:161: the top level
2: configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
2: build/libtool.m4:1185: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
2: build/libtool.m4:2810: _LT_AC_LANG_CXX_CONFIG is expanded from...
2: build/libtool.m4:2809: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from...
2: build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
2: build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
2: build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
2: build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
2: configure.ac:161: the top level
1: /var/folders/6h/qhrmc0wx0cng0kdbvqs_p_1m0000gn/T/gnupg/gnupg-1.5.0/configure --with-gnupg=shared  --with-gnupg --without-[gpg]
2: configure: error: invalid package name: `[gpg]'%

https://github.com/php-gnupg/php-gnupg/blob/master/config.m4#L65-L67

AC_ARG_WITH([gpg], [AS_HELP_STRING([--with-gpg],
        [path to gpg v1.x])], [], [with_gpg=no])

when it parse

protected function fetchArgAc($which, $config)
{
$next = 0;
$options = [];
$type = strpos($which, 'ENABLE') !== false ? 'enable' : 'with';
while (false !== ($s = strpos($config, $which, $next))) {
$default = true;
$s = strpos($config, '(', $s);
$e = strpos($config, ')', $s + 1);
$option = substr($config, $s + 1, $e - $s);
$default = $this->isWithOrEnable($option, $type);
[$name, $desc] = explode(',', $option);
$desc = preg_replace('/\s+/', ' ', trim($desc));
$desc = trim(substr($desc, 1, strlen($desc) - 2));
$s_a = strpos($desc, ' ');
$desc = trim(substr($desc, $s_a));
$options[$name] = (object) [
'prompt' => $desc,
'type' => $type,
'default' => $default,
];
$next = $e + 1;
}
return $options;
}

 [$name, $desc] = explode(',', $option);  //  $option ='[gpg], [AS_HELP_STRING([--with-gpg],'

the $name will be an error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions