[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: meinproc/docbook can't handle paths with spaces ?
From:       Ingo =?iso-8859-15?q?Kl=F6cker?= <kloecker () kde ! org>
Date:       2007-12-17 23:16:30
Message-ID: 200712180016.30532 () erwin ! ingo-kloecker ! de
[Download RAW message or body]


On Monday 17 December 2007, Ingo Klöcker wrote:
> 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.

No. That leads to

[pid 28837] stat("\'/home/ingo/svn/kde/branches/work/new", 
0x7fff16a1a0f0) = -1 ENOENT (No such file or directory)
[pid 28837] stat("ssl/kdelibs/kdoctools/customization/catalog\'", 
0x7fff16a1a0f0) = -1 ENOENT (No such file or directory)

i.e. xmllint escapes the single quotes around the filename.


Same procedure with double quotes:

stat("\"/home/ingo/svn/kde/branches/work/new", 0x7fffd7d2f390) = -1 
ENOENT (No such file or directory)
stat("ssl/kdelibs/kdoctools/customization/catalog\"", 0x7fffd7d2f390) 
= -1 ENOENT (No such file or directory)


And escaping the spaces in the catalog names with a backslash also does 
not work:

stat("/home/ingo/svn/kde/branches/work/new\\", 0x7fff0ecaa310) = -1 
ENOENT (No such file or directory)
stat("ssl/kdelibs/kdoctools/customization/catalog", 0x7fff0ecaa310) = -1 
ENOENT (No such file or directory)

Again the backslash is escaped again.


Conclusion:
- meinproc4 did not quote the catalog names correctly before putting 
them in the environment variable.
- xmllint does not seem to be able to extract catalog names containing 
spaces correctly from the environment variable no matter how they are 
escaped.


Regards,
Ingo

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic