distrobox icon indicating copy to clipboard operation
distrobox copied to clipboard

[Error] No such file or directory when path contains "at" (@) character

Open karypid opened this issue 2 months ago • 0 comments

Describe the bug

My Linux box uses Active Directory for authentication. As a result, my home path has the @ character in it. This seems to confuse "distrobox-export". I can create and run containers, but using the export command to list applications causes problems.

To Reproduce

I have reproduced this with podman on Fedora 39 (I do not have docker to check if the problem exists there). You do not need to actually join and Active Directory domain to reproduce this, you just need to have the @ character in the home directory name, which can also be achieved with the --badname parameter:

  • Create a user with the @ character in the name. I did this as follows: sudo useradd -m --badname sampleuser@withatchar
  • Login as that user (in my example: sampleuser@withatchar)
  • Create a Fedora 39 box with podman (I used BoxBuddy to create it)
  • Enter the box and install an application
  • Run distrobox-export to export the application
  • Run distrobox-export --list-apps and observe the error in the output

You need to have successfully exported an application so that when listing the apps, there is something to list.

I installed Citrix Workspace App so the export was done with:

📦[sampleuser@withatchar@f39 ~]$ distrobox-export --app Citrix
Application Citrix successfully exported.
OK!
Citrix will appear in your applications list in a few seconds.

When listing apps is the output that demonstrates the bug is:

📦[sampleuser@withatchar@f39 ~]$ distrobox-export --list-apps
grep: /run/host/home/sampleuser: No such file or directory
grep: withatchar/.local/share/applications/f39-selfservice.desktop: No such file or directory
                     | withatchar/.local/share/applications/f39-selfservice.desktop
grep: /run/host/home/sampleuser: No such file or directory
grep: withatchar/.local/share/applications/f39-wfica.desktop: No such file or directory
                     | withatchar/.local/share/applications/f39-wfica.desktop
grep: /run/host/home/sampleuser: No such file or directory
grep: withatchar/.local/share/applications/f39-new_store.desktop: No such file or directory
                     | withatchar/.local/share/applications/f39-new_store.desktop
grep: /run/host/home/sampleuser: No such file or directory
grep: withatchar/.local/share/applications/f39-configmgr.desktop: No such file or directory
                     | withatchar/.local/share/applications/f39-configmgr.desktop
grep: /run/host/home/sampleuser: No such file or directory
grep: withatchar/.local/share/applications/f39-conncenter.desktop: No such file or directory
                     | withatchar/.local/share/applications/f39-conncenter.desktop
grep: /run/host/home/sampleuser: No such file or directory
grep: withatchar/.local/share/applications/f39-receiver.desktop: No such file or directory
                     | withatchar/.local/share/applications/f39-receiver.desktop
grep: /run/host/home/sampleuser: No such file or directory
grep: withatchar/.local/share/applications/f39-receiver_fido2.desktop: No such file or directory
                     | withatchar/.local/share/applications/f39-receiver_fido2.desktop

Expected behavior The exported apps should be listed.

Logs Attached podman logs

Desktop (please complete the following information):

  • Are you using podman, docker or lilipod? podman
  • Which version or podman, docker or lilipod? 5.0.2
  • Which version of distrobox? 1.7.1.0
  • Which host distribution? Fedora
  • How did you install distrobox? curl https://raw.githubusercontent.com/89luca89/distrobox/main/install | sudo sh

Additional context I think somewhere the code assumes that @ is never in the username / directory-path of a user running distrobox. While this is not normal for a regular user, it is quite common for users logging into machines that authenticate with Active Directory as a server.

karypid avatar Apr 21 '24 18:04 karypid