Web lists-archives.com

Re: alias in maintainer scripts?

[2018-03-01 22:54] Ralf Treinen <treinen@xxxxxxx>
> should we really allow for the usage of alias in maintainer scripts? 
> Policy 10.4 says that /bin/sh scripts may assume an interpreter
> that implements the POSIX standard, plus some additional features
> listed in the policy. And the POSIX standards describes alias
> substitution in shell scripts [1], so it seems we currently do
> allow for it.
> However, /bin/sh may be linked to bash, and bash does alias substitution
> only when in interactive mode but not in batch mode [2]. That is, unless
> a special bash option is set.
> Hence, maintainer scripts relying on alias substitution will not work
> correctly when /bin/sh is bash. 

Is it true? When invoked as /bin/sh, GNU Bash works in Posix-emulation
mode, and it is not that bad:

	$ cat foo.sh
	alias ls='echo foo'
	$ /bin/dash foo.sh
	$ /bin/bash foo.sh
	[.. other junk in my /tmp ..]
	$ chpst -b /bin/sh bash foo.sh