Skip to content

Commit

Permalink
Don't use broken BusyBox less as default pager.
Browse files Browse the repository at this point in the history
Fixes #778

This is the flavor of less that ships by default in Alpine Linux. We're detecting it by checking whether `less` is a symlink that includes `busybox` in the path. There may be false negatives, but shouldn't be (m)any false positives?

This default can be overridden by explicitly setting less as the pager via PsySH config, if you really want to, but you probably don't. Install proper `less` instead :)
  • Loading branch information
bobthecow committed Mar 16, 2024
1 parent 39621c7 commit 9ebb102
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Configuration.php
Expand Up @@ -1253,6 +1253,16 @@ public function getPager()
$this->pager = $pager;
} elseif ($less = $this->configPaths->which('less')) {
// check for the presence of less...

// n.b. The busybox less implementation is a bit broken, so
// let's not use it by default.
//
// See https://github.com/bobthecow/psysh/issues/778
$link = @\readlink($less);
if ($link !== false && \strpos($link, 'busybox') !== false) {
return false;
}

$this->pager = $less.' -R -F -X';
}
}
Expand Down

0 comments on commit 9ebb102

Please sign in to comment.