nix-community / npmlock2nix

nixify npm based packages [maintainer=@andir]
Apache License 2.0
130 stars 42 forks source link

Using "?" in the derivation name is not ideal #118

Closed cideM closed 2 years ago

cideM commented 2 years ago

When making a valid derivation name in https://github.com/nix-community/npmlock2nix/blob/master/internal.nix#L33 a ? character is chosen as a fall back. This can cause several errors in the succeeding Nix calls. For example, the Bash code often does not properly quote variables, which, in the case of ?, leads to incorrect file names, since the ? is interpreted as a wildcard. This issue is easy to fix by just adding quotes. But I then ran into another issue where the stack trace lead to this line. I suspect that the derivation name somehow ends up as $3.

Looong story short: why not use a more file name friendly fallback character or just drop invalid characters? Also, the package name that I am dealing with is something like @foo/bar which got turned into ?foo?bar or something like it.

I can provide a reproducible example if the problem is not already clear from the description.

andir commented 2 years ago

On 01:31 11.10.21, Florian Beeres wrote:

When making a valid derivation name in https://github.com/nix-community/npmlock2nix/blob/master/internal.nix#L33 a ? character is chosen as a fall back. This can cause several errors in the succeeding Nix calls. For example, the Bash code often does not properly quote variables, which, in the case of ? leads to incorrect file names since the ? is interpreted as a wildcard. This issue is easy to fix by just adding some quotes. But I then ran into another issue where the stack trace lead to this line. I suspect that the derivation name somehow ends up as $3.

Looong story short: why not use a more file name friendly fallback character or just drop invalid characters? Also, the package name that I am dealing with is something like @.***/barwhich got turned into?foo?bar` or something like it.

I wouldn't mind using an underscore (_) instead. Not sure why the ? was picked in that particular PR that we merged but I remember going with an underscore in one of my WIP branches.

infinisil commented 2 years ago

This is now resolved with https://github.com/nix-community/npmlock2nix/pull/150