ash: substring processing seems to be borken

James Simmons jsimmons at infradead.org
Tue Apr 22 19:22:28 UTC 2008


> On Friday 18 April 2008 18:40, Cristian Ionescu-Idbohrn wrote:
> > So, what's the conclusion on this?  Does anything to be done?
> 
> Nothing needs to be done. bash goes extra mile and
> handles unpaired [ as literal. Other shells don't do it.
> We can also not do it, as there seem to be no easy way
> to do this (bash has its own fnmatch implemetation fro that!)
> and nothing says it must be done (IIUC).

Agree. As you can see what I did before was attempt string manipulation 
before fnmatch was called on it. In the process it broke several things.

//              // chop off end if its '*'
//              full = strrchr(str, '*');
//              if (full && full != str)
//                      match--;
//
//              // If str starts with '*' replace with s.
//              if ((*str == '*') && strlen(s) >= match) {
//                      full = xstrdup(s);
//                      strncpy(full+strlen(s)-match+1, str+1, match-1);
//              } else
//                      full = xstrndup(str, match);
//              match = strncmp(s, full, strlen(full));
//              free(full);
//




More information about the busybox mailing list