bugmake - Bugs: bug #60312, echo replaces double quote with...

 
 

bug #60312: echo replaces double quote with backslash

Submitted by:  None
Submitted on:  Tue 30 Mar 2021 08:22:32 PM UTC
 
Severity:  3 - Normal Item Group:  Bug
Status:  Not A Bug Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  4.3 Operating System:  MS Windows
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       No canned response available

 

( Jump to the original submission )

Sat 17 Apr 2021 08:54:08 PM UTC, comment #10: 

I'm not sure I know what to do with this: is there a problem to be resolved or should this be closed?

Paul D. Smith <psmith>
Project Administrator
Wed 31 Mar 2021 05:02:48 PM UTC, comment #9: 

The native Windows build of GNU Make basically assumes the behavior of native programs wrt quotes and their escaping.

There's nothing wrong with MSYS `echo`, but if you want to use MSYS, you are well advised to use an MSYS build of Make as well.

Eli Zaretskii <eliz>
Project Member
Wed 31 Mar 2021 04:32:31 PM UTC, comment #8: 

Yeah, well. But if it assumes the invoked program can interpret "backslash double quote" in the command line, why can't it also assume that it can understand "single quote quoting" and not change one into the other?

Because MSYS's echo works finely with the latter but has problems with the former :)

Anyway, thanks for your time. I think I'll install a GNU/Linux VM to build and use this particular program that's giving me make trouble. "If the scalpel doesn't work, use a sledgehammer..."

Anonymous
Wed 31 Mar 2021 03:13:27 PM UTC, comment #7: 

As your debug output shows, Make is escaping the quote, not what's after the quote.  Make leaves the quotes there because your command included the quotes.

Eli Zaretskii <eliz>
Project Member
Wed 31 Mar 2021 03:08:30 PM UTC, comment #6: 

So you have the MSYS `bin` directory on your PATH...

Don't do that, native Windows programs and MSYS don't mix well.

Eli Zaretskii <eliz>
Project Member
Wed 31 Mar 2021 02:56:13 PM UTC, comment #5: 

And one more thing, this is the respective line output by make -d:

CreateProcess(C:\msys64\usr\bin\echo.exe,echo \"xx\",...)

I don't know if those backslashes are just added by the log routine or are actually sent by make to echo (in which case, maybe make is the culprit after all?).

Anonymous
Wed 31 Mar 2021 02:44:52 PM UTC, comment #4: 

I do have it:

$ which sh
/usr/bin/sh

but make seems to be calling echo.exe directly. Extracts from "strace make -f tm":

    0       0 [main] echo (7896) **********************************************
  155     155 [main] echo (7896) Program name: C:\msys64\usr\bin\echo.exe (windows pid 7896)
   59     214 [main] echo (7896) OS version:   Windows NT-10.0
  102     316 [main] echo (7896) **********************************************

  294   12965 [main] echo (7896) open_shared: name cygpid.640, n 640, shared 0x180010000 (wanted 0x180010000), h 0x134, *m 2
   81   13046 [main] echo (7896) time: 1617201324 = time(0x0)
  106   13152 [main] echo 640 pinfo::thisproc: myself dwProcessId 7896

  202   55767 [main] echo 640 build_argv: cmd = 'echo \"xx\"', winshell = 1, glob = 1
  144   55911 [main] echo 640 build_argv: argv[0] = 'echo'
  324   56235 [main] echo 640 lstat64: entering
  115   56350 [main] echo 640 normalize_posix_path: src \xx"
   78   56428 [main] echo 640 normalize_win32_path: C:\xx" = normalize_win32_path (\xx")
   78   56506 [main] echo 640 mount_info::conv_to_win32_path: conv_to_win32_path (C:/xx")
   92   56598 [main] echo 640 mount_info::conv_to_win32_path:  mount[0] .. checking /bin -> C:\msys64\usr\bin
   67   56665 [main] echo 640 mount_info::conv_to_win32_path:  mount[1] .. checking / -> C:\msys64
   91   56756 [main] echo 640 mount_info::conv_to_win32_path: src_path C:/xx", dst C:\xx", flags 0x0, rc 0
  207   56963 [main] echo 640 symlink_info::check: 0xC0000034 = NtCreateFile (\??\C:\xx")
   73   57036 [main] echo 640 symlink_info::check: 0xC0000034 = NtQueryInformationFile (\??\C:\xx")
  110   57146 [main] echo 640 symlink_info::check: 0xC0000034 = NtCreateFile (\??\C:\xx".exe)
   59   57205 [main] echo 640 symlink_info::check: 0xC0000034 = NtQueryInformationFile (\??\C:\xx".exe)
  270   57475 [main] echo 640 symlink_info::check: 0xC0000034 = NtCreateFile (\??\C:\xx".lnk)
  108   57583 [main] echo 640 symlink_info::check: 0xC0000034 = NtQueryInformationFile (\??\C:\xx".lnk)
  171   57754 [main] echo 640 symlink_info::check: 0xC0000034 = NtCreateFile (\??\C:\xx".exe.lnk)
   74   57828 [main] echo 640 symlink_info::check: 0xC0000034 = NtQueryInformationFile (\??\C:\xx".exe.lnk)
   77   57905 [main] echo 640 symlink_info::check: 0 = symlink.check(C:\xx", 0xFFFC9730) (mount_flags 0x6000, path_flags 0x0)
   76   57981 [main] echo 640 mount_info::conv_to_win32_path: conv_to_win32_path (C:)
   86   58067 [main] echo 640 mount_info::conv_to_win32_path:  mount[0] .. checking /bin -> C:\msys64\usr\bin
   72   58139 [main] echo 640 mount_info::conv_to_win32_path:  mount[1] .. checking / -> C:\msys64
   48   58187 [main] echo 640 mount_info::conv_to_win32_path: src_path C:, dst C:, flags 0x0, rc 0
  128   58315 [main] echo 640 symlink_info::check: 0x0 = NtCreateFile (\??\C:\)
  202   58517 [main] echo 640 symlink_info::check: not a symlink
  136   58653 [main] echo 640 symlink_info::check: 0 = symlink.check(C:\, 0xFFFC9730) (mount_flags 0x6000, path_flags 0x0)
   91   58744 [main] echo 640 path_conv::check: this->path(C:\xx"), has_acls(0)
   71   58815 [main] echo 640 __set_errno: int stat_worker(path_conv&, stat*):2060 setting errno 2
   84   58899 [main] echo 640 stat_worker: -1 = (\??\C:\xx",0xFFFCC9F0)
  220   59119 [main] echo 640 globify: argv[1] = '\xx"'

Anonymous
Wed 31 Mar 2021 06:39:41 AM UTC, comment #3: 

Maybe it is an internal command, but in the wrong shell.  Do you have sh.exe somewhere on your PATH?

Eli Zaretskii <eliz>
Project Member
Wed 31 Mar 2021 05:53:12 AM UTC, comment #2: 

Yes, you're right. I thought echo was an internal command. I investigated further and the culprit seems to be the POSIX emulation library, which does strange things trying to emulate shell globbing.

Sorry for the inconvenience, please discard this ticket.

Thanks.

Anonymous
Wed 31 Mar 2021 01:18:16 AM UTC, comment #1: 

Make passes recipies to shell line by line. Shell runs echo.
You can see here
echo 'nospacebefore:"xx"'
nospacebefore:\xx"

The first line is what make passes to shell.
The 2nd line is the result of echo.
Apparently, echo on your system does this.

Dmitry Goncharov <dgoncharov>
Tue 30 Mar 2021 08:22:32 PM UTC, original submission:  

It seems to happen when there's no blanks earlier in the line. System is Windows 10, MINGW-64.

$ make --version
GNU Make 4.3
Built for Windows32
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ cat tm
all:
        echo 'space before: "xx"'
        echo 'nospacebefore:"xx"'
        echo '"xx"'

$ make -f tm
echo 'space before: "xx"'
space before: "xx"
echo 'nospacebefore:"xx"'
nospacebefore:\xx"
echo '"xx"'
\xx"

No problems with same version on GNU/Linux (Debian).

Thanks.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by eliz (Posted a comment)
  • -email is unavailable- added by dgoncharov (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

     

     

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-03-31 eliz StatusNone => Not A Bug

    Back to the top


    Powered by Savane 3.9