Changeset 535 for trunk/src


Ignore:
Timestamp:
Sep 19, 2006, 6:29:18 AM (19 years ago)
Author:
bird
Message:

o A real attempt at fixing the double quoting problem on windows. ash seems to want a

space between a double quote enclosing the last argument on the commandline and the
double quote enclosing the commandline (the -c argument). Also, defined HAVE_CYGWIN_SHELL.

o Fixed a newline escape problem when using batch_mode_shell on windows with kmk_ash.

Location:
trunk/src/gmake
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmake/Makefile.kmk

    r533 r535  
    3030        CONFIG_WITH_VALUE_LENGTH \
    3131        CONFIG_WITH_COMPARE
     32kmk_DEFS.win32 = HAVE_CYGWIN_SHELL
     33kmk_DEFS.win64 = HAVE_CYGWIN_SHELL
    3234
    3335kmk_SOURCES = \
     
    272274        echo "4"
    273275
    274 # shell double and single quoting check.
     276
     277#
     278# Shell execution tests.
     279#
     280test_shell: test_shell_quoting test_shell_newline
     281
     282# shell double and single quoting check (was busted on windows in 3.81).
    275283test_shell_quoting:
     284        $(ECHO_EXT) "double quoted sTrInG"
    276285        $(ECHO_EXT) "double quoted sTrInG" | $(SED_EXT) -e "s/sTrInG/string/g"
    277286        $(ECHO_EXT) 'single quoted sTrInG' | $(SED_EXT) -e 's/sTrInG/string/g'
    278287        $(ECHO) "This string should not be printed with double quotes."
    279288        $(ECHO) 'This string should not be printed with single quotes.'
     289
     290# when using batch mode shell, the newline got escaped twice and spoiling everything.
     291test_shell_newline:
     292        $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
     293                's/foo/$@/' -e \
     294                's/foo/works/' \
     295                -e 's/foo/\!/'
     296
  • trunk/src/gmake/job.c

    r521 r535  
    25492549# ifndef KMK
    25502550    goto slow;
    2551 #else /* KMK */
     2551# else /* KMK */
    25522552    {
    25532553      /* Allow ash from kBuild. */
     
    29042904              {
    29052905                *(ap++) = '\\';
     2906#ifdef KMK /* see test in Makefile.kmk, required on windows. */
     2907                if (!batch_mode_shell)
     2908#endif
    29062909                *(ap++) = '\\';
    29072910                *(ap++) = '\n';
  • trunk/src/gmake/main.c

    r534 r535  
    893893  }
    894894
    895 #ifdef KMK
     895#if 0/* def KMK - has been fixed in sub_proc.c */
    896896  /* WORKAROUND:
    897897    With GNU Make 3.81, this kludge was necessary to get double quotes
  • trunk/src/gmake/w32/subproc/sub_proc.c

    r503 r535  
    10731073         */
    10741074        bytes_required++;
     1075#ifdef KMK /* for the space before the final " in case we need it. */
     1076        bytes_required++;
     1077#endif
    10751078
    10761079        command_line = (char*) malloc(bytes_required);
     
    11171120                                } else {
    11181121
    1119                                 /*
    1120                                 * We have to insert a backslash for the "
    1121                                 * and each \ that precedes the ".
    1122                                 */
    1123                                 backslash_count++;
    1124 
    1125                                 while(backslash_count) {
    1126                                         *(command_line_i++) = '\\';
    1127                                         backslash_count--;
    1128                                 };
     1122                                        /*
     1123                                        * We have to insert a backslash for the "
     1124                                        * and each \ that precedes the ".
     1125                                        */
     1126                                        backslash_count++;
     1127       
     1128                                        while(backslash_count) {
     1129                                                *(command_line_i++) = '\\';
     1130                                                backslash_count--;
     1131                                        };
    11291132                                }
    11301133#if !defined(HAVE_MKS_SHELL) && !defined(HAVE_CYGWIN_SHELL)
     
    11521155                        };
    11531156#endif
     1157#ifdef KMK
     1158                        /*
     1159                         * ash it put off by echo "hello world" ending up as:
     1160                         *  G:/.../kmk_ash.exe -c "echo ""hello world"""
     1161                         * It wants a space before the last '"'.
     1162                         * (The 'test_shell' goals in Makefile.kmk tests this problem.)
     1163                         */
     1164                        if (command_line_i[-1] == '\"' && cygwin_mode && have_sh && !argvi[1]) {
     1165                            *(command_line_i++) = ' ';
     1166                        }
     1167#endif
    11541168                        *(command_line_i++) = '\"';
    11551169                }
Note: See TracChangeset for help on using the changeset viewer.