Bug 1121212

Summary: bash-completion for systemctl is somewhat broken
Product: [Fedora] Fedora Reporter: Vadim Raskhozhev <iamdexpl>
Component: systemdAssignee: systemd-maint
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: johannbg, lnykryn, msekleta, s, systemd-maint, vpavlin, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-18 16:16:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Attachments:
Description Flags
Patch for bash-completion for systemctl none

Description Vadim Raskhozhev 2014-07-18 16:10:56 UTC
Created attachment 919136 [details]
Patch for bash-completion for systemctl

Description of problem:

bash-completion does not work as expected when I try to see possible completions after, for example, systemctl show -p <Tab>


Version-Release number of selected component (if applicable):
systemd-208-19.fc20.x86_64

How reproducible:


Steps to Reproduce:
1. Ensure you have bash-completion working
2. type something like `systemctl show -p ` and press <Tab>

Actual results:
bash: systemd: command not found...

Expected results:
Display all 239 possibilities? (y or n)
Accept                              ExecStopPost                        MemoryLimit                         SecureBits
After                               ExecStopPre                         MessageQueueMaxMessages             SendBuffer
Alias                               Features                            MessageQueueMessageSize             SendSIGHUP
AllowIsolate                        FinishTimestamp                     MountFlags                          SendSIGKILL
Also                                FinishTimestampMonotonic            NFailedJobs                         Service
Backlog                             FirmwareTimestampMonotonic          Nice                                ShowStatus
Before                              FreeBind                            NInstalledJobs                      ShutdownWatchdogUSec
BindIPv6Only                        FsckPassNo                          NJobs                               Slice
BindsTo                             GeneratorsFinishTimestamp           NNames                              SmackLabel
BindTo                              GeneratorsFinishTimestampMonotonic  NonBlocking                         SmackLabelIPIn
BindToDevice                        GeneratorsStartTimestamp            NoNewPrivileges                     SmackLabelIPOut
BlockIOAccounting                   GeneratorsStartTimestampMonotonic   NotifyAccess                        SocketMode
BlockIODeviceWeight                 Group                               OnActiveSec                         Sockets
BlockIOReadBandwidth                GuessMainPID                        OnBootSec                           SourcePath
BlockIOWeight                       IgnoreOnIsolate                     OnCalendar                          StandardError
BlockIOWriteBandwidth               IgnoreOnSnapshot                    OnFailure                           StandardInput
Broadcast                           IgnoreSIGPIPE                       OnFailureIsolate                    StandardOutput
BusName                             InaccessibleDirectories             OnStartupSec                        StartLimitAction
Capabilities                        InitRDTimestamp                     OnUnitActiveSec                     StartLimitBurst
CapabilityBoundingSet               InitRDTimestampMonotonic            OnUnitInactiveSec                   StartLimitInterval
ConditionACPower                    IOSchedulingClass                   OOMScoreAdjust                      StopWhenUnneeded
ConditionCapability                 IOSchedulingPriority                Options                             SuccessExitStatus
ConditionDirectoryNotEmpty          IPTOS                               PAMName                             SupplementaryGroups
ConditionFileIsExecutable           IPTTL                               PartOf                              SyslogFacility
ConditionFileNotEmpty               JobTimeoutSec                       PassCredentials                     SyslogIdentifier
ConditionHost                       KeepAlive                           PassSecurity                        SyslogLevel
ConditionKernelCommandLine          KernelTimestamp                     PathChanged                         SyslogLevelPrefix
ConditionNull                       KernelTimestampMonotonic            PathExists                          SystemCallFilter
ConditionPathExists                 KillMode                            PathExistsGlob                      SysVStartPriority
ConditionPathExistsGlob             KillSignal                          PathModified                        TCPCongestion
ConditionPathIsDirectory            LimitAS                             PermissionsStartOnly                TCPWrapName
ConditionPathIsMountPoint           LimitCORE                           PIDFile                             TimeoutSec
ConditionPathIsReadWrite            LimitCPU                            PipeSize                            TimeoutStartSec
ConditionPathIsSymbolicLink         LimitDATA                           Priority                            TimeoutStopSec
ConditionSecurity                   LimitFSIZE                          PrivateNetwork                      TimerSlackNSec
ConditionVirtualization             LimitLOCKS                          PrivateTmp                          Transparent
ConfirmSpawn                        LimitMEMLOCK                        Progress                            TTYPath
Conflicts                           LimitMSGQUEUE                       PropagateReloadFrom                 TTYReset
CPUAccounting                       LimitNICE                           PropagateReloadTo                   TTYVHangup
CPUAffinity                         LimitNOFILE                         PropagatesReloadTo                  TTYVTDisallocate
CPUSchedulingPolicy                 LimitNPROC                          ReadOnlyDirectories                 Type
CPUSchedulingPriority               LimitRSS                            ReadWriteDirectories                UMask
CPUSchedulingResetOnFork            LimitRTPRIO                         ReceiveBuffer                       Unit
CPUShares                           LimitRTTIME                         RefuseManualStart                   UnitPath
DefaultDependencies                 LimitSIGPENDING                     RefuseManualStop                    UnitsLoadFinishTimestamp
DefaultStandardError                LimitSTACK                          ReloadPropagatedFrom                UnitsLoadFinishTimestampMonotonic
DefaultStandardOutput               ListenDatagram                      RemainAfterExit                     UnitsLoadStartTimestamp
Description                         ListenFIFO                          RequiredBy                          UnitsLoadStartTimestampMonotonic
DeviceAllow                         ListenMessageQueue                  Requires                            User
DevicePolicy                        ListenNetlink                       RequiresMountsFor                   UserspaceTimestamp
DirectoryMode                       ListenSequentialPacket              RequiresOverridable                 UserspaceTimestampMonotonic
DirectoryNotEmpty                   ListenSpecial                       Requisite                           UtmpIdentifier
Documentation                       ListenStream                        RequisiteOverridable                Version
Environment                         LoaderTimestampMonotonic            Restart                             WantedBy
EnvironmentFile                     LogLevel                            RestartPreventExitStatus            Wants
ExecReload                          LogTarget                           RestartSec                          WatchdogSec
ExecStart                           MakeDirectory                       ReusePort                           What
ExecStartPost                       Mark                                RootDirectory                       Where
ExecStartPre                        MaxConnections                      RootDirectoryStartOnly              WorkingDirectory
ExecStop                            MemoryAccounting                    RuntimeWatchdogUSec                 


Additional info:
The problem goes away after replacing systemd with /usr/lib/systemd/systemd in /usr/share/bash-completion/completions/systemctl (see patch attached) and reloading bash-completion rules.

Comment 1 Zbigniew Jędrzejewski-Szmek 2014-07-18 16:16:54 UTC
Thank you for the patch. The fix is more complicated, because we support installation of systemd binary in different paths (e.g. on Debian). A proper fix is upstream in http://cgit.freedesktop.org/systemd/systemd/commit/?id=c0a67aef31bb97.