tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Command substitution using backticks or $(...)



* On 2020-05-01 at 12:41 BST, Roland Illig wrote:

> On 01.05.2020 09:40, Jonathan Perkin wrote:
> > * On 2020-05-01 at 07:42 BST, Roland Illig wrote:
> > 
> > > In pkgsrc the command substitution is usually done via `backticks`, for
> > > compatibility with /bin/sh from Solaris.  To fix the shell parse errors,
> > > the special characters are properly escaped inside the command
> > > substitution.
> > 
> > But we've never used /bin/sh on SunOS?
> 
> In 2006, when I used pkgsrc on Solaris 8, I thought /bin/sh were indeed
> used.
> 
> https://mail-index.netbsd.org/pkgsrc-changes/2006/01/12/0022.html
> 
> But at that time, mk/tools/tools.SunOS.mk already said:
> 
> TOOLS_PLATFORM.sh?= /bin/ksh
> 
> This means the pkglint warnings about $(...) being unsupported have
> probably been wrong all the time from 2006 until now.

I guess it depends what we're checking.  In theory /bin/sh should not
be used at all except possibly by the bootstrap script:

 * bootstrap sets TOOLS_PLATFORM.sh as necessary, ensuring that any
   ${SH} invocations use the correct shell.

 * We build devel/bmake --with-defshell= to ensure any shell fragments
   in Makefiles use the correct shell.

 * We set CONFIG_SHELL to ${SH} to ensure that configure scripts are
   executed with the correct shell. 

but it's always possible we missed something.

> I'll reverse that warning, suggesting to use $(...) instead of
> `backticks` since in that form it is easier to understand how many
> backslashes are really needed.

Fine with me, I'd like to expose any potential issues with the wrong
shell being called, though it's harder these days as nobody that I'm
aware of actually builds pkgsrc on a Solaris version which has the
original Bourne shell.  I have a Solaris 9 VM that is very rarely
used.

Thanks,

-- 
Jonathan Perkin  -  Joyent, Inc.  -  www.joyent.com


Home | Main Index | Thread Index | Old Index