Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 638182 - sys-devel/crossdev: Strange parsing of options
Summary: sys-devel/crossdev: Strange parsing of options
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal minor
Assignee: Gentoo Crossdev team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-19 21:12 UTC by Maciej Piechotka
Modified: 2017-11-19 23:10 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Piechotka 2017-11-19 21:12:01 UTC
When I run crossdev -t <target> -b 2.28.1 crossdev treated 2.28.1 as a target instead of invalid option or binutils version. I haven't tested in-depth why this happened but it doesn't follow from the --help output.

Reproducible: Always

Actual Results:  
% sudo crossdev -t x86_64-w64-mingw32 -b 2.28.1
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 * crossdev version:      20160602
 * Host Portage ARCH:     amd64
 * Target Portage ARCH:   *
 * Target System:         2.28.1
 * Stage:                 4 (C/C++ compiler)
 * ABIs:                  default

 * binutils:              binutils-[latest]
 * gcc:                   gcc-[latest]
 * libc:                  mingw64-runtime-[latest]

 * CROSSDEV_OVERLAY:      /usr/local/portage
 * PORT_LOGDIR:           /var/log/portage
 * PORTAGE_CONFIGROOT:    
 * Portage flags:          -b


Expected Results:  
Error or:
 * crossdev version:      20160602
 * Host Portage ARCH:     amd64
 * Target Portage ARCH:   amd64
 * Target System:         x86_64-w64-mingw32
 * Stage:                 4 (C/C++ compiler)
 * ABIs:                  amd64

 * binutils:              =binutils-2.28.1
 * gcc:                   gcc-[latest]
 * libc:                  mingw64-runtime-[latest]

 * CROSSDEV_OVERLAY:      /usr/local/portage
 * PORT_LOGDIR:           /var/log/portage
 * PORTAGE_CONFIGROOT:    
 * Portage flags:
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2017-11-19 22:51:57 UTC
(In reply to Maciej Piechotka from comment #0)
> When I run crossdev -t <target> -b 2.28.1 crossdev treated 2.28.1 as a
> target instead of invalid option or binutils version. I haven't tested
> in-depth why this happened but it doesn't follow from the --help output.
> 
> Reproducible: Always
> 
> Actual Results:  
> % sudo crossdev -t x86_64-w64-mingw32 -b 2.28.1

That's because option is called '--b', not '-b': https://gitweb.gentoo.org/proj/crossdev.git/tree/crossdev#n618

But I agree it's very confusing behaviour. Perhaps we should just deprecate unnamed options.
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2017-11-19 22:55:42 UTC
(In reply to Sergei Trofimovich from comment #1)
> (In reply to Maciej Piechotka from comment #0)
> > When I run crossdev -t <target> -b 2.28.1 crossdev treated 2.28.1 as a
> > target instead of invalid option or binutils version. I haven't tested
> > in-depth why this happened but it doesn't follow from the --help output.
> > 
> > Reproducible: Always
> > 
> > Actual Results:  
> > % sudo crossdev -t x86_64-w64-mingw32 -b 2.28.1
> 
> That's because option is called '--b', not '-b':
> https://gitweb.gentoo.org/proj/crossdev.git/tree/crossdev#n618
> 
> But I agree it's very confusing behaviour. Perhaps we should just deprecate
> unnamed options.

Oh, and more to that the following options are passed to emerge as-is:
    -b|-d|-p|-v|-q)    UOPTS="${UOPTS} $1";;

https://gitweb.gentoo.org/proj/crossdev.git/tree/crossdev#n655
Comment 3 Larry the Git Cow gentoo-dev 2017-11-19 23:03:21 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=da9b5185640ac15d930624e1d52621c8a3da87f2

commit da9b5185640ac15d930624e1d52621c8a3da87f2
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2017-11-19 22:58:48 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2017-11-19 23:00:15 +0000

    crossdev: remove support for undocumented -b -d -p -v -q -pv -vp options, bug #638182
    
    In bug #638182 Maciej tried to use crossdev as:
        crossdev -t x86_64-w64-mingw32 -b 2.28.1
    which attempted to build configs for '2.28.1' target.
    
    crossdev silently passed '-b' to emerge and treated
    next argument as target option.
    
    This change removes all undocumented options.
    Use '-P <option>' instead.
    
    That way typo is reported correctly as:
        * UNKNOWN OPTION: '-b'
    
    Bug: https://bugs.gentoo.org/638182
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 crossdev | 2 --
 1 file changed, 2 deletions(-)}
Comment 4 Larry the Git Cow gentoo-dev 2017-11-19 23:09:33 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d0fa1795fcd5f556c5ca856e8fd786021980912a

commit d0fa1795fcd5f556c5ca856e8fd786021980912a
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2017-11-19 23:09:14 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2017-11-19 23:09:27 +0000

    sys-devel/crossdev: bump up to 20171119
    
    Bug: https://bugs.gentoo.org/638182
    Package-Manager: Portage-2.3.14, Repoman-2.3.6

 sys-devel/crossdev/Manifest                 |  1 +
 sys-devel/crossdev/crossdev-20171119.ebuild | 35 +++++++++++++++++++++++++++++
 sys-devel/crossdev/crossdev-99999999.ebuild |  5 +++--
 3 files changed, 39 insertions(+), 2 deletions(-)}
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2017-11-19 23:10:30 UTC
Should get better error in 20171119