Skip to content

OSX: Multiple libedit/readline fixes#585

Merged
pwpiwi merged 2 commits intoProxmark:masterfrom
micolous:osx-libedit-optimisation
Mar 21, 2018
Merged

OSX: Multiple libedit/readline fixes#585
pwpiwi merged 2 commits intoProxmark:masterfrom
micolous:osx-libedit-optimisation

Conversation

@micolous
Copy link
Contributor

@micolous micolous commented Mar 17, 2018

Extracted from PR #463, this addresses issues when using libedit's compatibility mode for readline, which is used on BSD and OSX. This patch set has been tested with Linux (using GNU readline), OSX 10.13 (using both libedit and GNU readline).

Using libedit over readline avoids needing to swap in readline over the top of system libraries (brew link --force readline), and removes the need to explicitly install readline (as libedit is included on OSX).

  1. If compiler optimisations are disabled in OSX, and the user is using libedit, then a link failure occurs, as the second if (need_hack) is no longer optimised out.

    I've got another branch where I've been attempting to get libedit to have the same functionality as GNU readline. It mostly works, but arrow keys don't work correctly after a PrintAndLog output. See: master...micolous:osx-libedit-compat

    There have been other changes to libedit recently, and in particular NetBSD PR/51518 may be enable resolving this issue properly.

  2. Reverted per @iceman1001 in Issues with after --head flash #497 Explicitly initialise readline on application start. This avoids a null pointer dereference using libedit (exposed in branch osx-libedit-compat).

  3. Adds documentation about what the need_hack actually does, and what expected behaviour is.

Test instructions (OSX):

  • To produce a libedit based build, run brew unlink readline
  • To produce a GNU readline based build, run brew link --force readline

Other platforms:

Build as normal.

@micolous micolous changed the title Multiple libedit/readline fixes OSX: Multiple libedit/readline fixes Mar 17, 2018
@pwpiwi
Copy link
Contributor

pwpiwi commented Mar 17, 2018

Promising! Looking forward to @Kaicastledine and @digitalentropy tests.

@pwpiwi pwpiwi merged commit a5a8301 into Proxmark:master Mar 21, 2018
@pwpiwi
Copy link
Contributor

pwpiwi commented Mar 22, 2018

Wouldn't it be better to have rl_initialize (and a use_history()) outside the whike(1) loop, I.e. in front of the read_history () ?

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

Successfully merging this pull request may close these issues.

2 participants