Bug#1053394: dash should not propagate aliases to subshells

2023-10-03 Thread Lawrence Velázquez
On Tue, Oct 3, 2023, at 5:54 AM, Дилян Палаузов wrote:
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_03_01
>  
> says:
>
> 2.3.1 Alias Substitution
>
> When used as specified by this volume of POSIX.1-2017, alias definitions 
> shall not be inherited by separate invocations of the shell or by the 
> utility execution environments invoked by the shell.
>
>
> So a subshell shall have no knowledge about the aliases from the 
> supershell

You are mistaken; subshells are not "separate invocations".  See
section 2.12:

A subshell environment shall be created as a duplicate of
the shell environment, except that signal traps that are
not being ignored shall be set to the default action.

> These programs
>
> #!/bin/bash
> alias wslpath=echo
> find `wslpath /tmp`
>
> and
>
> #!/bin/dash
> alias wslpath=echo
> find `wslpath /tmp`
>
> produce different results (bash 5.2.15-3.fc38,  dash 0.5.12-1.fc38) when 
> executed on a WSL2 system.  The former program shows the content of the 
> current directory, the latter program shows the content of /tmp .

That is because aliases are not expanded at all in noninteractive
bash "native mode" shells.  If you were to run bash as "sh" or with
its "--posix" option, then you would see the same behavior as with
dash.

-- 
vq



Bug#1053394: dash should not propagate aliases to subshells

2023-10-03 Thread Дилян Палаузов

To: 1053...@bugs.debian.org, d...@vger.kernel.org

Hello,

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_03_01 
says:


2.3.1 Alias Substitution

When used as specified by this volume of POSIX.1-2017, alias definitions 
shall not be inherited by separate invocations of the shell or by the 
utility execution environments invoked by the shell.



So a subshell shall have no knowledge about the aliases from the 
supershell, and backticks start a subshell.


These programs

#!/bin/bash
alias wslpath=echo
find `wslpath /tmp`

and

#!/bin/dash
alias wslpath=echo
find `wslpath /tmp`

produce different results (bash 5.2.15-3.fc38,  dash 0.5.12-1.fc38) when 
executed on a WSL2 system.  The former program shows the content of the 
current directory, the latter program shows the content of /tmp .


Moreover, I filled this initially towards the Debian Bug tracking system 
(cf. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1053394) , and 
was then told to check http://gondor.apana.org.au/~herbert/dash/ .


Please include in the repository 
https://git.kernel.org/pub/scm/utils/dash/dash.git links to 
http://gondor.apana.org.au/~herbert/dash/ and d...@vger.kernel.org , for 
instance in src/dash.1, so that it is documented where to report 
problems in dash.


Kind regards
  Dilyan



Bug#1053394: dash should not propagate aliases to subshells

2023-10-03 Thread Andrej Shadura
Control: tag -1 upstream

Hello,

On Tue, 3 Oct 2023, at 10:53, Дилян Палаузов wrote:
> I use actually dash on Fedora version 0.5.12-1.fc38, but the only way to 
> report bugs towards dash seems to be the Debian bug tracker system.

You can report bugs directly to the dash upstream developer at 
d...@vger.kernel.org as described here: 
http://gondor.apana.org.au/~herbert/dash/

If would be great if you submitted this issue to them.

Thanks!

-- 
Cheers,
  Andrej



Bug#1053394: dash should not propagate aliases to subshells

2023-10-03 Thread Дилян Палаузов

Package: dash
Version: 0.5.12-6

Hello,

I use actually dash on Fedora version 0.5.12-1.fc38, but the only way to 
report bugs towards dash seems to be the Debian bug tracker system.


https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_03_01 
says:


2.3.1 Alias Substitution

When used as specified by this volume of POSIX.1-2017, alias definitions 
shall not be inherited by separate invocations of the shell or by the 
utility execution environments invoked by the shell.



So a subshell shall have no knowledge about the aliases from the 
supershell, and backticks start a subshell.


These programs

#!/bin/bash
alias wslpath=echo
find `wslpath /tmp`


and

#!/bin/dash
alias wslpath=echo
find `wslpath /tmp`

produce different results (bash 5.2.15-3.fc38) when executed on a WSL2 
system.  The former program shows the content of the current directory, 
the latter program shows the content of /tmp .


Kind regards
  Dilyan