Re: [PATCH] Add -p option to ps command

2006-02-16 Thread Corinna Vinschen
On Feb 14 07:12, Jerry D. Hedden wrote:
 Attached is a patch to add a -p option to the ps command to show
 information for only a single PID:  ps -p PID
 This option is available on other implementations of ps (e.g., Solaris).

Thanks for the patch.  It's barely short enough so that we decided to
put it in despite the fact that you have no copyright assignment
in place.  Please read http://cygwin.com/contrib.html for further
information about how to contribute.  Note especially the fact that
we need your copyright assignment for any substantial patch.

I applied your patch with some minor changes.  I fixed the wrongly set
curly braces at one point, I added the descriptive text to utils.sgml
(cygwin-ug-net.sgml is only a generated file) and, most important, I
added a ChangeLog entry.


Thanks,
Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader  cygwin AT cygwin DOT com
Red Hat


RE: [PATCH] Add -p option to ps command

2006-02-16 Thread Jerry D. Hedden
 On Feb 14 07:12, Jerry D. Hedden wrote:
  Attached is a patch to add a -p option to the ps command to show
  information for only a single PID:  ps -p PID

 Corrina Vinschen replied:
 Thanks for the patch.  It's barely short enough so that we decided to
 put it in despite the fact that you have no copyright assignment
 in place.

I will send one in today.

 I applied your patch with some minor changes.

Thanks.  I realized one minor oversight.  Using -p should imply -a so
that even if the PID is not owned by the current user, it will still
get listed.  I've attached a patch for this (just a one line addition)
that builds on top of the previous patch (i.e., apply it against
version 1.20 of ps.cc).  Thanks again.
Index: src/winsup/utils/ps.cc
===
--- ps.cc  1.20
+++ ps.cc
@@ -286,6 +286,7 @@
break;
   case 'p':
proc_id = atoi (optarg);
+   aflag = 1;
break;
   case 's':
sflag = 1;


Re: [PATCH] Add -p option to ps command

2006-02-16 Thread Corinna Vinschen
On Feb 16 07:58, Jerry D. Hedden wrote:
 Thanks.  I realized one minor oversight.  Using -p should imply -a so
 that even if the PID is not owned by the current user, it will still
 get listed.  I've attached a patch for this (just a one line addition)
 that builds on top of the previous patch (i.e., apply it against
 version 1.20 of ps.cc).  Thanks again.

 Index: src/winsup/utils/ps.cc
 ===
 --- ps.cc  1.20
 +++ ps.cc
 @@ -286,6 +286,7 @@
   break;
case 'p':
   proc_id = atoi (optarg);
 + aflag = 1;
   break;
case 's':
   sflag = 1;

What about the ChangeLog entry?  http://cygwin.com/contrib.html


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader  cygwin AT cygwin DOT com
Red Hat


Re: [PATCH] cygcheck: follow symbolic links

2006-02-16 Thread Igor Peshansky
On Thu, 16 Feb 2006, Corinna Vinschen wrote:

 On Feb 13 13:44, Igor Peshansky wrote:
  As promised in http://cygwin.com/ml/cygwin/2006-02/msg00071.html, the
  attached patch teaches cygcheck to follow symlinks when looking for
  executables, and also flags scripts.  Sorry, had legal delays in sending
  this (as you can see, I had this working since 02/03).  Comments welcome.
  Igor

 A few comments.

Thanks for looking at it and for the comments.

 - Most of your patch should go into path.cc so it can be reused, for
   instance in strace.

Agreed -- that's why I put that TODO in there. :-)  Should I move it in
the next iteration of the patch?

 - Your readlink lacks checking the file attributes.  Shortcut symlinks
   require a R/O attribute to be valid, old-style symlinks require the
   SYSTEM attribute.

Ouch.  Will fix, thanks.

 - Couldn't you just reuse the readlink implementation in ../cygwin/path.cc
   as is, to avoid having to different implementations?

Umm, most of that code is very general purpose, and has too much extra
stuff in it.  I basically used part of it (symlink_info::check_shortcut)
for my implementation.  I wanted something lightweight and easy to
understand (also, the code in path.cc doesn't check for PE headers, so I
had to write that part anyway).
Igor
-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED] | [EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_Igor Peshansky, Ph.D. (name changed!)
 |,4-  ) )-,_. ,\ (  `'-'   old name: Igor Pechtchanski
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte.
But no -- you are no fool; you call yourself a fool, there's proof enough in
that! -- Rostand, Cyrano de Bergerac


RE: [PATCH] Add -p option to ps command

2006-02-16 Thread Jerry D. Hedden
  Original Message 
 Subject: Re: [PATCH] Add -p option to ps command
 From: Corinna Vinschen [EMAIL PROTECTED]
 Date: Thu, February 16, 2006 10:09 am
 To: cygwin-patches@cygwin.com
 
 On Feb 16 07:58, Jerry D. Hedden wrote:
  Thanks.  I realized one minor oversight.  Using -p should imply -a so
  that even if the PID is not owned by the current user, it will still
  get listed.  I've attached a patch for this (just a one line addition)
  that builds on top of the previous patch (i.e., apply it against
  version 1.20 of ps.cc).  Thanks again.
 
  Index: src/winsup/utils/ps.cc
  ===
  --- ps.cc  1.20
  +++ ps.cc
  @@ -286,6 +286,7 @@
  break;
 case 'p':
  proc_id = atoi (optarg);
  +   aflag = 1;
  break;
 case 's':
  sflag = 1;
 
 What about the ChangeLog entry?  http://cygwin.com/contrib.html

I'll get this right one of these days.  Thanks for your patience.

Changelog entry:

2006-02-16  Jerry D. Hedden  [EMAIL PROTECTED]

* ps.cc (main): -p implies -a