nix icon indicating copy to clipboard operation
nix copied to clipboard

Case-hacked files are observable from the language

Open roberth opened this issue 2 years ago • 6 comments

Describe the bug

Whether the current store (or configuration (#9318)) enables the case hack should not affect the language. Nix tries to support case sensitivity as much as possible, including allowing case sensitive paths to be represented in the store. This does not need to be detectable and arguably should not be detectable.

Steps To Reproduce

One a store (or machine (#9318)) that has the case hack, run nix repl

> :lf nixpkgs
> builtins.readDir (legacyPackages.aarch64-linux.ncurses + "/share/terminfo")  
{ "1" = "directory"; "2" = "directory"; "3" = "directory"; "4" = "directory"; "5" = "directory"; "6" = "directory"; "7" = "directory"; "8" = "directory"; "9" = "directory"; A = "directory"; E = "directory"; L = "directory"; M = "directory"; N = "directory"; P = "directory"; Q = "directory"; X = "directory";
  "a~nix~case~hack~1" = "directory"; b = "directory"; c = "directory"; d = "directory"; "e~nix~case~hack~1" = "directory"; f = "directory"; g = "directory"; h = "directory"; i = "directory"; j = "directory"; k = "directory"; "l~nix~case~hack~1" = "directory"; "m~nix~case~hack~1" = "directory";
  "n~nix~case~hack~1" = "directory"; o = "directory"; "p~nix~case~hack~1" = "directory"; "q~nix~case~hack~1" = "directory"; r = "directory"; s = "directory"; t = "directory"; u = "directory"; v = "directory"; w = "directory"; "x~nix~case~hack~1" = "directory"; z = "directory"; }

Expected behavior

The language uses a file system accessor that unapplies the case hack on trees that implement case sensitivity using the case hack.

nix-env --version output

Additional context

Priorities

Add :+1: to issues you find important.

roberth avatar Nov 07 '23 16:11 roberth

@roberth Do you think this issue would cause my NixOS VM I built with a darwin host to have terminfo all screwed up?

will@nixos ~> uname -a
Linux nixos 6.6.31 #1-NixOS SMP Fri May 17 10:02:40 UTC 2024 aarch64 GNU/Linux

will@nixos ~> cat /etc/os-release | grep -i pretty
PRETTY_NAME="NixOS 24.05 (Uakari)"

will@nixos ~> ls /etc/terminfo
1  A                  h                  n~nix~case~hack~1  u
2  a~nix~case~hack~1  i                  o                  v
3  b                  j                  P                  w
4  c                  k                  p~nix~case~hack~1  X
5  d                  L                  Q                  x~nix~case~hack~1
6  E                  l~nix~case~hack~1  q~nix~case~hack~1  z
7  e~nix~case~hack~1  M                  r
8  f                  m~nix~case~hack~1  s
9  g                  N                  t

The only other similar issue is https://github.com/NixOS/nixpkgs/issues/34364 but that was closed as fixed in 2018, so probably it's not the cause?

will avatar May 20 '24 14:05 will

That's the case hack you're seeing, but in your situation I think it's probably up to the image building derivations to handle the case hack.

I have to say that asking derivations to support the case hack is a big ask, and I believe long term we'd be better off configuring Nix on darwin to use a case sensitive APFS volume (also lightly suggested by Eelco in https://github.com/NixOS/nix/issues/9318#issuecomment-1802228873).

roberth avatar May 20 '24 17:05 roberth

Thanks for the information, that all makes sense!

will avatar May 20 '24 18:05 will

@will did you ever find a fix for your issue?

I'm having the exact same problem with a aarch64-darwin host and aarch64-linux builder vm when compiling / running the standard nixos qemu vm target.

LukeChannings avatar Aug 22 '24 22:08 LukeChannings

@LukeChannings not any real, systematic solution. I use wezterm but normally dont set TERM to anything on my local machine. Then for my nixos vms, I have the wezterm.terminfo nixpkgs package installed and just manually set TERM=wezterm. Not great, but at least the terminal is usable when inside the vm :/

will avatar Aug 23 '24 00:08 will

I made a PR to fix the case hack appearing in the linux-builder https://github.com/NixOS/nixpkgs/pull/347636

Enzime avatar Oct 10 '24 21:10 Enzime