distrobox icon indicating copy to clipboard operation
distrobox copied to clipboard

[Error] assemble does not work with hyphenated container names as expected

Open askoa opened this issue 1 year ago • 1 comments

Describe the bug distrobox-assemble uses grep -qw to check if the container already exist.

https://github.com/89luca89/distrobox/blob/4c38d6b3f9bc833e58a435471158935824727805/distrobox-assemble#L328

According to the grep manual page, the option -w does not consider hyphens to be "Word-constituent characters"

       -w, --word-regexp
              Select only those lines containing matches that form whole
              words.  The test is that the matching substring must
              either be at the beginning of the line, or preceded by a
              non-word constituent character.  Similarly, it must be
              either at the end of the line or followed by a non-word
              constituent character.  Word-constituent characters are
              letters, digits, and the underscore.  This option has no
              effect if -x is also specified.

When there is a container named prototype-dev and if the user is attempting to create a container named dev using command distrobox assemble create --name dev --file <file>, the user will get an error message container dev already exist which is wrong.

To Reproduce

  1. Create a distrobox container named prototype-dev
  2. Attempt to create a container named dev by running distrobox assemble create --name dev --file <file>

Expected behavior distrobox assemble should create the container named dev.

Logs

 - Creating dev...
dev already exists

Desktop (please complete the following information):

  • Are you using podman, docker or lilipod? podman
  • Which version or podman, docker or lilipod? podman version 5.1.2
  • Which version of distrobox? distrobox: 1.7.2.1
  • Which host distribution? Fedora silverblue
  • How did you install distrobox? wget -qO- https://raw.githubusercontent.com/89luca89/distrobox/main/install | sh -s -- --prefix ~/.local

Edit: Changed the name from dev-prototype to prototype-dev

askoa avatar Aug 05 '24 23:08 askoa

I was also affected by this. Nice write-up of the situation.

evan-goode avatar Sep 24 '24 18:09 evan-goode