From: Hans-Bernhard B. <br...@ph...> - 2001-11-19 13:29:30
|
On Sat, 17 Nov 2001, Steven Elliott wrote: > Currently cscope.files does not support filenames with spaces as it > considers the filenames in cscope.files to be separated by white space: That's an old issue with most, if not all traditional Unix tools: filenames are allowed to contain characters that the tools can't really cope with easily, and certainly not automatically. That's what caused the necessity for hacks like '-print0' in GNU find. You'll find the same type of problem in traditional 'tar', IIRC. Even the shell itself needs human assistance ("quoting" around blanks in filenames) to deal with such filenames. There are those who take this kind of problem as the reason to claim that all kind of inband-signalling should always be considered evil. > From the code (src/dir.c) it looks like cscope reads cscope.files one > token at a time. It reads whitespace-separated words, just like the shell does in default conditions (IFS="<space><tab><newline>"). > Each token is considered to either be an option, if it begins with > "-", or a filename, if it does not begin with "-". So, filenames that > either have spaces in them or begin with a "-" are not supported. Right. Same as they would not be supported in the command line of just about any other Unix tool without special help (--> the "--" option to allow names beginning with a minus, and quoting to allow whitespace). > In order to support such filenames would it be reasonable to place the > following restrictions on cscope.files?: > 1) Each filename must appear on a separate line. I don't think that's a good idea. Placing additional restrictions on existing users' "cscope.files" breaks compatibility. I, for one, am in the habit of generating my cscope.files via 'echo *.[ch]', so it does contain lots of names per line. > 2) Options, if any, must appear at the beginning of cscope.files. Same problem. > I'm guessing that the most common case is for cscope.files to simply be > the output of "find". The most common yes. But can we really discard the uncommon ones just like that? I don't think so. I think it'd be more sensible to imitate the shell's way of treating these. After all, cscope.files is essentially just an extra source of command line input, right now. It works as if the user had typed cscope `cat cscope.files` So it makes sense to treat it like the shell would treat command lines. We would require all unusual filenames to be quoted. 'find' output could easily be massaged to contain the quotes, where necessary. -- Hans-Bernhard Broeker (br...@ph...) Even if all the snow were burnt, ashes would remain. |