[geos-devel] [GEOS] #1015: Update geos-config tool for consistency
Paul Ramsey
pramsey at cleverelephant.ca
Tue Feb 18 09:27:12 PST 2020
> On Feb 18, 2020, at 6:11 AM, Greg Troxel <gdt at lexort.com> wrote:
>
> Mike Taves <mwtoews at gmail.com> writes:
>
>> On Tue, 18 Feb 2020 at 13:20, Greg Troxel <gdt at lexort.com> wrote:
>>> "GEOS" <geos-trac at osgeo.org> writes:
>>>> **Specify bash, and use printf to escape paths (if needed)**
>>>>
>>>> This allows installation with CMake to other directories, such as `/opt/my
>>>> prefix`, since `geos-config --prefix` would return `/opt/my\ prefix`. Also
>>>> `printf` is a bash-only feature.
>>>
>>> It really seems like a regression to require bash, rather than POSIX
>>> shell, and it's definitely a regression if the build doesn't find bash
>>> and substitute in the path.
>>>
>>> Is this really necessary?
>>
>> As noted above, the printf function is built-in with Bash, and can
>> properly escape a path. While I see there is also /usr/bin/printf I'm
>> not sure how common or standard this tool is (my tests with /bin/sh
>> didn't go well, so I opted to switch to Bash for reliability).
>
> First, to me requiring bash is worse than telling people not to do
> ridiculous things like putting spaces in pathnames :-) But I realize
> other people think spaces in pathnames is an ok thing.
>
> The right question about tools is not what's typically on Linux but what
> POSIX requires.
>
> In searching for the POSIX printf spec, I found this post about escaping
> spaces in a portable manner.
>
> https://stackoverflow.com/questions/12162010/posix-sh-equivalent-for-bash-s-printf-q
>
> The specs at opengroup.org seem hard to deal with today - not sure if
> they changed - but I found this POSIX printf description:
>
> https://www.unix.com/man-page/POSIX/1posix/printf/
>
>> Currently, other Bash scripts are present in tools/chi/ but these are
>> not installed with GEOS.
>
> chi tools are quite a different story than a requirement for regular
> installs, although I see using bash there (vs /bin/sh) as a bug also.
>
>> Besides Native Windows, what OSes (that GEOS is used on) does not have
>> Bash available? As far as I know, it's available on most Linux
>> distributions, all recent Solaris and macOS, and even some Windows. I
>> can't think of any other shell that is more common.
>
> The shell that is more common is the one required by POSIX: /bin/sh,
> having the behaviour specified by POSIX. Bash either conforms to POSIX
> or is close enough, so code written for POSIX will work fine with bash.
>
> None of the BSDs have bash by default. When it is present, via ports,
> pkgsrc, etc., it's not in /bin. On NetBSD, it's in /usr/pkg/bin/bash.
> People use it for their login shell. I do too - I'm not a bash hater,
> but object to it for programming use. It's enormous, and is one
> particular implementation among many. I view it as personal choice to
> use it for interactive use, and not appropriate for scripting.
>
> The fact that /bin/bash does not exist on *BSD, and probably other
> places, prompted my question about looking for it and substituting the
> path. Expecting bash to be in /bin/bash is just not a valid assumption.
Yeah, and with Apple changing the default shell in OSX, this only gets worse not better over time…
Could follow the pgsql project and just rewrite the thing (the config program) in C and be done with it…
P
>
>
> So, given that there seems to be a way to do this without introducing a
> dependenchy on bash, I'd like to see this backed out.
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/geos-devel
More information about the geos-devel
mailing list