meinproc/docbook can't handle paths with spaces ?
Ingo Klöcker
kloecker at kde.org
Mon Dec 17 22:27:02 GMT 2007
On Monday 17 December 2007, Alexander Neundorf wrote:
> On Monday 17 December 2007, Andreas Pakulat wrote:
> > On 17.12.07 21:12:28, Alexander Neundorf wrote:
> > > currently kdelibs doesn't build if the source dir contains
> > > spaces: man-checkXML.1.docbook:4: warning: failed to load
> > > external entity "dtd/kdex.dtd"
> > >
> > > strace says the following:
> > > stat64("/home/alex/src/kde4-svn/KDE", 0xbfcf68ec) = -1 ENOENT (No
> > > such file or directory)
> > > stat64("dir/kdelibs/kdoctools/customization/catalog", 0xbfcf68ec)
> > > = -1 ENOENT (No such file or directory)
> > >
> > > This is obviously wrong and should be:
> > > stat64("/home/alex/src/kde4-svn/KDE\
> > > dir/kdelibs/kdoctools/customization/catalog", ... )
> > >
> > > So, is libxml actually able to deal with paths which contains
> > > spaces ? Or are we just forgetting somewhere to escape some paths
> > > ?
> > >
> > > (libxml docs seem to say that separators are the colon and
> > > spaces, which doesn't sound good...)
> >
> > That would be really bad, however calling xmllint with a file that
> > lies in a dir with spaces works fine. So hopefully its just some
> > CMake-part that doesn't quote properly.
>
> My mail was too short.
> Here are the results from running it manually:
> kdelibs-cmake-HEAD/doc/kbuildsycoca4$ ../../bin/meinproc4
> --stylesheet /home/alex/src/kde4-svn/KDE\
> dir/kdelibs/kdoctools/docbook/xsl/manpages/docbook.xsl --check
> --srcdir=/home/alex/src/kde4-svn/KDE\ dir/kdelibs/kdoctools/
> /home/alex/src/kde4-svn/KDE\
> dir/kdelibs/doc/kbuildsycoca4/man-kbuildsycoca4.8.docbook
> meinproc4(27435) KLocalePrivate::initFormat:
> KLocalePrivate::KLocalePrivate -- srcdir=
> -/home/alex/src/kde4-svn/KDE dir/kdelibs/kdoctools-
> man-kbuildsycoca4.8.docbook:4: warning: failed to load external
> entity "dtd/kdex.dtd"
> ]>
> ^
> man-kbuildsycoca4.8.docbook:6: validity error : Validation failed: no
> DTD found !
> <refentry>
>
>
> This is the command as it is executed when building. As you can see
> the spaces are escaped with backslashes.
> Now I replaced them with double quotes:
>
> kdelibs-cmake-HEAD/doc/kbuildsycoca4$ ../../bin/meinproc4
> --stylesheet "/home/alex/src/kde4-svn/KDE
> dir/kdelibs/kdoctools/docbook/xsl/manpages/docbook.xsl" --check
> --srcdir="/home/alex/src/kde4-svn/KDE dir/kdelibs/kdoctools/"
> "/home/alex/src/kde4-svn/KDE
> dir/kdelibs/doc/kbuildsycoca4/man-kbuildsycoca4.8.docbook"
> meinproc4(27458) KLocalePrivate::initFormat:
> KLocalePrivate::KLocalePrivate -- srcdir=
> -/home/alex/src/kde4-svn/KDE dir/kdelibs/kdoctools-
> man-kbuildsycoca4.8.docbook:4: warning: failed to load external
> entity "dtd/kdex.dtd"
> ]>
> ^
> man-kbuildsycoca4.8.docbook:6: validity error : Validation failed: no
> DTD found !
> <refentry>
> ^
> man-kbuildsycoca4.8.docbook:9: parser error : Entity 'kde' not
> defined <title>&kde; User's Manual</title>
>
>
> The strace output was in my first mail.
>
> Actually it is already one month ago when I found that, and I sent an
> email to kdelibs-bugs then, so the details are not completely fresh.
> But I think somewhere in libxml the arguments are parsed and escaping
> space isn't supported. Can somebody confirm this ?
The following code-snippet in meinproc.cpp looks highly suspicious to
me:
=====
QString catalogs;
catalogs +=
KStandardDirs::locate( "dtd", "customization/catalog" );
catalogs += ' ';
catalogs +=
KStandardDirs::locate( "dtd", "docbook/xml-dtd-4.1.2/docbook.cat" );
setenv( "SGML_CATALOG_FILES", QFile::encodeName(
catalogs ).constData(), 1);
=====
I haven't verified, but it seems the spaces in the return value of
KStandardDirs::locate() are not escaped and thus an incorrect value is
put into SGML_CATALOG_FILES. So the bug is obviously in meinproc.cpp
and not in libxml.
Maybe
catalogs += KShell::quoteArg(
KStandardDirs::locate( "dtd", "customization/catalog" ) );
catalogs += ' ';
catalogs += KShell::quoteArg(
KStandardDirs::locate( "dtd", "docbook/xml-dtd-4.1.2/docbook.cat" ) );
fixes the problem, but that's just a wild guess.
Regards,
Ingo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20071217/fd5ea400/attachment.sig>
More information about the kde-core-devel
mailing list