unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Why call-process removes '{' and '}' chars from arguments???
@ 2010-06-02 20:40 Oleksandr Gavenko
  2010-06-02 21:39 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Oleksandr Gavenko @ 2010-06-02 20:40 UTC (permalink / raw)
  To: help-gnu-emacs

I use Emacs 23.2 under Windows.

(call-process
    "echo.exe"
    nil (get-buffer "*Messages*") nil
    "--bla"   "{rev}"   "}}}xxx{1}xxx{2}xxx{{{" )

put in Message buffer

   "--bla rev }}}xxx1xxx2xxx"

so remove occurrences of "{" and "}". Why???

This reproduced in Emacs 21.4, 22.3, 23.2
with "runemacs -q" ever cmdproxy.exe removed.

Emacs 32.2 uses "hg --template {rev} file-name" for Mercurial
in VC mode and so fail properly check file revision.

-- 
Best regards!




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why call-process removes '{' and '}' chars from arguments???
  2010-06-02 20:40 Why call-process removes '{' and '}' chars from arguments??? Oleksandr Gavenko
@ 2010-06-02 21:39 ` Eli Zaretskii
  2010-06-03  7:46   ` Oleksandr Gavenko
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2010-06-02 21:39 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Oleksandr Gavenko <gavenkoa@gmail.com>
> Date: Wed, 02 Jun 2010 23:40:46 +0300
> 
> I use Emacs 23.2 under Windows.
> 
> (call-process
>     "echo.exe"
>     nil (get-buffer "*Messages*") nil
>     "--bla"   "{rev}"   "}}}xxx{1}xxx{2}xxx{{{" )
> 
> put in Message buffer
> 
>    "--bla rev }}}xxx1xxx2xxx"
> 
> so remove occurrences of "{" and "}". Why???

I cannot reproduce this in Emacs 23.2 on MS-Windows.  I get the
expected result:

   --bla {rev} }}}xxx{1}xxx{2}xxx{{{

What kind of port of which program is your echo.exe?  What happens if
you invoke the same command from the shell?




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why call-process removes '{' and '}' chars from arguments???
  2010-06-02 21:39 ` Eli Zaretskii
@ 2010-06-03  7:46   ` Oleksandr Gavenko
  2010-06-03 15:04     ` Larry Hall (Cygwin)
  0 siblings, 1 reply; 6+ messages in thread
From: Oleksandr Gavenko @ 2010-06-03  7:46 UTC (permalink / raw)
  To: cygwin; +Cc: help-gnu-emacs

On 2010.06.03 0:39, Eli Zaretskii wrote:
>> From: Oleksandr Gavenko<gavenkoa@gmail.com>
>> Date: Wed, 02 Jun 2010 23:40:46 +0300
>>
>> I use Emacs 23.2 under Windows.
>>
>> (call-process
>>      "echo.exe"
>>      nil (get-buffer "*Messages*") nil
>>      "--bla"   "{rev}"   "}}}xxx{1}xxx{2}xxx{{{" )
>>
>> put in Message buffer
>>
>>     "--bla rev }}}xxx1xxx2xxx"
>>
>> so remove occurrences of "{" and "}". Why???
>
> I cannot reproduce this in Emacs 23.2 on MS-Windows.  I get the
> expected result:
>
>     --bla {rev} }}}xxx{1}xxx{2}xxx{{{
>
> What kind of port of which program is your echo.exe?  What happens if
> you invoke the same command from the shell?
>
Futher info: I wrote simple C prog  - printarg.c with:

int main(int argc, char **argv)
{
    for (int i = 0; i < argc; i++)
        printf("\"%s\"\n", argv[i]);
    return 0;
}

When I compile it with

CC=gcc  # resulted executable depend on cygwin1.dll

(call-process "printarg.exe"
      nil (get-buffer "*Messages*") nil
      "--bla"   "{rev}"   "}}}xxx{1}xxx{2}xxx{{{" )

return

"/home/user/usr/bin/printarg"
"--bla"
"rev"
"}}}xxx1xxx2xxx"

When I compile it with

CC=i686-pc-cygwin-gcc-3 -mno-cygwin
      # resulted executable *NOT* depend on cygwin1.dll

call-process return

"d:\home\usr\bin\printarg.exe"
"--bla"
"{rev}"
"}}}xxx{1}xxx{2}xxx{{{"


Also interesting that from Cygwin bash argument successful passed to 
printarg:

bash# ldd `which printarg`
	ntdll.dll => /cygdrive/c/WINDOWS/system32/ntdll.dll
	kernel32.dll => /cygdrive/c/WINDOWS/system32/kernel32.dll
	cygwin1.dll => /usr/bin/cygwin1.dll
	ADVAPI32.DLL => /cygdrive/c/WINDOWS/system32/ADVAPI32.DLL
	RPCRT4.dll => /cygdrive/c/WINDOWS/system32/RPCRT4.dll
	Secur32.dll => /cygdrive/c/WINDOWS/system32/Secur32.dll
	cyggcc_s-1.dll => /usr/bin/cyggcc_s-1.dll
bash# printarg {}{}{{{{}}}{}}}{{} {rev}
"printarg"
"{}{}{{{{}}}{}}}{{}"
"{rev}"


GNU Emacs 23.2 from ftp.gnu.org - release build with mingw.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why call-process removes '{' and '}' chars from arguments???
  2010-06-03  7:46   ` Oleksandr Gavenko
@ 2010-06-03 15:04     ` Larry Hall (Cygwin)
  2010-06-03 20:33       ` Oleksandr Gavenko
  0 siblings, 1 reply; 6+ messages in thread
From: Larry Hall (Cygwin) @ 2010-06-03 15:04 UTC (permalink / raw)
  To: cygwin; +Cc: help-gnu-emacs

On 6/3/2010 3:46 AM, Oleksandr Gavenko wrote:
> On 2010.06.03 0:39, Eli Zaretskii wrote:
>>> From: Oleksandr Gavenko<gavenkoa@gmail.com>
>>> Date: Wed, 02 Jun 2010 23:40:46 +0300
>>>
>>> I use Emacs 23.2 under Windows.
>>>
>>> (call-process
>>> "echo.exe"
>>> nil (get-buffer "*Messages*") nil
>>> "--bla" "{rev}" "}}}xxx{1}xxx{2}xxx{{{" )
>>>
>>> put in Message buffer
>>>
>>> "--bla rev }}}xxx1xxx2xxx"
>>>
>>> so remove occurrences of "{" and "}". Why???
>>
>> I cannot reproduce this in Emacs 23.2 on MS-Windows. I get the
>> expected result:
>>
>> --bla {rev} }}}xxx{1}xxx{2}xxx{{{
>>
>> What kind of port of which program is your echo.exe? What happens if
>> you invoke the same command from the shell?
>>
> Futher info: I wrote simple C prog - printarg.c with:
>
> int main(int argc, char **argv)
> {
> for (int i = 0; i < argc; i++)
> printf("\"%s\"\n", argv[i]);
> return 0;
> }
>
> When I compile it with
>
> CC=gcc # resulted executable depend on cygwin1.dll
>
> (call-process "printarg.exe"
> nil (get-buffer "*Messages*") nil
> "--bla" "{rev}" "}}}xxx{1}xxx{2}xxx{{{" )
>
> return
>
> "/home/user/usr/bin/printarg"
> "--bla"
> "rev"
> "}}}xxx1xxx2xxx"
>
> When I compile it with
>
> CC=i686-pc-cygwin-gcc-3 -mno-cygwin
> # resulted executable *NOT* depend on cygwin1.dll
>
> call-process return
>
> "d:\home\usr\bin\printarg.exe"
> "--bla"
> "{rev}"
> "}}}xxx{1}xxx{2}xxx{{{"
>
>
> Also interesting that from Cygwin bash argument successful passed to
> printarg:
>
> bash# ldd `which printarg`
> ntdll.dll => /cygdrive/c/WINDOWS/system32/ntdll.dll
> kernel32.dll => /cygdrive/c/WINDOWS/system32/kernel32.dll
> cygwin1.dll => /usr/bin/cygwin1.dll
> ADVAPI32.DLL => /cygdrive/c/WINDOWS/system32/ADVAPI32.DLL
> RPCRT4.dll => /cygdrive/c/WINDOWS/system32/RPCRT4.dll
> Secur32.dll => /cygdrive/c/WINDOWS/system32/Secur32.dll
> cyggcc_s-1.dll => /usr/bin/cyggcc_s-1.dll
> bash# printarg {}{}{{{{}}}{}}}{{} {rev}
> "printarg"
> "{}{}{{{{}}}{}}}{{}"
> "{rev}"
>
>
> GNU Emacs 23.2 from ftp.gnu.org - release build with mingw.

See <http://cygwin.com/cygwin-ug-net/using-cygwinenv.html> and try setting
the CYGWIN environment variable to include "noglob".

-- 
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
216 Dalton Rd.                          (508) 893-9889 - FAX
Holliston, MA 01746

_____________________________________________________________________

A: Yes.
> Q: Are you sure?
>> A: Because it reverses the logical flow of conversation.
>>> Q: Why is top posting annoying in email?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why call-process removes '{' and '}' chars from arguments???
  2010-06-03 15:04     ` Larry Hall (Cygwin)
@ 2010-06-03 20:33       ` Oleksandr Gavenko
  2010-06-04  8:56         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Oleksandr Gavenko @ 2010-06-03 20:33 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: cygwin

On 2010-06-03 18:04, Larry Hall (Cygwin) wrote:
> On 6/3/2010 3:46 AM, Oleksandr Gavenko wrote:
>> On 2010.06.03 0:39, Eli Zaretskii wrote:
>>>> From: Oleksandr Gavenko<gavenkoa@gmail.com>
>>>> Date: Wed, 02 Jun 2010 23:40:46 +0300
>>>>
>>>> I use Emacs 23.2 under Windows.
>>>>
>>>> (call-process
>>>> "echo.exe"
>>>> nil (get-buffer "*Messages*") nil
>>>> "--bla" "{rev}" "}}}xxx{1}xxx{2}xxx{{{" )
>>>>
>>>> put in Message buffer
>>>>
>>>> "--bla rev }}}xxx1xxx2xxx"
>>>>
>>>> so remove occurrences of "{" and "}". Why???
>>>
>>> I cannot reproduce this in Emacs 23.2 on MS-Windows. I get the
>>> expected result:
>>>
>>> --bla {rev} }}}xxx{1}xxx{2}xxx{{{
>>>
>>> What kind of port of which program is your echo.exe? What happens if
>>> you invoke the same command from the shell?
>>>
>> Futher info: I wrote simple C prog - printarg.c with:
>>
>> int main(int argc, char **argv)
>> {
>> for (int i = 0; i < argc; i++)
>> printf("\"%s\"\n", argv[i]);
>> return 0;
>> }
>>
>> When I compile it with
>>
>> CC=gcc # resulted executable depend on cygwin1.dll
>>
>> (call-process "printarg.exe"
>> nil (get-buffer "*Messages*") nil
>> "--bla" "{rev}" "}}}xxx{1}xxx{2}xxx{{{" )
>>
>> return
>>
>> "/home/user/usr/bin/printarg"
>> "--bla"
>> "rev"
>> "}}}xxx1xxx2xxx"
>>
>> When I compile it with
>>
>> CC=i686-pc-cygwin-gcc-3 -mno-cygwin
>> # resulted executable *NOT* depend on cygwin1.dll
>>
>> call-process return
>>
>> "d:\home\usr\bin\printarg.exe"
>> "--bla"
>> "{rev}"
>> "}}}xxx{1}xxx{2}xxx{{{"
>>
>>
>> Also interesting that from Cygwin bash argument successful passed to
>> printarg:
>>
>> bash# ldd `which printarg`
>> ntdll.dll => /cygdrive/c/WINDOWS/system32/ntdll.dll
>> kernel32.dll => /cygdrive/c/WINDOWS/system32/kernel32.dll
>> cygwin1.dll => /usr/bin/cygwin1.dll
>> ADVAPI32.DLL => /cygdrive/c/WINDOWS/system32/ADVAPI32.DLL
>> RPCRT4.dll => /cygdrive/c/WINDOWS/system32/RPCRT4.dll
>> Secur32.dll => /cygdrive/c/WINDOWS/system32/Secur32.dll
>> cyggcc_s-1.dll => /usr/bin/cyggcc_s-1.dll
>> bash# printarg {}{}{{{{}}}{}}}{{} {rev}
>> "printarg"
>> "{}{}{{{{}}}{}}}{{}"
>> "{rev}"
>>
>>
>> GNU Emacs 23.2 from ftp.gnu.org - release build with mingw.
>
> See <http://cygwin.com/cygwin-ug-net/using-cygwinenv.html> and try setting
> the CYGWIN environment variable to include "noglob".
>
That is!!!! Much thanks.

I explain that I have.

Cygwin distro have Mercurial package inside.
'cygwin.el' allow incorporate Emacs with Cygwin
without any pain.

But native Windows Emacs can not run scripts
(in Cygwin - these are files without ext with
usual UNIX #!/bin/bla-bla first string).

To be able invoke it from Emacs I wrote .bat wrappers
with same base name for needed scripts like:

   @echo off
   python /bin/hg %*

With CYGWIN env var set to

   "nodosfilewarning noglob"

and wrapper I can use VC mode
for Mersurial/Bazaar repos (without 'nodosfilewarning'
script output can be damaged by Cygwin warning messages).

That work pretty nice if there are no new line
char in passed to .bat file args.

As I debug 'log-edit-done' it can pass such command line
(through 'process-file' in 'vc-do-command') switches for Mercurial:

   (apply 'process-file "hg" nil t nil
            '("commit" "-m" "message\nXXX\nYYY\nZZZ\n"))

%* in .bat file not proper work - it strip all chars after
first new line occurrence.

I think in Windows there are no anything scriptable with
"$*" like in POSIX sh.

So through .bat wrapper I can not commit multiline
message and as list of files for commit goes after
-m "message\n" - it also forget pass list of files for commit.

So if I commit single file - it commit all modified files in repo.

To workaround this I create executable
which linked with Cygwin runtime and as in BusyBox
to 'execvp' passed base name as command and all args without
changes. Cygwin 'execvp' first search for 'prog' then
for 'prog.exe' so trick worked!

So I switch from simple .bat wrapper to
special executable. To enable another Cygwin script 'foo'
for Emacs I just copy existing executable:

   $ cp hg.exe foo.exe

Some further info accessed at 
http://www.mail-archive.com/cygwin@cygwin.com/msg109064.html

-- 
Best regards!




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why call-process removes '{' and '}' chars from arguments???
  2010-06-03 20:33       ` Oleksandr Gavenko
@ 2010-06-04  8:56         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2010-06-04  8:56 UTC (permalink / raw)
  To: help-gnu-emacs, cygwin

> From: Oleksandr Gavenko <gavenkoa@gmail.com>
> Date: Thu, 03 Jun 2010 23:33:44 +0300
> Cc: cygwin@cygwin.com
> 
> %* in .bat file not proper work - it strip all chars after
> first new line occurrence.
> 
> I think in Windows there are no anything scriptable with
> "$*" like in POSIX sh.

Yes, there is: it's %*.  The problem is that the Windows shells do not
support command lines with embedded newlines at all.

> To workaround this I create executable
> which linked with Cygwin runtime and as in BusyBox
> to 'execvp' passed base name as command and all args without
> changes. Cygwin 'execvp' first search for 'prog' then
> for 'prog.exe' so trick worked!
> 
> So I switch from simple .bat wrapper to
> special executable. To enable another Cygwin script 'foo'
> for Emacs I just copy existing executable:
> 
>    $ cp hg.exe foo.exe

Mixing the native Windows build of Emacs with Cygwin is asking for
trouble.  I expect you to see more surprises down the line.  I highly
recommend to install the Cygwin build of Emacs and use that instead.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-06-04  8:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-02 20:40 Why call-process removes '{' and '}' chars from arguments??? Oleksandr Gavenko
2010-06-02 21:39 ` Eli Zaretskii
2010-06-03  7:46   ` Oleksandr Gavenko
2010-06-03 15:04     ` Larry Hall (Cygwin)
2010-06-03 20:33       ` Oleksandr Gavenko
2010-06-04  8:56         ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).