Subject: bug#7687: 23.1.50; shell-quote-argument does not correctly quote newlines

From: Flo <[email-masked]>
Date: Mon, 20 Dec 2010 17:21:37 +0100

Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the [email-masked] mailing list.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

When I run the following script:

----------------------------------
#!/bin/bash
emacs -Q --batch eval='(shell-command (concat "echo "
(shell-quote-argument "line1\nline2") " >tmpfile"))'
cat tmpfile
----------------------------------

I expect the following content within 'tmpfile', i.e. exactly the
string I passed to shell-quote-argument.

-------------
line1
line2
-------------

Instead I get this:

-------------
line1line2
-------------

I have not made any modification to Emacs.

I made a patch and will send it as described in the Emacs manual in
chapter 'Sending Patches for GNU Emacs'.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/share/emacs/23.1.50/etc/DEBUG for instructions.

In GNU Emacs 23.1.50.1 (i486-pc-linux-gnu, GTK+ Version 2.18.0)
 of 2009-09-27 on palmer, modified by Debian
 (emacs-snapshot package, version 1:20090909-1)
Windowing system distributor `The X.Org Foundation', version 11.0.10706000
configured using `configure  '--build' 'i486-linux-gnu' '--host'
'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib'
'--libexecdir=/usr/lib' '--localstatedir=/var'
'--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes'
'--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/23.1.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1.50/site-lisp:/usr/share/emacs/site-lisp'
'--with-x=yes' '--with-x-toolkit=gtk' 'build_alias=i486-linux-gnu'
'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN
-DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed'
'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.utf8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Info

Minor modes in effect:
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x b u g - r e p o <tab> C-g C-h i C-h r C-s b u g
C-s <return> <return> 2 C-v SPC M-x r e p o r t - e
m a c s - b u <tab> <return>

Recent messages:
uncompressing emacs-6.gz...done
uncompressing emacs-7.gz...done
uncompressing emacs-8.gz...done
Mark saved where search started
uncompressing emacs.gz...done
uncompressing emacs-6.gz...done
uncompressing emacs.gz...done
uncompressing emacs-6.gz...done
uncompressing emacs.gz...done
uncompressing emacs-6.gz...done

Load-path shadows:
/usr/share/emacs/23.1.50/site-lisp/debian-startup hides
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/site-lisp/rst hides /usr/share/emacs/23.1.50/lisp/textmodes/rst