Debian Bug report logs - #44039
libc0.3: nice changes priority of parent shell

Package: libc0.3; Maintainer for libc0.3 is GNU Libc Maintainers <debian-glibc@lists.debian.org>; Source for libc0.3 is src:eglibc.

Reported by: Marcus.Brinkmann@ruhr-uni-bochum.de

Date: Fri, 3 Sep 1999 03:33:01 UTC

Severity: normal

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#44039; Package hurd. Full text and rfc822 format available.

Acknowledgement sent to Marcus.Brinkmann@ruhr-uni-bochum.de:
New bug report received and forwarded. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Marcus.Brinkmann@ruhr-uni-bochum.de
To: submit@bugs.debian.org
Subject: hurd: nice changes priority of parent shell
Date: Fri, 3 Sep 1999 05:06:31 +0200
Package: hurd
Version: N/A
Severity: normal

Hello,

$ nice
0
$ nice echo Hi!
Hi!
$ nice
10

This is not what I expect (and get under Linux). I would expect the "echo"
command to run with priority 10, but not change the priority of the current
shell. Is this a bug or a limitation of the current implementation?

(I will try to provide more info / isolate a C program later, if necessary)

Thanks,
Marcus

-- System Information
Debian Release: potato
Kernel Version: Linux ulysses 2.2.10-ac9 #1 Mit Jul 14 01:43:01 CEST 1999 i586 unknown



Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#44039; Package hurd. Full text and rfc822 format available.

Acknowledgement sent to Mike Kienenberger <mkienenb@alaska.net>:
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>. Full text and rfc822 format available.

Message #10 received at 44039@bugs.debian.org (full text, mbox):

From: Mike Kienenberger <mkienenb@alaska.net>
To: 44039@bugs.debian.org, Marcus.Brinkmann@ruhr-uni-bochum.de
Subject: Re: Bug#44039: hurd: nice changes priority of parent shell
Date: Fri, 03 Sep 1999 11:11:55 -0800
Marcus.Brinkmann@ruhr-uni-bochum.de wrote:
> Package: hurd
> Version: N/A
> Severity: normal
> 
> Hello,
> 
> $ nice
> 0
> $ nice echo Hi!
> Hi!
> $ nice
> 10
> 
> This is not what I expect (and get under Linux). I would expect the "echo"
> command to run with priority 10, but not change the priority of the current
> shell. Is this a bug or a limitation of the current implementation?
> 
> (I will try to provide more info / isolate a C program later, if necessary)

Depending on your shell, echo might be a built-in command of that shell.
The operation of "nice" on a built-in is probably undefined (do nothing? or
nice the shell instead?)

Try using "nice /bin/echo Hi!" and see if that makes a difference.

-Mike Kienenberger
 mkienenb@alaska.net




Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#44039; Package hurd. Full text and rfc822 format available.

Acknowledgement sent to Roland McGrath <roland@gnu.org>:
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>. Full text and rfc822 format available.

Message #15 received at 44039@bugs.debian.org (full text, mbox):

From: Roland McGrath <roland@gnu.org>
To: Marcus.Brinkmann@ruhr-uni-bochum.de, 44039@bugs.debian.org
Subject: Re: Bug#44039: hurd: nice changes priority of parent shell
Date: Sun, 5 Sep 1999 04:42:34 -0400
Let me know what effect this libc patch has on that:

1999-09-05  Roland McGrath  <roland@baalperazim.frob.com>

	* hurd/hurdprio.c (_hurd_priority_which_map): If WHO is zero default
	it to getpid () for PRIO_PROCESS, geteuid () for PRIO_USER.

Index: hurdprio.c
===================================================================
RCS file: /glibc/cvsfiles/libc/hurd/hurdprio.c,v
retrieving revision 1.7.2.1
diff -u -b -p -r1.7.2.1 hurdprio.c
--- hurdprio.c	1999/07/26 23:27:02	1.7.2.1
+++ hurdprio.c	1999/09/05 08:41:56
@@ -36,7 +36,7 @@ _hurd_priority_which_map (enum __priorit
     {
     case PRIO_PROCESS:
       npids = 1;
-      pids[0] = who;
+      pids[0] = who ?: getpid (); /* XXX function could special-case self? */
       err = 0;
       break;
 
@@ -45,6 +45,8 @@ _hurd_priority_which_map (enum __priorit
       break;
 
     case PRIO_USER:
+      if (who == 0)
+	who = geteuid ();
       err = __USEPORT (PROC, __proc_getallpids (port, &pids, &npids));
       break;
 


Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#44039; Package hurd. Full text and rfc822 format available.

Acknowledgement sent to Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>:
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>. Full text and rfc822 format available.

Message #20 received at 44039@bugs.debian.org (full text, mbox):

From: Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>
To: Roland McGrath <roland@gnu.org>
Cc: 44039@bugs.debian.org
Subject: Re: Bug#44039: hurd: nice changes priority of parent shell
Date: Mon, 6 Sep 1999 04:25:42 +0200
On Sun, Sep 05, 1999 at 04:42:34AM -0400, Roland McGrath wrote:
> Let me know what effect this libc patch has on that:
> 
> 	* hurd/hurdprio.c (_hurd_priority_which_map): If WHO is zero default
> 	it to getpid () for PRIO_PROCESS, geteuid () for PRIO_USER.

It's better now. "nice command" does only change the priority of the child
process when run as root.

There is another problem now that nice/renice returns a bogus error message
if you try to lower the priority below 0. The error message is bogus because
the priority is indeed set, as the below transcript proves.

Another minor nit are the following warnings:

hurdprio.c: In function `_hurd_priority_which_map':
hurdprio.c:39: warning: implicit declaration of function `getpid'
hurdprio.c:49: warning: implicit declaration of function `geteuid'

Here is the script:

Script started on Mon Sep  6 04:15:57 1999
hurd:/tests# renice 0 150
150: old priority 0, new priority 0
hurd:/tests# renice 10 150
150: old priority 0, new priority 10
hurd:/tests# renice 20 150
150: old priority 10, new priority 20
hurd:/tests# renice 30 150
150: old priority 20, new priority 20

Mmmh. Okay. Raising priority up to 20 works.

hurd:/tests# renice 0 150
150: old priority 20, new priority 0
hurd:/tests# renice -10 150
renice: 150: setpriority: Permission denied

Hu?

hurd:/tests# renice 0 150
150: old priority -10, new priority 0

Ah! It did change the priority, but anyway gave a bogus error.

hurd:/tests# renice -20 150
renice: 150: setpriority: Permission denied
hurd:/tests# renice 0 150
150: old priority -20, new priority 0

Again.

hurd:/tests# renice -30 150
renice: 150: setpriority: Permission denied
hurd:/tests# renice 0 150
150: old priority -20, new priority 0

Okay, lower border is honoured.

Thanks,
Marcus

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org  Check Key server 
Marcus Brinkmann              GNU    http://www.gnu.org    for public PGP Key 
Marcus.Brinkmann@ruhr-uni-bochum.de                        PGP Key ID 36E7CD09
http://homepage.ruhr-uni-bochum.de/Marcus.Brinkmann/


Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#44039; Package hurd. Full text and rfc822 format available.

Acknowledgement sent to Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>:
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>. Full text and rfc822 format available.

Message #25 received at 44039@bugs.debian.org (full text, mbox):

From: Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>
To: Roland McGrath <roland@gnu.org>
Cc: 44039@bugs.debian.org
Subject: Re: Bug#44039: hurd: nice changes priority of parent shell
Date: Sun, 3 Dec 2000 13:54:00 +0100
On Mon, Sep 06, 1999 at 04:25:42AM +0200, Marcus Brinkmann wrote:
> On Sun, Sep 05, 1999 at 04:42:34AM -0400, Roland McGrath wrote:
> > Let me know what effect this libc patch has on that:
> > 
> > 	* hurd/hurdprio.c (_hurd_priority_which_map): If WHO is zero default
> > 	it to getpid () for PRIO_PROCESS, geteuid () for PRIO_USER.
> 
> It's better now. "nice command" does only change the priority of the child
> process when run as root.
> 
> There is another problem now that nice/renice returns a bogus error message
> if you try to lower the priority below 0. The error message is bogus because
> the priority is indeed set, as the below transcript proves.

The transcript doesn't show the full truth. The priority of the task is set,
but not of the individual threads. The reason is the following check in
thread_priority (gnumach/kern/task.c):

    /*
     *  Check for violation of max priority
     */
    if (priority < thread->max_priority) {
        ret = KERN_FAILURE;
    }

We need to adjust the max_priority. It might be possible to change the
max_priority to the lowest value at task creation time, not in the kernel,
but in the Hurd servers / GLibC, whereever tasks are created.

Or maybe we can call thread_max_priority in libc/sysdeps/mach/hurd.c, or
something like that. There is also threads_set_own_priority, which might be
useful.

Marcus

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de



Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>:
Bug#44039; Package hurd. Full text and rfc822 format available.

Acknowledgement sent to Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>:
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>. Full text and rfc822 format available.

Message #30 received at 44039@bugs.debian.org (full text, mbox):

From: Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>
To: 44039@bugs.debian.org
Subject: nice is not implemented correctly
Date: Mon, 29 Oct 2001 22:40:44 +0100
Hi,

the implementation of setpriority is broken, as it doesn't allow the super
user to lower the priority of the task *and all threads it contains* below
the current minimal priority of the threads/processor set (I am liberally
mixing POSIX priorities with Mach concepts here).  Also, it reports the
tasks priority, but this is not the acutal or enforced priority (for
example, a normal user can lower the priority of a task to -10, but willg et
an error, and indeed the threads won't have the desired priority).

This needs more work. Of course, we only need to give a consistent view in
the POSIX world if the user doesn't use Mach calls directly.  I suggest that
if task_priority fails, it is called again with the old priority to make
the getpriority report the correct value.

If the user is the superuser, he can request the processor set ports and use
that to set the threads max (for POSIX: min) priority.

All this ignores the max priority of processor sets, this is something I
haven't checked yet.  It seems to me we should set the processor sets max
priority to the highest value by default.

Actually, I haven't really spent too much thought on this, maybe someone can
investigate the remaining details and develop patches for glibc (and maybe
proc, which would set the processor sets priorities, I think).

If the Mach picture is not good enough, we might save the priority of a
task/thread in proc.  From a first glance, I don't think that it is needed.

Thanks,
Marcus


-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de



Information forwarded to debian-bugs-dist@lists.debian.org, GNU Hurd Maintainers <bug-hurd@gnu.org>, hurd@packages.qa.debian.org:
Bug#44039; Package hurd. Full text and rfc822 format available.

Acknowledgement sent to Robert Millan <zeratul2@wanadoo.es>:
Extra info received and forwarded to list. Copy sent to GNU Hurd Maintainers <bug-hurd@gnu.org>, hurd@packages.qa.debian.org. Full text and rfc822 format available.

Message #35 received at 44039@bugs.debian.org (full text, mbox):

From: Robert Millan <zeratul2@wanadoo.es>
To: Jeff Bailey <jbailey@nisa.net>
Cc: debian-hurd@lists.debian.org, 44039@bugs.debian.org, 190581@bugs.debian.org
Subject: Re: status of coreutils
Date: Fri, 25 Apr 2003 19:38:48 +0200
reassign 44039 libc0.3
retitle 44039 libc0.3: nice changes priority of parent shell
thanks

On Fri, Apr 25, 2003 at 10:19:17AM -0700, Jeff Bailey wrote:
> On Fri, Apr 25, 2003 at 06:03:35PM +0200, Robert Millan wrote:
> 
> > I checked the libc0.3 bug list before reporting. what is a libc0.3 bug doing in the hurd package?
> 
> We've been sloppy in the past about how things were assigned - Generally
> if it was a Hurd-specific bug it went into the Hurd package,
> since the Hurd maintainers were looking there, and not in the 
> glibc bugs.

I see.. well gnumach, hurd and libc0.3 are part of the same system but
we should have sorted their respective bugs.

Glibc maintainers: bug #44039 is not exactly the same as #190581, so
i'm not merging. i'd say that #44039 is a "multibug" that contains a patch
which fixes #190581, but doesn't fix all the bugs in #44039

> Feel free to reassign it.

done.

-- 
Robert Millan

make: *** No rule to make target `war'.  Stop.

Another world is possible - Just say no to genocide



Bug reassigned from package `hurd' to `libc0.3'. Request was from Robert Millan <zeratul2@wanadoo.es> to control@bugs.debian.org. Full text and rfc822 format available.

Changed Bug title. Request was from Robert Millan <zeratul2@wanadoo.es> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, GNU Libc Maintainers <debian-glibc@lists.debian.org>:
Bug#44039; Package libc0.3. Full text and rfc822 format available.

Acknowledgement sent to Aurelien Jarno <aurelien@aurel32.net>:
Extra info received and forwarded to list. Copy sent to GNU Libc Maintainers <debian-glibc@lists.debian.org>. Full text and rfc822 format available.

Message #44 received at 44039@bugs.debian.org (full text, mbox):

From: Aurelien Jarno <aurelien@aurel32.net>
To: 44039@bugs.debian.org, 190581@bugs.debian.org, Marcus.Brinkmann@ruhr-uni-bochum.de, Robert Millan <rmh@aybabtu.com>
Cc: debian-hurd@lists.debian.org
Subject: nice on Hurd
Date: Sat, 18 Feb 2006 23:41:05 +0100
Hi,

The nice() code glibc seems to have changed a lot in the glibc since
these two bugs have been reported. Could you (or somebody from
debian-hurd), please give a try to see if the problem is still there?

Thanks,
Aurelien

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net



Information forwarded to debian-bugs-dist@lists.debian.org, GNU Libc Maintainers <debian-glibc@lists.debian.org>:
Bug#44039; Package libc0.3. Full text and rfc822 format available.

Acknowledgement sent to Michael Banck <mbanck@debian.org>:
Extra info received and forwarded to list. Copy sent to GNU Libc Maintainers <debian-glibc@lists.debian.org>. Full text and rfc822 format available.

Message #49 received at 44039@bugs.debian.org (full text, mbox):

From: Michael Banck <mbanck@debian.org>
To: 44039@bugs.debian.org, 190581@bugs.debian.org
Subject: Re: nice on Hurd
Date: Sun, 19 Feb 2006 02:02:45 +0100
On Sat, Feb 18, 2006 at 11:41:05PM +0100, Aurelien Jarno wrote:
> The nice() code glibc seems to have changed a lot in the glibc since
> these two bugs have been reported. Could you (or somebody from
> debian-hurd), please give a try to see if the problem is still there?

I think it is still there.


Michael

-- 
Michael Banck
Debian Developer
mbanck@debian.org
http://www.advogato.org/person/mbanck/diary.html



Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Apr 20 04:09:52 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.