Import crash with 1.6.0
Clinton Popetz
cpopetz@cpopetz.com
Tue, 12 Jun 2001 18:05:37 -0500
[Taking this back to the list]
On Tue, Jun 12, 2001 at 05:11:29PM -0500, Clinton Popetz wrote:
> guile> (string-match "" "income:contract")
> ERROR: In procedure gsubr-apply in expression (make-regexp pattern):
> ERROR: empty (sub)expression
> ABORT: (regular-expression-syntax)
>
> Type "(backtrace)" to get more information or "(debug)" to enter the
> debugger.
> guile>
It turns out this is not a guile problem, but rather a difference in
the regexp libraries. My guile installation is not broken:
guile> (string-match "." "income:contract")
#("income:contract" (0 . 1))
guile> (string-match "foobar" "income:contract")
#f
But my regexp library (FreeBSD's libc) agrees with POSIX 1003.2, and
thinks an empty string is an invalid regular expression, because a
regular expression is defined to be "one or more non-empty branches,
separated by `|'."
The appended patch gets things working for me. That's the only
instance of string-match in ./scm, so this bug probably won't bite
anywhere else. However, since we know the qif account name won't be a
regexp anyway, some speed could be gained by making this use whatever
the scheme equivalent of strstr(3) is.
-Clint
--- qif-guess-map.scm.orig Tue Jun 12 17:52:49 2001
+++ qif-guess-map.scm Tue Jun 12 17:53:25 2001
@@ -329,7 +329,7 @@
;; the QIF name is a substring of the gnc full name.
;; this happens if you have the same tree but a different
;; top-level structure. (i.e. expenses:tax vs. QIF tax)
- (string-match (sprintf #f "(%s)" (string-downcase qif-acct-name))
+ (string-match (string-downcase qif-acct-name)
(string-downcase (cadr gnc-acct)))))