Package: xjobs
Version: 20110730-1
Severity: minor
Tags: upstream

Hello,

thanks for xargs, it's sometimes very handy tool to utilize all
available cores. BUT: it's also inconvenient for advanced shell users
in contrast to the claims in the manpage.

Example: I write a shell one-liner to do many similar things and
create a loop to repeat the work, like:

for x in `seq -f%03g 500` ; do gencfg skeleton.cfg node.$x.cfg -p nodeid=$x ; 
done

Now I would like to run it in parallel. Quick assumption after checking
manpage:

for x in `seq -f%03g 500` ; do echo gencfg skeleton.cfg node.$x.cfg -p 
nodeid=$x ; done | xjobs -j4 -1

But this does not work. Checking the manpage again... ok, moving the
executable from the command line to xjobs option:

for x in `seq -f%03g 500` ; do echo skeleton.cfg node.$x.cfg -p nodeid=$x ; 
done | xjobs -j4 -1 gencfg

But that does not work either. So what now, how I am supposed to pass
multiple arguments to the command? Ok, I know that I have a shell script
onliner so I could write a mini shell script, make it executable and
feed it with "seq ...| xjobs ./helper" but this looks like an ugly
kluge, IMHO.

Reading the manpage again, it tells to "advanced shell features ... use
as utility a shell of your preference". But how is that supposed to
work? To use "advanced features" I need to pass them as a inline script
argument after a special option (-c for sh, and similar reasoning
applies to many other interpreters, like perl -e "code argument").

Is there a workaround? I do not see any. The manpage is confusing too,
it tells to "escape spaces" and things like that, and also has an example
for sed'ing a name to add a > to it. All that looks suspicious. Why does
it not simply explain the background, i.e. does it open a subshell for
execution? If yes, when does it happen? This is an IMPORTANT thing
because shell-wrapped execution tends to create security vulnerabilities
that the user might be not really aware of in the beginning.

But back to original issue, it would be nice if xjobs had an option
which takes all subsequent arguments as bare arguments of that command.
Something similar to how it's done in xterm and friends, for example
(-e and everything after it ends as-is in argv[] of the command which is
argv[0], of course).

This would make the usage (command adaption) for my original use case
very simple:

for x in `seq -f%03g 500` ; do echo gencfg skeleton.cfg node.$x.cfg -p 
nodeid=$x 
; done | xjobs -1 -j4 -e sh -c

Regards,
Eduard.

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.1 (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages xjobs depends on:
ii  libc6  2.13-24

xjobs recommends no packages.

xjobs suggests no packages.

-- no debconf information

-- 
<plaisthos> Bei "/exec -o banner Linux rulez" wird bestimmt
        wegen flood gekickt oder? ;)
<Getty> plaisthos: mach das auf +debian.de ;)
<weasel> Getty: dann take ich den channel und kick ihn *G*



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to