scsh-users
[Top] [All Lists]

Re: regexp weirdness

To: Friedrich Dominicus <frido@q-software-solutions.com>
Subject: Re: regexp weirdness
From: Martin Gasbichler <gasbichl@informatik.uni-tuebingen.de>
Date: Thu, 02 May 2002 13:45:51 +0200
Cc: scsh-news@zurich.ai.mit.edu
Sender: gasbichl@informatik.uni-tuebingen.de
>>>>> "Friedrich" == Friedrich Dominicus <frido@q-software-solutions.com> 
>>>>> writes:

Friedrich> gasbichl@informatik.uni-tuebingen.de (Martin Gasbichler) writes:
>> >>>>> "Ikke" == Martin Gasbichler <gasbichl@informatik.uni-tuebingen.de> 
>> >>>>> writes:
>> 
Ikke> This works fine for me. However, I use the current version of scsh
Ikke> (0.6.1).
>> 
>> Ah, it's not a problem of the scsh version but of the OS you use: I
>> see the problem on Redhat Linux and SunOS 5.8 but not on FreeBSD , AIX
>> and Mac OS X. Strange. I'll try to figure out what goes wrong here.
Friedrich> It' shows up too here on a Debian 3.0. I tried to find a work around
Friedrich> but that has not worked very well, maybe this helps a bit it seems
Friedrich> that the trouble arose on the edge between 
sre-> regexp (Posix), but please take that with some grain of salt. I
Friedrich> did not really investigate it further.

The following patch seems to remedy the problem:

Index: posixstr.scm
===================================================================
RCS file: /cvsroot/scsh/scsh-0.6/scsh/rx/posixstr.scm,v
retrieving revision 1.6
diff -u -c -r1.6 posixstr.scm
*** posixstr.scm        21 Feb 2002 13:44:47 -0000      1.6
--- posixstr.scm        2 May 2002 11:40:38 -0000
***************
*** 319,325 ****
  ;;; quote the special chars with backslashes.
  
  (define translate-string
!   (let ((specials (string->char-set "[.*?()|\\$^+")))
      (lambda (s)
        (let ((len (string-length s)))
        (if (zero? len)
--- 319,325 ----
  ;;; quote the special chars with backslashes.
  
  (define translate-string
!   (let ((specials (string->char-set "{}[.*?()|\\$^+")))
      (lambda (s)
        (let ((len (string-length s)))
        (if (zero? len)


It quotes '{' and '}' within a literal string. However, I don't
understand, why the bug didn't show up under FreeBSD etc.

-- 
Martin

<Prev in Thread] Current Thread [Next in Thread>