This is the mail archive of the
cygwin
mailing list for the Cygwin project.
What is rationale for GLOB_BRACE in globify() from /winsup/cygwin/dcrt0.cc??
- From: Oleksandr Gavenko <gavenkoa at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Mon, 14 Nov 2011 01:11:31 +0200
- Subject: What is rationale for GLOB_BRACE in globify() from /winsup/cygwin/dcrt0.cc??
NOTE: all text I wrote about invoking Cygwin app from native Windows app.
Look to code:
/* Attempt to match the argument. Return just word (minus quoting) if no match. */
if (glob (pattern, GLOB_TILDE | GLOB_NOCHECK | GLOB_BRACE | GLOB_QUOTE, NULL, &gl) || !gl.gl_pathc)
return 0;
from /winsup/cygwin/dcrt0.cc.
Brace globing does not defined in POSIX (I check POSIX "2. Shell Command
Language" and glob() page.
It is available in bash by default (set -B). But does not work in ash...
Previously I have issue with striping of '{}' from arguments when used in
native Emacs:
http://thread.gmane.org/gmane.emacs.help/73810
Every Emacs release I patch /emacs/lisp/vc/vc-hg.el because of arguments:
... "--template" "{rev}" ...
by quoting {rev} in single quotes. I can not use CYGWIN=noglob because in that
case I get another issue (CYGWIN=noglob remove double quotes from args):
http://thread.gmane.org/gmane.os.cygwin/122538
Another people also have trouble with this behavior (Disable Cygwin dll
autoglobbing when git is not run via shell):
https://github.com/magit/magit/commit/54d42d87b5b3fd756bc6d1afe30a87a684a35f37
for package: http://www.emacswiki.org/emacs/Magit
Expanding of {} is not fully consecutive, from globexp1() code:
/* Protect a single {}, for find(1), like csh */
I ask for making this behavior configurable, like:
CYGWIN=glob:nobrace
Note that CYGWIN=noglob is not proper solution with native Emacs for me as:
1) It buggy when double quotes was used.
2) Require rewrite existing code to properly quote arguments as I like set
shell to bash...
When I say buggy I mean next. If you compile
http://msdn.microsoft.com/en-us/library/windows/desktop/bb776391%28v=vs.85%29.aspx
with MS visual studio and run from cmd:
cmd> argv a\"b
you get:
0: argv
1: a"b
When you compile:
for (i = 0; i < argc; i++)
printf("%d: %s\n", argv[i]);
with Cygwin gcc you get:
cmd> set CYGWIN=noglob
cmd> cygargv a\"b
0: cygargv
1: a\b
When I commit from cmd (usually this is FAR file manager) with CYGWIN=noglob
all quotes striped from my commit messages... ((
I would like to hear any comments...
--
Best regards!
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple