Open eroussy opened 1 year ago
This has two impacts, the first is the username is used for docker image naming (eg. cqfd_username_orgname_projectname), the second is it's passed within the Linux container for user environment cloning.
For naming the docker image, I see two approaches,
For the container runtime part, we should be able to find a proper username passing mechanism, however we need to make sure it works with containers like Alpine which don't use glibc, in this case we'd better stopping execution as described above.
I open the issue a bit too early, a patch for the docker image naming is on the way. I choose to simply replace every problematic characters with an underscore.
However, the runtime problem doesn't seems too simple in my opinion. I didn't find a proper way to patch it.
Original problem
When running a
cqfd run
with the username "test@test", I get this error :.cqfdrc
.cqfd/docker/Dockerfile
Investigation
By using special options when creating a user, it is technically possible to use '@' and '$' characters in Linux usernames.
When launching docker, cqfd use the useradd command to create a user with the same username as the user who launched the cqfd command. If this username contains '@' or '$' the useradd command will fail, but only on some systems :
One possible fix would be to add the
--badnames
option to useradd in the make_launcher function to make it accept bad usernames. But old Linux distributions (ex : Ubuntu 14, 16 and 18 ) doesn't recognize this option.TL;DR : For now, only Ubuntu images works with bad usernames