Skip to content

x.py commands stopped working when CWD is not the rust.git root directory #48268

Closed
@pnkfelix

Description

@pnkfelix

Until somewhat recently I was able to do (for example):

% git clone [email protected]:rust-lang/rust.git
Cloning into 'rust'...
Enter passphrase for key '/Users/fklock/.ssh/id_rsa-Mozilla': 
remote: Counting objects: 750528, done.        
remote: Total 750528 (delta 0), reused 1 (delta 0), pack-reused 750527        
Receiving objects: 100% (750528/750528), 338.52 MiB | 4.64 MiB/s, done.
Resolving deltas: 100% (605180/605180), done.
Checking out files: 100% (12010/12010), done.
% cd rust
% mkdir objdir
% cd objdir/
% ../x.py test src/tools/tidy
...

and, after some amount of time downloading bootstrap stuff and compiling tidy (sigh), it would run that command, checking that the source from the checked out directory was indeed tidy.

Likewise, I could use x.py build to do a build (where it would use the config.toml in my CWD as the basis for the build, which would be emitted into $(pwd)/build/).

Today, however, after a git pull from master bringing myself up to 5570cdc, I can no longer use the above workflow.

All of my attempts to run x.py from a directory other than the root of the checkout have been met with, for example:

% time python ../x.py test src/tools/tidy
Updating submodules
    Finished dev [unoptimized] target(s) in 0.0 secs
Warning: no rules matched objdir-opt/src/tools/tidy.
Build completed successfully in 0:00:03

real	0m3.829s
user	0m2.087s
sys	0m1.334s
%

This is bad in two ways:

  1. A command that used to work is now failing.
  2. A command that used to work is now failing and returning 0 as its exit status, so that when I have a local script for driving my builds that works by chaining calls (so e.g. I can run tidy before I start my build), the implicit failure of the first x.py call only causes a warning to be emitted, while the rest of the command sequence is subsequently run.

For me, point 2 is not so so bad, since the command sequence in question is just more calls to x.py from that same non-root directory, so they all emit the warning and so I'm likely to notice at least one of them.

But for other clients, I can imagine point 2 being quite disasterous.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions