bugmake - Bugs: bug #56701, Do not allow -j without a number

 
 

bug #56701: Do not allow -j without a number

Submitter:  None
Submitted:  Wed 31 Jul 2019 02:55:34 PM UTC
   
 
Severity:  3 - Normal Item Group:  Enhancement
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  4.2.1 Operating System:  POSIX-Based
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 23 Jun 2021 12:36:08 PM UTC, comment #6: 

For some reason I always assumed -j without an argument was equivalent to -j $(nproc).

It certainly can't be made illegal without breaking compatibility with existing systems that execute make.

Making it equivalent to any number other than unlimited could break compatibility if there is some script out there which relies on infinite parallel jobs to avoid a deadlock. -l is likely to avoid this since deadlocked jobs will not contribute to system load.

immibis
Mon 26 Aug 2019 06:13:48 PM UTC, comment #5: 

Well gnulib is not what I call portable. So if the sysconf/getconf calls
are not around to give us _NPROCESSORS_ONLN or even _NPROCESSORS_CONF
then no way should some hack attempt be made to extract that data. No
promise the data is available at all in a portable manner anyways and
get_nprocs_conf should be entirely avoided.

The "defacto" standard which has worked for the past three decades
should not be messed with unless there exist some really amazingly
solid arguments.  As for a system exhausting all resources due to a
badly specified set of parameters to "make" one could argue that any
user can do worse damage with "rm -rf *" and that is the users issue
entirely.  Giving the user a hug should not be required here.

Dennis

Dennis Clarke <blastwave>
Mon 26 Aug 2019 03:04:44 PM UTC, comment #4: 

FWIW, nproc(1) is part of GNU coreutils, it is based on nproc module from gnulib, so the way it works is probably as much portable as one can get.

If GNU make was using gnulib directly, it would cost just a single invocation of num_processors.

Dmitry V. Levin <ldv>
Mon 26 Aug 2019 01:58:28 PM UTC, comment #3: 

First, "$(nproc)" is not easy to obtain in a portable manner; this has been asked many times before.

Second, I'm not sure if using -l $(nproc) is the right way to handle this.  It's still a change in behavior, just one that's more obscure.

Let's still think and discuss :)

Paul D. Smith <psmith>
Group administrator
Mon 26 Aug 2019 12:47:57 PM UTC, comment #2: 

Let's try to fix this issue and avoid introducing any regressions.

For example, if -j is given without an argument and no -l option is provided, behave as if -j -l $(nproc) was specified.

Dmitry V. Levin <ldv>
Mon 26 Aug 2019 12:35:15 PM UTC, comment #1: 

Actually -j without a number is useful: it's used in conjunction with the -l option to allow parallelism to be limited by system load rather than an explicit number of outstanding jobs.

I implemented a change which requires the -l option to be provided if -j is given without an argument, else you get an error.

However that's a large backward-compatibility change so I'm not sure about it.  Just as an example, I had to modify quite a number of tests in the GNU make regression test suite after making this change.  Of course, it's quite reasonable to say that the usages in the regression test suite are not appropriate to "real world" usages.

I'll need to think about this.  If anyone has opinions on whether this would be a good change and/or how much breakage it would cause please let me know.

I'm changing this to an enhancement because the current behavior is (a) documented, (b) useful, and (c) how make has worked for 30+ years.  The question is can we find a way to avoid the downsides, and is the cost in backward-compatibiity worth it.

Paul D. Smith <psmith>
Group administrator
Wed 31 Jul 2019 02:55:34 PM UTC, original submission:  

If there is no number with -j, make uses infinite resources, compiling the Linux kernel stops to out of memory error and causes Xfce desktop to reboot login via the Linux OOM killer.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by immibis (Posted a comment)
  • -email is unavailable- added by blastwave (Posted a comment)
  • -email is unavailable- added by ldv (Posted a comment)
  • -email is unavailable- added by psmith (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-08-26 psmith Item GroupBug Enhancement

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code