From: Eric Paris <eparis@parisplace.org>
To: antoine <antoine@nagafix.co.uk>
Cc: SELinux <selinux@tycho.nsa.gov>
Subject: Re: error building file_contexts
Date: Tue, 13 Sep 2005 18:07:13 -0400 [thread overview]
Message-ID: <1126649233.6074.14.camel@localhost.localdomain> (raw)
In-Reply-To: <1126647898.3769.19.camel@localhost>
> (...)
> -/home/rsyslog
> -/emul/lib(64)?/*$
> -/home/rsyslog
> -/emul/lib(64)?/.*\.so(\.[^/]*)*/*$
> -/home/rsyslog
> -/emul/lib(64)?/ld-[^/]*\.so(\.[^/]*)*/*$
> -/home/rsyslog
> -/usr/sbin/amavisd(.*)?/*$
> -/home/rsyslog
> Traceback (most recent call last):
> File "/usr/sbin/genhomedircon", line 475, in ?
> oldgenhomedircon(cmds[0], cmds[1])
> File "/usr/sbin/genhomedircon", line 190, in oldgenhomedircon
> if re.search(regex, potential, 0):
> File "/usr/lib/python2.3/sre.py", line 137, in search
> return _compile(pattern, flags).search(string)
> File "/usr/lib/python2.3/sre.py", line 230, in _compile
> raise error, v # invalid expression
> sre_constants.error: nothing to repeat
> make: *** [file_contexts/file_contexts] Error 1
>
> Any ideas?
>
> Thanks
> Antoine
>
>
> For reference, here is the updated code snippet:
> (...)
> for potential in potential_prefixes.keys():
> addme = 1
> for regex in prefix_regex:
> #match a trailing (/*)? which is actually a bug
> in rpc_pipefs
> regex = re.sub("\(/\*\)\?$", "", regex)
> #match a trailing .+
> regex = re.sub("\.+$", "", regex)
> #match a trailing .*
> regex = re.sub("\.\*$", "", regex)
> #strip a (/.*)? which matches anything trailing
> to a /*$ which matches trailing /'s
> regex = re.sub("\(\/\.\*\)\?", "", regex)
> regex = regex + "/*$"
> sys.stderr.write("-%s\n" % regex)
> sys.stderr.write("-%s\n" % potential)
> sys.stderr.flush()
> if re.search(regex, potential, 0):
> addme = 0
>
> if addme == 1:
> if not prefixes.has_key(potential):
> prefixes[potential] = ""
> (...)
So I simplified the problem. Maybe someone with more regex or python
foo can help us out. Python refuses to use (.*)? as a valid regular
expression. Seems like we want to say match anything 0 or more times.
Why is this invalid and what would be valid?
>>> import re
>>> test = re.sub("(.*)?", "", "hello")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.3/sre.py", line 143, in sub
return _compile(pattern, 0).sub(repl, string, count)
File "/usr/lib/python2.3/sre.py", line 230, in _compile
raise error, v # invalid expression
sre_constants.error: nothing to repeat
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
next prev parent reply other threads:[~2005-09-13 22:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-12 22:18 error building file_contexts antoine
2005-09-13 13:17 ` Stephen Smalley
2005-09-13 13:28 ` Antoine Martin
2005-09-13 14:00 ` Stephen Smalley
2005-09-13 14:07 ` Antoine Martin
2005-09-13 14:18 ` Stephen Smalley
[not found] ` <1126623363.6074.7.camel@localhost.localdomain>
2005-09-13 21:44 ` antoine
2005-09-13 22:07 ` Eric Paris [this message]
2005-09-14 12:30 ` Daniel J Walsh
2005-09-16 20:32 ` Antoine Martin
2005-09-13 13:48 ` Christopher J. PeBenito
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1126649233.6074.14.camel@localhost.localdomain \
--to=eparis@parisplace.org \
--cc=antoine@nagafix.co.uk \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.