wagoodman / dive

A tool for exploring each layer in a docker image
MIT License
44.64k stars 1.69k forks source link

Fix error on Layer section and reduce information on one line per step. #395

Closed lightsnowball closed 1 year ago

lightsnowball commented 2 years ago

When scrolling through commands in Layers section, in the case of multiline commands, the user could cause an index out of bounds error by scrolling to much. Here is an example:

dive_wrong

and Dockerfile used is as follows:

# syntax=docker/dockerfile:1.3-labs                                                                 
FROM archlinux                                                                                      

RUN <<-EOF                                                                                          
    echo "Look what they've done to my line, it's ruined! Ruined, I tell ya! Because maybe I have a wide monitor that can fit more than 50 chars so I shall not be hindered by mere mortals! 
    cd /tmp                                                                                         
    cd /                                                                                            
EOF                                                                                                 

WORKDIR /home/bajo 

It's hard to see, but when the user just presses down, at one point it panics from dive.exe. Therefore multiline is now limited to just one line, as it also seems redundant to have the same information in Layers and Layers Details sections.

patcon commented 2 years ago

Potentially related: https://github.com/wagoodman/dive/issues/328#issuecomment-949824600

I'm seeing this with my use of HEREDOC multi-line commands. Seems that the dive layer list doesn't size correctly, and scrolls "off-screen", and then crashes when scrolling too far.