Bug#558044: pkill, pgrep: don't use -v for negation; it's dangerous some think -v means verbose

2012-02-12 Thread Sami Kerola
Hi,

Upstream of the procps-ng adopted removing -v from pkill, while
keeping it for pgrep. The change allows one to reach the inversion
logic with long option e.g. 'pkill --invert' but that is not
documented (while it perhaps should be).

https://gitorious.org/procps/procps/commit/1af18c260a87dc38f0e33bfeb6de6163f91be4ad

-- 
   Sami Kerola
   http://www.iki.fi/kerolasa/



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#558044: pkill, pgrep: don't use -v for negation; it's dangerous some think -v means verbose

2010-02-09 Thread Andrew Doran
Hi Jason,

On Thu, Feb 04, 2010 at 04:01:33AM -0500, Jason A. Spiro wrote:

 Thanks for writing NetBSD pgrep/pkill.  When you have some spare time
 to carefully read ten messages and think, you please read through
 http://bugs.debian.org/558044 and suggest what you think would be a
 good algorithm for making -v safer?

I would chalk this down to experience.  In my youth I typed killall on an
ICL DRS6000 running SVR4 on the assumption that it would kill one process.
In fact it brought down the entire system, as designed, leaving me very
red faced.

So personally, having made the mistake and learned to be very careful about
killing things I don't see it as a big issue, although perhaps there is a 
good way to improve it and make it safer.

Unfortunately, I don't have any
good ideas in this area.  If you'd like to solicit ideas from the greater
NetBSD userbase, tech-userle...@netbsd.org would be a good place to ask.
They can be a noisy and opinionated bunch so liberal use of your mail
client's Delete facility would be advised, if you chose to go down this
route. :-)

Note that the suggestion of disallowing -v with a pattern could be 
problematic because it would prevent rare and strange, albeit meaningful
constructs such as:

pkill -v (init|syslogd|sh|randomprogram)

Thank you for asking my opinion.

Cheers,
Andrew




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#558044: pkill, pgrep: don't use -v for negation; it's dangerous some think -v means verbose

2010-02-04 Thread Jason A. Spiro
Hi Andrew,

Thanks for writing NetBSD pgrep/pkill.  When you have some spare time
to carefully read ten messages and think, you please read through
http://bugs.debian.org/558044 and suggest what you think would be a
good algorithm for making -v safer?

Thanks in advance,
-Jason



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#558044: changing pkill -v

2010-01-09 Thread Kjetil Torgrim Homme
as the original author of Linux' pgrep, I support the idea of making the
use of -v an error unless a search criterium other than pattern is
specified.  (-f is not a search criterium in itself.)

there is a sort of precedent for this, since -o and -n has always been
disallowed with -v since the behaviour would be useless.

wrt. adding a verbose mode for pkill I think it would be best done by
adding -l, even if other kill programs use that option to list signal
names.  but that's not pertinent to this change request :-)

-- 
best wishes,
Kjetil T.




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#558044:

2009-12-02 Thread Jason A. Spiro
On Thu, Nov 26, 2009 at 6:41 AM, Craig Small csm...@debian.org wrote:

 I disagree. pgrep/pkill (they're the same binary) are like grep and use
 the same flags. I think that is important.

I think it is more important to protect users.  But you are the
maintainer and so the decision is up to you.

Now I will continue to respond to the other arguments that you said in
your last mail.

 Changing the flags now will cause more problems than it will solve
 because now you will have different flags for new Debian servers, old
 ones and the rest of the world.

Maybe you could gradually transition it in, by making both options
work for a year or two and printing a warning message, then disabling
-v.

 If you are not careful you can do bad things easily. pkill -v is in the
 same vein as fuser -km / or the old rm -rf / mydir/myfile.

Yes.  But I think it would be good if you disable this particular bad
thing, just like GNU disabled the old rm -rf / mydir/myfile.

 Principle of least astonishment is all good, but inconsistent flags
 across different Linuxs is even worse.

Which Linux does not use Debian procps?  For example, it looks like
Fedora uses Debian procps.[1]

 While I do understand what you
 are trying to do here I don't agree. Given that, I'm closing this
 bug.

What would you think if we posted on the debian-devel list and asked
for more advice on other possible options to prevent accidental
killing-all-processes with pkill -v?

^  [1].  http://cvs.fedoraproject.org/viewvc/rpms/procps/devel/FAQ?view=markup



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#558044: Fwd: Re: Bug#558044: pkill, pgrep: don't use -v for negation; it's dangerous some think -v means verbose

2009-12-02 Thread Jason A. Spiro
-- Forwarded message --
From: Craig Small csm...@enc.com.au
Date: Wed, Dec 2, 2009 at 3:06 AM
Subject: Re: Bug#558044:
To: Jason A. Spiro jasonspi...@gmail.com


On Wed, Dec 02, 2009 at 02:59:38AM -0500, Jason A. Spiro wrote:
 Maybe you could gradually transition it in, by making both options
 work for a year or two and printing a warning message, then disabling
 -v.
That's been done before, there were lots of complaints.

 Which Linux does not use Debian procps?  For example, it looks like
 Fedora uses Debian procps.[1]
They copied the FAQ from upstream, I saw nothing about it being a Debian
specific patched version.

 What would you think if we posted on the debian-devel list and asked
 for more advice on other possible options to prevent accidental
 killing-all-processes with pkill -v?
If the bulk of debian-devel said yes this is a good idea I'd regretfully
change it.

Now the rm -rf / blah protection is quite neat and perhaps something
like it could be done. I'm not sure what the criteria would be.

 - Craig
--
Craig Small      GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
http://www.enc.com.au/                             csmall at : enc.com.au
http://www.debian.org/          Debian GNU/Linux, software should be Free



-- 
Jason Spiro: software/web developer, packager, trainer, IT consultant.
I support Linux, UNIX, Windows, and more. Contact me to discuss your needs.
+1 (416) 992-3445 / www.jspiro.com



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#558044: pkill, pgrep: don't use -v for negation; it's dangerous some think -v means verbose

2009-12-02 Thread Jason A. Spiro
On Wed, Dec 2, 2009 at 3:06 AM, Craig Small csm...@enc.com.au wrote:

 That's been done before, there were lots of complaints.

When?  What were the complaints?  :)

 They copied the FAQ from upstream, I saw nothing about it being a Debian
 specific patched version.

But Craig, aren't you the upstream maintainer of procps?

 If the bulk of debian-devel said yes this is a good idea I'd regretfully
 change it.

Thank you for offering to do so.

 Now the rm -rf / blah protection is quite neat and perhaps something
 like it could be done. I'm not sure what the criteria would be.

Good idea.  I have researched your idea.  From the first forty or so
Google search results for [ pkill -v ], it looks like nobody in
those search results uses pkill -v some_process_name except by
accident.  They only use -v purposefully when they use it with -u, as
in pkill -v -u root or pkill -v -u 0,1 or pkill -v -u
root,daemon,nobody,gdm.  Maybe if you want to use -v without -u, you
should need to pass the long option --invert-match instead of the
short option -v.  What do you think?



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#558044: Fwd: Bug#558044: pkill, pgrep: don't use -v for negation; it's dangerous some think -v means verbose

2009-12-02 Thread Jason A. Spiro
-- Forwarded message --
From: Craig Small csm...@enc.com.au
Date: Wed, Dec 2, 2009 at 5:14 AM
Subject: Re: Bug#558044: pkill, pgrep: don't use -v for negation;
it's dangerous  some think -v means verbose
To: Jason A. Spiro jasonspi...@gmail.com


On Wed, Dec 02, 2009 at 04:09:30AM -0500, Jason A. Spiro wrote:
 When?  What were the complaints?  :)
It was quite a few a years ago and it was basically we want it the
other way

 But Craig, aren't you the upstream maintainer of procps?
No. Albert is. I'm the Debian procps maintainer. I can only generate
Debian-specific diffs, so thats why changing the flags is a bad idea.
I'm also the psmisc (eg killall) maintainer.

 Good idea.  I have researched your idea.  From the first forty or so
 Google search results for [ pkill -v ], it looks like nobody in
 those search results uses pkill -v some_process_name except by
 accident.  They only use -v purposefully when they use it with -u, as
 in pkill -v -u root or pkill -v -u 0,1 or pkill -v -u
 root,daemon,nobody,gdm.  Maybe if you want to use -v without -u, you
 should need to pass the long option --invert-match instead of the
 short option -v.  What do you think?
Something like that would be better.  Not changing the flag but
disabling it for somewhat obvious errors; and then having another flag,
a long option, that means yes really do it.


 - Craig
--
Craig Small      GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
http://www.enc.com.au/                             csmall at : enc.com.au
http://www.debian.org/          Debian GNU/Linux, software should be Free



-- 
Jason Spiro: software/web developer, packager, trainer, IT consultant.
I support Linux, UNIX, Windows, and more. Contact me to discuss your needs.
+1 (416) 992-3445 / www.jspiro.com



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#558044: pkill, pgrep: don't use -v for negation; it's dangerous some think -v means verbose

2009-12-02 Thread Jason A. Spiro
cc added:  Albert Cahalan acahalan %at% gmail.com.  Albert, welcome
to the thread, and thanks for maintaining procps.

On Wed, Dec 2, 2009 at 5:14 AM, Craig Small csm...@enc.com.au wrote:

 On Wed, Dec 02, 2009 at 04:09:30AM -0500, Jason A. Spiro wrote:

 When?  What were the complaints?  :)

 It was quite a few a years ago and it was basically we want it the
 other way

What functionality were you gradually transitioning in?

 But Craig, aren't you the upstream maintainer of procps?

 No. Albert is. I'm the Debian procps maintainer. I can only generate
 Debian-specific diffs, so thats why changing the flags is a bad idea.
 I'm also the psmisc (eg killall) maintainer.

Ah.  Craig, when I saw You may use the Debian bug tracking system at
http://procps.sourceforge.net/faq.html , and you replied to my issue
mail, I thought you were the upstream.  :)  Is it allowed in the
current version of debbugs for you to configure things so debbugs will
forward all new procps bugs not just to you, but also to Albert?

 Good idea.  I have researched your idea.  From the first forty or so
 Google search results for [ pkill -v ], it looks like nobody in
 those search results uses pkill -v some_process_name except by
 accident.  They only use -v purposefully when they use it with -u, as
 in pkill -v -u root or pkill -v -u 0,1 or pkill -v -u
 root,daemon,nobody,gdm.  Maybe if you want to use -v without -u, you
 should need to pass the long option --invert-match instead of the
 short option -v.  What do you think?

 Something like that would be better.  Not changing the flag but
 disabling it for somewhat obvious errors; and then having another flag,
 a long option, that means yes really do it.

Albert, I wrote an explanation -- viewable at the top of
http://bugs.debian.org/558044 -- on why pkill -v is so dangerous.
Given my explanation, what do you think of my idea?

Albert, Craig, please make sure to always CC me and the bugtracker
when you reply.

Kind regards,
-Jason



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#558044: reopening

2009-12-02 Thread Craig Small
reopen 558044 =
thankyou

The current way of using pgrep -v can often lead to a large number of
processes killed and often this is not the intention of the user.  A way
of limiting the damage needs to be added to pkill without changing the
flag.

Some ideas are to disable -v if no process (before the negation) is
found or to not by default be able to use -v if no other flags are used.
In other words pkill -v myproc will not work but 
kill -v myproc -u root will and pkill --some-flag myproc will.

-- 
Craig Small  GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
http://www.enc.com.au/ csmall at : enc.com.au
http://www.debian.org/  Debian GNU/Linux, software should be Free 



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#558044:

2009-11-26 Thread Jason A. Spiro
I see from
http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-150923
that pkill's options are derived from pgrep's which are derived from
grep's.  But still, the benefits of preserving grep-like -v behavior
don't outweigh the costs.

The benefits of preserving Solaris compatibility for -v aren't worth
the costs either.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#558044: pkill, pgrep: don't use -v for negation; it's dangerous some think -v means verbose

2009-11-25 Thread Jason A. Spiro
Package: procps
Version: 1:3.2.8-2
Severity: wishlist
X-Debbugs-CC: mo...@mozai.com;volker.maib...@eberspaecher.com

Thank you for maintaining procps.

A suggestion:  killall -v Foo means kill process Foo, and print
verbose output.  Therefore many users think that pkill -v Foo means
the same thing.[1][2][3][4][5][6][7]  It doesn't.  It kills all
processes except Foo.  This tends to cause harm.

Please follow the Rule of Least Surprise.  Don't allow -v to mean
the more destructive of its two possible meanings.  Instead, please
rename the -v option to some other letter.  Not -i for invert:
killall uses -i to mean interactive.  And preferably not -L:
skill uses that to List all possible signals.  Use some other letter.
Preferably also make pkill -v print a special error message telling
you the new way to negate your criteria.

Please change pgrep too, so that its option names will match pkill's.

^  [1].  It's ... good to know that pkill -v doesn't give you
verbose output.
--http://www.reddit.com/r/AskReddit/comments/7vkpi/whats_the_worst_mistake_youve_ever_made_at_your/c07j2yv
^  [2].  Just assuming that a [-v] option stands for --verbose.  Yep,
most of the time.  But not on a [pkill] command.
--http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-149235
^  [3].  I used that once to kill all evolution processes on my
machine:  'pkill -v evolution' ... believe me, next time I will read
the man-pages before I try an unknown option :-).
--http://www.mail-archive.com/ads...@vm.marist.edu/msg62476.html
^  [4].  Note to self: the '-v' in 'pkill -v $pid' does not mean
--verbose.  --http://www.df7cb.de/blog/2007/pkill.html
^  [5].  It turns out 'pkill -v x' is NOT 'verbose'; rather, it's
'kill all processes except x'. Kind of a bummer!
--http://twitter.com/kellyterryjones/status/4112024256
^  [6].  `pkill -v rsync` does NOT mean 'kill all rsync processes and
be verbose about it.' shamehangs head/shame
--http://twitter.com/mozai/status/5240550425
^  [7].  Many more examples are available if you do a Google search
for [ pkill -v ].

-- 
Jason Spiro: software/web developer, packager, trainer, IT consultant.
I support Linux, UNIX, Windows, and more. Contact me to discuss your needs.
+1 (416) 992-3445 / www.jspiro.com



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org