GNU bug report logs - #38057
(shell-command "alias" "bash-aliases" "bash-errors") - Shell command succeeded with no output

Previous Next

Package: emacs;

Reported by: arthur miller <arthur.miller <at> live.com>

Date: Mon, 4 Nov 2019 11:53:01 UTC

Severity: normal

Tags: notabug

Done: Stefan Kangas <stefan <at> marxist.se>

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 38057 in the body.
You can then email your comments to 38057 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#38057; Package emacs. (Mon, 04 Nov 2019 11:53:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to arthur miller <arthur.miller <at> live.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 04 Nov 2019 11:53:02 GMT) Full text and rfc822 format available.

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

From: arthur miller <arthur.miller <at> live.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: (shell-command "alias" "bash-aliases" "bash-errors") - Shell command
 succeeded with no output
Date: Mon, 4 Nov 2019 11:52:38 +0000
[Message part 1 (text/plain, inline)]
When I run 'alias' (a bash command) from within elisp I don't get list of aliases. It used to work fine, but in my latest build from git as of 2019-11-04 (4th november) it does not. Maybe it stopped to work earlier, I don't know, I was reworking my init file, so I didn't had it in for like a month or so, anyway, when I test it today I don't get the 'alias' command to work at all. It works from ansi-term, but not interactively or from an elisp script.

I get message that shell command succeeds without any output. The line (shell-command "alias" "bash-aliases" "bash-errors") is part of a little script I posted on Emacs Wiki earlier this year https://www.emacswiki.org/emacs/EshellAlias.

Is it a bug or do I something wrong? I am sorry, I am not an expert on Emacs, so I am a bit unsure.

Best regards
/a
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38057; Package emacs. (Mon, 04 Nov 2019 16:18:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: arthur miller <arthur.miller <at> live.com>
Cc: 38057 <at> debbugs.gnu.org
Subject: Re: bug#38057: (shell-command "alias" "bash-aliases" "bash-errors") -
 Shell command succeeded with no output
Date: Mon, 04 Nov 2019 18:17:58 +0200
> From: arthur miller <arthur.miller <at> live.com>
> Date: Mon, 4 Nov 2019 11:52:38 +0000
> 
> When I run 'alias' (a bash command) from within elisp I don't get list of aliases. It used to work fine, but in my
> latest build from git as of 2019-11-04 (4th november) it does not. Maybe it stopped to work earlier, I don't
> know, I was reworking my init file, so I didn't had it in for like a month or so, anyway, when I test it today I don't
> get the 'alias' command to work at all. It works from ansi-term, but not interactively or from an elisp script.
> 
> I get message that shell command succeeds without any output. The line (shell-command "alias"
> "bash-aliases" "bash-errors") is part of a little script I posted on Emacs Wiki earlier this year
> https://www.emacswiki.org/emacs/EshellAlias.
> 
> Is it a bug or do I something wrong? I am sorry, I am not an expert on Emacs, so I am a bit unsure.

Does the following discussion help to understand the issue?

  https://stackoverflow.com/questions/1615877/why-aliases-in-a-non-interactive-bash-shell-do-not-work




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38057; Package emacs. (Thu, 07 Nov 2019 03:39:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 38057 <at> debbugs.gnu.org, arthur miller <arthur.miller <at> live.com>
Subject: Re: bug#38057: (shell-command "alias" "bash-aliases" "bash-errors")
 - Shell command succeeded with no output
Date: Thu, 07 Nov 2019 04:37:59 +0100
tags 38057 + notabug
close 38057
thanks

Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: arthur miller <arthur.miller <at> live.com>
>> Date: Mon, 4 Nov 2019 11:52:38 +0000
>> 
>> When I run 'alias' (a bash command) from within elisp I don't get list of aliases. It used to work fine, but in my
>> latest build from git as of 2019-11-04 (4th november) it does not. Maybe it stopped to work earlier, I don't
>> know, I was reworking my init file, so I didn't had it in for like a month or so, anyway, when I test it today I don't
>> get the 'alias' command to work at all. It works from ansi-term, but not interactively or from an elisp script.
>> 
>> I get message that shell command succeeds without any output. The line (shell-command "alias"
>> "bash-aliases" "bash-errors") is part of a little script I posted on Emacs Wiki earlier this year
>> https://www.emacswiki.org/emacs/EshellAlias.
>> 
>> Is it a bug or do I something wrong? I am sorry, I am not an expert on Emacs, so I am a bit unsure.
>
> Does the following discussion help to understand the issue?
>
>   https://stackoverflow.com/questions/1615877/why-aliases-in-a-non-interactive-bash-shell-do-not-work

The above link makes the situation clear: your .bashrc is not
processed by non-interactive shells.  I don't see how this could have
worked earlier or how it could work now.

One work-around, if you really need this, would be to put the relevant
aliases in a new file, say "~/.bash_aliases", and then running:

    (setenv "BASH_ENV" "~/.bash_aliases")
    (shell-command "alias")

This utilizes the fact that the file pointed to by the BASH_ENV
environment variable will always be sourced.  But be aware that this
may cause problems, depending on the contents of your
"~/.bash_aliases" file.  For more information on this, see the bash
man page section "INVOCATION".

In other words, this is all working as expected, and I'm closing this
as notabug.

Best regards,
Stefan Kangas




Added tag(s) notabug. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Thu, 07 Nov 2019 03:39:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 38057 <at> debbugs.gnu.org and arthur miller <arthur.miller <at> live.com> Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Thu, 07 Nov 2019 03:39:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38057; Package emacs. (Fri, 08 Nov 2019 08:57:01 GMT) Full text and rfc822 format available.

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

From: arthur miller <arthur.miller <at> live.com>
To: Stefan Kangas <stefan <at> marxist.se>, Eli Zaretskii <eliz <at> gnu.org>
Cc: "38057 <at> debbugs.gnu.org" <38057 <at> debbugs.gnu.org>
Subject: Sv: bug#38057: (shell-command "alias" "bash-aliases" "bash-errors") -
 Shell command succeeded with no output
Date: Fri, 8 Nov 2019 08:55:52 +0000
[Message part 1 (text/plain, inline)]
THanks for answers. I have looked at SX-article, and I do understand that bashr is not sourced in non-interactive shells since before, however,
I do have my Shell command set to use ”-ic” flags. It also used to work earlier; when I wrote that function and posted on wiki, with same Shell flags.

I don’t know how or why it worked earlier if it shouldn’t work though 😊. Even more confusing, it works fine on MS Windows (msys2 distro of *nix Tools),
Without even using ”-ic” flag. I use same bashrc as I do under my GNU/Linux, but I attribute that to (probable) msys2 quirks.

*nix gods are not smiling at me?

Skickades från E-post<https://go.microsoft.com/fwlink/?LinkId=550986> för Windows 10

________________________________
Från: Stefan Kangas <stefan <at> marxist.se>
Skickat: Thursday, November 7, 2019 4:37:59 AM
Till: Eli Zaretskii <eliz <at> gnu.org>
Kopia: arthur miller <arthur.miller <at> live.com>; 38057 <at> debbugs.gnu.org <38057 <at> debbugs.gnu.org>
Ämne: Re: bug#38057: (shell-command "alias" "bash-aliases" "bash-errors") - Shell command succeeded with no output

tags 38057 + notabug
close 38057
thanks

Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: arthur miller <arthur.miller <at> live.com>
>> Date: Mon, 4 Nov 2019 11:52:38 +0000
>>
>> When I run 'alias' (a bash command) from within elisp I don't get list of aliases. It used to work fine, but in my
>> latest build from git as of 2019-11-04 (4th november) it does not. Maybe it stopped to work earlier, I don't
>> know, I was reworking my init file, so I didn't had it in for like a month or so, anyway, when I test it today I don't
>> get the 'alias' command to work at all. It works from ansi-term, but not interactively or from an elisp script.
>>
>> I get message that shell command succeeds without any output. The line (shell-command "alias"
>> "bash-aliases" "bash-errors") is part of a little script I posted on Emacs Wiki earlier this year
>> https://www.emacswiki.org/emacs/EshellAlias.
>>
>> Is it a bug or do I something wrong? I am sorry, I am not an expert on Emacs, so I am a bit unsure.
>
> Does the following discussion help to understand the issue?
>
>   https://stackoverflow.com/questions/1615877/why-aliases-in-a-non-interactive-bash-shell-do-not-work

The above link makes the situation clear: your .bashrc is not
processed by non-interactive shells.  I don't see how this could have
worked earlier or how it could work now.

One work-around, if you really need this, would be to put the relevant
aliases in a new file, say "~/.bash_aliases", and then running:

    (setenv "BASH_ENV" "~/.bash_aliases")
    (shell-command "alias")

This utilizes the fact that the file pointed to by the BASH_ENV
environment variable will always be sourced.  But be aware that this
may cause problems, depending on the contents of your
"~/.bash_aliases" file.  For more information on this, see the bash
man page section "INVOCATION".

In other words, this is all working as expected, and I'm closing this
as notabug.

Best regards,
Stefan Kangas
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38057; Package emacs. (Fri, 08 Nov 2019 12:27:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: arthur miller <arthur.miller <at> live.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>,
 "38057 <at> debbugs.gnu.org" <38057 <at> debbugs.gnu.org>
Subject: Re: bug#38057: Sv: bug#38057: (shell-command "alias" "bash-aliases"
 "bash-errors") - Shell command succeeded with no output
Date: Fri, 08 Nov 2019 13:26:21 +0100
arthur miller <arthur.miller <at> live.com> writes:

> THanks for answers. I have looked at SX-article, and I do understand
> that bashr is not sourced in non-interactive shells since before,
> however, I do have my Shell command set to use ”-ic” flags. It also
> used to work earlier; when I wrote that function and posted on wiki,
> with same Shell flags.

Are you saying that you set the variable shell-command-switch to
"-ic"?

When I try setting that, `M-x shell-command RET alias RET' gives me
my full list of aliases.

I'm not sure why you're seeing this, but it sounds like there may be
some other variable at play here.  Are you seeing the same behaviour
when running under emacs -Q?

> I don’t know how or why it worked earlier if it shouldn’t work
> though 😊. Even more confusing, it works fine on MS Windows (msys2
> distro of *nix Tools),
>
> Without even using ”-ic” flag. I use same bashrc as I do under my
> GNU/Linux, but I attribute that to (probable) msys2 quirks.

Yes, that sounds strange.

Best regards,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38057; Package emacs. (Fri, 08 Nov 2019 13:20:01 GMT) Full text and rfc822 format available.

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

From: arthur miller <arthur.miller <at> live.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: Eli Zaretskii <eliz <at> gnu.org>,
 "38057 <at> debbugs.gnu.org" <38057 <at> debbugs.gnu.org>
Subject: Sv: bug#38057: Sv: bug#38057: (shell-command "alias" "bash-aliases"
 "bash-errors") - Shell command succeeded with no output
Date: Fri, 8 Nov 2019 13:19:12 +0000
[Message part 1 (text/plain, inline)]
Yes, I do use '-ic' switch (which gives me error message about ioctl control, but I can live with that 🙂).

I have rebuilt Emacs today and it works fine. Same code, without change in setup. I can't explain why.

Anyway, thanks for the help.
/a

________________________________
Från: Stefan Kangas <stefan <at> marxist.se>
Skickat: den 8 november 2019 13:26
Till: arthur miller <arthur.miller <at> live.com>
Kopia: Eli Zaretskii <eliz <at> gnu.org>; 38057 <at> debbugs.gnu.org <38057 <at> debbugs.gnu.org>
Ämne: Re: bug#38057: Sv: bug#38057: (shell-command "alias" "bash-aliases" "bash-errors") - Shell command succeeded with no output

arthur miller <arthur.miller <at> live.com> writes:

> THanks for answers. I have looked at SX-article, and I do understand
> that bashr is not sourced in non-interactive shells since before,
> however, I do have my Shell command set to use ”-ic” flags. It also
> used to work earlier; when I wrote that function and posted on wiki,
> with same Shell flags.

Are you saying that you set the variable shell-command-switch to
"-ic"?

When I try setting that, `M-x shell-command RET alias RET' gives me
my full list of aliases.

I'm not sure why you're seeing this, but it sounds like there may be
some other variable at play here.  Are you seeing the same behaviour
when running under emacs -Q?

> I don’t know how or why it worked earlier if it shouldn’t work
> though 😊. Even more confusing, it works fine on MS Windows (msys2
> distro of *nix Tools),
>
> Without even using ”-ic” flag. I use same bashrc as I do under my
> GNU/Linux, but I attribute that to (probable) msys2 quirks.

Yes, that sounds strange.

Best regards,
Stefan Kangas
[Message part 2 (text/html, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 07 Dec 2019 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 279 days ago.

Previous Next


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