Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ammonite "exec" format issue on fish #68151

Closed
fabianhjr opened this issue Sep 5, 2019 · 7 comments
Closed

Ammonite "exec" format issue on fish #68151

fabianhjr opened this issue Sep 5, 2019 · 7 comments

Comments

@fabianhjr
Copy link
Member

fabianhjr commented Sep 5, 2019

Describe the bug
The ammonite package is broken if a user sets their shell to fish.

To Reproduce

  1. Set the user shell to fish
    users.fabian = {
      isNormalUser = true;
      extraGroups = [ "wheel" ];
      shell = pkgs.fish;
    };
  1. Install the ammonite package (nix-env -iA nixos.ammonite
  2. Try to run the amm executable.

One will get the following error:

Failed to execute process '/home/fabian/.nix-profile/bin/amm'. Reason:
exec: Exec format error
The file '/home/fabian/.nix-profile/bin/amm' is marked as an executable but could not be run by the operating system.

However,

bash
amm

works.

Expected behavior
Ammonite loads a REPL

Metadata

  • system: "x86_64-linux"
  • host os: Linux 5.2.11, NixOS, 19.03.173426.541d9cce8af (Koi)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.2.2
  • channels(root): "nixos-19.03.173426.541d9cce8af"
  • channels(fabian): "nixos-unstable-19.09pre191505.7d5375ebf4c"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

Maintainer information:

# a list of nixos modules affected by the problem
module: ammonite

Maintainer: /cc @NeQuissimus

@symphorien
Copy link
Member

amm is a shell script without a shebang. The behavior of exec(3) in this case if to execute /bin/sh amm. Apparently fish does otherwise. Looks like it is a deficiency in fish.

@fabianhjr
Copy link
Member Author

exec depends on the shell being used. (Since it is a built-in of each(?) shell)

https://fishshell.com/docs/current/commands.html#exec exec(1)

https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#index-exec

@denisgarci
Copy link

@fabianhjr I have the same issue. Should we open an issue on the Ammonite repo?

@fabianhjr
Copy link
Member Author

Not really sure, I think it has mostly to do with the nix package rather than upstream.

Maybe add a shebang for /bin/sh or require bash and add a bash shebang or have a fish version (an amm.fish)?

@denisgarci
Copy link

I have the same issue with z-lua:

Failed to execute process '/Users/dgarcia/.nix-profile/bin/z'. Reason:
exec: Exec format error
The file '/Users/dgarcia/.nix-profile/bin/z' is marked as an executable but could not be run by the operating system.

Should I open a separate issue? I'm going to try to open an issue on fish to see what they recommend.

@denisgarci
Copy link

I found this related issue: fish-shell/fish-shell#4946
Also I installed ammonite by hand and it works.

@bbjubjub2494
Copy link
Member

I use fish too and I had the same issue. The ammonite documentation recommends adding the shebang line when installing. I think it's on the Nixpkgs derivation to fix this.

NeQuissimus added a commit that referenced this issue Dec 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants