Bug 16598 - kill {-p,--pid} & pid(alias) does not work; documented in man page
Summary: kill {-p,--pid} & pid(alias) does not work; documented in man page
Status: RESOLVED INVALID
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 5
Hardware: x86_64 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Mageia Bug Squad
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-18 13:56 CEST by Pierre Fortin
Modified: 2015-08-19 07:24 CEST (History)
1 user (show)

See Also:
Source RPM:
CVE:
Status comment:


Attachments

Description Pierre Fortin 2015-08-18 13:56:56 CEST
Description of problem:  read "man kill"; found {-p,--pid} option -- also use of "pid" as alias for "kill".
Trying to use this option gives:

$ kill -p firefox
bash: kill: p: invalid signal specification
$ kill --pid firefox
bash: kill: -pid: invalid signal specification
$ pid firefox
bash: pid: command not found


Version-Release number of selected component (if applicable):


How reproducible: always


Steps to Reproduce:
1. see above
2.
3.


Reproducible: 

Steps to Reproduce:
Comment 1 Marja Van Waes 2015-08-18 20:08:28 CEST
Please find the PID of the process and then kill it by its number, like this:

[marja@localhost Bureaublad]$ pgrep -l firefox
23422 firefox
[marja@localhost Bureaublad]$ kill 23422
[marja@localhost Bureaublad]$

That should work nicely

CC: (none) => marja11

Comment 2 Rémi Verschelde 2015-08-18 21:01:52 CEST
For me the manpage for kill says:

       -p, --pid
              Only print the process id (pid) of the named processes, do not
              send any signals.

              The  --pid  option is automatically enabled when the kill command
              is invoked with the name of pid.  This functionality is
              deprecated, and will be removed in March 2016.

I don't see any indication that "kill -p <name>" should work.
Comment 3 Pierre Fortin 2015-08-19 00:40:11 CEST
(In reply to Marja van Waes from comment #1)
> Please find the PID of the process and then kill it by its number, like this:
> 
> [marja@localhost Bureaublad]$ pgrep -l firefox
> 23422 firefox
> [marja@localhost Bureaublad]$ kill 23422
> [marja@localhost Bureaublad]$
> 
> That should work nicely

Thanks for the hint! Not quite what I was looking for:
$ pgrep -l firefox
4597 firefox
15620 firefox
26759 firefox

but this is:
$ pgrep -u $USER -l firefox
4597

(In reply to Rémi Verschelde from comment #2)
> For me the manpage for kill says:
> 
>        -p, --pid
>               Only print the process id (pid) of the named processes, do not
>               send any signals.
> 
>               The  --pid  option is automatically enabled when the kill
> command
>               is invoked with the name of pid.  This functionality is
>               deprecated, and will be removed in March 2016.
Missed this:    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Looks like it's already removed... 

> I don't see any indication that "kill -p <name>" should work.

I was trying to get the _current user_'s pid (missed the deprecation note); the above solution works when combined with kill like this:
$ kill -<n> $(pgrep -u $USER firefox)  # without "-l"
where n is the desired signal.  i.e.,
$ kill -3 $(pgrep -u $USER firefox)

Status: NEW => RESOLVED
Resolution: (none) => INVALID

Comment 4 Rémi Verschelde 2015-08-19 07:24:12 CEST
Ah you're right indeed, now I understand that "kill -p firefox" should still return the PID of the current Firefox instance. As you say, it seems that they deprecated it sooner than anticipated.

Note You need to log in before you can comment on or make changes to this bug.