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

pcsclite: Remove the confdir configure option (fix #121088) #121247

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thblt
Copy link
Contributor

@thblt thblt commented Apr 30, 2021

Motivation

This reverts commit 6d23cfd by @peterhoeg, which solved #121088 by hardcoding the configuration file path into the binary call. Instead, it removes the --enable-confdir build option which was the root cause of the issue. To clarify, this is how ./configure --help describes the parameter:

  --enable-confdir=DIR directory containing reader
                       configurations (default /etc/reader.conf.d)

But it was set as:

  configureFlags = [
     "--enable-confdir=/etc" … ]

(Also a very minor formatting change that Emacs insisted to make and I forgot to unstage.)

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@peterhoeg
Copy link
Member

The enable-confdir was there all along - even before #97440. The issues are:

  1. pcsclite goes off on its own if it cannot read proper config from /etc/reader.conf and tries everything else in that directory. This is just bananas. If we don't specify it, it will default to $out/etc which while it doesn't blow up, is just pointless. The best way to deal with this is just to specify a file inside nix store which we generate and then reference that in ExecStart (this way we can also drop the restartTrigger).

  2. the policykit files aren't registered properly.

This PR doesn't address either issue.

@r-rmcgibbo
Copy link

r-rmcgibbo commented Apr 30, 2021

Result of nixpkgs-review pr 121247 at b81b9ba6 run on x86_64-linux 1

297 packages marked as broken and skipped:
  • globalplatform
  • gnokii
  • gnome3.gnome-books
  • gnome3.gnome-documents
  • gnuradio3_7Packages.gsm
  • gppcscconnectionplugin
  • gpshell
  • hash-slinger
  • libsForQt512.akonadi
  • libsForQt512.akonadi-calendar
  • ...
1 package failed to build:
742 packages skipped due to time constraints:
  • AusweisApp2
  • acsccid
  • adapta-gtk-theme
  • aeon
  • aerc
  • afew
  • ajour
  • almanah
  • alot (python38Packages.alot)
  • amarok (amarok-kf5)
  • ...
50 packages built successfully:
  • cosign
  • gcr (gnome3.gcr)
  • git-remote-gcrypt
  • git-secret
  • gitRepo
  • gnome-online-accounts (gnome3.gnome-online-accounts ,gnome3.gnome_online_accounts)
  • gvfs (gnome2.gvfs)
  • libgdata (gnome3.libgdata)
  • gnupg (gnupg22)
  • gnupg1 (gnupg1compat)
  • gpgme
  • hexio
  • keychain
  • leiningen
  • libblockdev
  • libnma
  • libsForQt5.grantleetheme (libsForQt515.grantleetheme ,plasma5Packages.grantleetheme)
  • libsForQt5.kaccounts-integration (libsForQt515.kaccounts-integration ,plasma5Packages.kaccounts-integration)
  • libsForQt5.kcmutils (libsForQt515.kcmutils ,plasma5Packages.kcmutils)
  • libsForQt5.kdeclarative (libsForQt515.kdeclarative ,plasma5Packages.kdeclarative)
  • libsForQt5.kdesignerplugin (libsForQt515.kdesignerplugin ,plasma5Packages.kdesignerplugin)
  • libsForQt5.kio (libsForQt515.kio ,plasma5Packages.kio)
  • libsForQt5.knewstuff (libsForQt515.knewstuff ,plasma5Packages.knewstuff)
  • libsForQt5.knotifyconfig (libsForQt515.knotifyconfig ,plasma5Packages.knotifyconfig)
  • libsForQt5.kpimtextedit (libsForQt515.kpimtextedit ,plasma5Packages.kpimtextedit)
  • libsForQt5.kwallet (libsForQt515.kwallet ,plasma5Packages.kwallet)
  • libsForQt5.qgpgme (libsForQt515.qgpgme ,plasma5Packages.qgpgme)
  • libsForQt514.kcmutils
  • libsForQt514.kdeclarative
  • libsForQt514.kio
  • libsForQt514.kwallet
  • libsForQt514.qgpgme
  • nice-dcv-client
  • open-ecard
  • pass
  • pcsclite
  • perl530Packages.pcscperl
  • perl532Packages.GnuPGInterface
  • perl532Packages.pcscperl
  • python38Packages.btchip
  • python38Packages.emv
  • python38Packages.pypass
  • python38Packages.pysatochip
  • python38Packages.pyscard
  • python39Packages.emv
  • python39Packages.pysatochip
  • python39Packages.pyscard
  • udisks (udisks2)
  • volume_key
  • yadm
2 suggestions:
  • warning: missing-patch-comment

    Please add a comment on the line above, explaining the purpose of this patch.
    Near pkgs/tools/security/pcsclite/default.nix:25:15:

       |
    25 |   patches = [ ./no-dropdir-literals.patch ];
       |               ^
    
  • warning: maintainers-missing

    Package does not have a maintainer. Consider adding yourself?

    Near pkgs/tools/security/pcsclite/default.nix:63:3:

       |
    63 |   meta = with lib; {
       |   ^
    

Note that build failures may predate this PR, and could be nondeterministic or hardware dependent.
Please exercise your independent judgement.


Result of nixpkgs-review pr 121247 at b81b9ba6 run on aarch64-linux 1

293 packages marked as broken and skipped:
  • globalplatform
  • gnokii
  • gnome3.gnome-books
  • gnome3.gnome-documents
  • gnuradio3_7Packages.gsm
  • gppcscconnectionplugin
  • gpshell
  • kstars
  • libsForQt512.akonadi
  • libsForQt512.akonadi-calendar
  • ...
688 packages skipped due to time constraints:
  • AusweisApp2
  • acsccid
  • adapta-gtk-theme
  • aerc
  • afew
  • ajour
  • almanah
  • alot (python38Packages.alot)
  • appimagekit
  • aptly
  • ...
50 packages built successfully:
  • cosign
  • gcr (gnome3.gcr)
  • git-remote-gcrypt
  • git-secret
  • gitRepo
  • gnome-online-accounts (gnome3.gnome-online-accounts ,gnome3.gnome_online_accounts)
  • gvfs (gnome2.gvfs)
  • libgdata (gnome3.libgdata)
  • gnupg (gnupg22)
  • gnupg1 (gnupg1compat)
  • gpgme
  • hexio
  • keychain
  • leiningen
  • libblockdev
  • libnma
  • libsForQt5.grantleetheme (libsForQt515.grantleetheme ,plasma5Packages.grantleetheme)
  • libsForQt5.kaccounts-integration (libsForQt515.kaccounts-integration ,plasma5Packages.kaccounts-integration)
  • libsForQt5.kcmutils (libsForQt515.kcmutils ,plasma5Packages.kcmutils)
  • libsForQt5.kdeclarative (libsForQt515.kdeclarative ,plasma5Packages.kdeclarative)
  • libsForQt5.kdesignerplugin (libsForQt515.kdesignerplugin ,plasma5Packages.kdesignerplugin)
  • libsForQt5.kio (libsForQt515.kio ,plasma5Packages.kio)
  • libsForQt5.knewstuff (libsForQt515.knewstuff ,plasma5Packages.knewstuff)
  • libsForQt5.knotifyconfig (libsForQt515.knotifyconfig ,plasma5Packages.knotifyconfig)
  • libsForQt5.kpimtextedit (libsForQt515.kpimtextedit ,plasma5Packages.kpimtextedit)
  • libsForQt5.kwallet (libsForQt515.kwallet ,plasma5Packages.kwallet)
  • libsForQt5.qgpgme (libsForQt515.qgpgme ,plasma5Packages.qgpgme)
  • libsForQt514.kcmutils
  • libsForQt514.kdeclarative
  • libsForQt514.kio
  • libsForQt514.kwallet
  • libsForQt514.qgpgme
  • nice-dcv-client
  • open-ecard
  • pass
  • pcsclite
  • perl532Packages.GnuPGInterface
  • perl532Packages.pcscperl
  • python38Packages.btchip
  • python38Packages.emv
  • python38Packages.pypass
  • python38Packages.pysatochip
  • python38Packages.pyscard
  • python39Packages.btchip
  • python39Packages.emv
  • python39Packages.pysatochip
  • python39Packages.pyscard
  • udisks (udisks2)
  • volume_key
  • yadm

@thblt
Copy link
Contributor Author

thblt commented Apr 30, 2021

The enable-confdir was there all along - even before #97440. The issues are:

Indeed, but its usage remains incorrect, AFAICT. As per configure --help, it's meant to tell pcsclite which directory contains all its config files, and only its config files. This cannot be /etc.

  1. pcsclite goes off on its own if it cannot read proper config from /etc/reader.conf and tries everything else in that directory. This is just bananas.

I cannot reproduce this behavior with my patch applied.

If we don't specify it, it will default to $out/etc which while it doesn't blow up, is just pointless.

How do you observe that? The default value for confdir is /etc/reader.conf.d, which makes perfect sense.

  1. the policykit files aren't registered properly.

This is not the point of this PR. I've addressed the PolicyKit issue in #121246.

@peterhoeg
Copy link
Member

The issue here is that while the default confdir is /etc/reader.conf.d if not specified, when we're building it with the nix, that gets set to $out/etc/reader.conf.d.

So the real fix would be to change it to that instead. Thanks for your patience @thblt - do you mind revising this PR?

@thblt
Copy link
Contributor Author

thblt commented May 6, 2021

Ha, right, thank you. Just one question, do we actually need confdir to be set to anything? Is it for Nix on non-NixOS platforms?

@peterhoeg
Copy link
Member

peterhoeg commented May 6, 2021 via email

@thblt thblt force-pushed the fix-for-the-pcsclite-fix branch from 05e9ea3 to 8261809 Compare May 7, 2021 07:18
@thblt
Copy link
Contributor Author

thblt commented May 7, 2021

Done, but I'm not sure it'll work — this is the default value, after all, I'm afraid $OUT is implied. I'm rebuilding to check.

@thblt
Copy link
Contributor Author

thblt commented May 7, 2021

It should be correct, the configure scripts actually defaults to confdir="${sysconfdir}/reader.conf.d"

@thblt thblt force-pushed the fix-for-the-pcsclite-fix branch from 8261809 to 21c3628 Compare May 7, 2021 07:45
This reverts commit 6d23cfd, which
solved NixOS#121088 by hardcoding the configuration file path into the
binary call. Instead, it sets the --enable-confdir build option which
was the root cause of the issue.  Please see the comment in
default.nix for more details about this option.
@thblt thblt force-pushed the fix-for-the-pcsclite-fix branch from 21c3628 to 7460ef9 Compare May 7, 2021 07:46
@stale
Copy link

stale bot commented Nov 9, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Nov 9, 2021
Copy link
Member

@kirelagin kirelagin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good and makes perfect sense.

While we are at it, would it make sense to also remove

environment.etc."reader.conf".source = cfgFile;

? I don’t think it serves any purpose and is thus a bit confusing.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Dec 4, 2021
Copy link
Member

@kirelagin kirelagin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, no, sorry, I think we need to keep the -c option though? If I am reading the code correctly, if -c is given, the daemon will go read config from this file, but if it is not given, it will go and read everything from confdir.

So, if you remove this option, then readerConfig written by the NixOS module will not be used in any way.

I think the confusion comes from the pcsclite documentation being entirely wrong and misleading in that /etc/reader.conf has no special significance for the code and won’t be ever tried, unless explicitly given as -c.

@kirelagin
Copy link
Member

Reported upstream: LudovicRousseau/PCSC#115.

@kirelagin
Copy link
Member

Upstream docs have been updated and they now indicate that -c accepts a directory rather than a file (and, I think, the fact that passing a file works is an undocumented feature/coincidence), so I think we should switch to writeTextFile with destination set instead of writeText

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 12, 2022
@Artturin Artturin marked this pull request as draft July 28, 2023 00:13
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 28, 2023
@wegank wegank added 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 2.status: merge conflict labels Mar 19, 2024
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 20, 2024
@flokli
Copy link
Contributor

flokli commented Apr 19, 2024

@peterhoeg @kirelagin @thblt what's the state of this PR? Has this been solved elsewhere in the meantime?

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

Successfully merging this pull request may close these issues.

None yet

7 participants