Modify

Ticket #467 (closed defect: fixed)

Opened 15 years ago

Last modified 15 years ago

Encaps need better string splitting regexps

Reported by: dclark Owned by: dclark
Priority: major Milestone: Bcfg2 0.9.5 Release
Component: bcfg2-client Version: 0.9.x
Keywords: Cc:

Description

There are 3 issues with the regular expression code used to parse "file=" Pkgmgr entries:

  1. epkg.log is a special case and should just be ignored.
  2. File names like openssh-4.6p1+2-encap-ix86-linux_debian_etch.tar.gz fail, I think due to the "+" character, which is actually a recommended encap convention to denote site-specific/packaging changes.
  3. File names like bcfg2-python-apt-0.6.19-encap-ix86-linux_debian_etch.tar.gz fail, I think due to the multiple "-" characters before the version.

I think all of these need to be fixed in both Client (src/lib/Client/Tools/Encap.py) and Server (src/lib/Server/Plugins/Pkgmgr.py) side code.

Attachments

Change History

comment:1 Changed 15 years ago by dclark

  • Status changed from new to assigned

Here is a (hopefully correctly) commented version of the current regexps for posterity:

pkgmgr = re.compile( r'''
         (?x)    # verbose - Split a stand-alone encap package name.
         ^       # Begin string
             (?P<name>    # Give the matched text the name "name"
             \w+)         # Match one or more words
         -       # Break on "-"
             (?P<version> # Give the matched text the name "version"
             [\w\d\.-]+)  # Match one or more words, digits, periods, or hyphens
         .       # Followed by any character
         encap   # And then the word "encap"
         .*      # Followed by anything
         $       # And then end of line
         ''')

encap = re.compile( r'''
        (?x)    # verbose - Split an encap package name at the end of a path.
        .*/     # We have any amount of stuff ending with a final "/"
            (?P<name>    # Give the matched text the name "name"
            [\w-]+)      # Match one or more words or hyphens
        \-      # Break on "-". I think the escape is unessisary (TEST)
            (?P<version> # Give the matched text the name "version"
            [\w\.-]+)    # Match one or more words, periods, or hyphens
        ''')

comment:2 Changed 15 years ago by dclark

  • Status changed from assigned to closed
  • Resolution set to fixed

Fixed in r3482

WARNING! You need to establish a session before you can create or edit tickets. Otherwise the ticket will get treated as spam.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.