Quantisan / docker-clojure

Official Docker image for Clojure
https://hub.docker.com/_/clojure/
MIT License
204 stars 34 forks source link

rlwrap deletes earlier prompts #170

Closed rap1ds closed 2 years ago

rap1ds commented 2 years ago

Steps to reproduce:

  1. Run "clojure:openjdk-11-tools-deps" container and type something to the REPL, like number 1.

Actual output:

$ docker run --rm -it clojure:openjdk-11-tools-deps
root@900e64a8edb9:/tmp# clj
Clojure 1.11.1
1
1
user=>

Expected:

$ docker run --rm -it clojure:openjdk-11-tools-deps
root@900e64a8edb9:/tmp# clj
Clojure 1.11.1
user=> 1
1
user=>

Background:

This is an issue with rlwrap 0.43 and a newer bash version. The issue is not present with the older distro version (and thus older bash version), e.g. clojure:openjdk-11-tools-deps-buster seems to work fine.

rlwrap 0.44 fixes the issue; see the changelog: https://github.com/hanslub42/rlwrap/releases/tag/0.44

The bug is also discussed in this Reddit thread: https://www.reddit.com/r/bash/comments/khwdq5/rlwrap_no_longer_work_as_intended/

cap10morgan commented 2 years ago

The openjdk variants are deprecated and will not be supported moving forward. We recommend migrating to the new temurin variants.

cap10morgan commented 2 years ago

However, it does appear that the current temurin-11-tools-deps image does exhibit this behavior. I think we'll have to wait for the new version to trickle down from upstream image updates, though. So you may want to open an issue there (i.e. with the official temurin docker image maintainers) if you'd like to expedite this.

rap1ds commented 2 years ago

Yes, this issue seems to be present with temurin as well.

I think we'll have to wait for the new version to trickle down from upstream image updates, though.

If I understand correctly, rlwrap is not coming from the temurin image, but is installed by tools-deps image.

As mentioned, rlwrap 0.44 fixes this for me. However, it seems that 0.44 is not yet available with apt-get. Maybe indeed the best thing to do is just wait until it gets there.

For those who are eager to get this working right now, I'll share my workaround which is to download and compile newest rlwrap version:

RUN apt-get remove -y rlwrap \
    && apt-get install -y curl autoconf libreadline-dev \
    && curl -L https://github.com/hanslub42/rlwrap/releases/download/v0.45.2/rlwrap-0.45.2.tar.gz -o rlwrap-0.45.2.tar.gz \
    && echo "9f8870deb46e473d21b5db89d709b6497f4ef9fa06d44eebc5f821daa00c8eca rlwrap-0.45.2.tar.gz" | sha256sum -c - \
    && tar -xzf rlwrap-0.45.2.tar.gz \
    && cd rlwrap-0.45.2 \
    && ./configure \
    && make \
    && make install \
    && rlwrap --version \
    && cd ..
cap10morgan commented 2 years ago

If I understand correctly, rlwrap is not coming from the temurin image, but is installed by tools-deps image.

As mentioned, rlwrap 0.44 fixes this for me. However, it seems that 0.44 is not yet available with apt-get. Maybe indeed the best thing to do is just wait until it gets there.

Yeah, this is what I mean. rlwrap comes from the upstream image in the sense that they provide a certain set of installable packages and we install from that set. Once they start providing a newer version of rlwrap upstream, we'll get it on the next rebuild (which Docker Hub does automatically for downstream images when upstreams change).