libksane seems to break QProcess::start calls

Thiago Macieira thiago at kde.org
Fri Mar 4 22:45:53 GMT 2022


On Friday, 4 March 2022 13:47:07 PST Tobias Leupold wrote:
> I don't know if this would be still possible for the Qt 5 docs, but a small
> hint like "If you subclass this, be aware that ..." woudn't hurt ... As
> said, I would never have thought that this would have such side-effects!

It shouldn't have any side-effects. In fact, the code exists to *avoid* side-
effects in the first place.

Of course, it assumes that there isn't buggy code elsewhere. If there is, then 
all bets are lost. I'm not going to document how to bugfix other code, 
especially complex code like this. And we've already established that the SANE 
backend is buggy.

> > Anyway, please note that simply your problem still exists even without
> > subclassing on kernels older than 5.4. For those, we have to use the
> > SIGCHLD handler anyway. This must be fixed in the SANE backend.
> 
> If you're really bored some time, maybe you want to file an issue for the
> SANE Pixma backend and tell the devs what exactly is wrong there and/or how
> to fix this?

I'm not. I'll explain if you file or if you want to actually fix, but I don't 
have that much free time available.

> > Or you can work around it by doing what it is doing: fork().
> 
> Well, I think, if I'm safe with Qt >=5.15 and Kernel >=5.4, for now, I'd
> stick with the simple implementation that works now. Forking some part of a
> Qt program is something I even know less about than what can happen if I
> call external programs via QProcess ... I'm quite happy to have it in a
> working state now!

Well, if you use QProcess to call the full SANE backend, that will also avoid 
the problem.

> Surely, the fact that some SANE backends may cause issues with process calls
> with older kernels should be mentioned in the still-to-write docs. But at
> the moment, I think I should first see if anybody besides me ever considers
> the project to be meaningful and if it would be worth it to make it safe
> for older environments. Although it may be worth it to mess with this stuff
> to learn more about process handling, threads and forks and so on.

"If you write buggy code, the application may misbehave" is not documentation.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DPG Cloud Engineering





More information about the kde-devel mailing list