On 4/8/2017 2:29 PM, Thomas wrote:
....
Thanks for this quick reply. I think I understand it now.
However, it's still quite weird.

C:\fos>fossil test-echo *
g.nameOfExe = [C:\fos\fossil.exe]
argv[0] = [fossil]
argv[1] = [test-echo]
argv[2] = [_FOSSIL_]
argv[3] = [fossil.exe]
argv[4] = [db.fossil]
argv[5] = [test.cmd]

Is this what it's supposed to look like?

Yes that is what fossil test-echo is supposed to do, but this shows that it expanded the * to file names. If it had been quoted right, you would have seen only entries for argv[0], argv[1], and argv[2].

Which is what I thought I saw when I did fossil test-echo "^*", but I was blinded by expectations and missed that it showed "^*" for argv[2] not "*".

So that doesn't work as expected.

test.cmd contains:
ECHO %1

When I run it:
C:\fos>test.cmd *

C:\fos>ECHO *
*

So, it works for test.cmd but not for Fossil. Strange.

Welcome to the strange and wonderful world of CMD.EXE's quoting rules. Which differ between the interactive prompt and in a .BAT file (and in some subtle ways .CMD files are yet different) too.

All is documented somewhere, but hard to find. I've spent several "pleasant" hours just reading the output of CMD/?, IF/?, CALL/?, START/?, and so forth. Often, important bits of trivia are only said in the help text for an obscure built-in command.

In fact, what is really happening is more complicated.

The command fossil test-echo * is passed the * by CMD, but as part of the C runtime startup, it is expanding wildcards on the command line so that fossil sees what it would see on a *nix box where the shell does the wildcard expansion before any program runs.

You can see this at the prompt with echo *, and echo ^* both which echo a single * character, because the echo command does not do any wildcard expansion.

I think this is an almost impossible platform-specific issue to fix. Most of the time, we want wildcards expanded. Rarely, we don't. Unfortunately, you've hit one of the rare cases.

There are two easy work-arounds.

1. Use fossil ui and the navigate to the settings page in the browser. That will let you change the setting from the web form. This assumes you have a browser and your firewall will allow it to talk to an arbitrary port on localhost owned by a local process. Which should all be true.

2. Use the versionable settings. Say echo * > .fossil-settings/crlf-glob then fossil add the settings file and check it in.

There are harder work-arounds.

3. Use MSYS bash to have a bash prompt with its different quoting rules. With care, it is possible to use that to modify either global settings or a specific repository.

4. Use SQL to edit the setting into the repo file. Don't do this unless you know what you are doing. The hint I'll provide is that the repository is actually a SQLite database file. There is documentation. But directly poking it is dangerous, so only try on a backup.

--
Ross Berteig                               r...@cheshireeng.com
Cheshire Engineering Corp.           http://www.CheshireEng.com/
+1 626 303 1602

_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to