DeterminateSystems / riff

Riff automatically provides external dependencies for Rust projects, with support for other languages coming soon.
https://riff.sh
Mozilla Public License 2.0
486 stars 13 forks source link

Revert problematic commit from "init `fsm run` subcommand" #54

Closed grahamc closed 2 years ago

grahamc commented 2 years ago

Reverts DeterminateSystems/fsm#44

Sorry @cole-h but I didn't actually run it again before merging, and I should have. It looks like both fsm shell and fsm run are broken:

fsm shell never actually puts me into a shell:

grahamc@scruffy:~/projects/github.com/DeterminateSystems/fsm/ > ./target/debug/fsm shell
✓ 🦀 rust: cargo, openssl, pkg-config, rustc, rustfmt
^C

and cargo run never outputs anything, and I'm not sure if it is running the program:

grahamc@scruffy:~/projects/github.com/DeterminateSystems/fsm/ > ./target/debug/fsm run date
✓ 🦀 rust: cargo, openssl, pkg-config, rustc, rustfmt
grahamc@scruffy:~/projects/github.com/DeterminateSystems/fsm/ > ./target/debug/fsm run cargo build
✓ 🦀 rust: cargo, openssl, pkg-config, rustc, rustfmt
grahamc@scruffy:~/projects/github.com/DeterminateSystems/fsm/ > 
grahamc commented 2 years ago
grahamc@scruffy:~/projects/github.com/DeterminateSystems/fsm/ > RUST_LOG=fsm=trace ./target/debug/fsm run date
  2022-08-24T17:46:35.431385Z DEBUG fsm::flake_generator: Project directory is '/home/grahamc/projects/github.com/DeterminateSystems/fsm'.
    at src/flake_generator.rs:20

  2022-08-24T17:46:35.431533Z DEBUG fsm::dev_env: Adding Cargo dependencies...
    at src/dev_env.rs:64
    in fsm::dev_env::add_deps_from_cargo with project_dir: /home/grahamc/projects/github.com/DeterminateSystems/fsm

  2022-08-24T17:46:35.431588Z TRACE fsm::dev_env: Running, command: Command { std: "cargo" "metadata" "--format-version" "1" "--manifest-path" "/home/grahamc/projects/github.com/DeterminateSystems/fsm/Cargo.toml", kill_on_drop: false }
    at src/dev_env.rs:73
    in fsm::dev_env::add_deps_from_cargo with project_dir: /home/grahamc/projects/github.com/DeterminateSystems/fsm

Running `cargo metadata`.                                                                                                                                                                                                                                                                                                      2022-08-24T17:46:35.459295Z TRACE fsm::dependency_registry: Fetching new registry data from https://fsm-server.fly.dev/fsm-registry.json, telemetry: {"distinct_id":"63f6fb17-ab95-4768-a0a2-b4106ca7c766","system_os":"linux","system_arch":"x86_64","fsm_version":"0.1.0","nix_version":"nix (Nix) 2.10.3","is_tty":true,"subcommand":"run","detected_languages":[]}
    at src/dependency_registry/mod.rs:93

  2022-08-24T17:46:35.552662Z DEBUG fsm::dev_env: Cache freshness, fresh: false
    at src/dev_env.rs:128
    in fsm::dev_env::add_deps_from_cargo with project_dir: /home/grahamc/projects/github.com/DeterminateSystems/fsm

  2022-08-24T17:46:35.552791Z DEBUG fsm::dev_env: Detected known crate information, package_name: openssl-sys, build-inputs: openssl, environment-variables: , runtime-inputs: 
    at src/dev_env.rs:136
    in fsm::dev_env::add_deps_from_cargo with project_dir: /home/grahamc/projects/github.com/DeterminateSystems/fsm

  2022-08-24T17:46:35.552834Z DEBUG fsm::dev_env: Detected known crate information, package_name: pkg-config, build-inputs: pkg-config, environment-variables: , runtime-inputs: 
    at src/dev_env.rs:136
    in fsm::dev_env::add_deps_from_cargo with project_dir: /home/grahamc/projects/github.com/DeterminateSystems/fsm

✓ 🦀 rust: cargo, openssl, pkg-config, rustc, rustfmt
  2022-08-24T17:46:35.567216Z TRACE fsm::telemetry: Sending telemetry data to https://fsm-server.fly.dev/telemetry, data: {"distinct_id":"63f6fb17-ab95-4768-a0a2-b4106ca7c766","system_os":"linux","system_arch":"x86_64","fsm_version":"0.1.0","nix_version":"nix (Nix) 2.10.3","is_tty":true,"subcommand":"run","detected_languages":["Rust"]}
    at src/telemetry.rs:98

  2022-08-24T17:46:35.650400Z DEBUG fsm::dependency_registry: Refreshed remote registry into XDG cache, path: /home/grahamc/.cache/fsm/registry.json
    at src/dependency_registry/mod.rs:140

  2022-08-24T17:46:35.749131Z DEBUG fsm::telemetry: Sent telemetry data to https://fsm-server.fly.dev/telemetry, telemetry: {"distinct_id":"63f6fb17-ab95-4768-a0a2-b4106ca7c766","system_os":"linux","system_arch":"x86_64","fsm_version":"0.1.0","nix_version":"nix (Nix) 2.10.3","is_tty":true,"subcommand":"run","detected_languages":["Rust"]}
    at src/telemetry.rs:104

  2022-08-24T17:46:35.749225Z TRACE fsm::flake_generator: Generated 'flake.nix':
{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  outputs = { self, nixpkgs }:
    let
      nameValuePair = name: value: { inherit name value; };
      genAttrs = names: f: builtins.listToAttrs (map (n: nameValuePair n (f n)) names);
      allSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];

      forAllSystems = f: genAttrs allSystems (system: f rec {
        inherit system;
        pkgs = import nixpkgs { inherit system; };
        lib = pkgs.lib;
      });
    in
    {
      devShells = forAllSystems ({ system, pkgs, ... }: {
        default = with pkgs;
          stdenv.mkDerivation {
            name = "fsm-shell";
            buildInputs = [ rustc pkg-config cargo rustfmt openssl ] ++ lib.optionals (stdenv.isDarwin) [
              libiconv
            ];

          };
      });
  };
}

    at src/flake_generator.rs:55

  2022-08-24T17:46:35.749522Z TRACE fsm::flake_generator: Running, command: Command { std: "nix" "flake" "lock" "--extra-experimental-features" "flakes nix-command" "-L" "path:///tmp/.tmpUFlGTy", kill_on_drop: false }
    at src/flake_generator.rs:72

  2022-08-24T17:46:36.001866Z TRACE fsm::cmds::run: Running, command: Command { std: "nix" "develop" "--extra-experimental-features" "flakes nix-command" "-L" "path:///tmp/.tmpUFlGTy" "-c" "date", kill_on_drop: false }
    at src/cmds/run.rs:48

grahamc@scruffy:~/projects/github.com/DeterminateSystems/fsm/ > 

and ...

grahamc@scruffy:~/projects/github.com/DeterminateSystems/fsm/ > RUST_LOG=fsm=trace ./target/debug/fsm shell   
  2022-08-24T17:46:56.577415Z DEBUG fsm::flake_generator: Project directory is '/home/grahamc/projects/github.com/DeterminateSystems/fsm'.
    at src/flake_generator.rs:20

  2022-08-24T17:46:56.577562Z DEBUG fsm::dev_env: Adding Cargo dependencies...
    at src/dev_env.rs:64
    in fsm::dev_env::add_deps_from_cargo with project_dir: /home/grahamc/projects/github.com/DeterminateSystems/fsm

  2022-08-24T17:46:56.577621Z TRACE fsm::dev_env: Running, command: Command { std: "cargo" "metadata" "--format-version" "1" "--manifest-path" "/home/grahamc/projects/github.com/DeterminateSystems/fsm/Cargo.toml", kill_on_drop: false }
    at src/dev_env.rs:73
    in fsm::dev_env::add_deps_from_cargo with project_dir: /home/grahamc/projects/github.com/DeterminateSystems/fsm

Running `cargo metadata`.                                                                                                                                                                                                                                                                                                      2022-08-24T17:46:56.600106Z TRACE fsm::dependency_registry: Fetching new registry data from https://fsm-server.fly.dev/fsm-registry.json, telemetry: {"distinct_id":"63f6fb17-ab95-4768-a0a2-b4106ca7c766","system_os":"linux","system_arch":"x86_64","fsm_version":"0.1.0","nix_version":"nix (Nix) 2.10.3","is_tty":true,"subcommand":"shell","detected_languages":[]}
    at src/dependency_registry/mod.rs:93

  2022-08-24T17:46:56.656240Z DEBUG fsm::dev_env: Cache freshness, fresh: false
    at src/dev_env.rs:128
    in fsm::dev_env::add_deps_from_cargo with project_dir: /home/grahamc/projects/github.com/DeterminateSystems/fsm

  2022-08-24T17:46:56.656366Z DEBUG fsm::dev_env: Detected known crate information, package_name: openssl-sys, build-inputs: openssl, environment-variables: , runtime-inputs: 
    at src/dev_env.rs:136
    in fsm::dev_env::add_deps_from_cargo with project_dir: /home/grahamc/projects/github.com/DeterminateSystems/fsm

  2022-08-24T17:46:56.656410Z DEBUG fsm::dev_env: Detected known crate information, package_name: pkg-config, build-inputs: pkg-config, environment-variables: , runtime-inputs: 
    at src/dev_env.rs:136
    in fsm::dev_env::add_deps_from_cargo with project_dir: /home/grahamc/projects/github.com/DeterminateSystems/fsm

✓ 🦀 rust: cargo, openssl, pkg-config, rustc, rustfmt
  2022-08-24T17:46:56.670236Z TRACE fsm::telemetry: Sending telemetry data to https://fsm-server.fly.dev/telemetry, data: {"distinct_id":"63f6fb17-ab95-4768-a0a2-b4106ca7c766","system_os":"linux","system_arch":"x86_64","fsm_version":"0.1.0","nix_version":"nix (Nix) 2.10.3","is_tty":true,"subcommand":"shell","detected_languages":["Rust"]}
    at src/telemetry.rs:98

  2022-08-24T17:46:56.801543Z DEBUG fsm::dependency_registry: Refreshed remote registry into XDG cache, path: /home/grahamc/.cache/fsm/registry.json
    at src/dependency_registry/mod.rs:140

  2022-08-24T17:46:56.854737Z DEBUG fsm::telemetry: Sent telemetry data to https://fsm-server.fly.dev/telemetry, telemetry: {"distinct_id":"63f6fb17-ab95-4768-a0a2-b4106ca7c766","system_os":"linux","system_arch":"x86_64","fsm_version":"0.1.0","nix_version":"nix (Nix) 2.10.3","is_tty":true,"subcommand":"shell","detected_languages":["Rust"]}
    at src/telemetry.rs:104

  2022-08-24T17:46:56.854890Z TRACE fsm::flake_generator: Generated 'flake.nix':
{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  outputs = { self, nixpkgs }:
    let
      nameValuePair = name: value: { inherit name value; };
      genAttrs = names: f: builtins.listToAttrs (map (n: nameValuePair n (f n)) names);
      allSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];

      forAllSystems = f: genAttrs allSystems (system: f rec {
        inherit system;
        pkgs = import nixpkgs { inherit system; };
        lib = pkgs.lib;
      });
    in
    {
      devShells = forAllSystems ({ system, pkgs, ... }: {
        default = with pkgs;
          stdenv.mkDerivation {
            name = "fsm-shell";
            buildInputs = [ rustc pkg-config cargo rustfmt openssl ] ++ lib.optionals (stdenv.isDarwin) [
              libiconv
            ];

          };
      });
  };
}

    at src/flake_generator.rs:55

  2022-08-24T17:46:56.855175Z TRACE fsm::flake_generator: Running, command: Command { std: "nix" "flake" "lock" "--extra-experimental-features" "flakes nix-command" "-L" "path:///tmp/.tmp5A0vLM", kill_on_drop: false }
    at src/flake_generator.rs:72

  2022-08-24T17:46:57.112964Z TRACE fsm::cmds::shell: Running, command: Command { std: "nix" "develop" "--extra-experimental-features" "flakes nix-command" "-L" "path:///tmp/.tmp5A0vLM", kill_on_drop: false }
    at src/cmds/shell.rs:34
grahamc commented 2 years ago

I filed https://linear.app/detsys/issue/DS-267/telemetry-ids-should-be-obscured-in-log-output to make it harder for users to share their distinct ID in logs like I did above.

grahamc commented 2 years ago

Converted this PR from a total revert to reverting just 7cfe53b434dd6aee7e4cbba4e5e6a61480e099b9 which appears to be the problematic commit.

linear[bot] commented 2 years ago
DS-257 `fsm run`

A way to run a command (inside a shell with shell parsing or not) inside the environment provided by fsm.

cole-h commented 2 years ago

(Updated PR title for posterity, so that if it pops up anywhere people are looking, it's clear it's not a total revert.)