-
-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/hardware/printers: fix ppdOptions
of ensured printers
#312261
nixos/hardware/printers: fix ppdOptions
of ensured printers
#312261
Conversation
Commit a52e27d changed the `ensurePrinter` mechanism such that it uses `lib.cli.toGNUCommandLineShell` to assemble the `lpadmin` command line that creates the required printer. Before that commit, the command line contained single quotes (')to protect certain options from being (mis-)interpreted by the shell. The new mechanism no longer needs those quotes as `lib.cli.toGNUCommandLineShell` takes care of quoting/escaping. Unfortunatelly, the commit missed the quotes around the `-o` command line part. `lib.cli.toGNUCommandLineShell` now properly escapes those quotes, thereby including them in the effective command line arguments that are passed to `lpadmin`. The result is that no option is applied anymore. The commit at hand simply removes the superfluous quotes. With this change, options are again properly applied as before.
Hi @Yarny0 could you please post some test code so I can take a look. |
This code services.printing.enable = true;
services.printing.drivers = [ pkgs.foomatic-db-ppds ];
hardware.printers.ensurePrinters = [{
name = "myprinter";
model = "foomatic-db-ppds/Samsung-ML-371x-Postscript-Samsung.ppd.gz";
deviceUri = "socket://123.123.123.123:9100";
ppdOptions.Duplex = "DuplexNoTumble";
}]; should add a printer
i.e., the option was not used. With the pull request at hand applied,
showing that the option got applied properly. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/3959 |
Thanks for the approval! Now that 24.05 got branched off, can someone with sufficient privilegens please add the backport label, so we can avoid this regression in the upcoming release? Thanks! |
Successfully created backport PR for |
Description of changes
#290240 changed the
ensurePrinter
mechanism such that it useslib.cli.toGNUCommandLineShell
. However, it missed to remove single quotes ('
) that have previously been needed to protect options from the shell, but that are now escaped and passed on tolpadmin
, thereby breakingppdOptions
.This pull request removes those superfluous quotes and fixes
ppdOptions
.Notifying author of previous pull request: @rhoriguchi
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Note that this pull request does not affect any packages/tests.
Result of
nixpkgs-review
run on x86_64-linux 11 package blacklisted:
Add a 馃憤 reaction to pull requests you find important.