[Instiki-devel] Instiki-AR critial bug

Venkat elk9r9q02 at sneakemail.com
Thu Sep 1 13:05:29 EDT 2005


Dear all:

Summary: In some cases, the page would be rendered with all links
showing some internal meaningless string.

Details:

Behavior in v 0.10.1

Each chunk (content part) was given a mask as the following:

    def id
      @id ||= "#{@content.page_id}n#{@content.chunk_id}"
    end

Where the page_id and chunk_id were defined as positive integers
starting from 0. The pattern used for the above is as following:

    def Abstract::mask_re(chunk_types)
      tmp = chunk_types.map{|klass| klass.mask_string}.join("|")
      Regexp.new("chunk([0-9a-f]+n\\d+)(#{tmp})chunk")
    end

Behavior in Instiki-AR:

Chunk mask is 

    # should contain only [a-z0-9]
    def mask
      @mask ||= "chunk#{self.object_id}#{self.class.mask_string}chunk"
    end

We should note here that the object_id in Ruby can be a positive or
NEGATIVE INTEGER.

Pattern is

    def Abstract::mask_re(chunk_types)
      chunk_classes = chunk_types.map{|klass| klass.mask_string}.join("|")
      /chunk(\d+)(#{chunk_classes})chunk/
    end

The above pattern won't match negative integers and hence the
rendering will be left with masks.

Fix:

The short term fix for this is to change the above pattern to look for
negative numbers also

      #Before \d+ added -*
      /chunk(-*\d+)(#{chunk_classes})chunk/   

PS: 1. It took sometime for me to figure this out because, in Win XP,
things were working as object_ids for some reason were always a
postive number. In my shared host Linux machine, the number was always
negative.
2. For some reason, from here in Bangalore-India, the instiki.org
server seems to be down most of the times. It would help if Alex can
investigate this. I don't have this problem with other sites like ROR
, etc. I have a very good broadband connection here.

Hope this helps in fixing this problem.

Cheers,
Venkat.



More information about the Instiki-devel mailing list