Re: A recent change causes SCardCancel() to block?

Ludovic Rousseau <[email protected]> Thu, 15 Jun 2017 15:00:41 +0200
Newsgroups gmane.comp.lib.muscle
Message-ID <CAGstE8A8ECxdvSZ7JaGyu-+8QL0XHd+8NwjcLm-yN8z0jyRrdQ@mail.gmail.com>
--===============7718326005805124107==
Content-Type: multipart/alternative; boundary="089e0822ca687433760551ff4247"

--089e0822ca687433760551ff4247
Content-Type: text/plain; charset="UTF-8"

2017-06-14 11:43 GMT+02:00 Ran Benita <[email protected]>:

> Hello,
>

Hello,


>
> I have noticed a change in behavior in one of the recent pcsclite
> releases. I am using pcsclite 1.8.21 and ccid 1.4.27 on ArchLinux.
>
> The program below calls a blocking SCardGetStatusChange, but before that
> spwans a thread which waits for a key press, then calls SCardCancel (on
> the same context). It is a port of the Rust program here:
> https://raw.githubusercontent.com/bluetech/pcsc-rust/
> 01bd4d80e366ef00f7006dabee45c8cb356d8566/pcsc/examples/cancel.rs
>
> Previously, the SCardCancel would return immediately and would cause
> SCardGetStatusChange to return SCARD_E_CANCELLED immediately.
>
> Now, SCardCancel blocks until SCardGetStatusChange times out, and only
> then returns SCARD_S_SUCCESS.
>
> Is this an intended change, or a regression? Or maybe I'm doing
> something wrong?
>

No. Your sample code is correct.
The bug is in pcsc-lite since 1.8.21 (latest version).
More precisely at this line:
https://github.com/LudovicRousseau/PCSC/commit/9a21c82330fc4b73ac00faf2c5cf948da5f8ab07#diff-320fdf2286b77c3aa12e4f0c174a5ac1L3082

It is now fixed in
https://github.com/LudovicRousseau/PCSC/commit/7a3738d2f8e48c669b0e3f485cb9dcabeffc941a

I will release a new pcsc-lite soon.

Thanks for the bug report.
Bye

-- 
 Dr. Ludovic Rousseau

--089e0822ca687433760551ff4247
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">2017=
-06-14 11:43 GMT+02:00 Ran Benita <span dir=3D"ltr">&lt;<a href=3D"mailto:r=
[email protected]" target=3D"_blank">[email protected]</a>&gt;</span>:<br><blo=
ckquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left=
:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br></blockquote><div><=
br></div><div>Hello,<br>=C2=A0<br></div><blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);pad=
ding-left:1ex">
<br>
I have noticed a change in behavior in one of the recent pcsclite<br>
releases. I am using pcsclite 1.8.21 and ccid 1.4.27 on ArchLinux.<br>
<br>
The program below calls a blocking SCardGetStatusChange, but before that<br=
>
spwans a thread which waits for a key press, then calls SCardCancel (on<br>
the same context). It is a port of the Rust program here:<br>
<a href=3D"https://raw.githubusercontent.com/bluetech/pcsc-rust/01bd4d80e36=
6ef00f7006dabee45c8cb356d8566/pcsc/examples/cancel.rs" rel=3D"noreferrer" t=
arget=3D"_blank">https://raw.githubusercontent.<wbr>com/bluetech/pcsc-rust/=
<wbr>01bd4d80e366ef00f7006dabee45c8<wbr>cb356d8566/pcsc/examples/<wbr>cance=
l.rs</a><br>
<br>
Previously, the SCardCancel would return immediately and would cause<br>
SCardGetStatusChange to return SCARD_E_CANCELLED immediately.<br>
<br>
Now, SCardCancel blocks until SCardGetStatusChange times out, and only<br>
then returns SCARD_S_SUCCESS.<br>
<br>
Is this an intended change, or a regression? Or maybe I&#39;m doing<br>
something wrong?<br></blockquote><div><br></div><div>No. Your sample code i=
s correct.<br clear=3D"all"></div></div>The bug is in pcsc-lite since 1.8.2=
1 (latest version).<br>More precisely at this line: <a href=3D"https://gith=
ub.com/LudovicRousseau/PCSC/commit/9a21c82330fc4b73ac00faf2c5cf948da5f8ab07=
#diff-320fdf2286b77c3aa12e4f0c174a5ac1L3082">https://github.com/LudovicRous=
seau/PCSC/commit/9a21c82330fc4b73ac00faf2c5cf948da5f8ab07#diff-320fdf2286b7=
7c3aa12e4f0c174a5ac1L3082</a><br><br></div><div class=3D"gmail_extra">It is=
 now fixed in <a href=3D"https://github.com/LudovicRousseau/PCSC/commit/7a3=
738d2f8e48c669b0e3f485cb9dcabeffc941a">https://github.com/LudovicRousseau/P=
CSC/commit/7a3738d2f8e48c669b0e3f485cb9dcabeffc941a</a><br><br></div><div c=
lass=3D"gmail_extra">I will release a new pcsc-lite soon.<br><br></div><div=
 class=3D"gmail_extra">Thanks for the bug report.<br></div><div class=3D"gm=
ail_extra">Bye<br></div><div class=3D"gmail_extra"><br></div><div class=3D"=
gmail_extra">-- <br><div class=3D"gmail_signature">=C2=A0Dr. Ludovic Rousse=
au</div>
</div></div>

--089e0822ca687433760551ff4247--


--===============7718326005805124107==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Pcsclite-muscle mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pcsclite-muscle
--===============7718326005805124107==--