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

sane: disabledDefaultBackends does not work reliably #292159

Closed
robinkrahl opened this issue Feb 28, 2024 · 1 comment · Fixed by #293022
Closed

sane: disabledDefaultBackends does not work reliably #292159

robinkrahl opened this issue Feb 28, 2024 · 1 comment · Fixed by #293022

Comments

@robinkrahl
Copy link

Describe the bug

The /etc/sane-config/dll.conf file lists enabled backends, with one backend per line. The hardware.sane.disabledDefaultBackends option uses string substitution to edit this file. But as it does not take into account line endings, disabling a backend x also affects other backends that contain the string x.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Set hardware.sane.enabled = true; in /etc/nixos/configuration.nix and observe the generated dll.conf:
$ realpath /etc/sane-config/dll.conf
/nix/store/hb5yn5874izgjychgfjgkjbf0igz9ivk-sane-config/etc/sane.d/dll.conf
  1. Set hardware.sane.disabledDefaultBackends = [ "net" ]; and repeat:
$ realpath /etc/sane-config/dll.conf
/nix/store/116ir7mwgfnwji955sjblyz0fla87933-sane-config/etc/sane.d/dll.conf
  1. Compare the two files:
$ diff /nix/store/{hb5yn5874izgjychgfjgkjbf0igz9ivk,116ir7mwgfnwji955sjblyz0fla87933}-sane-config/etc/sane.d/dll.conf
7,8c7,8
< # The next line enables the network backend; comment it out if you don't
< # need to use a remote SANE scanner over the network -- see sane-net(5)
---
> # The next line enables the # net disabled in nixos configwork backend; comment it out if you don't
> # need to use a remote SANE scanner over the # net disabled in nixos configwork -- see sane-# net disabled in nixos config(5)
10c10
< net
---
> # net disabled in nixos config
31c31
< dell1600n_net
---
> dell1600n_# net disabled in nixos config

Expected behavior

Instead of mangling the dell1600n_net driver, only the net driver should be disabled.

Additional context

This is the code that performs the string substition:

substituteInPlace $out/etc/sane.d/dll.conf --replace '${backend}' '# ${backend} disabled in nixos config'

It should probably use something like ^backend$ instead, though I don’t know how this could be expressed here.

On a related note, it would be great to have an option to disable all default backends and manually select the backends to enable.

Notify maintainers

@symphorien (pinging because of c64fb50)

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.76, NixOS, 23.11 (Tapir), 23.11.3920.25e3d4c0d359`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"nixos-23.11"`
 - channels(robin): `"home-manager-23.05.tar.gz"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Add a 👍 reaction to issues you find important.

@symphorien
Copy link
Member

please test #293022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants