Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
makehashes: Regular expression not quoted #94
Issue migrated (2015-06-05) from old issue tracker http://mirrorbrain.org/issues/issue94
msg345 (view) Author: sascha_silbe Date: 2012-01-09.22:36:12
When running "mb -d makehashes /srv/upload -t /srv/mirrorbrain/hashes/srv/upload" on the server hosting http://download.sugarlabs.org/, MirrorBrain breaks with the following error:
services/gcc-c++ is the name of a directory below /srv/upload:
silbe@sunjammer:~$ ls -d /srv/upload/services/gcc-c++
MirrorBrain should escape special (regular expression) characters in paths before using them as part of a regular expression.
msg358 (view) Author: toma Date: 2012-03-25.10:50:45
Bug confirmed. KDE runs into this one as well.
msg364 (view) Author: poeml Date: 2012-03-26.22:31:22
It seems to me that the only way to deal with this is to manually escape regexp
select 'services/gcc-c++/a' ~ '**:^services/gcc-c++/[^/]$' as result;
There is no PostgreSQL function to do this, and there doesn't seem to be a way to
msg377 (view) Author: poeml Date: 2012-04-11.21:22:20
So the task is to pass a regexp from Python to PostgreSQL, through SQLobject and psycopg2, that
So, let's pass all literal characters as literal characters! I.e., using octal \000 syntax.
Fixed in r8271.
--- ../mb/mb/files.py (revision 8270)
+from mb import util
def has_file(conn, path, mirror_id):
(end of migrated issue)