Your message dated Sun, 08 Sep 2024 17:10:17 +0000
with message-id <e1snlqx-00a7cn...@fasolo.debian.org>
and subject line Bug#1081115: fixed in pyscard 2.1.0-1
has caused the Debian Bug report #1081115,
regarding access to undefined variable in PCSCCardConnection.py
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
1081115: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1081115
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: python3-pyscard
Version: 2.0.10-1+b1
Severity: minor
Tags: patch upstream

Upstream report: https://github.com/LudovicRousseau/pyscard/pull/173

pyscard 2.0.8 has a regression in which it introduced code that
references undefined variables in case no card is connected.  So rather
than the expected CardConnectionException, there's a nested
UnboundLocalError exception in such a [not very unusual] situation where
the user has not inserted a card into the reader.

Traceback (most recent call last):
  File "/crypt/space/home/laforge/projects/git/pysim/./contrib/card2server.py", 
line 106, in <module>
    'atr': tp.get_atr(),
           ^^^^^^^^^^^^
  File 
"/crypt/space/home/laforge/projects/git/pysim/contrib/pySim/transport/pcsc.py", 
line 95, in get_atr
    return self._con.getATR()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/smartcard/CardConnectionDecorator.py", 
line 66, in getATR
    return self.component.getATR()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/smartcard/CardConnectionDecorator.py", 
line 66, in getATR
    return self.component.getATR()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/smartcard/pcsc/PCSCCardConnection.py", 
line 215, in getATR
    hresult=hresult)
            ^^^^^^^

-- System Information:
Debian Release: trixie/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.10.7-amd64 (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages python3-pyscard depends on:
ii  libc6    2.40-2
ii  python3  3.12.5-1

Versions of packages python3-pyscard recommends:
ii  libpcsclite1  2.3.0-1

Versions of packages python3-pyscard suggests:
ii  python3-wxgtk4.0  4.2.1+dfsg-4+b1

-- no debconf information
>From 21e411ac11d09895a7bf8f0bca2e842e2f37b2dd Mon Sep 17 00:00:00 2001
From: Harald Welte <lafo...@osmocom.org>
Date: Sun, 8 Sep 2024 08:53:44 +0200
Subject: [PATCH] Fix use of undefined variable 'hresult' in exceptions

The following commit introrudced the inclusion of hresult in
exceptions that are raised:

commit 395cdc46a0fda86af79523a2d18bef06b96a234b
Author: Ludovic Rousseau <ludovic.rouss...@free.fr>
Date:   Sun Apr 23 18:27:24 2023 +0200

However, it also introduces hresult into 'raise' statements where
no hresult exists [yet].  THis in turn causes double exceptions like
this:

Traceback (most recent call last):
  File "/crypt/space/home/laforge/projects/git/pysim/./contrib/card2server.py", 
line 106, in <module>
    'atr': tp.get_atr(),
           ^^^^^^^^^^^^
  File 
"/crypt/space/home/laforge/projects/git/pysim/contrib/pySim/transport/pcsc.py", 
line 95, in get_atr
    return self._con.getATR()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/smartcard/CardConnectionDecorator.py", 
line 66, in getATR
    return self.component.getATR()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/smartcard/CardConnectionDecorator.py", 
line 66, in getATR
    return self.component.getATR()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/smartcard/pcsc/PCSCCardConnection.py", 
line 215, in getATR
    hresult=hresult)
            ^^^^^^^
UnboundLocalError: cannot access local variable 'hresult' where it is not 
associated with a value
---
 smartcard/pcsc/PCSCCardConnection.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/smartcard/pcsc/PCSCCardConnection.py 
b/smartcard/pcsc/PCSCCardConnection.py
index 9975eea..929b0c5 100644
--- a/smartcard/pcsc/PCSCCardConnection.py
+++ b/smartcard/pcsc/PCSCCardConnection.py
@@ -150,8 +150,7 @@ class PCSCCardConnection(CardConnection):
         (C{smartcard.scard.SCARD_RESET_CARD})"""
         CardConnection.reconnect(self, protocol)
         if self.hcard is None:
-            raise CardConnectionException('Card not connected',
-                                          hresult=hresult)
+            raise CardConnectionException('Card not connected')
 
         pcscprotocol = translateprotocolmask(protocol)
         if 0 == pcscprotocol:
@@ -211,8 +210,7 @@ class PCSCCardConnection(CardConnection):
         """Return card ATR"""
         CardConnection.getATR(self)
         if self.hcard is None:
-            raise CardConnectionException('Card not connected',
-                                          hresult=hresult)
+            raise CardConnectionException('Card not connected')
         hresult, reader, state, protocol, atr = SCardStatus(self.hcard)
         if hresult != 0:
             raise CardConnectionException(
-- 
2.45.2


--- End Message ---
--- Begin Message ---
Source: pyscard
Source-Version: 2.1.0-1
Done: Ludovic Rousseau <rouss...@debian.org>

We believe that the bug you reported is fixed in the latest version of
pyscard, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1081...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Ludovic Rousseau <rouss...@debian.org> (supplier of updated pyscard package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmas...@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Sun, 08 Sep 2024 18:11:02 +0200
Source: pyscard
Architecture: source
Version: 2.1.0-1
Distribution: unstable
Urgency: medium
Maintainer: Ludovic Rousseau <rouss...@debian.org>
Changed-By: Ludovic Rousseau <rouss...@debian.org>
Closes: 1081115
Changes:
 pyscard (2.1.0-1) unstable; urgency=medium
 .
   * New upstream release
   * Fix "access to undefined variable in PCSCCardConnection.py" fixed
     upstream (Closes: #1081115)
   * Remove pyscard.egg-info/
   * d/control: Standards-Version: 4.6.2 -> 4.7.0, no change needed
Checksums-Sha1:
 89b71b858efea73b527b69bb8f0c606905e23019 2374 pyscard_2.1.0-1.dsc
 1327cd00ff47a3fd625ddfbc899158e12e8e6e61 153511 pyscard_2.1.0.orig.tar.gz
 2a4a1ddca2586d8060f7ad82105454da31684a4e 833 pyscard_2.1.0.orig.tar.gz.asc
 420b4653712eb839fa8488f3d0da47a25d307198 8556 pyscard_2.1.0-1.debian.tar.xz
 9418b10a1b78bc45ce39a237dde547acfd91acf4 7940 pyscard_2.1.0-1_amd64.buildinfo
Checksums-Sha256:
 ba4774c6e9d84b73219dcbf162991bba94aeddd420afd1c5f9d68cdee0b4d985 2374 
pyscard_2.1.0-1.dsc
 0d00de93c9df1fed9d1b246d8ffe16b0b92fb8e9f5d8887454c1829cbcfd56de 153511 
pyscard_2.1.0.orig.tar.gz
 3b3de0da9762e89b54430259c24e76fa10f0fa0dc38d85f9eab52ac8c0befc95 833 
pyscard_2.1.0.orig.tar.gz.asc
 fcf5fae4a67b82088f5a259809c2c46289f1b28652c897442092361942eba4d9 8556 
pyscard_2.1.0-1.debian.tar.xz
 bcbb82237e48f341eba49c139cf53db444881eca294bef03c76065121a35a1a2 7940 
pyscard_2.1.0-1_amd64.buildinfo
Files:
 f51023c70671858f65b991b621cf9380 2374 python optional pyscard_2.1.0-1.dsc
 e250dac4c6494092d0de3d9dabe236ee 153511 python optional 
pyscard_2.1.0.orig.tar.gz
 efdbb859216a45392a0f325a9611d491 833 python optional 
pyscard_2.1.0.orig.tar.gz.asc
 7eebaf7e9e15964230f5aa4068dbf9ce 8556 python optional 
pyscard_2.1.0-1.debian.tar.xz
 97bbe379bae873619e0eb9d598187d1b 7940 python optional 
pyscard_2.1.0-1_amd64.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJIBAEBCAAyFiEE9eEbn/6REUb0HZU9eKG03+j5xX4FAmbdzSoUHHJvdXNzZWF1
QGRlYmlhbi5vcmcACgkQeKG03+j5xX5y4w//SG/6lYFN0E31zEC24hXual38IvbU
A3H1McUD8V509X4RlzLnoyf6TDtTZ19eGEI6i8UgcSmkBwAX++QGC6lR0IQkLM8A
pWbB5J7fzQe8XuNROgXfXlGFk/eaqCbkd607e58s5DkRBmQpr3bbxULCIVC3Jret
+zWfLS82xxFguwoaUImbIeF4w57iZmYnDP7VZKRcQXQhRMsXWuwu1lgTty3Oyg9u
oUaYcfcNIqV/qVK1ci1mzW04ko7azIo0LWPH8nV/TnayJ7v1ZpVmUhCQ8Cp4wXAf
+g1JJWyL7+oxc1XIWoDBny+4A8m/uQ+j7wJGQFLz9BVvklIbgErvy6gK+U7LEHcK
zfdLDRVT0urFPOO5dgnGE7gmFmjKJRJAn3KzJlLYUSWWWKpwbREuGCU1Bci8A0uB
LJ3y7rfmxFfZIY95ZUji1wWBQaMpQ6f+9fLt+4LDAILBWHCYNLAifOql7+bMIaCi
Dp74BA6HZN5jjN2qzCozBJi93h/8LZkOL/wxxzb9mgx/FCo2Kaf4yQ6XS0xSflhR
lfXn9pIazuGyumiut0JNG6W6sIO48jdmx3/CPPmiktHyrodUmzU8N6LD4g+KV2Xo
+8vgVIyv2Cfyuhd8aw5vSFTHXTZ3rBqewi614aDwsmJwlpCu7bLe5wBWolWkxkE0
1+l33gkwFph43jg=
=9ovI
-----END PGP SIGNATURE-----

Attachment: pgpZHthkAecdN.pgp
Description: PGP signature


--- End Message ---

Reply via email to