containers / podman

Podman: A tool for managing OCI containers and pods.
https://podman.io
Apache License 2.0
23.25k stars 2.37k forks source link

Incorrect output of `podman search` if image description contains CJK Characters #10497

Closed 1sixth closed 3 years ago

1sixth commented 3 years ago

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

  1. podman search sometimes prints if the image description contains CJK characters.

  2. Columns after DESCRIPTION don't line up properly if the image description contains CJK characters.

Steps to reproduce the issue:

Run podman search docker.io/qbittorrent or podman search docker.io/qbittorrent --no-trunc.

Describe the results you received:

  1. Output of podman search docker.io/qbittorrent:
INDEX      NAME                                           DESCRIPTION                                      STARS   OFFICIAL  AUTOMATED
docker.io  docker.io/linuxserver/qbittorrent              A Qbittorrent container, brought to you by L...  495               
docker.io  docker.io/markusmcnugen/qbittorrentvpn         Headless qBittorrent client with WebUI and o...  65                [OK]
docker.io  docker.io/gists/qbittorrent                    [unofficial] qBittorrent-NoX torrent client ...  24                
docker.io  docker.io/wernight/qbittorrent                 Lightweight qBittorrent-NoX (i.e. headless) ...  49                [OK]
docker.io  docker.io/johngong/qbittorrent                 qBittorrent:4.3.5,qBittorrent-EE:4.3.5.10,�...  74                [OK]
docker.io  docker.io/crazymax/qbittorrent                 qBittorrent Docker image based on Alpine Lin...  4                 
docker.io  docker.io/superng6/qbittorrentee               [全平台 x86-64、arm64、arm32] qBittorre...            43                
docker.io  docker.io/p3terx/qbittorrent                   qBittorrent Enhanced Edition                     9                 
docker.io  docker.io/superng6/qbittorrent                 [全平台 x86-64、arm64、arm32 ] qBittorr...            19                
docker.io  docker.io/lsioarmhf/qbittorrent                ARMHF based Linuxserver.io image of qbittorr...  6                 
docker.io  docker.io/hotio/qbittorrent                    Visit https://hotio.dev/containers/qbittorre...  3                 
docker.io  docker.io/guillaumedsde/qbittorrent-openvpn    Docker container running qBittorrent torrent...  4                 
docker.io  docker.io/mace/qbittorrent                     qBittorrent build from source                    7                 [OK]
docker.io  docker.io/jarylc/qbittorrent                   qBittorrent-nox specially built with latest ...  0                 
docker.io  docker.io/ghostserverd/qbittorrent-filebot     Install filebot alongside qBittorrent, and c...  2                 [OK]
docker.io  docker.io/hayduck/qbittorrent-openvpn          qBittorrent running in an openvpn stolen fro...  4                 [OK]
docker.io  docker.io/emmercm/qbittorrent                  Headless qBittorrent client with remote web ...  2                 
docker.io  docker.io/80x86/qbittorrent                    [v4.3.0 build on 2020-10-22] amd64/arm64(aar...  134               
docker.io  docker.io/rabbired/qbittorrent                 qBittorrent + autoremove-torrents + FlexGet      5                 
docker.io  docker.io/p3terx/qbittorrent-enhanced          qBittorrent Enhanced Edition                     4                 
docker.io  docker.io/martokk/qbittorrent-influxdb-export  qbittorrent-influxdb-export                      0                 [OK]
docker.io  docker.io/lsioarmhf/qbittorrent-aarch64        ARM64 based Linuxserver.io image of qbittorr...  3                 
docker.io  docker.io/ghostserverd/qbittorrent             Config wrapper around linuxserver/qbittorren...  1                 [OK]
docker.io  docker.io/linedpaper/qbittorrent               qbittorrent                                      0                 [OK]
docker.io  docker.io/chchia/qbittorrent-synology          for testing try at your own risk, work with ...  2                 
  1. Output of podman search docker.io/qbittorrent --no-trunc:
INDEX      NAME                                           DESCRIPTION                                                                                           STARS   OFFICIAL  AUTOMATED
docker.io  docker.io/linuxserver/qbittorrent              A Qbittorrent container, brought to you by LinuxServer.io.                                            495               
docker.io  docker.io/markusmcnugen/qbittorrentvpn         Headless qBittorrent client with WebUI and optional OpenVPN connection                                65                [OK]
docker.io  docker.io/gists/qbittorrent                    [unofficial] qBittorrent-NoX torrent client based on alpine                                           24                
docker.io  docker.io/wernight/qbittorrent                 Lightweight qBittorrent-NoX (i.e. headless) torrent client and one of the most feature complete       49                [OK]
docker.io  docker.io/johngong/qbittorrent                 qBittorrent:4.3.5,qBittorrent-EE:4.3.5.10,集成Trackers更新                                                74                [OK]
docker.io  docker.io/crazymax/qbittorrent                 qBittorrent Docker image based on Alpine Linux                                                        4                 
docker.io  docker.io/superng6/qbittorrentee               [全平台 x86-64、arm64、arm32] qBittorrent增强版,防吸血                                                           43                
docker.io  docker.io/superng6/qbittorrent                 [全平台 x86-64、arm64、arm32 ] qBittorrent 中国优化版                                                           19                
docker.io  docker.io/p3terx/qbittorrent                   qBittorrent Enhanced Edition                                                                          9                 
docker.io  docker.io/lsioarmhf/qbittorrent                ARMHF based Linuxserver.io image of qbittorrent                                                       6                 
docker.io  docker.io/hotio/qbittorrent                    Visit https://hotio.dev/containers/qbittorrent for more information.                                  3                 
docker.io  docker.io/guillaumedsde/qbittorrent-openvpn    Docker container running qBittorrent torrent client with WebUI over an OpenVPN tunnel                 4                 
docker.io  docker.io/mace/qbittorrent                     qBittorrent build from source                                                                         7                 [OK]
docker.io  docker.io/jarylc/qbittorrent                   qBittorrent-nox specially built with latest libtorrent on Alpine Linux (optimized gists/qbittorrent)  0                 
docker.io  docker.io/ghostserverd/qbittorrent-filebot     Install filebot alongside qBittorrent, and configure it to use filebot to handle completed downloads  2                 [OK]
docker.io  docker.io/emmercm/qbittorrent                  Headless qBittorrent client with remote web interface.                                                2                 
docker.io  docker.io/hayduck/qbittorrent-openvpn          qBittorrent running in an openvpn stolen from https://hub.docker.com/r/haugene/transmission-openvpn/  4                 [OK]
docker.io  docker.io/rabbired/qbittorrent                 qBittorrent + autoremove-torrents + FlexGet                                                           5                 
docker.io  docker.io/80x86/qbittorrent                    [v4.3.0 build on 2020-10-22] amd64/arm64(aarch64) / auto https(ACME) / categorization / Log viewer    134               
docker.io  docker.io/p3terx/qbittorrent-enhanced          qBittorrent Enhanced Edition                                                                          4                 
docker.io  docker.io/lsioarmhf/qbittorrent-aarch64        ARM64 based Linuxserver.io image of qbittorrent                                                       3                 
docker.io  docker.io/martokk/qbittorrent-influxdb-export  qbittorrent-influxdb-export                                                                           0                 [OK]
docker.io  docker.io/ghostserverd/qbittorrent             Config wrapper around linuxserver/qbittorrent                                                         1                 [OK]
docker.io  docker.io/linedpaper/qbittorrent               qbittorrent                                                                                           0                 [OK]
docker.io  docker.io/chchia/qbittorrent-synology          for testing try at your own risk, work with PT qBittorrent Master Branch 4.4 alpha Libtorrent 2.0.1   2                 
  1. In contrast, this is the output of podman search docker.io/debian:
INDEX      NAME                                                        DESCRIPTION                                      STARS   OFFICIAL  AUTOMATED
docker.io  docker.io/library/debian                                    Debian is a Linux distribution that's compos...  3863    [OK]      
docker.io  docker.io/smartentry/debian                                 debian with smartentry                           5                 [OK]
docker.io  docker.io/library/ubuntu                                    Ubuntu is a Debian-based Linux operating sys...  12302   [OK]      
docker.io  docker.io/samueldebruyn/debian-git                          a minimal docker container with debian and g...  22                [OK]
docker.io  docker.io/i386/debian                                       Debian is a Linux distribution that's compos...  14                
docker.io  docker.io/itscaro/debian-ssh                                debian:jessie                                    28                [OK]
docker.io  docker.io/jdub/debian-sources-resource                      Concourse CI resource to check for updated D...  0                 [OK]
docker.io  docker.io/arm32v7/debian                                    Debian is a Linux distribution that's compos...  72                
docker.io  docker.io/eboraas/debian                                    Debian base images, for all currently-availa...  8                 [OK]
docker.io  docker.io/amd64/debian                                      Debian is a Linux distribution that's compos...  6                 
docker.io  docker.io/arm64v8/debian                                    Debian is a Linux distribution that's compos...  26                
docker.io  docker.io/holgerimbery/debian                               debian multiarch docker base image               1                 
docker.io  docker.io/dockershelf/debian                                Repository for docker images of Debian. Test...  1                 [OK]
docker.io  docker.io/ppc64le/debian                                    Debian is a Linux distribution that's compos...  4                 
docker.io  docker.io/s390x/debian                                      Debian is a Linux distribution that's compos...  2                 
docker.io  docker.io/vicamo/debian                                     Debian docker images for all versions/archit...  3                 
docker.io  docker.io/vpgrp/debian                                      Docker images of Debian.                         2                 
docker.io  docker.io/multiarch/debian-debootstrap                      multiarch ports of debian-debootstrap            13                
docker.io  docker.io/arm32v5/debian                                    Debian is a Linux distribution that's compos...  2                 
docker.io  docker.io/spritsail/debian-builder                          A Docker image based on debian:slim ideal fo...  1                 [OK]
docker.io  docker.io/fleshgrinder/debian                               Debian base images for production and multis...  0                 [OK]
docker.io  docker.io/mdoerges/debian-buster-nginx                      Debian Buster with Nginx                         0                 
docker.io  docker.io/1and1internet/debian-9-nginx-php-7.2-wordpress-4  debian-9-nginx-php-7.2-wordpress-4               0                 [OK]
docker.io  docker.io/mdoerges/debian-buster-php73                      Debian Buster with PHP 7.3                       0                 
docker.io  docker.io/jelastic/debianvps                                An image of the Debian Elastic VPS maintaine...  0                 

You can see that everything works as expected if the image description is ASCII-only.

Describe the results you expected:

I expect no printed (unless some image author delibrately puts it in the description), and columns after DESCRIPTION should line up properly.

Additional information you deem important (e.g. issue happens only occasionally):

I use alacritty/0.8.0 as my terminal emulator. Everything mentioned above happens even when I pass --config-file /dev/null to alacritty.

If you want to test Japanese characters, try podman search docker.io/japanese-nlp.

Output of podman version:

Version:      3.1.2
API Version:  3.1.2
Go Version:   go1.16.4
Git Commit:   51b8ddbc22cf5b10dd76dd9243924aa66ad7db39
Built:        Sun May 23 05:22:34 2021
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.20.1
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.0.28-1
    path: /usr/bin/conmon
    version: 'conmon version 2.0.28, commit: 6b18f7e0f2e4cd7f7b016b88141e82210d370008'
  cpus: 16
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: toy
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 5.12.7-zen1-1-zen
  linkmode: dynamic
  memFree: 775979008
  memTotal: 16164188160
  ociRuntime:
    name: runc
    package: /usr/bin/runc is owned by runc 1.0.0rc95-1
    path: /usr/bin/runc
    version: |-
      runc version 1.0.0-rc95
      commit: b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
      spec: 1.0.2-dev
      go: go1.16.4
      libseccomp: 2.5.1
  os: linux
  remoteSocket:
    path: /run/user/1000/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    selinuxEnabled: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.10-1
    version: |-
      slirp4netns version 1.1.10
      commit: baa2bc5ff12fe6db646c1f4f3f966526c0eba5a0
      libslirp: 4.5.0
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.1
  swapFree: 0
  swapTotal: 0
  uptime: 22h 55m 28.24s (Approximately 0.92 days)
registries: {}
store:
  configFile: /home/one6th/.config/containers/storage.conf
  containerStore:
    number: 1
    paused: 0
    running: 1
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/one6th/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 7
  runRoot: /run/user/1000/containers
  volumePath: /home/one6th/.local/share/containers/storage/volumes
version:
  APIVersion: 3.1.2
  Built: 1621718554
  BuiltTime: Sun May 23 05:22:34 2021
  GitCommit: 51b8ddbc22cf5b10dd76dd9243924aa66ad7db39
  GoVersion: go1.16.4
  OsArch: linux/amd64
  Version: 3.1.2

Package info (e.g. output of rpm -q podman or apt list podman):

Name            : podman
Version         : 3.1.2-2
Description     : Tool and library for running OCI-based containers in pods
Architecture    : x86_64
URL             : https://github.com/containers/libpod
Licenses        : Apache
Groups          : None
Provides        : None
Depends On      : cni-plugins  conmon  containers-common  device-mapper  iptables  libseccomp  runc  slirp4netns  libsystemd  fuse-overlayfs  libgpgme.so=11-64
Optional Deps   : podman-docker: for Docker-compatible CLI
                  btrfs-progs: support btrfs backend devices [installed]
                  catatonit: --init flag support
                  crun: support for unified cgroupsv2
Required By     : podman-compose
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 72.52 MiB
Packager        : Morten Linderud <foxboron@archlinux.org>
Build Date      : Sun 23 May 2021 05:22:34 AM CST
Install Date    : Sat 29 May 2021 12:01:55 PM CST
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)

Yes.

Additional environment details (AWS, VirtualBox, physical, etc.):

vrothberg commented 3 years ago

Thanks for reaching out!

I will have a look what we can do. Docker has the same issue. The underlying problem is that we're counting characters which are not equally wide in this case.

vrothberg commented 3 years ago

The � issue looks like a terminal issue rather than a Podman issue.

vrothberg commented 3 years ago

Regarding the correct alignment of the table, I fear that this will be hard. Even the tabwriter package [1] assumes that all characters have the same width.

[1] https://golang.org/pkg/text/tabwriter/

1sixth commented 3 years ago

The � issue looks like a terminal issue rather than a Podman issue.

You are right. I just tried kitty/0.20.3 and no gets printed.

vrothberg commented 3 years ago

Thanks for checking, @1sixth!

I fear that there's nothing much Podman can do for the table formatting. It's based on the assumption that all characters have an equal width (same for the Go standard library).