[PATCH] ash: make bash_source command search current directory after PATH
Paul Otto
paul at ottoops.com
Mon Jan 29 15:42:38 UTC 2018
On Sun, Jan 28, 2018 at 10:43 PM, Mike Frysinger <vapier at gentoo.org> wrote:
> On 28 Jan 2018 19:17, Denys Vlasenko wrote:
> > On Fri, Jan 26, 2018 at 7:50 PM, Mike Frysinger wrote:
> > > On 26 Jan 2018 15:15, Denys Vlasenko wrote:
> > >> On Fri, Jan 26, 2018 at 9:34 AM, Paul Otto wrote:
> > >> > This patch restores, and improves upon, expected behavior to BASH
> > >> > compatibility which was lost beginning with 1.27.0. This was pulled
> into
> > >> > Alpine 3.7 which, in turn was pulled into official Docker images
> beginning
> > >> > with docker:17.12. As a result, a large number of CICD builds that
> use
> > >> > "source filename" have broken everywhere.
> > >> >
> > >> > According to the BASH documentation, the source command should:
> > >> > Read and execute commands from filename in the current shell
> environment
> > >> > and return the exit status of the last command executed from
> filename. If
> > >> > filename does not contain a slash, filenames in PATH are used to
> find the
> > >> > directory containing filename. The file searched for in PATH
> need not be
> > >> > executable. When bash is not in posix mode, the current
> directory is
> > >> > searched if no file is found in PATH.
> > >>
> > >> I wish bash wouldn't introduce gratuitous standard violations.
> > >
> > > bash is its own shell. why can't it introduce its own extensions as
> it sees
> > > fit ?
> >
> > Because a divergence is not a good thing, especially if it's gratuitous
>
> this position makes no sense. are you saying that no shell should be
> allowed
> to extend the syntax however it wants ? every shell out there should only
> be
> allowed to implement POSIX and nothing else ?
>
>
Based on my understanding of the history of these shells, BASH came up with
its syntax before the POSIX standard was ratified. So, while BASH came out
after sh, it came out *before* this "standard" was established that some
hold to so religiously.
> > Making bash "source" behavior non-standard had nothing useful in it.
>
> "source" is already non-standard and not specified in POSIX. so simply by
> using it, your script is not POSIX compliant.
That is why, incidentally, I wrote my proposed contribution the way I did
initially. In my view, while BASH treats "source" and "." the same, POSIX
doesn't allow for "source" so why not have "source" hold to the BASH
standard and "." hold to the POSIX standard? I definitely caved too quickly
on that point, and wound up with my contribution being swallowed up into a
patch that did the exact opposite of my intent. ¯\_(ツ)_/¯
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20180129/21ee9b1b/attachment.html>
More information about the busybox
mailing list