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

Fix readline integration #13184

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Fix readline integration #13184

wants to merge 4 commits into from

Conversation

petk
Copy link
Member

@petk petk commented Jan 17, 2024

This removes the GNU readline library integration on *nix systems and relies on only libedit library. Issue is that there are several ext/readline libraries and GNU Readline library (licenced under the GNU GPL 3) is not compatible with PHP license. In reality this means that as soon as you build PHP with Readline library linked you shouldn't distribute PHP, which makes it unusable. There was a similar attempt to fix this (#3823) and now fix continues here.

Changes:

  • --with-libedit configure option removed (only --with-readline stays)
  • PHP constant READLINE_LIB removed
  • Test file names synced with redundant libedit prefix or suffix removed

Fixes:

  • This also fixes the phpdbg readline integration on *nix systems (using libedit library) for history (up/down keys and similar nice features). Previously there was a build error if the --with-readline or --with-libedit option wasn't added:

    ./configure --enable-phpdbg-readline
    make
    
    undefined reference to 'readline'
    undefined reference to 'add_history'
    

Other patches pending that further improve the libedit integration in PHP:

Post pull requests fixes and adjustments:

@petk petk marked this pull request as draft January 17, 2024 23:33
@petk petk changed the title Remove configure option --enable-phpdbg-readline Fix phpdbg readline integration Jan 18, 2024
@petk petk changed the title Fix phpdbg readline integration Fix readline integration Jan 19, 2024
@devnexen
Copy link
Member

If you want to remove readline support, we then no longer need their unit tests wdyt ?

@petk
Copy link
Member Author

petk commented Jul 29, 2024

If you want to remove readline support, we then no longer need their unit tests wdyt ?

Yes. The readline library specific tests can be then removed here.

@remicollet
Copy link
Member

Waiting for this, see PR #15194

petk added a commit to petk/php-src that referenced this pull request Aug 9, 2024
PHP_READLINE, PHP_LIBEDIT, and PHP_READLINE_LIBS variables are not
available in sapi before the extensions arguments get processed by the
configure script. But the Autoconf raw default variables with_readline
and with_libedit are. This checks if readline support can be enabled in
phpdbg

This is partial fix towards the more proper phpGH-13184 or similar in the
future to make phpdbg readline integration easier to use.

Previous check silently enabled the phpdbg readline integration when
readline is built as shared and failed on the make step:

    undefined reference to 'readline'
    undefined reference to 'add_history'

These cases enable it:
    ./configure --enable-phpdbg-readline --with-libedit
    ./configure --enable-phpdbg-readline --with-readline
These cases don't enable it:
    ./configure --enable-phpdbg-readline
    ./configure --enable-phpdbg-readline --with-libedit=shared
    ./configure --enable-phpdbg-readline --with-readline=shared
@petk petk force-pushed the patch-phpdbg-readline branch from 1b7e3cb to 5b671b6 Compare September 13, 2024 18:21
@petk petk marked this pull request as ready for review September 13, 2024 18:22
@petk
Copy link
Member Author

petk commented Sep 13, 2024

I'm wondering if we should just merge this for PHP 8.4 or wait for PHP 9 here. It is non-functional to have some library available for linking and it can't be used for distribution etc.

This removes the GNU Readline library integration and relies on the
libedit library if present. Issue is that there are several ext/readline
libraries and GNU Readline license (GNU GPL 3) is not compatible with
the PHP license. There was a similar attempt to fix this (phpGH-3823) and
now fix continues here.

Changes:
- `--with-libedit` configure option removed (only `--with-readline`
  stays)
- readline extension tests fixed: those required by only readline
  library removed, added missing skip reasons, some functions are always
  available, etc.
- New PHP_SETUP_EDIT Autoconf macro that finds libedit

This also fixes the phpdbg readline integration on *nix systems (using
libedit library) for history (up/down keys and similar nice features) to
not produce compile errors:

    ./configure --enable-phpdbg-readline
    make

    undefined reference to 'readline'
    undefined reference to 'add_history'
@petk petk force-pushed the patch-phpdbg-readline branch from 8e6e98c to 38c9f89 Compare September 14, 2024 13:48
@petk petk linked an issue Sep 14, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GNU Readline should be replaced with libedit
3 participants