all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#38057: (shell-command "alias" "bash-aliases" "bash-errors") - Shell command succeeded with no output
@ 2019-11-04 11:52 arthur miller
  2019-11-04 16:17 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: arthur miller @ 2019-11-04 11:52 UTC (permalink / raw)
  To: 38057

[-- Attachment #1: Type: text/plain, Size: 819 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1643 bytes --]

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

* bug#38057: (shell-command "alias" "bash-aliases" "bash-errors") - Shell command succeeded with no output
  2019-11-04 11:52 bug#38057: (shell-command "alias" "bash-aliases" "bash-errors") - Shell command succeeded with no output arthur miller
@ 2019-11-04 16:17 ` Eli Zaretskii
  2019-11-07  3:37   ` Stefan Kangas
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2019-11-04 16:17 UTC (permalink / raw)
  To: arthur miller; +Cc: 38057

> From: arthur miller <arthur.miller@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





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

* bug#38057: (shell-command "alias" "bash-aliases" "bash-errors") - Shell command succeeded with no output
  2019-11-04 16:17 ` Eli Zaretskii
@ 2019-11-07  3:37   ` Stefan Kangas
  2019-11-08  8:55     ` bug#38057: Sv: " arthur miller
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Kangas @ 2019-11-07  3:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 38057, arthur miller

tags 38057 + notabug
close 38057
thanks

Eli Zaretskii <eliz@gnu.org> writes:

>> From: arthur miller <arthur.miller@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





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

* bug#38057: Sv: bug#38057: (shell-command "alias" "bash-aliases" "bash-errors") - Shell command succeeded with no output
  2019-11-07  3:37   ` Stefan Kangas
@ 2019-11-08  8:55     ` arthur miller
  2019-11-08 12:26       ` Stefan Kangas
  0 siblings, 1 reply; 6+ messages in thread
From: arthur miller @ 2019-11-08  8:55 UTC (permalink / raw)
  To: Stefan Kangas, Eli Zaretskii; +Cc: 38057@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 3082 bytes --]

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@marxist.se>
Skickat: Thursday, November 7, 2019 4:37:59 AM
Till: Eli Zaretskii <eliz@gnu.org>
Kopia: arthur miller <arthur.miller@live.com>; 38057@debbugs.gnu.org <38057@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@gnu.org> writes:

>> From: arthur miller <arthur.miller@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

[-- Attachment #2: Type: text/html, Size: 5456 bytes --]

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

* bug#38057: Sv: bug#38057: (shell-command "alias" "bash-aliases" "bash-errors") - Shell command succeeded with no output
  2019-11-08  8:55     ` bug#38057: Sv: " arthur miller
@ 2019-11-08 12:26       ` Stefan Kangas
  2019-11-08 13:19         ` bug#38057: Sv: " arthur miller
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Kangas @ 2019-11-08 12:26 UTC (permalink / raw)
  To: arthur miller; +Cc: 38057@debbugs.gnu.org

arthur miller <arthur.miller@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





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

* bug#38057: Sv: bug#38057: Sv: bug#38057: (shell-command "alias" "bash-aliases" "bash-errors") - Shell command succeeded with no output
  2019-11-08 12:26       ` Stefan Kangas
@ 2019-11-08 13:19         ` arthur miller
  0 siblings, 0 replies; 6+ messages in thread
From: arthur miller @ 2019-11-08 13:19 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 38057@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 1710 bytes --]

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@marxist.se>
Skickat: den 8 november 2019 13:26
Till: arthur miller <arthur.miller@live.com>
Kopia: Eli Zaretskii <eliz@gnu.org>; 38057@debbugs.gnu.org <38057@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@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

[-- Attachment #2: Type: text/html, Size: 2896 bytes --]

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

end of thread, other threads:[~2019-11-08 13:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-04 11:52 bug#38057: (shell-command "alias" "bash-aliases" "bash-errors") - Shell command succeeded with no output arthur miller
2019-11-04 16:17 ` Eli Zaretskii
2019-11-07  3:37   ` Stefan Kangas
2019-11-08  8:55     ` bug#38057: Sv: " arthur miller
2019-11-08 12:26       ` Stefan Kangas
2019-11-08 13:19         ` bug#38057: Sv: " arthur miller

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.