After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 671162 - jhbuild doesn't work if old chrt or ionice is installed
jhbuild doesn't work if old chrt or ionice is installed
Status: RESOLVED FIXED
Product: jhbuild
Classification: Infrastructure
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Jhbuild maintainers
Jhbuild QA
Depends on:
Blocks:
 
 
Reported: 2012-03-01 19:46 UTC by Marcin Wojdyr
Modified: 2012-03-07 14:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
terminal: Avoid passing invalid arguments if ionice/chrt are too old (1.66 KB, patch)
2012-03-01 20:29 UTC, Colin Walters
none Details | Review
terminal: Avoid passing invalid arguments if ionice/chrt are too old (1.94 KB, patch)
2012-03-05 14:39 UTC, Colin Walters
committed Details | Review

Description Marcin Wojdyr 2012-03-01 19:46:29 UTC
I'm trying to use jhbuild for another project and my colleague just found this issue when using it on OpenSuse 11.0.

Change 0e453d94 introduced nice_build option that uses chrt and ionice programs if found. The presence of these programs is checked, but versions or accepted parameters not. Old versions of these programs take different parameters and jhbuild doesn't work.

Here are parameters of that versions (chrt is missing --idle):

chrt (util-linux-ng 2.13.1)
usage: chrt [options] [prio] [pid | cmd [args...]]
manipulate real-time attributes of a process
  -b, --batch                        set policy to SCHED_BATCH
  -f, --fifo                         set policy to SCHED_FIFO
  -p, --pid                          operate on existing given pid
  -m, --max                          show min and max valid priorities
  -o, --other                        set policy to SCHED_OTHER
  -r, --rr                           set policy to SCHED_RR (default)
  -h, --help                         display this help
  -v, --verbose                      display status information
  -V, --version                      output version information

You must give a priority if changing policy.



Usage: ionice [OPTIONS] [COMMAND [ARG]...]
Sets or gets process io scheduling class and priority.

        -n	Class data (typically 0-7, lower being higher prio)
        -c	Scheduling class
                        1: realtime, 2: best-effort, 3: idle
        -p	Process pid
        -h	This help page
Comment 1 Colin Walters 2012-03-01 20:29:47 UTC
Created attachment 208813 [details] [review]
terminal: Avoid passing invalid arguments if ionice/chrt are too old
Comment 2 Colin Walters 2012-03-01 20:37:43 UTC
Can you test?
Comment 3 Marcin Wojdyr 2012-03-01 20:51:03 UTC
Thanks for quick reply!
I'll test it tomorrow.
Comment 4 Marcin Wojdyr 2012-03-02 19:08:37 UTC
it doesn't work

major problem is that ionice returns 0 even if it gets invalid option:

>>> subprocess.call(['ionice', '-c', '3', '-t', 'true'])
ionice: invalid option -- t
Usage: ionice [OPTIONS] [COMMAND [ARG]...]
Sets or gets process io scheduling class and priority.

        -n      Class data (typically 0-7, lower being higher prio)
        -c      Scheduling class
                        1: realtime, 2: best-effort, 3: idle
        -p      Process pid
        -h      This help page

Jens Axboe <axboe@suse.de> (C) 2005
0


and minor issue is that these error messages go to the terminal.

I guess you will need to parse stdout or stderr to determine if ionice works.
The first line ("invalid option") goes to stderr, the usage goes to stdout.
Comment 5 Colin Walters 2012-03-05 14:39:32 UTC
Created attachment 209002 [details] [review]
terminal: Avoid passing invalid arguments if ionice/chrt are too old

Check ionice's stderr, ensure it's empty
Comment 6 Colin Walters 2012-03-06 18:08:11 UTC
Does the above patch work?
Comment 7 Marcin Wojdyr 2012-03-07 14:45:04 UTC
works!
thanks!
Comment 8 Colin Walters 2012-03-07 14:47:39 UTC
Attachment 209002 [details] pushed as aac1075 - terminal: Avoid passing invalid arguments if ionice/chrt are too old