Bug 478528

Summary: Kate editor can't validate XML files ("Error: Failed to find xmllint"), even though the plugin is activated and libxml2 is present.
Product: [Applications] kate Reporter: Christian R. <3288pcxd>
Component: applicationAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: normal CC: christoph, waqar.17a
Priority: NOR    
Version First Reported In: 23.08.4   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Christian R. 2023-12-15 00:39:52 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. In Kate editor (with the XML validation present and activated), select the "XML" menu
2. Select Validate XML

OBSERVED RESULT
Message appears at the bottom:
[23:31:07  XMLCheck Error] Error: Failed to find xmllint. Please make sure that xmllint is installed. It is part of libxml2.

EXPECTED RESULT
Currently loaded file to be checked by xmllint (via the "XML validation" plugin, which is present and activated.)

SOFTWARE/OS VERSIONS
Windows: 10 22h2 (OS build 19045.3803)
Debian 12.0, in the Windows Subsystem for Linux (WSL2). No linux desktop.




ADDITIONAL INFORMATION
- I tried both the KDE "Kate for Windows" installer and the Microsoft store. Debian was downloaded from the Debian website and Linux Kate was installed with apt-get.
For the Windows version of Kate, both kate.exe and libxml2.dll are in the same folder (C:\Program Files\Kate\bin\) along with all the other Kate files. I forgot to check in Debian before I uninstalled Kate (because the app's schemes and themes probably need the kde desktop in order to work properly).
Comment 1 Waqar Ahmed 2023-12-15 05:36:31 UTC
if you type `xmllint` in terminal promt _inside_ kate, what happens?

Maybe inside WSL commands need to be invoked differently.
Comment 2 Christian R. 2023-12-15 16:52:54 UTC
Hi,
As i mentioned, the problem happens also OUTSIDE WSL, with the Windows version of Kate in Windows 10. With that one, I tried
  
	PS C:\> cd c:\'Program Files'\Kate\bin
	PS C:\Program Files\Kate\bin> xmllint

lmxlint : The term 'lmxlint' is not recognized as the name of a cmdlet, function, script file, or operable program.

what is weird is that in the Kate Powershell terminal, this error message contains the wordxmllint
and when I copy-paste it in this email, it becomes
lmxlint

If I try the same procedure directly inside apowershell 7.4.0
window, this doesn't happen and the error message indeed contains xmllint before and after copying in this email:
xmllint: The term 'xmllint' is not recognized as a name of a cmdlet, function, script file, or executable program.

In the embedded terminal of the windows version of Kate, the command
	PS C:\Program Files\Kate\bin> $PSVersionTable
results in

Name                           Value
----                           -----
PSVersion                      5.1.19041.3803
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.3803
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


I'll stop here for now.

I will reinstall the Linux version of Kate inside the Debian WSL, and try your suggestion there as well.

Christian R.


On 15.12.2023 06:36, Waqar Ahmed wrote:
> https://bugs.kde.org/show_bug.cgi?id=478528
> 
> Waqar Ahmed <waqar.17a@gmail.com> changed:
> 
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |waqar.17a@gmail.com
> 
> --- Comment #1 from Waqar Ahmed <waqar.17a@gmail.com> ---
> if you type `xmllint` in terminal promt _inside_ kate, what happens?
> 
> Maybe inside WSL commands need to be invoked differently.
>
Comment 3 Waqar Ahmed 2023-12-15 17:27:39 UTC
The issue is simple. Kate expects `xmllint` to be in your PATH environment variable. If its not there, it wont get found. So just make sure to add the directory contain xmllint.exe to your path.
Comment 4 Christian R. 2023-12-16 16:55:24 UTC
Well, there is no xmllint.exe on my whole Windows 10 PC, and if you read 
again carefully my previous messages, the error message says

/        /XMLCheck////Error//] //Error://Failed to find xmllint.Please 
make sure that xmllint is installed.//////It is part of libxml2.////

- I already tried to put C:\Program Files\Kate\bin\ in the system Path, 
which, _as I wrote before_, is the directory where both Kate.exe and 
libmxl2 reside.

- I extracted what I could from libxml2.DLL with the first extractor I 
could find. Here's what redwood.exe found:

- I don't think it's a config mistake, I think it's a coding, compiling, 
or file management issue.

- What have you got to say about the error messages and the weirdest 
copy-paste thing I ever noticed, depending on the Powershell version, 
that were explained in my previous message?

Has anybody checked whether it happens in a native Debian environment, 
_without the KDE deskop_, but with KDE Kate? and the same setup in WSL 
on Windows?

Interventions and analysis of other people from the mailing list for 
this bug would be useful.


Thanks in advance.


On 15.12.2023 18:27, Waqar Ahmed wrote:
> https://bugs.kde.org/show_bug.cgi?id=478528
>
> --- Comment #3 from Waqar Ahmed <waqar.17a@gmail.com> ---
> The issue is simple. Kate expects `xmllint` to be in your PATH environment
> variable. If its not there, it wont get found. So just make sure to 
> add the
> directory contain xmllint.exe to your path.
>
Comment 5 Waqar Ahmed 2023-12-17 07:18:49 UTC
Like I said, you need to install xmllint. That is what kates error msg says.

Xmllint is a program just like Kate. Its not a dll/library.
Comment 6 Waqar Ahmed 2023-12-17 16:26:03 UTC
Please dont reopen bugs that we can't fix / do anything about. Thanks.

I understand you are having an issue, but its not something Kate developers can fix.
Comment 7 Christoph Cullmann 2023-12-17 16:48:09 UTC
Hi, if xmllint is not found, it will not work. We can't start to bundle all that stuff, that is an amount of work we will not want to have. If the tool is in the path, it should work.
Comment 8 Christian R. 2023-12-17 21:30:31 UTC
> That is what kates error msg says.
The message is badly written, because it ends with
> It is part of libxml2.

At first there was no mention of an .exe, so I thought xmllint was 
inside libxml2. I wasn't helped by internet statements like

> 24 Nov 2023 "xmllint.exe is considered a type of libxml2 library file.
> It is most-commonly used in libxml2 developed by IDM Computer Solutions."

and
> > Two tools from libxml2 will be heavily used in this course : xmllint 
and xsltproc.
> ...
> libxml2 is installed by default on MacOSX, but not on Windows systems.
> 
>     As indicated by the Downloads page from the reference site of libxml2, Windows binaries are to be found on:
>         http://xmlsoft.org/sources/win32/ for 32 bit architectures
>         http://xmlsoft.org/sources/win32/64bit/ for 64 bit.

but then he goes on

>     For instance, downloading and unpacking the libxml2-2.9.1-win32-x86_64.7z archive yields a folder containing
>         bin
>         include
>         lib
>         share
> 
>     The bin directory contains 4 files:
>         libxml2-2.dll
>         xml2-config
>         xmlcatalog.exe
>         xmllint.exe

Now it was clear. I followed the instructions, put xmllint.exe in 
C:\Program Files\Kate\bin\ where kate.exe and libxml2 are. Result:
> XMLCheck Error] Validate process crashed

I then tried to replace the libxml2 in Kate with the newest from the 
download, same thing. I tried other xmllint.exe from the Internet, all 
crashed. Finally, a small and old one named google-xmllink, once 
renamed, works.

Since I installed chocolatey to install Kate for easy updates, I thought 
maybe it was their package that was missing the proper xmllint.exe, so I 
uninstalled Kate and Chocolatey, and installed Kate from the latest 
"release Kate 64-bit installer" from kate-editor.org.

  And THERE IS NO APPROPRIATE XMLLINT IN IT!

On kate-editor.org, you push Kate's numerous plugins as an asset, but 
then you omit the essential file that "XML Validate" needs!

I placed the one that worked in the same directory as kate.exe, like for 
the chocolatey install. Result:
> XMLCheck error] Error: Failed to find xmllint. Please make sure that xmllint is installed. It is part of libxml2.

I had to create an environment variable (as you had suggested) pointing 
to the very same directory in which Kate and xmllink are. Unlike with 
the Chocolatey version...

So everything is fine now, except that I spent hours on this. I know 
it's coming from the Linux world, but still, come on!

Would it be too much for the KDE team to put the proper xmllint in the 
proper place in the installer, and have a script creating the proper 
environment variable? And what about checking/organizing things so that 
Chocolatey always has the same version as the KDE Release Installer? By 
the way, theirs was 32bit,the latest release is 64bit.

Allow me to point out that I voluntarily chose NOT to use the Microsoft 
store to install Kate, because I don't like Microsoft, Apple, Google, 
Facebook and whoever else is going to make things work differently in 
order to make money. Having used HP-UX on workstations back in the 
Middle Ages, I like Linux, but a little bit of diligence would go a long 
way towards bringing Windows users to your platform. I sure hope you 
will share this with your Kate team, and that this damned xmllink will 
be included correctly in all installations from now on.

Ciao,

Christian R.


On 17.12.2023 08:18, Waqar Ahmed wrote:
> https://bugs.kde.org/show_bug.cgi?id=478528
> 
> Waqar Ahmed <waqar.17a@gmail.com> changed:
> 
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>           Resolution|---                         |NOT A BUG
>               Status|REPORTED                    |RESOLVED
> 
> --- Comment #5 from Waqar Ahmed <waqar.17a@gmail.com> ---
> Like I said, you need to install xmllint. That is what kates error msg says.
> 
> Xmllint is a program just like Kate. Its not a dll/library.
>
Comment 9 Christoph Cullmann 2023-12-17 21:35:56 UTC
As said, we don't bundle that. If it is hard to install on Windows that is not nice, but we can't provide howtos for all that things. If you want to contribute some better error handling or extend our manual, we are open for merge requests on that.
Comment 10 Christian R. 2023-12-17 22:19:46 UTC
By the way, don't get me wrong: I've recently tried many text/code 
multi-platform editors, and Kate is the best!

Chris R.
Comment 11 Christoph Cullmann 2023-12-18 17:54:01 UTC
(In reply to Christian R. from comment #10)
> By the way, don't get me wrong: I've recently tried many text/code 
> multi-platform editors, and Kate is the best!
> 
> Chris R.

Thanks!