All of lore.kernel.org
 help / color / mirror / Atom feed
* docbook: fix fatal error in linux/input.h
@ 2010-10-26 18:45 Randy Dunlap
  2010-10-26 19:13 ` Mauro Carvalho Chehab
  2010-10-29 17:56 ` [PATCH] scripts/kernel-doc: escape special characters for xml struct output Randy Dunlap
  0 siblings, 2 replies; 12+ messages in thread
From: Randy Dunlap @ 2010-10-26 18:45 UTC (permalink / raw)
  To: lkml; +Cc: Mauro Carvalho Chehab, Dmitry Torokhov

Hi,

Recent commit 8613e4c2872a87cc309a42de2c7091744dc54d0e:
Author: Mauro Carvalho Chehab <mchehab@redhat.com>
Date:   Thu Sep 9 21:54:22 2010 -0700
    Input: add support for large scancodes

causes a fatal error in docbook generation:

linux-2.6.36-git8/DOC1/Documentation/DocBook/device-drivers.xml:40690: parser error : StartTag: invalid element name
#define INPUT_KEYMAP_BY_INDEX	(1 << 0)
                             	    ^

I think that this message comes from xsltproc, but I'm not positive about that.
I also don't know of a really good fix for it.  However, I did find 2 ways to
work around the error:

a/ move the #define value to after the end of the struct input_keymap_entry, like:

/* flags bits: */
#define INPUT_KEYMAP_BY_INDEX	(1 << 0)

or
b/ don't use the "<< 0" (can leave the #define where it is in this case):
#define INPUT_KEYMAP_BY_INDEX	(1)

I have tested both of these patches and they work OK.
Are you OK with either of them?  or want to choose one?

thanks,
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: docbook: fix fatal error in linux/input.h
  2010-10-26 18:45 docbook: fix fatal error in linux/input.h Randy Dunlap
@ 2010-10-26 19:13 ` Mauro Carvalho Chehab
  2010-10-26 19:17   ` Randy Dunlap
  2010-10-29 17:56 ` [PATCH] scripts/kernel-doc: escape special characters for xml struct output Randy Dunlap
  1 sibling, 1 reply; 12+ messages in thread
From: Mauro Carvalho Chehab @ 2010-10-26 19:13 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: lkml, Dmitry Torokhov

Em 26-10-2010 16:45, Randy Dunlap escreveu:
> Hi,
> 
> Recent commit 8613e4c2872a87cc309a42de2c7091744dc54d0e:
> Author: Mauro Carvalho Chehab <mchehab@redhat.com>
> Date:   Thu Sep 9 21:54:22 2010 -0700
>     Input: add support for large scancodes
> 
> causes a fatal error in docbook generation:
> 
> linux-2.6.36-git8/DOC1/Documentation/DocBook/device-drivers.xml:40690: parser error : StartTag: invalid element name
> #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
>                              	    ^
> 
> I think that this message comes from xsltproc, but I'm not positive about that.
> I also don't know of a really good fix for it.  However, I did find 2 ways to
> work around the error:
> 
> a/ move the #define value to after the end of the struct input_keymap_entry, like:
> 
> /* flags bits: */
> #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
> 
> or
> b/ don't use the "<< 0" (can leave the #define where it is in this case):
> #define INPUT_KEYMAP_BY_INDEX	(1)
> 
> I have tested both of these patches and they work OK.
> Are you OK with either of them?  or want to choose one?


Hmm... probably, the first one is not correct.

I suspect that the right way is to use something like:

	#define INPUT_KEYMAP_BY_INDEX	(1 &lt;&lt; 0)

Could you please test if this would fix the issue?

Thanks,
Mauro

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: docbook: fix fatal error in linux/input.h
  2010-10-26 19:13 ` Mauro Carvalho Chehab
@ 2010-10-26 19:17   ` Randy Dunlap
  2010-10-26 20:08     ` Mauro Carvalho Chehab
  2010-10-26 20:15     ` Mauro Carvalho Chehab
  0 siblings, 2 replies; 12+ messages in thread
From: Randy Dunlap @ 2010-10-26 19:17 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: lkml, Dmitry Torokhov

On Tue, 26 Oct 2010 17:13:01 -0200 Mauro Carvalho Chehab wrote:

> Em 26-10-2010 16:45, Randy Dunlap escreveu:
> > Hi,
> > 
> > Recent commit 8613e4c2872a87cc309a42de2c7091744dc54d0e:
> > Author: Mauro Carvalho Chehab <mchehab@redhat.com>
> > Date:   Thu Sep 9 21:54:22 2010 -0700
> >     Input: add support for large scancodes
> > 
> > causes a fatal error in docbook generation:
> > 
> > linux-2.6.36-git8/DOC1/Documentation/DocBook/device-drivers.xml:40690: parser error : StartTag: invalid element name
> > #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
> >                              	    ^
> > 
> > I think that this message comes from xsltproc, but I'm not positive about that.
> > I also don't know of a really good fix for it.  However, I did find 2 ways to
> > work around the error:
> > 
> > a/ move the #define value to after the end of the struct input_keymap_entry, like:
> > 
> > /* flags bits: */
> > #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
> > 
> > or
> > b/ don't use the "<< 0" (can leave the #define where it is in this case):
> > #define INPUT_KEYMAP_BY_INDEX	(1)
> > 
> > I have tested both of these patches and they work OK.
> > Are you OK with either of them?  or want to choose one?
> 
> 
> Hmm... probably, the first one is not correct.

Why not?  All it does is move the line to after the end of the struct.

> I suspect that the right way is to use something like:
> 
> 	#define INPUT_KEYMAP_BY_INDEX	(1 &lt;&lt; 0)
> 
> Could you please test if this would fix the issue?

You are suggesting putting that into include/linux/input.h ??

That would make sense if some tool converted "<<" to "&lt;&lt;".
And that may be where the problem is, but I don't know those tools.


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: docbook: fix fatal error in linux/input.h
  2010-10-26 19:17   ` Randy Dunlap
@ 2010-10-26 20:08     ` Mauro Carvalho Chehab
  2010-10-26 20:15     ` Mauro Carvalho Chehab
  1 sibling, 0 replies; 12+ messages in thread
From: Mauro Carvalho Chehab @ 2010-10-26 20:08 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: lkml, Dmitry Torokhov

Em 26-10-2010 17:17, Randy Dunlap escreveu:
> On Tue, 26 Oct 2010 17:13:01 -0200 Mauro Carvalho Chehab wrote:
> 
>> Em 26-10-2010 16:45, Randy Dunlap escreveu:
>>> Hi,
>>>
>>> Recent commit 8613e4c2872a87cc309a42de2c7091744dc54d0e:
>>> Author: Mauro Carvalho Chehab <mchehab@redhat.com>
>>> Date:   Thu Sep 9 21:54:22 2010 -0700
>>>     Input: add support for large scancodes
>>>
>>> causes a fatal error in docbook generation:
>>>
>>> linux-2.6.36-git8/DOC1/Documentation/DocBook/device-drivers.xml:40690: parser error : StartTag: invalid element name
>>> #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
>>>                              	    ^
>>>
>>> I think that this message comes from xsltproc, but I'm not positive about that.
>>> I also don't know of a really good fix for it.  However, I did find 2 ways to
>>> work around the error:
>>>
>>> a/ move the #define value to after the end of the struct input_keymap_entry, like:
>>>
>>> /* flags bits: */
>>> #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
>>>
>>> or
>>> b/ don't use the "<< 0" (can leave the #define where it is in this case):
>>> #define INPUT_KEYMAP_BY_INDEX	(1)
>>>
>>> I have tested both of these patches and they work OK.
>>> Are you OK with either of them?  or want to choose one?
>>
>>
>> Hmm... probably, the first one is not correct.
> 
> Why not?  All it does is move the line to after the end of the struct.
> 
>> I suspect that the right way is to use something like:
>>
>> 	#define INPUT_KEYMAP_BY_INDEX	(1 &lt;&lt; 0)
>>
>> Could you please test if this would fix the issue?
> 
> You are suggesting putting that into include/linux/input.h ??
> 
> That would make sense if some tool converted "<<" to "&lt;&lt;".
> And that may be where the problem is, but I don't know those tools.

Well, if you don't do it, you may have other problems ;)

Letting characters like <, > or & source code may generate wrong xml files,
and may be bad interpreted by the xml tools.

Btw, that Makefile patch I did to auto-generate some media files[1] use this
logic to generate such files:

ESCAPE = \
	-e "s/&/\\&amp;/g" \
	-e "s/</\\&lt;/g" \
	-e "s/>/\\&gt;/g"

$(MEDIA_DIR)/videodev2.h.xml: $(srctree)/include/linux/videodev2.h $(MEDIA_DIR)/v4l2.xml
	@$($(quiet)gen_xml)
	@(					\
	echo "<programlisting>") > $@
	@(					\
	expand --tabs=8 < $< |			\
	  sed $(ESCAPE) $(DOCUMENTED) |		\
	  sed 's/i\.e\./&ie;/') >> $@
	@(					\
	echo "</programlisting>") >> $@

[1] https://patchwork.kernel.org/patch/267932/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: docbook: fix fatal error in linux/input.h
  2010-10-26 19:17   ` Randy Dunlap
  2010-10-26 20:08     ` Mauro Carvalho Chehab
@ 2010-10-26 20:15     ` Mauro Carvalho Chehab
  2010-10-26 20:51       ` Randy Dunlap
  2010-10-26 20:59       ` Randy Dunlap
  1 sibling, 2 replies; 12+ messages in thread
From: Mauro Carvalho Chehab @ 2010-10-26 20:15 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: lkml, Dmitry Torokhov

Em 26-10-2010 17:17, Randy Dunlap escreveu:
> On Tue, 26 Oct 2010 17:13:01 -0200 Mauro Carvalho Chehab wrote:
> 
>> Em 26-10-2010 16:45, Randy Dunlap escreveu:
>>> Hi,
>>>
>>> Recent commit 8613e4c2872a87cc309a42de2c7091744dc54d0e:
>>> Author: Mauro Carvalho Chehab <mchehab@redhat.com>
>>> Date:   Thu Sep 9 21:54:22 2010 -0700
>>>     Input: add support for large scancodes
>>>
>>> causes a fatal error in docbook generation:
>>>
>>> linux-2.6.36-git8/DOC1/Documentation/DocBook/device-drivers.xml:40690: parser error : StartTag: invalid element name
>>> #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
>>>                              	    ^
>>>
>>> I think that this message comes from xsltproc, but I'm not positive about that.
>>> I also don't know of a really good fix for it.  However, I did find 2 ways to
>>> work around the error:
>>>
>>> a/ move the #define value to after the end of the struct input_keymap_entry, like:
>>>
>>> /* flags bits: */
>>> #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
>>>
>>> or
>>> b/ don't use the "<< 0" (can leave the #define where it is in this case):
>>> #define INPUT_KEYMAP_BY_INDEX	(1)
>>>
>>> I have tested both of these patches and they work OK.
>>> Are you OK with either of them?  or want to choose one?
>>
>>
>> Hmm... probably, the first one is not correct.
> 
> Why not?  All it does is move the line to after the end of the struct.
> 
>> I suspect that the right way is to use something like:
>>
>> 	#define INPUT_KEYMAP_BY_INDEX	(1 &lt;&lt; 0)
>>
>> Could you please test if this would fix the issue?
> 
> You are suggesting putting that into include/linux/input.h ??
> 
> That would make sense if some tool converted "<<" to "&lt;&lt;".
> And that may be where the problem is, but I don't know those tools.


Hmm... such rule is already at DocBook/Makefile:

%.xml: %.c
        @$($(quiet)gen_xml)
        @(                            \
	   echo "<programlisting>";   \
           expand --tabs=8 < $< |     \
           sed -e "s/&/\\&amp;/g"     \
               -e "s/</\\&lt;/g"      \
               -e "s/>/\\&gt;/g";     \
           echo "</programlisting>")  > $@

Not sure why this didn't work. It should have replaced the < from the c file.
Maybe some patch broke Makefile?

Cheers,
Mauro.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: docbook: fix fatal error in linux/input.h
  2010-10-26 20:15     ` Mauro Carvalho Chehab
@ 2010-10-26 20:51       ` Randy Dunlap
  2010-10-26 20:59       ` Randy Dunlap
  1 sibling, 0 replies; 12+ messages in thread
From: Randy Dunlap @ 2010-10-26 20:51 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: lkml, Dmitry Torokhov

On Tue, 26 Oct 2010 18:15:10 -0200 Mauro Carvalho Chehab wrote:

> Em 26-10-2010 17:17, Randy Dunlap escreveu:
> > On Tue, 26 Oct 2010 17:13:01 -0200 Mauro Carvalho Chehab wrote:
> > 
> >> Em 26-10-2010 16:45, Randy Dunlap escreveu:
> >>> Hi,
> >>>
> >>> Recent commit 8613e4c2872a87cc309a42de2c7091744dc54d0e:
> >>> Author: Mauro Carvalho Chehab <mchehab@redhat.com>
> >>> Date:   Thu Sep 9 21:54:22 2010 -0700
> >>>     Input: add support for large scancodes
> >>>
> >>> causes a fatal error in docbook generation:
> >>>
> >>> linux-2.6.36-git8/DOC1/Documentation/DocBook/device-drivers.xml:40690: parser error : StartTag: invalid element name
> >>> #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
> >>>                              	    ^
> >>>
> >>> I think that this message comes from xsltproc, but I'm not positive about that.
> >>> I also don't know of a really good fix for it.  However, I did find 2 ways to
> >>> work around the error:
> >>>
> >>> a/ move the #define value to after the end of the struct input_keymap_entry, like:
> >>>
> >>> /* flags bits: */
> >>> #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
> >>>
> >>> or
> >>> b/ don't use the "<< 0" (can leave the #define where it is in this case):
> >>> #define INPUT_KEYMAP_BY_INDEX	(1)
> >>>
> >>> I have tested both of these patches and they work OK.
> >>> Are you OK with either of them?  or want to choose one?
> >>
> >>
> >> Hmm... probably, the first one is not correct.
> > 
> > Why not?  All it does is move the line to after the end of the struct.
> > 
> >> I suspect that the right way is to use something like:
> >>
> >> 	#define INPUT_KEYMAP_BY_INDEX	(1 &lt;&lt; 0)
> >>
> >> Could you please test if this would fix the issue?
> > 
> > You are suggesting putting that into include/linux/input.h ??
> > 
> > That would make sense if some tool converted "<<" to "&lt;&lt;".
> > And that may be where the problem is, but I don't know those tools.
> 
> 
> Hmm... such rule is already at DocBook/Makefile:
> 
> %.xml: %.c
>         @$($(quiet)gen_xml)
>         @(                            \
> 	   echo "<programlisting>";   \
>            expand --tabs=8 < $< |     \
>            sed -e "s/&/\\&amp;/g"     \
>                -e "s/</\\&lt;/g"      \
>                -e "s/>/\\&gt;/g";     \
>            echo "</programlisting>")  > $@
> 
> Not sure why this didn't work. It should have replaced the < from the c file.
> Maybe some patch broke Makefile?

Thanks, I'll look into that.

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: docbook: fix fatal error in linux/input.h
  2010-10-26 20:15     ` Mauro Carvalho Chehab
  2010-10-26 20:51       ` Randy Dunlap
@ 2010-10-26 20:59       ` Randy Dunlap
  2010-10-26 21:07         ` Randy Dunlap
  1 sibling, 1 reply; 12+ messages in thread
From: Randy Dunlap @ 2010-10-26 20:59 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: lkml, Dmitry Torokhov

On Tue, 26 Oct 2010 18:15:10 -0200 Mauro Carvalho Chehab wrote:

> Em 26-10-2010 17:17, Randy Dunlap escreveu:
> > On Tue, 26 Oct 2010 17:13:01 -0200 Mauro Carvalho Chehab wrote:
> > 
> >> Em 26-10-2010 16:45, Randy Dunlap escreveu:
> >>> Hi,
> >>>
> >>> Recent commit 8613e4c2872a87cc309a42de2c7091744dc54d0e:
> >>> Author: Mauro Carvalho Chehab <mchehab@redhat.com>
> >>> Date:   Thu Sep 9 21:54:22 2010 -0700
> >>>     Input: add support for large scancodes
> >>>
> >>> causes a fatal error in docbook generation:
> >>>
> >>> linux-2.6.36-git8/DOC1/Documentation/DocBook/device-drivers.xml:40690: parser error : StartTag: invalid element name
> >>> #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
> >>>                              	    ^
> >>>
> >>> I think that this message comes from xsltproc, but I'm not positive about that.
> >>> I also don't know of a really good fix for it.  However, I did find 2 ways to
> >>> work around the error:
> >>>
> >>> a/ move the #define value to after the end of the struct input_keymap_entry, like:
> >>>
> >>> /* flags bits: */
> >>> #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
> >>>
> >>> or
> >>> b/ don't use the "<< 0" (can leave the #define where it is in this case):
> >>> #define INPUT_KEYMAP_BY_INDEX	(1)
> >>>
> >>> I have tested both of these patches and they work OK.
> >>> Are you OK with either of them?  or want to choose one?
> >>
> >>
> >> Hmm... probably, the first one is not correct.
> > 
> > Why not?  All it does is move the line to after the end of the struct.
> > 
> >> I suspect that the right way is to use something like:
> >>
> >> 	#define INPUT_KEYMAP_BY_INDEX	(1 &lt;&lt; 0)
> >>
> >> Could you please test if this would fix the issue?
> > 
> > You are suggesting putting that into include/linux/input.h ??
> > 
> > That would make sense if some tool converted "<<" to "&lt;&lt;".
> > And that may be where the problem is, but I don't know those tools.
> 
> 
> Hmm... such rule is already at DocBook/Makefile:
> 
> %.xml: %.c
>         @$($(quiet)gen_xml)
>         @(                            \
> 	   echo "<programlisting>";   \
>            expand --tabs=8 < $< |     \
>            sed -e "s/&/\\&amp;/g"     \
>                -e "s/</\\&lt;/g"      \
>                -e "s/>/\\&gt;/g";     \
>            echo "</programlisting>")  > $@
> 
> Not sure why this didn't work. It should have replaced the < from the c file.
> Maybe some patch broke Makefile?

Maybe that rule needs to apply to .h files also.

Would

%.xml: %.[hc]

work?


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: docbook: fix fatal error in linux/input.h
  2010-10-26 20:59       ` Randy Dunlap
@ 2010-10-26 21:07         ` Randy Dunlap
  2010-10-26 21:32           ` Randy Dunlap
  0 siblings, 1 reply; 12+ messages in thread
From: Randy Dunlap @ 2010-10-26 21:07 UTC (permalink / raw)
  To: lkml; +Cc: Mauro Carvalho Chehab, Dmitry Torokhov

On Tue, 26 Oct 2010 13:59:57 -0700 Randy Dunlap wrote:

> On Tue, 26 Oct 2010 18:15:10 -0200 Mauro Carvalho Chehab wrote:
> 
> > Em 26-10-2010 17:17, Randy Dunlap escreveu:
> > > On Tue, 26 Oct 2010 17:13:01 -0200 Mauro Carvalho Chehab wrote:
> > > 
> > >> Em 26-10-2010 16:45, Randy Dunlap escreveu:
> > >>> Hi,
> > >>>
> > >>> Recent commit 8613e4c2872a87cc309a42de2c7091744dc54d0e:
> > >>> Author: Mauro Carvalho Chehab <mchehab@redhat.com>
> > >>> Date:   Thu Sep 9 21:54:22 2010 -0700
> > >>>     Input: add support for large scancodes
> > >>>
> > >>> causes a fatal error in docbook generation:
> > >>>
> > >>> linux-2.6.36-git8/DOC1/Documentation/DocBook/device-drivers.xml:40690: parser error : StartTag: invalid element name
> > >>> #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
> > >>>                              	    ^
> > >>>
> > >>> I think that this message comes from xsltproc, but I'm not positive about that.
> > >>> I also don't know of a really good fix for it.  However, I did find 2 ways to
> > >>> work around the error:
> > >>>
> > >>> a/ move the #define value to after the end of the struct input_keymap_entry, like:
> > >>>
> > >>> /* flags bits: */
> > >>> #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
> > >>>
> > >>> or
> > >>> b/ don't use the "<< 0" (can leave the #define where it is in this case):
> > >>> #define INPUT_KEYMAP_BY_INDEX	(1)
> > >>>
> > >>> I have tested both of these patches and they work OK.
> > >>> Are you OK with either of them?  or want to choose one?
> > >>
> > >>
> > >> Hmm... probably, the first one is not correct.
> > > 
> > > Why not?  All it does is move the line to after the end of the struct.
> > > 
> > >> I suspect that the right way is to use something like:
> > >>
> > >> 	#define INPUT_KEYMAP_BY_INDEX	(1 &lt;&lt; 0)
> > >>
> > >> Could you please test if this would fix the issue?
> > > 
> > > You are suggesting putting that into include/linux/input.h ??
> > > 
> > > That would make sense if some tool converted "<<" to "&lt;&lt;".
> > > And that may be where the problem is, but I don't know those tools.
> > 
> > 
> > Hmm... such rule is already at DocBook/Makefile:
> > 
> > %.xml: %.c
> >         @$($(quiet)gen_xml)
> >         @(                            \
> > 	   echo "<programlisting>";   \
> >            expand --tabs=8 < $< |     \
> >            sed -e "s/&/\\&amp;/g"     \
> >                -e "s/</\\&lt;/g"      \
> >                -e "s/>/\\&gt;/g";     \
> >            echo "</programlisting>")  > $@
> > 
> > Not sure why this didn't work. It should have replaced the < from the c file.
> > Maybe some patch broke Makefile?
> 
> Maybe that rule needs to apply to .h files also.
> 
> Would
> 
> %.xml: %.[hc]
> 
> work?

Doesn't work like that or as a separate rule for
%.xml: %.h

The gen_xml rule isn't firing at all AFAICT.

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: docbook: fix fatal error in linux/input.h
  2010-10-26 21:07         ` Randy Dunlap
@ 2010-10-26 21:32           ` Randy Dunlap
  2010-10-26 21:41             ` Dmitry Torokhov
  0 siblings, 1 reply; 12+ messages in thread
From: Randy Dunlap @ 2010-10-26 21:32 UTC (permalink / raw)
  To: lkml; +Cc: Mauro Carvalho Chehab, Dmitry Torokhov

On Tue, 26 Oct 2010 14:07:26 -0700 Randy Dunlap wrote:

> On Tue, 26 Oct 2010 13:59:57 -0700 Randy Dunlap wrote:
> 
> > On Tue, 26 Oct 2010 18:15:10 -0200 Mauro Carvalho Chehab wrote:
> > 
> > > Em 26-10-2010 17:17, Randy Dunlap escreveu:
> > > > On Tue, 26 Oct 2010 17:13:01 -0200 Mauro Carvalho Chehab wrote:
> > > > 
> > > >> Em 26-10-2010 16:45, Randy Dunlap escreveu:
> > > >>> Hi,
> > > >>>
> > > >>> Recent commit 8613e4c2872a87cc309a42de2c7091744dc54d0e:
> > > >>> Author: Mauro Carvalho Chehab <mchehab@redhat.com>
> > > >>> Date:   Thu Sep 9 21:54:22 2010 -0700
> > > >>>     Input: add support for large scancodes
> > > >>>
> > > >>> causes a fatal error in docbook generation:
> > > >>>
> > > >>> linux-2.6.36-git8/DOC1/Documentation/DocBook/device-drivers.xml:40690: parser error : StartTag: invalid element name
> > > >>> #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
> > > >>>                              	    ^
> > > >>>
> > > >>> I think that this message comes from xsltproc, but I'm not positive about that.
> > > >>> I also don't know of a really good fix for it.  However, I did find 2 ways to
> > > >>> work around the error:
> > > >>>
> > > >>> a/ move the #define value to after the end of the struct input_keymap_entry, like:
> > > >>>
> > > >>> /* flags bits: */
> > > >>> #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
> > > >>>
> > > >>> or
> > > >>> b/ don't use the "<< 0" (can leave the #define where it is in this case):
> > > >>> #define INPUT_KEYMAP_BY_INDEX	(1)
> > > >>>
> > > >>> I have tested both of these patches and they work OK.
> > > >>> Are you OK with either of them?  or want to choose one?
> > > >>
> > > >>
> > > >> Hmm... probably, the first one is not correct.
> > > > 
> > > > Why not?  All it does is move the line to after the end of the struct.
> > > > 
> > > >> I suspect that the right way is to use something like:
> > > >>
> > > >> 	#define INPUT_KEYMAP_BY_INDEX	(1 &lt;&lt; 0)
> > > >>
> > > >> Could you please test if this would fix the issue?
> > > > 
> > > > You are suggesting putting that into include/linux/input.h ??
> > > > 
> > > > That would make sense if some tool converted "<<" to "&lt;&lt;".
> > > > And that may be where the problem is, but I don't know those tools.
> > > 
> > > 
> > > Hmm... such rule is already at DocBook/Makefile:
> > > 
> > > %.xml: %.c
> > >         @$($(quiet)gen_xml)
> > >         @(                            \
> > > 	   echo "<programlisting>";   \
> > >            expand --tabs=8 < $< |     \
> > >            sed -e "s/&/\\&amp;/g"     \
> > >                -e "s/</\\&lt;/g"      \
> > >                -e "s/>/\\&gt;/g";     \
> > >            echo "</programlisting>")  > $@
> > > 
> > > Not sure why this didn't work. It should have replaced the < from the c file.
> > > Maybe some patch broke Makefile?
> > 
> > Maybe that rule needs to apply to .h files also.
> > 
> > Would
> > 
> > %.xml: %.[hc]
> > 
> > work?
> 
> Doesn't work like that or as a separate rule for
> %.xml: %.h
> 
> The gen_xml rule isn't firing at all AFAICT.

That rule was used for procfs_exmaple.c in 2.6.33 and earlier.
It's no longer used/needed (but I'm in no hurry to delete it either).

It appears that scripts/kernel-doc is the problem with not converting
<,> to &lt;, &gt; etc.  I'll look into that.


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: docbook: fix fatal error in linux/input.h
  2010-10-26 21:32           ` Randy Dunlap
@ 2010-10-26 21:41             ` Dmitry Torokhov
  2010-10-26 21:58               ` Randy Dunlap
  0 siblings, 1 reply; 12+ messages in thread
From: Dmitry Torokhov @ 2010-10-26 21:41 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: lkml, Mauro Carvalho Chehab

On Tue, Oct 26, 2010 at 02:32:02PM -0700, Randy Dunlap wrote:
> On Tue, 26 Oct 2010 14:07:26 -0700 Randy Dunlap wrote:
> 
> > On Tue, 26 Oct 2010 13:59:57 -0700 Randy Dunlap wrote:
> > 
> > > On Tue, 26 Oct 2010 18:15:10 -0200 Mauro Carvalho Chehab wrote:
> > > 
> > > > Em 26-10-2010 17:17, Randy Dunlap escreveu:
> > > > > On Tue, 26 Oct 2010 17:13:01 -0200 Mauro Carvalho Chehab wrote:
> > > > > 
> > > > >> Em 26-10-2010 16:45, Randy Dunlap escreveu:
> > > > >>> Hi,
> > > > >>>
> > > > >>> Recent commit 8613e4c2872a87cc309a42de2c7091744dc54d0e:
> > > > >>> Author: Mauro Carvalho Chehab <mchehab@redhat.com>
> > > > >>> Date:   Thu Sep 9 21:54:22 2010 -0700
> > > > >>>     Input: add support for large scancodes
> > > > >>>
> > > > >>> causes a fatal error in docbook generation:
> > > > >>>
> > > > >>> linux-2.6.36-git8/DOC1/Documentation/DocBook/device-drivers.xml:40690: parser error : StartTag: invalid element name
> > > > >>> #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
> > > > >>>                              	    ^
> > > > >>>
> > > > >>> I think that this message comes from xsltproc, but I'm not positive about that.
> > > > >>> I also don't know of a really good fix for it.  However, I did find 2 ways to
> > > > >>> work around the error:
> > > > >>>
> > > > >>> a/ move the #define value to after the end of the struct input_keymap_entry, like:
> > > > >>>
> > > > >>> /* flags bits: */
> > > > >>> #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
> > > > >>>
> > > > >>> or
> > > > >>> b/ don't use the "<< 0" (can leave the #define where it is in this case):
> > > > >>> #define INPUT_KEYMAP_BY_INDEX	(1)
> > > > >>>
> > > > >>> I have tested both of these patches and they work OK.
> > > > >>> Are you OK with either of them?  or want to choose one?
> > > > >>
> > > > >>
> > > > >> Hmm... probably, the first one is not correct.
> > > > > 
> > > > > Why not?  All it does is move the line to after the end of the struct.
> > > > > 
> > > > >> I suspect that the right way is to use something like:
> > > > >>
> > > > >> 	#define INPUT_KEYMAP_BY_INDEX	(1 &lt;&lt; 0)
> > > > >>
> > > > >> Could you please test if this would fix the issue?
> > > > > 
> > > > > You are suggesting putting that into include/linux/input.h ??
> > > > > 
> > > > > That would make sense if some tool converted "<<" to "&lt;&lt;".
> > > > > And that may be where the problem is, but I don't know those tools.
> > > > 
> > > > 
> > > > Hmm... such rule is already at DocBook/Makefile:
> > > > 
> > > > %.xml: %.c
> > > >         @$($(quiet)gen_xml)
> > > >         @(                            \
> > > > 	   echo "<programlisting>";   \
> > > >            expand --tabs=8 < $< |     \
> > > >            sed -e "s/&/\\&amp;/g"     \
> > > >                -e "s/</\\&lt;/g"      \
> > > >                -e "s/>/\\&gt;/g";     \
> > > >            echo "</programlisting>")  > $@
> > > > 
> > > > Not sure why this didn't work. It should have replaced the < from the c file.
> > > > Maybe some patch broke Makefile?
> > > 
> > > Maybe that rule needs to apply to .h files also.
> > > 
> > > Would
> > > 
> > > %.xml: %.[hc]
> > > 
> > > work?
> > 
> > Doesn't work like that or as a separate rule for
> > %.xml: %.h
> > 
> > The gen_xml rule isn't firing at all AFAICT.
> 
> That rule was used for procfs_exmaple.c in 2.6.33 and earlier.
> It's no longer used/needed (but I'm in no hurry to delete it either).
> 
> It appears that scripts/kernel-doc is the problem with not converting
> <,> to &lt;, &gt; etc.  I'll look into that.
> 

Thnaks Randy. I'd prefer not to impose restrictions on the kernel code
for the sake of kerneldoc tools.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: docbook: fix fatal error in linux/input.h
  2010-10-26 21:41             ` Dmitry Torokhov
@ 2010-10-26 21:58               ` Randy Dunlap
  0 siblings, 0 replies; 12+ messages in thread
From: Randy Dunlap @ 2010-10-26 21:58 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: lkml, Mauro Carvalho Chehab

On Tue, 26 Oct 2010 14:41:40 -0700 Dmitry Torokhov wrote:

> On Tue, Oct 26, 2010 at 02:32:02PM -0700, Randy Dunlap wrote:
> > On Tue, 26 Oct 2010 14:07:26 -0700 Randy Dunlap wrote:
> > 
> > > On Tue, 26 Oct 2010 13:59:57 -0700 Randy Dunlap wrote:
> > > 
> > > > On Tue, 26 Oct 2010 18:15:10 -0200 Mauro Carvalho Chehab wrote:
> > > > 
> > > > > Em 26-10-2010 17:17, Randy Dunlap escreveu:
> > > > > > On Tue, 26 Oct 2010 17:13:01 -0200 Mauro Carvalho Chehab wrote:
> > > > > > 
> > > > > >> Em 26-10-2010 16:45, Randy Dunlap escreveu:
> > > > > >>> Hi,
> > > > > >>>
> > > > > >>> Recent commit 8613e4c2872a87cc309a42de2c7091744dc54d0e:
> > > > > >>> Author: Mauro Carvalho Chehab <mchehab@redhat.com>
> > > > > >>> Date:   Thu Sep 9 21:54:22 2010 -0700
> > > > > >>>     Input: add support for large scancodes
> > > > > >>>
> > > > > >>> causes a fatal error in docbook generation:
> > > > > >>>
> > > > > >>> linux-2.6.36-git8/DOC1/Documentation/DocBook/device-drivers.xml:40690: parser error : StartTag: invalid element name
> > > > > >>> #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
> > > > > >>>                              	    ^
> > > > > >>>
> > > > > >>> I think that this message comes from xsltproc, but I'm not positive about that.
> > > > > >>> I also don't know of a really good fix for it.  However, I did find 2 ways to
> > > > > >>> work around the error:
> > > > > >>>
> > > > > >>> a/ move the #define value to after the end of the struct input_keymap_entry, like:
> > > > > >>>
> > > > > >>> /* flags bits: */
> > > > > >>> #define INPUT_KEYMAP_BY_INDEX	(1 << 0)
> > > > > >>>
> > > > > >>> or
> > > > > >>> b/ don't use the "<< 0" (can leave the #define where it is in this case):
> > > > > >>> #define INPUT_KEYMAP_BY_INDEX	(1)
> > > > > >>>
> > > > > >>> I have tested both of these patches and they work OK.
> > > > > >>> Are you OK with either of them?  or want to choose one?
> > > > > >>
> > > > > >>
> > > > > >> Hmm... probably, the first one is not correct.
> > > > > > 
> > > > > > Why not?  All it does is move the line to after the end of the struct.
> > > > > > 
> > > > > >> I suspect that the right way is to use something like:
> > > > > >>
> > > > > >> 	#define INPUT_KEYMAP_BY_INDEX	(1 &lt;&lt; 0)
> > > > > >>
> > > > > >> Could you please test if this would fix the issue?
> > > > > > 
> > > > > > You are suggesting putting that into include/linux/input.h ??
> > > > > > 
> > > > > > That would make sense if some tool converted "<<" to "&lt;&lt;".
> > > > > > And that may be where the problem is, but I don't know those tools.
> > > > > 
> > > > > 
> > > > > Hmm... such rule is already at DocBook/Makefile:
> > > > > 
> > > > > %.xml: %.c
> > > > >         @$($(quiet)gen_xml)
> > > > >         @(                            \
> > > > > 	   echo "<programlisting>";   \
> > > > >            expand --tabs=8 < $< |     \
> > > > >            sed -e "s/&/\\&amp;/g"     \
> > > > >                -e "s/</\\&lt;/g"      \
> > > > >                -e "s/>/\\&gt;/g";     \
> > > > >            echo "</programlisting>")  > $@
> > > > > 
> > > > > Not sure why this didn't work. It should have replaced the < from the c file.
> > > > > Maybe some patch broke Makefile?
> > > > 
> > > > Maybe that rule needs to apply to .h files also.
> > > > 
> > > > Would
> > > > 
> > > > %.xml: %.[hc]
> > > > 
> > > > work?
> > > 
> > > Doesn't work like that or as a separate rule for
> > > %.xml: %.h
> > > 
> > > The gen_xml rule isn't firing at all AFAICT.
> > 
> > That rule was used for procfs_exmaple.c in 2.6.33 and earlier.
> > It's no longer used/needed (but I'm in no hurry to delete it either).
> > 
> > It appears that scripts/kernel-doc is the problem with not converting
> > <,> to &lt;, &gt; etc.  I'll look into that.
> > 
> 
> Thnaks Randy. I'd prefer not to impose restrictions on the kernel code
> for the sake of kerneldoc tools.


Yes, I agree, it was just a matter of finding a way thru the maze.

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] scripts/kernel-doc: escape special characters for xml struct output
  2010-10-26 18:45 docbook: fix fatal error in linux/input.h Randy Dunlap
  2010-10-26 19:13 ` Mauro Carvalho Chehab
@ 2010-10-29 17:56 ` Randy Dunlap
  1 sibling, 0 replies; 12+ messages in thread
From: Randy Dunlap @ 2010-10-29 17:56 UTC (permalink / raw)
  To: lkml, akpm; +Cc: Mauro Carvalho Chehab, Dmitry Torokhov

From: Randy Dunlap <randy.dunlap@oracle.com>

scripts/kernel-doc was leaving unescaped '<', '>', and '&' in
generated xml output for structs.  This causes xml parser errors.
Convert these characters to "&lt;", "&gt;", and "&amp;" as needed
to prevent errors.
Most of the conversion was already done; complete it just before
output.

Documentation/DocBook/device-drivers.xml:41883: parser error : StartTag: invalid element name
#define INPUT_KEYMAP_BY_INDEX	(1 << 0)

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 scripts/kernel-doc |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

--- linux-2.6.36-git13.orig/scripts/kernel-doc
+++ linux-2.6.36-git13/scripts/kernel-doc
@@ -5,7 +5,7 @@ use strict;
 ## Copyright (c) 1998 Michael Zucchi, All Rights Reserved        ##
 ## Copyright (C) 2000, 1  Tim Waugh <twaugh@redhat.com>          ##
 ## Copyright (C) 2001  Simon Huggins                             ##
-## Copyright (C) 2005-2009  Randy Dunlap                         ##
+## Copyright (C) 2005-2010  Randy Dunlap                         ##
 ## 								 ##
 ## #define enhancements by Armin Kuster <akuster@mvista.com>	 ##
 ## Copyright (c) 2000 MontaVista Software, Inc.			 ##
@@ -453,7 +453,7 @@ sub output_highlight {
     if ($output_mode eq "html" || $output_mode eq "xml") {
 	$contents = local_unescape($contents);
 	# convert data read & converted thru xml_escape() into &xyz; format:
-	$contents =~ s/\\\\\\/&/g;
+	$contents =~ s/\\\\\\/\&/g;
     }
 #   print STDERR "contents b4:$contents\n";
     eval $dohighlight;
@@ -770,7 +770,11 @@ sub output_struct_xml(%) {
     print $args{'type'} . " " . $args{'struct'} . " {\n";
     foreach $parameter (@{$args{'parameterlist'}}) {
 	if ($parameter =~ /^#/) {
-	    print "$parameter\n";
+	    my $prm = $parameter;
+	    # convert data read & converted thru xml_escape() into &xyz; format:
+	    # This allows us to have #define macros interspersed in a struct.
+	    $prm =~ s/\\\\\\/\&/g;
+	    print "$prm\n";
 	    next;
 	}
 
@@ -1701,6 +1705,8 @@ sub push_parameter($$$) {
 	}
 	}
 
+	$param = xml_escape($param);
+
 	# strip spaces from $param so that it is one continous string
 	# on @parameterlist;
 	# this fixes a problem where check_sections() cannot find

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-10-29 17:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-26 18:45 docbook: fix fatal error in linux/input.h Randy Dunlap
2010-10-26 19:13 ` Mauro Carvalho Chehab
2010-10-26 19:17   ` Randy Dunlap
2010-10-26 20:08     ` Mauro Carvalho Chehab
2010-10-26 20:15     ` Mauro Carvalho Chehab
2010-10-26 20:51       ` Randy Dunlap
2010-10-26 20:59       ` Randy Dunlap
2010-10-26 21:07         ` Randy Dunlap
2010-10-26 21:32           ` Randy Dunlap
2010-10-26 21:41             ` Dmitry Torokhov
2010-10-26 21:58               ` Randy Dunlap
2010-10-29 17:56 ` [PATCH] scripts/kernel-doc: escape special characters for xml struct output Randy Dunlap

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.