unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#22203: 25.0.50; # is treated as a comment character in shell-command arg
@ 2015-12-18 16:25 Kaushal Modi
  2015-12-18 17:39 ` Glenn Morris
  2015-12-18 19:11 ` Wolfgang Jenkner
  0 siblings, 2 replies; 9+ messages in thread
From: Kaushal Modi @ 2015-12-18 16:25 UTC (permalink / raw)
  To: 22203

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@gmail.com>
Commit: Juanma Barranquero <lekktu@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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#22203: 25.0.50; # is treated as a comment character in shell-command arg
  2015-12-18 16:25 bug#22203: 25.0.50; # is treated as a comment character in shell-command arg Kaushal Modi
@ 2015-12-18 17:39 ` Glenn Morris
  2015-12-18 18:34   ` Kaushal Modi
  2015-12-18 19:11 ` Wolfgang Jenkner
  1 sibling, 1 reply; 9+ messages in thread
From: Glenn Morris @ 2015-12-18 17:39 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: 22203

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.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#22203: 25.0.50; # is treated as a comment character in shell-command arg
  2015-12-18 17:39 ` Glenn Morris
@ 2015-12-18 18:34   ` Kaushal Modi
  0 siblings, 0 replies; 9+ messages in thread
From: Kaushal Modi @ 2015-12-18 18:34 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 22203

> 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@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix a typo in the Emacs manual

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

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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#22203: 25.0.50; # is treated as a comment character in shell-command arg
  2015-12-18 16:25 bug#22203: 25.0.50; # is treated as a comment character in shell-command arg Kaushal Modi
  2015-12-18 17:39 ` Glenn Morris
@ 2015-12-18 19:11 ` Wolfgang Jenkner
  2015-12-18 19:30   ` Kaushal Modi
  1 sibling, 1 reply; 9+ messages in thread
From: Wolfgang Jenkner @ 2015-12-18 19:11 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: 22203

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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#22203: 25.0.50; # is treated as a comment character in shell-command arg
  2015-12-18 19:11 ` Wolfgang Jenkner
@ 2015-12-18 19:30   ` Kaushal Modi
  2015-12-18 19:49     ` Kaushal Modi
  2015-12-18 19:53     ` Wolfgang Jenkner
  0 siblings, 2 replies; 9+ messages in thread
From: Kaushal Modi @ 2015-12-18 19:30 UTC (permalink / raw)
  To: Wolfgang Jenkner; +Cc: 22203

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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#22203: 25.0.50; # is treated as a comment character in shell-command arg
  2015-12-18 19:30   ` Kaushal Modi
@ 2015-12-18 19:49     ` Kaushal Modi
  2015-12-18 19:53     ` Wolfgang Jenkner
  1 sibling, 0 replies; 9+ messages in thread
From: Kaushal Modi @ 2015-12-18 19:49 UTC (permalink / raw)
  To: 22203-done, Glenn Morris; +Cc: Wolfgang Jenkner

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.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#22203: 25.0.50; # is treated as a comment character in shell-command arg
  2015-12-18 19:30   ` Kaushal Modi
  2015-12-18 19:49     ` Kaushal Modi
@ 2015-12-18 19:53     ` Wolfgang Jenkner
  2015-12-18 19:59       ` Kaushal Modi
  1 sibling, 1 reply; 9+ messages in thread
From: Wolfgang Jenkner @ 2015-12-18 19:53 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: 22203

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?





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#22203: 25.0.50; # is treated as a comment character in shell-command arg
  2015-12-18 19:53     ` Wolfgang Jenkner
@ 2015-12-18 19:59       ` Kaushal Modi
  2015-12-19 14:09         ` Wolfgang Jenkner
  0 siblings, 1 reply; 9+ messages in thread
From: Kaushal Modi @ 2015-12-18 19:59 UTC (permalink / raw)
  To: Wolfgang Jenkner; +Cc: 22203

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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#22203: 25.0.50; # is treated as a comment character in shell-command arg
  2015-12-18 19:59       ` Kaushal Modi
@ 2015-12-19 14:09         ` Wolfgang Jenkner
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Jenkner @ 2015-12-19 14:09 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: 22203

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?





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-12-19 14:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-18 16:25 bug#22203: 25.0.50; # is treated as a comment character in shell-command arg Kaushal Modi
2015-12-18 17:39 ` Glenn Morris
2015-12-18 18:34   ` Kaushal Modi
2015-12-18 19:11 ` Wolfgang Jenkner
2015-12-18 19:30   ` Kaushal Modi
2015-12-18 19:49     ` Kaushal Modi
2015-12-18 19:53     ` Wolfgang Jenkner
2015-12-18 19:59       ` Kaushal Modi
2015-12-19 14:09         ` Wolfgang Jenkner

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).