Bug 232652 - runcon shouldn't reorder parameters
runcon shouldn't reorder parameters
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Ondrej Vasik
Depends On:
  Show dependency treegraph
Reported: 2007-03-16 10:52 EDT by Ulrich Drepper
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-10-29 07:54:20 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Ulrich Drepper 2007-03-16 10:52:47 EDT
Description of problem:
The runcon program reorders parameters since it uses the default getopt_long
setup.  But runcon differs from su here since su does not take a command and its
parameters on the command line.  Trying to run

  runcon -t unconfined_t /usr/sbin/prelink --no-update-cache some/binary

fails since --no-update-cache is no option for runcon.  But runcon shouldn't use
it in the first place.  Of course one can add -- as a parameter before the
program name but this is not how other programs with similar interface work,
they don't require this kind of knowledge from the user (strace, sh, ...).

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.echo 'int main(){return 0;}' > u.c
2.gcc -o u u.c
3.runcon -t unconfined_t /usr/sbin/prelink -N ./u
Actual results:
runcon: invalid option -- N

Expected results:

Additional info:
The solution is easy: add + as the first character in the option string of the
getopt_long call.  I very much doubt any script today depends on this level of
option reordering so it should not introduce any regression.
Comment 1 Jim Meyering 2007-03-18 14:25:25 EDT
Hi Uli,
Thanks for the report.  I've fixed it on the selinux branch, upstream:
Comment 2 Ondrej Vasik 2007-10-29 07:54:20 EDT
Built as coreutils-6.9-9.fc9 , closing RAWHIDE

Note You need to log in before you can comment on or make changes to this bug.