Skip to content

Consider --version output more carefully #13582

Closed
@brson

Description

@brson

The output of --version is often grepped, so it needs to be parsable and stable, and our current output has not been thought through quite enough.

Here are two examples of its current output:

brian@brian-X1:~$ rustc --version
rustc 0.11-pre-nightly (e332287 2014-04-16 00:56:30 -0700)
host: x86_64-unknown-linux-gnu
brian@brian-X1:~$ /usr/local/bin/rustc --version
/usr/local/bin/rustc 0.11-pre-nightly (e332287 2014-04-16 00:56:30 -0700)
host: x86_64-unknown-linux-gnu

The name rustc is actually arg[0], so it changes depending on how rustc is invoked. This makes it very hard to parse rustc's version. Note also that the info in parens is only present in git builds, so it can't be relied on.

The one obvious fix is to hardcode rustc as the program name. As long as we leave the first line using a consistent format forever we should be mostly ok.

The host: ... line in our output is non-conventional and might properly be put under another flag or remove it; alternately, we may want to include more info here - why is 'host' special?

For comparison, here are some other --version outputs on my system:

brian@brian-X1:~$ gcc --version
gcc (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

brian@brian-X1:~$ perl --version

This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-gnu-thread-multi
(with 80 registered patches, see perl -V for more detail)

Copyright 1987-2011, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

brian@brian-X1:~$ python --version
Python 2.7.4

Also, make rustdoc consistent with whatever format is preferred.

Nominating.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-lowLow priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions