X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_RG X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Oleksandr Gavenko Subject: What is rationale for GLOB_BRACE in globify() from /winsup/cygwin/dcrt0.cc?? Date: Mon, 14 Nov 2011 01:11:31 +0200 Lines: 83 Message-ID: <87y5vjhb30.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (windows-nt) X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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