containers / podman

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

Powershell completion stopped worked #15527

Open goldman7911 opened 2 years ago

goldman7911 commented 2 years ago

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

/kind bug

Description

podman completion stopped worked

image

Steps to reproduce the issue:

podman.exe machi

Describe the results you received:

Describe the results you expected:

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

Output of podman version:

 desktop-pc      ﮫ 5.564s   7:58 AM  
 ⚡janki ❯❯ podman.exe version
Client:       Podman Engine
Version:      4.2.0
API Version:  4.2.0
Go Version:   go1.16.15
Git Commit:   7fe5a419cfd2880df2028ad3d7fd9378a88a04f4
Built:        Thu Aug 11 11:20:57 2022
OS/Arch:      windows/amd64

Server:       Podman Engine
Version:      4.1.1
API Version:  4.1.1
Go Version:   go1.16.15
Built:        Wed Jun 15 11:32:06 2022
OS/Arch:      linux/amd64

Output of podman info:

 desktop-pc      ﮫ 0ms   7:58 AM  
 ⚡janki ❯❯ podman.exe info
host:
  arch: amd64
  buildahVersion: 1.26.1
  cgroupControllers: []
  cgroupManager: cgroupfs
  cgroupVersion: v1
  conmon:
    package: conmon-2.1.1-2.fc35.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.1, commit: '
  cpuUtilization:
    idlePercent: 99.37
    systemPercent: 0.38
    userPercent: 0.24
  cpus: 12
  distribution:
    distribution: fedora
    variant: container
    version: "35"
  eventLogger: file
  hostname: desktop-pc
  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.10.102.1-microsoft-standard-WSL2
  linkmode: dynamic
  logDriver: journald
  memFree: 16225755136
  memTotal: 16731246592
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: crun-1.4.5-2.fc35.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.4.5
      commit: c381048530aa750495cf502ddb7181f2ded5b400
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    exists: true
    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
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.1.12-2.fc35.x86_64
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 4294967296
  swapTotal: 4294967296
  uptime: 22.28s
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
  - quay.io
store:
  configFile: /home/user/.config/containers/storage.conf
  containerStore:
    number: 2
    paused: 0
    running: 0
    stopped: 2
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/user/.local/share/containers/storage
  graphRootAllocated: 269490393088
  graphRootUsed: 5920436224
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 10
  runRoot: /run/user/1000/containers
  volumePath: /home/user/.local/share/containers/storage/volumes
version:
  APIVersion: 4.1.1
  Built: 1655303526
  BuiltTime: Wed Jun 15 11:32:06 2022
  GitCommit: ""
  GoVersion: go1.16.15
  Os: linux
  OsArch: linux/amd64
  Version: 4.1.1

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

 desktop-pc      ﮫ 0ms   7:59 AM  
 ⚡janki ❯❯ winget list
Nome                                          ID                                             Versão             Origem
-----------------------------------------------------------------------------------------------------------------------
Neo4j Desktop 1.4.15                          14c7e06f-6a3b-5e4e-9e0c-ebe055b1b752           1.4.15
GMenu                                         4ac46a8d-c0d4-56ee-87f3-9abd4ce22e7f           3.10.0
Focus To-Do                                   52299SuperElement.119436511DDC8_792yctbvabkar  6.7.5.0
WhatsApp Desktop                              5319275A.WhatsAppDesktop_cv1g1gvanyjgm         2.2228.14.0
7-Zip 22.01 (x64)                             7zip.7zip                                      22.01              winget
AMD Chipset Software                          AMD_Chipset_IODrivers                          4.06.10.651
Amazon Kindle                                 Amazon.Kindle                                  1.37.0.65274       winget
Ubuntu on Windows                             Canonical.Ubuntu                               2004.2022.1.0      winget
Discord                                       Discord.Discord                                1.0.9005           winget
Everything 1.4.1.1015 (x64)                   Everything                                     1.4.1.1015
Foxit PDF Reader                              Foxit.FoxitReader                              12.0.1.12430       winget
GitHub Desktop                                GitHub.GitHubDesktop                           3.0.6              winget
Git                                           Git.Git                                        2.37.2.2           winget
HWiNFO64 Version 7.26                         REALiX.HWiNFO                                  7.26               winget
GanttProject powered by weatherlights.com     HaukeGtze.GanttProjectpoweredbyweatherlights.… 1.2811.3.0
Microsoft Edge                                Microsoft.Edge                                 104.0.1293.70      winget
Microsoft Edge Update                         Microsoft Edge Update                          1.3.167.21
Microsoft Edge WebView2 Runtime               Microsoft.EdgeWebView2Runtime                  104.0.1293.70      winget
Central de Mouse e Teclado da Microsoft       Microsoft Mouse and Keyboard Center            14.41.137.0
Cortana                                       Microsoft.549981C3F5F10_8wekyb3d8bbwe          4.2204.13303.0
Microsoft Notícias                            Microsoft.BingNews_8wekyb3d8bbwe               1.0.6.0
MSN Clima                                     Microsoft.BingWeather_8wekyb3d8bbwe            3.2.3.0
Instalador de Aplicativo                      Microsoft.DesktopAppInstaller_8wekyb3d8bbwe    1.18.2091.0
Xbox                                          Microsoft.GamingApp_8wekyb3d8bbwe              2208.1001.13.0
Serviços de jogos                             Microsoft.GamingServices_8wekyb3d8bbwe         4.67.21001.0
Obter Ajuda                                   Microsoft.GetHelp_8wekyb3d8bbwe                10.2206.2011.0
Dicas da Microsoft                            Microsoft.Getstarted_8wekyb3d8bbwe             10.2206.2.0
HEIF Image Extensions                         Microsoft.HEIFImageExtension_8wekyb3d8bbwe     1.0.43012.0
Pacote de Experiência Local em Português (Br… Microsoft.LanguageExperiencePackpt-BR_8wekyb3… 22000.25.103.0
Microsoft Edge                                Microsoft.MicrosoftEdge.Stable_8wekyb3d8bbwe   104.0.1293.70
Office                                        Microsoft.MicrosoftOfficeHub_8wekyb3d8bbwe     18.2205.1091.0
Microsoft Solitaire Collection                Microsoft.MicrosoftSolitaireCollection_8wekyb… 4.13.7180.0
Notas Autoadesivas da Microsoft               Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe   4.0.4506.0
OneDrive                                      Microsoft.OneDriveSync_8wekyb3d8bbwe           22161.731.2.0
Paint                                         Microsoft.Paint_8wekyb3d8bbwe                  11.2206.6.0
Microsoft People                              Microsoft.People_8wekyb3d8bbwe                 10.2105.4.0
Power Automate                                Microsoft.PowerAutomateDesktop_8wekyb3d8bbwe   1.0.297.0
PowerShell                                    Microsoft.PowerShell                           7.2.6.0            winget
Ferramenta de Captura                         Microsoft.ScreenSketch_8wekyb3d8bbwe           11.2206.13.0
Segurança do Windows                          Microsoft.SecHealthUI_8wekyb3d8bbwe            1000.22000.251.0
Host de Experiência na Store                  Microsoft.StorePurchaseApp_8wekyb3d8bbwe       12203.44.0.0
VP9 Video Extensions                          Microsoft.VP9VideoExtensions_8wekyb3d8bbwe     1.0.51171.0
Extensões de Mídia da Web                     Microsoft.WebMediaExtensions_8wekyb3d8bbwe     1.0.42192.0
Extensões de Imagem WebP                      Microsoft.WebpImageExtension_8wekyb3d8bbwe     1.0.42351.0
Fotos Microsoft                               Microsoft.Windows.Photos_8wekyb3d8bbwe         2022.31070.26005.0
Relógio do Windows                            Microsoft.WindowsAlarms_8wekyb3d8bbwe          11.2206.27.0
Calculadora Windows                           Microsoft.WindowsCalculator_8wekyb3d8bbwe      11.2206.0.0
Câmera do Windows                             Microsoft.WindowsCamera_8wekyb3d8bbwe          2022.2206.2.0
Hub de Comentários                            Microsoft.WindowsFeedbackHub_8wekyb3d8bbwe     1.2203.761.0
Mapas do Windows                              Microsoft.WindowsMaps_8wekyb3d8bbwe            1.0.43.0
Bloco de notas do Windows                     Microsoft.WindowsNotepad_8wekyb3d8bbwe         11.2206.17.0
Gravador de Som do Windows                    Microsoft.WindowsSoundRecorder_8wekyb3d8bbwe   11.2206.30.0
Microsoft Store                               Microsoft.WindowsStore_8wekyb3d8bbwe           22207.1401.1.0
Terminal do Windows                           Microsoft.WindowsTerminal                      1.14.2282.0        winget
Windows Package Manager Source (winget)       Microsoft.Winget.Source_8wekyb3d8bbwe          2022.827.2035.44
Xbox TCUI                                     Microsoft.Xbox.TCUI_8wekyb3d8bbwe              1.24.10001.0
Xbox Game Bar Plugin                          Microsoft.XboxGameOverlay_8wekyb3d8bbwe        1.54.4001.0
Xbox Game Bar                                 Microsoft.XboxGamingOverlay_8wekyb3d8bbwe      5.822.6271.0
Xbox Identity Provider                        Microsoft.XboxIdentityProvider_8wekyb3d8bbwe   12.90.14001.0
Xbox Game Speech Window                       Microsoft.XboxSpeechToTextOverlay_8wekyb3d8bb… 1.21.13002.0
Vincular ao Celular                           Microsoft.YourPhone_8wekyb3d8bbwe              1.22062.542.0
Reprodutor Multimídia do Windows              Microsoft.ZuneMusic_8wekyb3d8bbwe              11.2205.22.0
Filmes e TV                                   Microsoft.ZuneVideo_8wekyb3d8bbwe              10.22041.10091.0
Microsoft Teams                               MicrosoftTeams_8wekyb3d8bbwe                   22183.300.1431.92…
Windows Web Experience Pack                   MicrosoftWindows.Client.WebExperience_cw5n1h2… 421.20070.625.0
NVIDIA Control Panel                          NVIDIACorp.NVIDIAControlPanel_56jybvy8sckqj    8.1.962.0
Notepad++ (64-bit x64)                        Notepad++.Notepad++                            8.4.4              winget
Microsoft 365 - pt-br                         O365HomePremRetail - pt-br                     16.0.15427.20210
OBS Studio                                    OBSProject.OBSStudio                           27.2.4             winget
Oh My Posh version 8.35.0                     JanDeDobbeleer.OhMyPosh                        8.35.0             winget
Microsoft OneDrive                            Microsoft.OneDrive                             22.161.0731.0002   winget
Postman x86_64 9.29.0                         Postman.Postman                                9.29.0             winget
VALORANT                                      Riot Game valorant.live                        Unknown
Riot Vanguard                                 Riot Vanguard                                  Unknown
Spotify                                       Spotify.Spotify                                1.1.92.647.ga4397… winget
Steam                                         Valve.Steam                                    2.10.91.91         winget
V Rising                                      Steam App 1604030                              Unknown
Counter-Strike: Global Offensive              Steam App 730                                  Unknown
Microsoft Teams                               Microsoft.Teams                                1.5.00.21463       winget
draw.io Diagrams                              draw.io.draw.ioDiagrams_1zh33159kp73c          20.2.3.0
kdenlive                                      KDE.Kdenlive                                   22.04.3            winget
Email e Calendário                            microsoft.windowscommunicationsapps_8wekyb3d8… 16005.14326.20970…
pgAdmin 4 version 6.13                        PostgreSQL.pgAdmin                             6.13               winget
Slack                                         SlackTechnologies.Slack                        4.28.171           winget
WinSCP 5.21.1                                 WinSCP.WinSCP                                  5.21.1             winget
i-Menu version 4.3.6                          {0121C0BD-363C-4B1D-8B64-FE7681A37D0A}_is1     4.3.6
Aplicativo Itaú                               {0686E28E-FA2A-4ED8-8FC1-C17B856A26D6}         1.0.178
Python 3.10.6 (64-bit)                        Python.Python.3                                3.10.6150.0
Python Launcher                               {25196DA8-29BD-4383-B7B5-B36C3BAF43F3}         3.10.7826.0
Eclipse Temurin JDK with Hotspot 17.0.4+8 (x… EclipseAdoptium.Temurin.17.JDK                 17.0.4.8           winget
mRemoteNG                                     mRemoteNG.mRemoteNG                            1.76.20.24615      winget
Eclipse Temurin JDK with Hotspot 8u345-b01 (… EclipseAdoptium.Temurin.8.JDK                  8.0.345.1          winget
MongoDB Shell                                 MongoDB.Shell                                  1.5.4              winget
Microsoft Update Health Tools                 {6A2A8076-135F-4F55-BB02-DED67C8C6934}         4.67.0.0
Microsoft Visual Studio Code (User)           Microsoft.VisualStudioCode                     1.70.2             winget
Realtek Ethernet Controller Driver            {8833FFB6-5B0C-4764-81AA-06DFEED9A476}         10.50.511.2021
JBL QuantumENGINE                             {927083e8-d64f-4c69-b6fc-0258f9d44a91}         1.10.0.1438
FortiClient                                   {A795A115-8F19-4590-A8BC-8C39AE13FCF1}         7.0.0.0029
Microsoft GameInput                           {A9CFD6A1-C0D3-7F37-C220-8B104867EF15}         10.1.22621.1011
NVIDIA Driver de gráficos 516.94              {B2FE1952-0186-46C3-BAEC-A80AA35AC5B8}_Displa… 516.94
NVIDIA GeForce Experience 3.25.1.27           Nvidia.GeForceExperience                       3.25.1.27          winget
NVIDIA Software do sistema PhysX 9.21.0713    {B2FE1952-0186-46C3-BAEC-A80AA35AC5B8}_Displa… 9.21.0713
NVIDIA FrameView SDK 1.2.7521.31103277        {B2FE1952-0186-46C3-BAEC-A80AA35AC5B8}_FrameV… 1.2.7521.31103277
Eclipse Temurin JDK with Hotspot 11.0.16+8 (… EclipseAdoptium.Temurin.11.JDK                 11.0.16.8          winget
Node.js                                       OpenJS.NodeJS                                  18.7.0             winget
Podman 4.2.0                                  RedHat.Podman                                  4.2.0              winget
VLC media player 3.0.17 (64-bit)              VideoLAN.VLC                                   3.0.17.4           winget
Microsoft Azure CLI                           Microsoft.AzureCLI                             2.39.0             winget
Windows Subsystem for Linux WSLg Preview      {E04B0005-A349-4BCC-9662-CA0132007E14}         1.0.26
PuTTY release 0.77 (64-bit)                   PuTTY.PuTTY                                    0.77.0.0           winget
Windows Subsystem for Linux Update            {F8474A47-8B5D-4466-ACE3-78EAB3BF21A8}         5.10.102.1
Microsoft Visual C++ 2015-2019 Redistributab… {a9cfe9c7-e54f-46cd-9c5c-542ff8e3e8c4}         14.28.29334.0
Microsoft Visual C++ 2015-2019 Redistributab… {b2d0f752-adc5-496e-8f70-8669de01f746}         14.28.29334.0

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

Yes

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

Microsoft Windows 11 Pro 10.0.22000 N/A compilação 22000 Windows Terminal 1.14.2282.0 Oh My Posh version 8.35.0

pwsh $PROFILE

oh-my-posh init pwsh --config C:\Users\janki\AppData\Local\Programs\oh-my-posh\themes\montys.omp.json | Invoke-Expression
podman.exe completion powershell | Out-String | Invoke-Expression

if ($host.Name -eq 'ConsoleHost')
{
    Import-Module PSReadLine
    Set-PSReadLineOption -EditMode Emacs
}
rhatdan commented 2 years ago

@n1hility PTAL

baude commented 2 years ago

@goldman7911 so it used to work, but does not anymore?

goldman7911 commented 2 years ago

@goldman7911 so it used to work, but does not anymore?

Yes, unfortunelly I don't know which version exactly. I used to let Windows in latest version and run winget upgrade --all. Now I try even manually and can't make it work for pwsh (even using other pwsh versions)

image

github-actions[bot] commented 1 year ago

A friendly reminder that this issue had no activity for 30 days.

n1hility commented 1 year ago

@baude are you still looking at this one? @cdoern was looking for some low-hanging fruit, this looks like one

@baude you probably already determined this, but to help point in the right direction, cobra seems to have a bug where it expects program name to not have a dot:

https://github.com/spf13/cobra/blob/main/powershell_completions.go#L109

This results in the powershell output:

$env:PODMAN.EXE_ACTIVE_HELP=0

With powershell, you can't have a dot in env names, needs to look like:

${env:PODMAN.EXE_ACTIVE_HELP}=0
github-actions[bot] commented 1 year ago

A friendly reminder that this issue had no activity for 30 days.

rhatdan commented 1 year ago

@baude @cdoern @n1hility could we get an update on this?

n1hility commented 1 year ago

hi @cdoern I see the commit above looks like you have the fix for this. Are you planning to open a PR for this to the cobra project?

banzr commented 1 year ago

I fixed the bugs that were in the generated script from running podman.exe completion powershell | Out-String | Invoke-Expression on Podman version 4.4.2 on Windows 11.

podman_completion.zip

I had to zip it because powershell scripts are supported in comments. Sorry for the laziness.

Ev3rdown commented 1 year ago

A temporary workaround would be using a modified command in the $PROFILE instead of the one in the manual. Like this one :

$(podman completion powershell | Out-String).Replace('podman.exe','podman').Replace('PODMAN.EXE','PODMAN') | Invoke-Expression

It just removes the ".exe" that is added after "podman" by cobra, turning "podman.exeCompleterBlock" into "podmanCompleterBlock" which doesn't crash. Works well for me in the latest podman version with powershell 5.1 or 7.2 and windows 10 (pro).

totkeks commented 5 months ago

Came here with the same issue. Can someone explain why cobra generates the completion specifically for podman.exe and not podman? I am curious, because oh-my-posh also uses cobra and oh-my-posh completion powershell does not create a completion for oh-my-posh.exe.