GNU bug report logs - #22203
25.0.50; # is treated as a comment character in shell-command arg

Previous Next

Package: emacs;

Reported by: Kaushal Modi <kaushal.modi <at> gmail.com>

Date: Fri, 18 Dec 2015 16:27:01 UTC

Severity: normal

Found in version 25.0.50

Done: Kaushal Modi <kaushal.modi <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22203 in the body.
You can then email your comments to 22203 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#22203; Package emacs. (Fri, 18 Dec 2015 16:27:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kaushal Modi <kaushal.modi <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 18 Dec 2015 16:27:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kaushal Modi <kaushal.modi <at> gmail.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 25.0.50; # is treated as a comment character in shell-command arg
Date: Fri, 18 Dec 2015 11:25:07 -0500
Hi,

I need to run shell-command that has a hash character (#) in it.

Here's is a trivialized example of what I need to do

(shell-command "echo abc#def" "*abc*")

The above works in a terminal and also in the below build from master branch:

Build date        : 2015/11/12 12:45 Thu
Savannah Git link :
http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=9dd7da9945c16aa343080a535ed74eeecf769fd1

commit 9dd7da9945c16aa343080a535ed74eeecf769fd1
Author: Juanma Barranquero <lekktu <at> gmail.com>
Commit: Juanma Barranquero <lekktu <at> gmail.com>

    * test/automated/keymap-tests.el: New test file

I get the output "abc#def" in both the cases.

But when I do the same in an emacs -Q session on the latest emacs
build on emacs-25 branch, the # is treated as a "comment char" and
everything after the # is not passed to the shell.

So

(shell-command "echo abc#def" "*abc*")

is treated as

(shell-command "echo abc" "*abc*")

I searched the log messages for "shell-command" here:
http://git.savannah.gnu.org/cgit/emacs.git/log/?h=emacs-25 but I did
not find a commit that could have caused this change.

Is this change intentional? If so, how do I pass "#" to the shell
using shell-command?

Thanks!


In GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23)
 of 2015-12-17
Repository revision: ecce24b34ba51f10d2a729bf5496a1cbec0bf329
Windowing system distributor 'The X.Org Foundation', version 11.0.60900000
System Description: Red Hat Enterprise Linux Workstation release 6.6 (Santiago)

Configured using:
 'configure --prefix=/home/kmodi/usr_local/apps/6/emacs/emacs-25
 'CPPFLAGS=-fgnu89-inline -I/home/kmodi/usr_local/6/include
 -I/usr/include/freetype2 -I/usr/include' 'CFLAGS=-ggdb3 -O0'
 'CXXFLAGS=-ggdb3 -O0' 'LDFLAGS=-L/home/kmodi/usr_local/6/lib
 -L/home/kmodi/usr_local/6/lib64 -ggdb3''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

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

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message dired format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util help-fns help-mode easymenu cl-loaddefs pcase cl-lib mail-prsvr
mail-utils time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese charscript
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 82254 6037)
 (symbols 48 19481 0)
 (miscs 40 48 136)
 (strings 32 12980 4411)
 (string-bytes 1 391078)
 (vectors 16 11502)
 (vector-slots 8 429541 5229)
 (floats 8 143 131)
 (intervals 56 232 16)
 (buffers 976 13)
 (heap 1024 30926 755))


--
Kaushal Modi




Added indication that bug 22203 blocks19759 Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 18 Dec 2015 16:44:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22203; Package emacs. (Fri, 18 Dec 2015 17:40:02 GMT) Full text and rfc822 format available.

Message #10 received at 22203 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Kaushal Modi <kaushal.modi <at> gmail.com>
Cc: 22203 <at> debbugs.gnu.org
Subject: Re: bug#22203: 25.0.50;
 # is treated as a comment character in shell-command arg
Date: Fri, 18 Dec 2015 12:39:34 -0500
Kaushal Modi wrote:

> But when I do the same in an emacs -Q session on the latest emacs
> build on emacs-25 branch, the # is treated as a "comment char" and
> everything after the # is not passed to the shell.

I can't reproduce this.
On the face of it, it seems unlikely to me that master and emacs-25
would have diverged in this area.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22203; Package emacs. (Fri, 18 Dec 2015 18:36:02 GMT) Full text and rfc822 format available.

Message #13 received at 22203 <at> debbugs.gnu.org (full text, mbox):

From: Kaushal Modi <kaushal.modi <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 22203 <at> debbugs.gnu.org
Subject: Re: bug#22203: 25.0.50; # is treated as a comment character in
 shell-command arg
Date: Fri, 18 Dec 2015 13:34:56 -0500
> I can't reproduce this.

That's odd. But in any case here is a gif of that in action.
This is on the following build of emacs-25 branch in an emacs -Q session,

Build date        : 2015/12/17 18:57 Thu
Savannah Git link :
http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=ecce24b34ba51f10d2a729bf5496a1cbec0bf329

commit ecce24b34ba51f10d2a729bf5496a1cbec0bf329
Author: Eli Zaretskii <eliz <at> gnu.org>
Commit: Eli Zaretskii <eliz <at> gnu.org>

    Fix a typo in the Emacs manual

    * doc/emacs/trouble.texi (Sending Patches): Fix a typo.  Reported
    by Lele Gaifax <lele <at> metapensiero.it>.  (Bug#22193)

GIF: http://i.imgur.com/Jyskbmv.gifv




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22203; Package emacs. (Fri, 18 Dec 2015 19:14:02 GMT) Full text and rfc822 format available.

Message #16 received at 22203 <at> debbugs.gnu.org (full text, mbox):

From: Wolfgang Jenkner <wjenkner <at> inode.at>
To: Kaushal Modi <kaushal.modi <at> gmail.com>
Cc: 22203 <at> debbugs.gnu.org
Subject: Re: bug#22203: 25.0.50;
 # is treated as a comment character in shell-command arg
Date: Fri, 18 Dec 2015 20:11:52 +0100
On Fri, Dec 18 2015, Kaushal Modi wrote:

> (shell-command "echo abc#def" "*abc*")
>
> is treated as
>
> (shell-command "echo abc" "*abc*")

The last stop in the call chain before entering C-land is
`call-process-region'.  It might be interesting to see what arguments
that function is passed (M-x trace-function).

Wolfgang




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22203; Package emacs. (Fri, 18 Dec 2015 19:31:02 GMT) Full text and rfc822 format available.

Message #19 received at 22203 <at> debbugs.gnu.org (full text, mbox):

From: Kaushal Modi <kaushal.modi <at> gmail.com>
To: Wolfgang Jenkner <wjenkner <at> inode.at>
Cc: 22203 <at> debbugs.gnu.org
Subject: Re: bug#22203: 25.0.50; # is treated as a comment character in
 shell-command arg
Date: Fri, 18 Dec 2015 14:30:14 -0500
Hi Wolfgang,

> The last stop in the call chain before entering C-land is
> `call-process-region'.  It might be interesting to see what arguments
> that function is passed (M-x trace-function).

I get this by doing trace-function on call-process-region.

It looks like the arguments are passed alright .. but the result
buffer *test* shows just "abc" (without quotes) as in the GIF I posted
in my previous email.

======================================================================
1 -> (call-process-region 18234 18234 "/bin/tcsh" nil #<buffer *test*>
nil "-c" "echo abc#def")
1 <- call-process-region: 0




Reply sent to Kaushal Modi <kaushal.modi <at> gmail.com>:
You have taken responsibility. (Fri, 18 Dec 2015 19:51:01 GMT) Full text and rfc822 format available.

Notification sent to Kaushal Modi <kaushal.modi <at> gmail.com>:
bug acknowledged by developer. (Fri, 18 Dec 2015 19:51:02 GMT) Full text and rfc822 format available.

Message #24 received at 22203-done <at> debbugs.gnu.org (full text, mbox):

From: Kaushal Modi <kaushal.modi <at> gmail.com>
To: 22203-done <at> debbugs.gnu.org, Glenn Morris <rgm <at> gnu.org>
Cc: Wolfgang Jenkner <wjenkner <at> inode.at>
Subject: Re: bug#22203: 25.0.50; # is treated as a comment character in
 shell-command arg
Date: Fri, 18 Dec 2015 14:49:26 -0500
I am closing this issue.

After further testing.. it turns out that this issue doesn't have to
do anything with emacs.

Here's what happened:

I was running the separate instances of emacs (master branch version
and emacs-25 branch version) from different terminals.
In the terminal where I was running the master branch version (working
case) I was on HOST (env var) X.
In the terminal where I was running the emacs-25 branch version
(non-working case) I was on the same HOST but had to ssh into the same
host X as a hack to fix some group permission issues (at work). That
seemed to mess up the shell-command execution. After I exit from that
ssh session and restarted emacs, this issue was gone, even on
emacs-25.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22203; Package emacs. (Fri, 18 Dec 2015 19:55:02 GMT) Full text and rfc822 format available.

Message #27 received at 22203 <at> debbugs.gnu.org (full text, mbox):

From: Wolfgang Jenkner <wjenkner <at> inode.at>
To: Kaushal Modi <kaushal.modi <at> gmail.com>
Cc: 22203 <at> debbugs.gnu.org
Subject: Re: bug#22203: 25.0.50;
 # is treated as a comment character in shell-command arg
Date: Fri, 18 Dec 2015 20:53:37 +0100
On Fri, Dec 18 2015, Kaushal Modi wrote:

> It looks like the arguments are passed alright .. but the result
> buffer *test* shows just "abc" (without quotes) as in the GIF I posted
> in my previous email.
>
> ======================================================================
> 1 -> (call-process-region 18234 18234 "/bin/tcsh" nil #<buffer *test*>
> nil "-c" "echo abc#def")
> 1 <- call-process-region: 0

Yes, I can reproduce this with

(call-process-region (point-min) (point-min) "/bin/tcsh" nil "*test*" nil "-c" "echo abc#def")

However, using sh or bash instead of tcsh works (tcsh -c 'echo abc#def'
works on the command line, though).

So, perhaps, for some reason, emacs 25 and trunk use different shells on
your system?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22203; Package emacs. (Fri, 18 Dec 2015 20:01:01 GMT) Full text and rfc822 format available.

Message #30 received at 22203 <at> debbugs.gnu.org (full text, mbox):

From: Kaushal Modi <kaushal.modi <at> gmail.com>
To: Wolfgang Jenkner <wjenkner <at> inode.at>
Cc: 22203 <at> debbugs.gnu.org
Subject: Re: bug#22203: 25.0.50; # is treated as a comment character in
 shell-command arg
Date: Fri, 18 Dec 2015 14:59:39 -0500
> So, perhaps, for some reason, emacs 25 and trunk use different shells on
> your system?

That was almost the case.. the shells weren't different though. The
shell was the same: tcsh.

(shell-command "echo abc#def" "*test*")

If I run the above shell-command in an emacs started as below,
everything is good; I see "abc#def" printed in the *test* buffer.

HOST> emacs -Q&

But if I run the SAME shell-command in an emacs started as below, I
see only "abc" printed in the *test* buffer.

HOST> ssh HOST
HOST> emacs -Q&

This is the regardless of the emacs version. I incorrectly thought
earlier that it had to do with emacs-25 branch version vs the master
branch version.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22203; Package emacs. (Sat, 19 Dec 2015 14:10:01 GMT) Full text and rfc822 format available.

Message #33 received at 22203 <at> debbugs.gnu.org (full text, mbox):

From: Wolfgang Jenkner <wjenkner <at> inode.at>
To: Kaushal Modi <kaushal.modi <at> gmail.com>
Cc: 22203 <at> debbugs.gnu.org
Subject: Re: bug#22203: 25.0.50;
 # is treated as a comment character in shell-command arg
Date: Sat, 19 Dec 2015 15:09:18 +0100
On Fri, Dec 18 2015, Kaushal Modi wrote:

> HOST> emacs -Q&
>
> But if I run the SAME shell-command in an emacs started as below, I
> see only "abc" printed in the *test* buffer.
>
> HOST> ssh HOST
> HOST> emacs -Q&

What happens if you repeat this, but, instead of `emacs -Q&', run

echo $SHELL; ps -fp $$

before and after logging in via ssh?




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 17 Jan 2016 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 158 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.