GNU bug report logs - #30928
nice: add option to abort on failure to change priority

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: coreutils; Severity: wishlist; Reported by: L A Walsh <coreutils@HIDDEN>; dated Sat, 24 Mar 2018 19:50:02 UTC; Maintainer for coreutils is bug-coreutils@HIDDEN.
Changed bug title to 'nice: add option to abort on failure to change priority' from 'no error val returned by 'nice' failure?' Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Severity set to 'wishlist' from 'normal' Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 30928 <at> debbugs.gnu.org:


Received: (at 30928) by debbugs.gnu.org; 1 Apr 2018 17:03:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 01 13:03:11 2018
Received: from localhost ([127.0.0.1]:34454 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1f2gNq-0001Lp-Uo
	for submit <at> debbugs.gnu.org; Sun, 01 Apr 2018 13:03:11 -0400
Received: from zimbra.cs.ucla.edu ([131.179.128.68]:38256)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1f2gNo-0001Lc-Lu
 for 30928 <at> debbugs.gnu.org; Sun, 01 Apr 2018 13:03:09 -0400
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 3BE121616D2;
 Sun,  1 Apr 2018 10:03:02 -0700 (PDT)
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id SOpy5fi9yN_z; Sun,  1 Apr 2018 10:03:01 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 8D52A1616F5;
 Sun,  1 Apr 2018 10:03:01 -0700 (PDT)
X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id o4X6KEybV471; Sun,  1 Apr 2018 10:03:01 -0700 (PDT)
Received: from [192.168.1.9] (unknown [47.154.30.119])
 by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 67E341616D2;
 Sun,  1 Apr 2018 10:03:01 -0700 (PDT)
Subject: Re: bug#30928: no error val returned by 'nice' failure?
To: =?UTF-8?Q?P=c3=a1draig_Brady?= <P@HIDDEN>,
 L A Walsh <coreutils@HIDDEN>
References: <5AB6A8E6.2090606@HIDDEN>
 <16d003ef-5b33-fbf7-942d-10b41885f224@HIDDEN>
 <5AB6E00E.4010800@HIDDEN>
 <cc8682e3-6bb0-0213-ff59-2d4921f53508@HIDDEN>
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
Message-ID: <38265b4e-0647-ab26-b91e-ba212e454bab@HIDDEN>
Date: Sun, 1 Apr 2018 10:03:01 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.7.0
MIME-Version: 1.0
In-Reply-To: <cc8682e3-6bb0-0213-ff59-2d4921f53508@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 30928
Cc: 30928 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

P=C3=A1draig Brady wrote:
> I wonder could we special case `nice true`
> to indicate the nice return

That would lead to a problem where 'nice true' succeeds but 'nice cmd' (f=
or=20
whatever reason) does not. Perhaps the OS has a limit as to how many proc=
esses=20
you can 'nice', for example. It'd be safer to add an option to avoid such=
 race=20
conditions. Plus, as you mention it'd be less hacky, which means it'd be =
more=20
straightforward to document.




Information forwarded to bug-coreutils@HIDDEN:
bug#30928; Package coreutils. Full text available.

Message received at 30928 <at> debbugs.gnu.org:


Received: (at 30928) by debbugs.gnu.org; 31 Mar 2018 23:00:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 31 19:00:41 2018
Received: from localhost ([127.0.0.1]:33377 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1f2PUH-00077s-2r
	for submit <at> debbugs.gnu.org; Sat, 31 Mar 2018 19:00:41 -0400
Received: from mail.magicbluesmoke.com ([82.195.144.49]:35274)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <P@HIDDEN>) id 1f2PUF-00075S-8h
 for 30928 <at> debbugs.gnu.org; Sat, 31 Mar 2018 19:00:39 -0400
Received: from localhost.localdomain (unknown [76.21.115.186])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mail.magicbluesmoke.com (Postfix) with ESMTPSA id 05E189E46;
 Sun,  1 Apr 2018 00:00:37 +0100 (IST)
Subject: Re: bug#30928: no error val returned by 'nice' failure?
To: L A Walsh <coreutils@HIDDEN>, Paul Eggert <eggert@HIDDEN>
References: <5AB6A8E6.2090606@HIDDEN>
 <16d003ef-5b33-fbf7-942d-10b41885f224@HIDDEN>
 <5AB6E00E.4010800@HIDDEN>
From: =?UTF-8?Q?P=c3=a1draig_Brady?= <P@HIDDEN>
Message-ID: <cc8682e3-6bb0-0213-ff59-2d4921f53508@HIDDEN>
Date: Sat, 31 Mar 2018 16:00:36 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <5AB6E00E.4010800@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 30928
Cc: 30928 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

On 24/03/18 16:32, L A Walsh wrote:
> 
> 
> Paul Eggert wrote:
>> L A Walsh wrote:
>>> how do you tell if the resetting of the
>>> priority worked or failed?
>>
>> I guess you're supposed to look at stderr, which is what you did.
>>
>> This is the way 'nice' has behaved for quite some time, and it's what POSIX 
>> specifies. We'd need a real good reason to change it, given that changing it 
>> would no doubt break stuff.
> ---
> How about a flag, like -e for 'fail on failure to change priority' and
> (maybe less important or useful) '-w' to only return nice's return 
> value, with the posix error message returned for called app (if error).
> 
> So, 
>   nice -e --19 sleep 99
> would return immediately if not root with exit status for EPERM (and
> no text); sleep would not be executed.
>  
> and for -w case:
> 
>   nice -w --19 ls noexist
> would return status for EPERM, and message:
> ls: cannot access 'noexist': No such file or directory
> 
> Seems those would cover most possibly wants, though
> the first would be enough to determine if nice is going to work.
> 
> Not an earth-shattering change, but at least it would allow
> some way to check if nice is going to work or not so
> one could not use it where it would fail (and not
> generate an error message).

I wonder could we special case `nice true`
to indicate the nice return, so you could then:

  nice true && nice cmd || exit

That would be forwards compat,
and backwards compat in the sense it would degrade to the current situation.

It's probably a bit hacky though.

Pádraig




Information forwarded to bug-coreutils@HIDDEN:
bug#30928; Package coreutils. Full text available.

Message received at 30928 <at> debbugs.gnu.org:


Received: (at 30928) by debbugs.gnu.org; 24 Mar 2018 23:32:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 24 19:32:44 2018
Received: from localhost ([127.0.0.1]:51977 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ezseS-0006fI-Ct
	for submit <at> debbugs.gnu.org; Sat, 24 Mar 2018 19:32:44 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:41406
 helo=Ishtar.sc.tlinx.org) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <coreutils@HIDDEN>) id 1ezseQ-0006f9-2n
 for 30928 <at> debbugs.gnu.org; Sat, 24 Mar 2018 19:32:42 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
 by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
 w2ONWTAF060783; Sat, 24 Mar 2018 16:32:31 -0700
Message-ID: <5AB6E00E.4010800@HIDDEN>
Date: Sat, 24 Mar 2018 16:32:30 -0700
From: L A Walsh <coreutils@HIDDEN>
User-Agent: Thunderbird
MIME-Version: 1.0
To: Paul Eggert <eggert@HIDDEN>
Subject: Re: bug#30928: no error val returned by 'nice' failure?
References: <5AB6A8E6.2090606@HIDDEN>
 <16d003ef-5b33-fbf7-942d-10b41885f224@HIDDEN>
In-Reply-To: <16d003ef-5b33-fbf7-942d-10b41885f224@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 30928
Cc: 30928 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)



Paul Eggert wrote:
> L A Walsh wrote:
>> how do you tell if the resetting of the
>> priority worked or failed?
> 
> I guess you're supposed to look at stderr, which is what you did.
> 
> This is the way 'nice' has behaved for quite some time, and it's what POSIX 
> specifies. We'd need a real good reason to change it, given that changing it 
> would no doubt break stuff.
---
How about a flag, like -e for 'fail on failure to change priority' and
(maybe less important or useful) '-w' to only return nice's return 
value, with the posix error message returned for called app (if error).

So, 
  nice -e --19 sleep 99
would return immediately if not root with exit status for EPERM (and
no text); sleep would not be executed.
 
and for -w case:

  nice -w --19 ls noexist
would return status for EPERM, and message:
ls: cannot access 'noexist': No such file or directory

Seems those would cover most possibly wants, though
the first would be enough to determine if nice is going to work.

Not an earth-shattering change, but at least it would allow
some way to check if nice is going to work or not so
one could not use it where it would fail (and not
generate an error message).

Thanks,..






Information forwarded to bug-coreutils@HIDDEN:
bug#30928; Package coreutils. Full text available.

Message received at 30928 <at> debbugs.gnu.org:


Received: (at 30928) by debbugs.gnu.org; 24 Mar 2018 23:07:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 24 19:07:14 2018
Received: from localhost ([127.0.0.1]:51967 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ezsFm-00063t-1w
	for submit <at> debbugs.gnu.org; Sat, 24 Mar 2018 19:07:14 -0400
Received: from mout.kundenserver.de ([217.72.192.73]:52423)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1ezsFk-00063e-UH
 for 30928 <at> debbugs.gnu.org; Sat, 24 Mar 2018 19:07:13 -0400
Received: from [192.168.101.10] ([91.12.163.69]) by mrelayeu.kundenserver.de
 (mreue102 [212.227.15.183]) with ESMTPSA (Nemesis) id
 0MLy2e-1ewYKa43g4-007ihU; Sun, 25 Mar 2018 00:06:49 +0100
Subject: Re: bug#30928: no error val returned by 'nice' failure?
To: Paul Eggert <eggert@HIDDEN>, L A Walsh <coreutils@HIDDEN>,
 30928 <at> debbugs.gnu.org
References: <5AB6A8E6.2090606@HIDDEN>
 <16d003ef-5b33-fbf7-942d-10b41885f224@HIDDEN>
From: Bernhard Voelker <mail@HIDDEN>
Message-ID: <f2a02f84-920e-af4c-756a-03179079e6a5@HIDDEN>
Date: Sun, 25 Mar 2018 00:06:47 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.6.0
MIME-Version: 1.0
In-Reply-To: <16d003ef-5b33-fbf7-942d-10b41885f224@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Provags-ID: V03:K0:6pxPEGQbrrK27YiOOSUoi5m3N0w8U3YqH7murZttqSAR1lQQbH/
 gIY/lUrUq2es4ptOqJNFE7aQxysOalrGArXIhcQshaSwmvJbvG5J3QrKuCN54IflrlzHfSz
 lDstpnwGWrLl9YTga1d7HE1yM0QRhEFkoqYMpNUGJneKZKDzr5qqoTN2oZcya//k65DvhXU
 Wm+Yf2UoMDgweqPA+gkJw==
X-UI-Out-Filterresults: notjunk:1;V01:K0:slLqNnn0Qc4=:6jDQSMKSAn6xNFY5/tvjgn
 /XsrOHUl2cds7IK8eNjC0XPbux/tqtM7j0HS5k2UOMwmLc/rLooLkpyLUjYOzIlaB/2wzszZj
 xZEV+Ul+FKdM2KuO/lvoyXeGvxI4sOWAuZxg873WMDGogGtzIpxh0+l3LCL00YyKAU/8QmfFu
 T/mOE6E3oGRyg62bViSbQ0Gqu2T3cdkaTq+PM2o2ViK3O50ih8XTMA/MmQ6VIPOdh6aGoMezK
 XRG2a1sGrNzeOwJiv7Pm3uTU9SyxXF4nSncg+2lMMRGEWo8ucnPr3nt0S0OpILzGlFshc54XG
 +WD140trAzHBiiszbNmhIrUd5E8t3reBFf7NYKU741GqpNrXoutKO0rCdMoRsoN0Hwxa7irRM
 K91lzOE78ae90V3Fz0kZul42T7jHReKWsBATFPgEgSLmV4177Kcxy2V3kegTfJFizOcwp23hM
 +tU7JwRr5XNcUwps3p6i5NShdJBIBP3Hlu4zPrhEeW0v4rx2XIH//ha1y0DDDiyatqJGYuZaD
 gawHhClTjwbqcqOogOxhVnh2yFGS7baRzTxk0zL97lRBccJQdaLuKQDVexZ4YKnxqkfmkaUon
 0IHFsEUeEj1keUsoltTax5JLCQsvizYHLiodf4nVb6+rx0x4uitmI+kGrwOq+DeFjEEaSf4FK
 bBY5bxqerKNIpdcLEd9guDhB6XkT9vWxJU2vP8lAPNQSwvQ/kz0zhRGC5PGVMy5M4fmnPXjrE
 GpYEuviRTM7zqxhz9kSHrEq6qbm+Imy07/4v1bJ/H3PAeGooWUcfGeI6GEA=
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 30928
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

On 03/24/2018 10:09 PM, Paul Eggert wrote:
> L A Walsh wrote:
>> how do you tell if the resetting of the
>> priority worked or failed?
> 
> I guess you're supposed to look at stderr, which is what you did.
> 
> This is the way 'nice' has behaved for quite some time, and it's what POSIX 
> specifies. We'd need a real good reason to change it, given that changing it 
> would no doubt break stuff.

Anyway, it wouldn't harm to document this behavior in the Texinfo
manual... the sentence from the POSIX spec sounds quote good:

  http://pubs.opengroup.org/onlinepubs/9699919799/utilities/nice.html

  If the user lacks appropriate privileges to affect the nice value
  in the requested manner, the nice utility shall not affect the
  nice value; in this case, a warning message may be written to
  standard error, but this shall not prevent the invocation of
  /utility/ or affect the exit status.

Have a nice day,
Berny




Information forwarded to bug-coreutils@HIDDEN:
bug#30928; Package coreutils. Full text available.

Message received at 30928 <at> debbugs.gnu.org:


Received: (at 30928) by debbugs.gnu.org; 24 Mar 2018 21:09:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 24 17:09:31 2018
Received: from localhost ([127.0.0.1]:51911 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ezqPr-0001Oh-KQ
	for submit <at> debbugs.gnu.org; Sat, 24 Mar 2018 17:09:31 -0400
Received: from zimbra.cs.ucla.edu ([131.179.128.68]:45454)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1ezqPo-0001OR-5U
 for 30928 <at> debbugs.gnu.org; Sat, 24 Mar 2018 17:09:28 -0400
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id D380B1616AC;
 Sat, 24 Mar 2018 14:09:22 -0700 (PDT)
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id ELhR3qMdSgwY; Sat, 24 Mar 2018 14:09:22 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id E79EB1616B5;
 Sat, 24 Mar 2018 14:09:21 -0700 (PDT)
X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id CAUFtSYyJEL3; Sat, 24 Mar 2018 14:09:21 -0700 (PDT)
Received: from [192.168.1.9] (unknown [47.154.30.119])
 by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id AF9C01616AC;
 Sat, 24 Mar 2018 14:09:21 -0700 (PDT)
Subject: Re: bug#30928: no error val returned by 'nice' failure?
To: L A Walsh <coreutils@HIDDEN>, 30928 <at> debbugs.gnu.org
References: <5AB6A8E6.2090606@HIDDEN>
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
Message-ID: <16d003ef-5b33-fbf7-942d-10b41885f224@HIDDEN>
Date: Sat, 24 Mar 2018 14:09:21 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.6.0
MIME-Version: 1.0
In-Reply-To: <5AB6A8E6.2090606@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 30928
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

L A Walsh wrote:
> how do you tell if the resetting of the
> priority worked or failed?

I guess you're supposed to look at stderr, which is what you did.

This is the way 'nice' has behaved for quite some time, and it's what POSIX 
specifies. We'd need a real good reason to change it, given that changing it 
would no doubt break stuff.




Information forwarded to bug-coreutils@HIDDEN:
bug#30928; Package coreutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 24 Mar 2018 19:49:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 24 15:49:02 2018
Received: from localhost ([127.0.0.1]:51776 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ezp9x-0007lz-UW
	for submit <at> debbugs.gnu.org; Sat, 24 Mar 2018 15:49:02 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41655)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <coreutils@HIDDEN>) id 1ezp9w-0007lj-29
 for submit <at> debbugs.gnu.org; Sat, 24 Mar 2018 15:49:00 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1ezp8m-0002YV-Pu
 for submit <at> debbugs.gnu.org; Sat, 24 Mar 2018 15:48:54 -0400
Received: from lists.gnu.org ([2001:4830:134:3::11]:58458)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <coreutils@HIDDEN>) id 1ezp8m-0002YH-ME
 for submit <at> debbugs.gnu.org; Sat, 24 Mar 2018 15:47:48 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:57350)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1ezp4b-00032l-J8
 for bug-coreutils@HIDDEN; Sat, 24 Mar 2018 15:47:48 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1ezoyb-0005DJ-M9
 for bug-coreutils@HIDDEN; Sat, 24 Mar 2018 15:38:23 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:41422
 helo=Ishtar.sc.tlinx.org)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <coreutils@HIDDEN>) id 1ezoyb-0005AU-C9
 for bug-coreutils@HIDDEN; Sat, 24 Mar 2018 15:37:17 -0400
Received: from [192.168.3.12] (Athenae [192.168.3.12])
 by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
 w2OJbADB087122
 for <bug-coreutils@HIDDEN>; Sat, 24 Mar 2018 12:37:13 -0700
Message-ID: <5AB6A8E6.2090606@HIDDEN>
Date: Sat, 24 Mar 2018 12:37:10 -0700
From: L A Walsh <coreutils@HIDDEN>
User-Agent: Thunderbird
MIME-Version: 1.0
To: bug-coreutils@HIDDEN
Subject: no error val returned by 'nice' failure?
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
 timestamps) [generic] [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)


I executed a command:

nice --19 sleep 5

and hoped to get back a status as to whether or not I was
allowed to use a negative priority, since on Windows,
anyone in the Admin group can set a priority, with
the above command running sleep at 'High' priority, but
on linux:

>  nice --19 sleep 1
nice --19 sleep 1
nice: cannot set niceness: Permission denied
>  echo $?
0

nice has an error setting the priority, but doesn't
set any status in the return code.

Shouldn't nice's exit value be something like
EPERM if it couldn't set the priority -- whether or
not it executed the command...

Otherwise, how do you tell if the resetting of the
priority worked or failed?






Acknowledgement sent to L A Walsh <coreutils@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#30928; Package coreutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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