Bug 29844

Summary: [PATCH] setpgrp does not behave as manual says
Product: Base System Reporter: SANETO Takanori <sanewo>
Component: kernAssignee: David Schultz <das>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
file.diff none

Description SANETO Takanori 2001-08-18 12:00:02 UTC
As superuser, setpgrp(1,1) fails (errno=ESRCH).

setpgrp(2) says:

	If the invoker is not the super-user, then the affected
	process must have the same effective user-id as the invoker or
	be a descendant of the invoking process.

Actually, document says nothing about what should happen when the invoker is
the super-user. So it might not be a software bug, but a poor documentation...

Fix: 1. Fix the document

Or

2. Fix the kernel source
How-To-Repeat: 
Compile following program:

main() { if (setpgrp(1,1) < 0) perror("setpgrp"); }

and run it as root.
Comment 1 Jens Schweikhardt freebsd_committer freebsd_triage 2002-09-20 18:37:13 UTC
Responsible Changed
From-To: freebsd-bugs->standards

Can the standards people please have a look at this and decide 
which of the patches is the way to go?
Comment 2 David Schultz freebsd_committer freebsd_triage 2004-02-08 12:04:48 UTC
Responsible Changed
From-To: standards->das

I'll take a look at this.
Comment 3 David Schultz freebsd_committer freebsd_triage 2004-02-08 12:39:41 UTC
State Changed
From-To: open->closed

The documentation was outdated.  Fixed in 
src/lib/libc/sys/setpgid.2,v 1.14.  Thanks for the report!
Comment 4 Martin Kammerhofer 2004-08-25 17:29:38 UTC
This PR is closed. However the fix still needs to be MFC.