devops-works / binenv

One binary to rule them all. Manage all those pesky binaries (kubectl, helm, terraform, ...) easily.
MIT License
372 stars 44 forks source link

"Cannot open self" error with docker-compose #55

Closed rskuipers closed 3 years ago

rskuipers commented 3 years ago

After installing docker-compose, I can't run it even though accessing the binary directly works fine.

$ binenv install docker-compose
2020-12-03T13:51:28+01:00 WRN version for "docker-compose" not specified; using "1.27.4"
fetching docker-compose version 1.27.4 100% |███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| (12/12 MB, 5.462 MB/s)        
2020-12-03T13:51:31+01:00 INF "docker-compose" (1.27.4) installed
$ docker-compose up
[56249] Cannot open self /home/rick/.binenv/docker-compose or archive /home/rick/.binenv/docker-compose.pkg
leucos commented 3 years ago

Hello @rskuipers ; sorry to here you ran into an issue.

Are you on bash/linux ?

Do you have this issue only with docker-compose ?

Can you type docker-compose to see where it points to and run hash -r so bash rehashes it's binary cache ?

rskuipers commented 3 years ago

I'm on ZSH.

$ type docker-compose
docker-compose is /home/rick/.binenv/docker-compose

hash -r unfortunately didn't do anything

leucos commented 3 years ago

yes it is rehash on zsh.

did you try installing anything else with binenv ?

rskuipers commented 3 years ago

Yep, helm and kubectl work perfectly :-)

rehash also didn't do anything.

leucos commented 3 years ago

Must admit I never tried docker-compose since I have it on my system by default. I will try to reproduce this asap (a bit busy right now)

rskuipers commented 3 years ago

@leucos All good, I appreciate your work :-)

leucos commented 3 years ago

@rskuipers I guess this wont work with docker-compose. It seems to be some python-packaged executable. From the strace I see, it re-opens itself, seeks the file and does some magic.

openat(AT_FDCWD, "/usr/bin/docker-compose", O_RDONLY) = 3
fcntl(3, F_GETFD)                       = 0
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
fstat(3, {st_mode=S_IFREG|0755, st_size=420, ...}) = 0
ioctl(3, TCGETS, 0x7ffc80e89770)        = -1 ENOTTY (Ioctl() inapproprié pour un périphérique)
lseek(3, 0, SEEK_CUR)                   = 0
fstat(3, {st_mode=S_IFREG|0755, st_size=420, ...}) = 0
read(3, "#!/usr/bin/python3\n# EASY-INSTAL"..., 4096) = 420
lseek(3, 0, SEEK_SET)                   = 0
read(3, "#!/usr/bin/python3\n# EASY-INSTAL"..., 4096) = 420
read(3, "", 4096) 

So unfortunately, I am afraid that we doomed for docker-compose :disappointed: Sorry for misleading you (and for not properly testing this in the first place). We will remove it from distributions now.

You can restore usage of you already-installed docker-compose like so (replace hash -r by rehash in your case):

$ docker-compose 
[1688266] Cannot open self /home/leucos/.binenv/docker-compose or archive /home/leucos/.binenv/docker-compose.pkg
$ binenv uninstall docker-compose 
WARNING: this will remove *ALL* versions for "docker-compose". Type "docker-compose" to confirm [oh now I changed my mind]: docker-compose
2020-12-03T21:00:40+01:00 WRN removed version "1.27.4" for "docker-compose"
$ hash -r
$ docker-compose -v
docker-compose version 1.21.0, build unknown
rskuipers commented 3 years ago

@leucos That's alright!

Thank you for your work and time.