[bug #60312] echo replaces double quote with backslash

2021-03-30 Thread anonymous
URL:
  

 Summary: echo replaces double quote with backslash
 Project: make
Submitted by: None
Submitted on: Tue 30 Mar 2021 08:22:32 PM UTC
Severity: 3 - Normal
  Item Group: Bug
  Status: None
 Privacy: Public
 Assigned to: None
 Open/Closed: Open
 Discussion Lock: Any
   Component Version: 4.3
Operating System: MS Windows
   Fixed Release: None
   Triage Status: None

___

Details:

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




___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[bug #60312] echo replaces double quote with backslash

2021-03-30 Thread Dmitry Goncharov
Follow-up Comment #1, bug #60312 (project make):

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.

___

Reply to this item at:

  

___
  Сообщение отправлено по Savannah
  https://savannah.gnu.org/




[bug #60312] echo replaces double quote with backslash

2021-03-30 Thread anonymous
Follow-up Comment #2, bug #60312 (project make):

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.

___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[bug #60312] echo replaces double quote with backslash

2021-03-30 Thread Eli Zaretskii
Update of bug #60312 (project make):

  Status:None => Not A Bug  

___

Follow-up Comment #3:

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


___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[bug #60312] echo replaces double quote with backslash

2021-03-31 Thread anonymous
Follow-up Comment #4, bug #60312 (project make):

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
0x18001 (wanted 0x18001), 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: 0xC034 = NtCreateFile
(\??\C:\xx")
   73   57036 [main] echo 640 symlink_info::check: 0xC034 =
NtQueryInformationFile (\??\C:\xx")
  110   57146 [main] echo 640 symlink_info::check: 0xC034 = NtCreateFile
(\??\C:\xx".exe)
   59   57205 [main] echo 640 symlink_info::check: 0xC034 =
NtQueryInformationFile (\??\C:\xx".exe)
  270   57475 [main] echo 640 symlink_info::check: 0xC034 = NtCreateFile
(\??\C:\xx".lnk)
  108   57583 [main] echo 640 symlink_info::check: 0xC034 =
NtQueryInformationFile (\??\C:\xx".lnk)
  171   57754 [main] echo 640 symlink_info::check: 0xC034 = NtCreateFile
(\??\C:\xx".exe.lnk)
   74   57828 [main] echo 640 symlink_info::check: 0xC034 =
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"'



___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[bug #60312] echo replaces double quote with backslash

2021-03-31 Thread anonymous
Follow-up Comment #5, bug #60312 (project make):

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?).

___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[bug #60312] echo replaces double quote with backslash

2021-03-31 Thread Eli Zaretskii
Follow-up Comment #6, bug #60312 (project make):

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

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


___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[bug #60312] echo replaces double quote with backslash

2021-03-31 Thread Eli Zaretskii
Follow-up Comment #7, bug #60312 (project make):

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.


___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[bug #60312] echo replaces double quote with backslash

2021-03-31 Thread anonymous
Follow-up Comment #8, bug #60312 (project make):

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

___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[bug #60312] echo replaces double quote with backslash

2021-03-31 Thread Eli Zaretskii
Follow-up Comment #9, bug #60312 (project make):

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.


___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[bug #60312] echo replaces double quote with backslash

2021-04-17 Thread Paul D. Smith
Follow-up Comment #10, bug #60312 (project make):

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

___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[bug #60312] echo replaces double quote with backslash

2022-07-16 Thread Paul D. Smith
Update of bug #60312 (project make):

 Open/Closed:Open => Closed 

___

Follow-up Comment #11:

I'm going to close this as "not a bug" but if someone disagrees please add a
comment.

I must confess the matrix of different environments on Windows and how they
interact has always confused me, and it confuses many others as well. 
Probably we should attempt to clarify this both in the code as well as in
output from make that could be clarifying to the user and/or someone
attempting to assist them.


___

Reply to this item at:

  

___
Message sent via Savannah
https://savannah.gnu.org/