#943 quotes and build command

v1.24
closed-fixed
v1.23
6
2014-11-12
2013-03-12
gok6tm
No

Hi there !

I have a problem with custom build command since i upgrade to 1.23 on Wind~.
I define my build command as :
command : "C:\Documents and Settings\xxx\Application Data\geany\tools\jsl-0.3.0\jsl.exe" -process "%d\%f" -conf jsl.default.conf
work path : "C:\Documents and Settings\xxx\Application Data\geany\tools\jsl-0.3.0\"

And now with 1.23 it produce an error (in french) :
"C:\Documents and Settings\xxx\Application Data\geany\tools\jsl-0.3.0\jsl.exe" -process "D:\pathToFile\file.js" -conf jsl.default.conf (dans le dossier : "C:\Documents and Settings\xxx\Application Data\geany\tools\jsl-0.3.0\")
'C:\Documents' n'est pas reconnu en tant que commande interne
ou externe, un programme ex cutable ou un fichier de commandes.

If i use single quote instead of double quote i have this message (in french) :
Syntaxe du nom de fichier, de r pertoire ou de volume incorrecte.

I seen in the mailing list there was some changes near the management of quotes in the build command, maybe there is an edge effect for a Wind~ environment.

There is also an error with accentuated character ("ex cutable" / "r pertoire"). maybe it was present on previous version i don't remember

Thanks for your reading and consideration

Duplicates of this bug: [#969], [#980], [#996]

Related

Bugs: #969
Bugs: #980
Bugs: #996

Discussion

<< < 1 2 (Page 2 of 2)
  • Matthew Brush
    Matthew Brush
    2013-11-02

    Not sure if it helps, but there's also CommandLineToArgvW which IIUC is the win32 equivalent of g_shell_parse_argv.

     
  • Dimitar Zhekov
    Dimitar Zhekov
    2013-11-02

    Here is a low-level create_process_with_pipes() for win~1 with a read(std{out,err}) test. No write(stdin) test yet, but I don't expect any problems. A comment in execute.c explains why the err/out may appear mixed (shoudn't be a problem in Geany).

    @Lex: I think we need both arguments. For example, FiF has a "grep command", while the text to search is certainly a separate argument, which may contain quotes. I don't want the calling functions to format something (sometimes with bugs, as in the current build.c) just so that I reformat it later. And there's the matter of utils_spawn_[a]sync(), both of which are currently in use.

    What I failed to mention is that if both command and argv are present, both will be used, with command_text before argv, and the non-native argument will be converted.

    (Yes, SF ate the asterisks).

    @Matthew: Argv[A|W]ToCommandLine would have been helpful, but I don't know of any, and haven't seen such a call in the windows crtl-s. The test in execute.c does a crude conversion, but I'll need to inspect this more carefully.

    I'm not sure what high level function(s) will be best, for example a sync/async spawn with callbacks instead of out/err fd-s, but in any case I'll create a new module, execute.c or something, and put all spawn related code there (except the client calls, of course). Enough hunting in utils, build, win32 and who knows where else.

     
  • Dimitar Zhekov
    Dimitar Zhekov
    2013-11-03

    Here's an updated version of execute. I'll probably name the new module spawn.[ch], and all functions will have spawn_ prefix. BTW, redirecting one or two of the pipes, while leaving the other(s) intact, seems to be a problem under win~1 - it's either all or none, the documentation of GetStdHandle() suggests otherwise.

     
  • Dimitar Zhekov
    Dimitar Zhekov
    2013-11-23

    The attached archive contains:

    • spawn.[ch] - spawning functions and tests, not Geany-dependent
    • Makefile - to compile the spawning tests under *nix/win~1
    • emit.c - a useful program to spawn
    • spawn.rsp - as in "./spawn < spawn.rsp"
    • respawn.diff - patch for Makefile.am, wscript, build.c and tools.c

    Changes since 0.8 which was sent to the ML:

    • added spawn_with_capture() and a test for it
    • altered tools.c to use spawn_with_capture()
    • added spawn.c to wscript
    • fixed passing mixed NULL and non-NULL hStd* to win~1 programs (it's not good, despite what the win~1 documentation says or does not say)
    • killed build.c SYNC_SPAWN and simplified the functions a bit
    • build.c tests: build geany/plugins with waf under win~1 and with autotools under *nix etc.
    • added documentation to spawn.c about the module and the various win~1 spawning problems
     
    Attachments
  • Dimitar Zhekov
    Dimitar Zhekov
    2013-11-29

    Changes since 0.9:

    • restored build.c kill process functionality
    • using g_win32_error_messages instead of error codes
    • patch and a bugfix for search.c
    • small fixes in spawn.c
    • small patches for notebook.c and templates.c
    • redirected utils_spawn_* to spawn_ functions
    • finally, cleanup patches of win32.[ch]
    • new file geanyvc.diff with a small geanyvc patch

    Note that you can apply the respawn patches separately, like splitdiff -a respawn.diff and then patch Makefile.am and build.c only; win32.[ch] should always be patched last.

    There are more calls that require change, for example g_shell_parse_argv (and thus g_spawn_command_line_*) should never be used under Windows directly. But I'll stop the spawning rewrite until the current changes are applied, rejected, fixed, or left to rot, as it sometimes happens.

     
    Attachments
  • Matthew Brush
    Matthew Brush
    2013-11-29

    @Dimitar it'd easier to test/review/merge if you used a Git branch, and ideally made a pull request for the branch on Github so it don't get lost/left to rot.

     
    • status: pending --> closed-fixed
    • assigned_to: Colomban Wendling
    • Fixed in: None --> v1.24
     
  • Fixed with [5c893e9b0eac95cc26f35a5dc279872ff1588f27]: windows command-line spawning has a very strange handling of quotes, whenever there was a space in the executable path and more than 2 quotes in the whole command, it broke.

    @Dimitar when next version is out, we'll try your cleaner and better approach. Thanks a lot for that effort BTW.

     

    Related

    Commit: [5c893e]

  • Dimitar Zhekov
    Dimitar Zhekov
    2014-05-18

    Changes since 1.0:

    • restored build_spawn_cmd() via /bin/sh, for compatibility
    • updated for geany-2014-05-08

    I'll recreate the git PR soon, but as before, this .zip contains the full version.

     
    Last edit: Dimitar Zhekov 2014-05-18
    Attachments
  • Dimitar Zhekov
    Dimitar Zhekov
    2014-05-22

    Changes since 1.01:

    • added spawn to makefile.win32
    • moved spawn to last position in all builds, it doesn't depend on anything

    geanyvc diff remains at 1.01.

     
    Attachments
  • Dimitar Zhekov
    Dimitar Zhekov
    2014-06-26

    Changes since 1.02:

    • updated for "include what you use"

    Updated PR #274 as well.

     
    Attachments
<< < 1 2 (Page 2 of 2)