I have been trying to use run (current version 1.3.3-1) to launch
emacsclient-w32 from the desktop via SendTo without having a console-window
pop up. It does work, but I have found two problems that prevent this from
working in certain cases:
1) Unicode text arguments: If I pass arguments to run with non-ANSI text
(German Umlaute in my case), they arrive at the called program (in my case
emacsclient-w32) garbled.
2) Empty args: There ARE cases where we want to do this, e.g. pass the -a ""
option to emacsclient, but this does not work even with the --quote option
to run - the empty arg is silently "swallowed".
 
To illustrate the problem, consider the following command-line, which passes
an empty arg and one containing an Umlaut (hope it shows up properly!):
run --run-verbose --run-debug=1 --quote bash -c 'exec >tmp; echo $#; echo
"$0" "$@"' a b c d "" ä 2>&1 | cat
 
See attachment 1 for what it gives on my system and what I think it should
show - and actually does with some small changes I hacked up. For the sake
of completeness I also attach output of cygcheck -svr.
 
The changes I propose are contained in the attachment 3, which was created
by running "cygport run package" (after modification and compilation, of
course). Apart from fixing the 2 problems above I also updated the man-page,
borrowing from the run2 man-page. I did not touch NEWS, ChangeLog, etc.
though. I hope this change can be adopted by the kind maintainers:-)
 
My testing showed some other issues I do not consider urgent, but are worth
mentioning:
1) run DOES handle symlinks, but only if one passes the program-name with an
absolute path or the symlink has a name with the right suffix (e.g. .exe) -
which unfortunately is not the case with the symlinks provided (e.g. for
emacs and emacsclient) via the alternatives system. This would require
fixing the symlinks in packages using alternatives - or fixing run to
process the program-name in the same way as the spawn/exec family of
functions.
2) run does not execute scripts as of now - on the other hand since the
exec/spawn functions do so, it should in principle be possible to layer run
on an extended form of those functions. That would really simplify creating
desktop-shortcuts by placing all complexity in a shell-script and using the
runprogram mechanism to call it - rather than packing a complex command-line
(typically using bash) into the shortcut.
 
Regards, Martin
Current:

$ run --run-verbose --run-debug=1 --quote bash -c 'exec >tmp; echo $#; echo 
"$0" "$@"' a b c d "" ä 2>&1 | cat
run DEBUG: opt_loglevel: 7
run DEBUG: opt_nogui   : 0
run DEBUG: opt_notty   : 0
run DEBUG: opt_wait    : 0
run DEBUG: opt_quote   : 1
run DEBUG: PATH: 
.:/usr/bin:/usr/sbin:/usr/local/bin:/usr/bin:/cygdrive/c/Dokumente und 
Einstellungen/All 
Users/Anwendungsdaten/Oracle/Java/javapath:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/opt/Gemeinsame
 Dateien/Roxio Shared/DLLShared:/opt/Depicus:/opt/Aquila 
Technology/WakeOnLAN:/opt/Gemeinsame Dateien/HP/Digital 
Imaging/bin:/opt/HP/Digital Imaging/bin:/opt/HP/Digital Imaging/bin/Qt/Qt 
4.3.3:/cygdrive/c/WINDOWS/system32/WindowsPowerShell/v1.0:/opt/Sysinternals

run DEBUG: exec_tmp     /usr/bin/bash.exe
pathlist        
.:/usr/bin:/usr/sbin:/usr/local/bin:/usr/bin:/cygdrive/c/Dokumente und 
Einstellungen/All 
Users/Anwendungsdaten/Oracle/Java/javapath:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/opt/Gemeinsame
 Dateien/Roxio Shared/DLLShared:/opt/Depicus:/opt/Aquila 
Technology/WakeOnLAN:/opt/Gemeinsame Dateien/HP/Digital 
Imaging/bin:/opt/HP/Digital Imaging/bin:/opt/HP/Digital Imaging/bin/Qt/Qt 
4.3.3:/cygdrive/c/WINDOWS/system32/WindowsPowerShell/v1.0:/opt/Sysinternals

run DEBUG: /usr/bin/bash.exe
run DEBUG: exec C:\cygwin\bin\bash.exe
execname        bash
execpath        /usr/bin

run DEBUG: C:\cygwin\bin\bash.exe -c "exec >tmp; echo $#; echo \"$0\" \"$@\"" a 
b c d  ä
run DEBUG: Launch non-GUI target
run Info: Exiting with status 0

$ cat tmp
4
a b c d ä

$

Expected:

$ run --run-verbose --run-debug=1 --quote bash -c 'exec >tmp; echo $#; echo 
"$0" "$@"' a
 b c d "" ä 2>&1 | cat
run DEBUG: opt_loglevel: 7
run DEBUG: opt_nogui   : 0
run DEBUG: opt_notty   : 0
run DEBUG: opt_wait    : 0
run DEBUG: opt_quote   : 1
run DEBUG: PATH: 
.:/usr/bin:/usr/sbin:/usr/local/bin:/usr/bin:/cygdrive/c/Dokumente und 
Einstellungen/All 
Users/Anwendungsdaten/Oracle/Java/javapath:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/opt/Gemeinsame
 Dateien/Teleca 
Shared:/opt/7-Zip:/cygdrive/c/WINDOWS/system32/WindowsPowerShell/v1.0:/opt/Sysinternals:/opt/GNU/bin:/cygdrive/c/Cygwin/usr/local/bin:/cygdrive/c/Cygwin/bin:/cygdrive/c/Cygwin/usr/sbin:/opt/MediaInfo_CLI:/opt/SMPlayer:/opt/SMPlayer/mplayer:/opt/FLAC:/opt/Kathrein:/opt/MPEG2Schnitt:/opt/Project-X:/opt/Comskip:/opt/MediathekView:/opt/AutoIt3:/opt/Depicus:/opt/Aquila
 Technology/WakeOnLAN:/opt/Gemeinsame Dateien/HP/Digital 
Imaging/bin:/opt/HP/Digital Imaging/bin:/opt/HP/Digital Imaging/bin/Qt/Qt 
4.3.3:/opt/QuickTime/QTSystem:/opt/Skype/Phone:/opt/FileVerifier++

run DEBUG: exec_tmp     /usr/bin/bash.exe
pathlist        
.:/usr/bin:/usr/sbin:/usr/local/bin:/usr/bin:/cygdrive/c/Dokumente und 
Einstellungen/All 
Users/Anwendungsdaten/Oracle/Java/javapath:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/opt/Gemeinsame
 Dateien/Teleca 
Shared:/opt/7-Zip:/cygdrive/c/WINDOWS/system32/WindowsPowerShell/v1.0:/opt/Sysinternals:/opt/GNU/bin:/cygdrive/c/Cygwin/usr/local/bin:/cygdrive/c/Cygwin/bin:/cygdrive/c/Cygwin/usr/sbin:/opt/MediaInfo_CLI:/opt/SMPlayer:/opt/SMPlayer/mplayer:/opt/FLAC:/opt/Kathrein:/opt/MPEG2Schnitt:/opt/Project-X:/opt/Comskip:/opt/MediathekView:/opt/AutoIt3:/opt/Depicus:/opt/Aquila
 Technology/WakeOnLAN:/opt/Gemeinsame Dateien/HP/Digital 
Imaging/bin:/opt/HP/Digital Imaging/bin:/opt/HP/Digital Imaging/bin/Qt/Qt 
4.3.3:/opt/QuickTime/QTSystem:/opt/Skype/Phone:/opt/FileVerifier++

run DEBUG: /usr/bin/bash.exe
run DEBUG: exec C:\cygwin\bin\bash.exe
execname        bash
execpath        /usr/bin

run DEBUG: C:\cygwin\bin\bash.exe -c "exec >tmp; echo $#; echo \"$0\" \"$@\"" a 
b c d ""
ä
run DEBUG: Launch non-GUI target
run DEBUG: converted command-line: C:\cygwin\bin\bash.exe -c "exec >tmp; echo 
$#; echo \"$0\" \"$@\"" a b c d "" ä, length 79, size 81
run Info: Exiting with status 0

Martin@MartinsDell ~
$ cat tmp
5
a b c d  ä

Martin@MartinsDell ~
$

Attachment: cygcheck-svr-150515.out
Description: Binary data

Attachment: run.src.patch
Description: Binary data

--
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

Reply via email to