Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 232652 - runcon shouldn't reorder parameters
Summary: runcon shouldn't reorder parameters
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Ondrej Vasik
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-03-16 14:52 UTC by Ulrich Drepper
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-10-29 11:54:20 UTC


Attachments (Terms of Use)

Description Ulrich Drepper 2007-03-16 14:52:47 UTC
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):
coreutils-6.7-9.fc7

How reproducible:
always

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:
Success

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 18:25:25 UTC
Hi Uli,
Thanks for the report.  I've fixed it on the selinux branch, upstream:
http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=9aee8e78ea

Comment 2 Ondrej Vasik 2007-10-29 11:54:20 UTC
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.