lkml.org 
[lkml]   [2010]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] KERNEL BUILD: Make the setlocalversion script POSIX-compliant.
On 18.7.2010 10:26, Michał Górny wrote:
> The 'source' builtin is a bash alias to the '.' (dot) builtin. While the
> former is supported only by bash, the latter is specified in POSIX and
> works fine with all POSIX-compliant shells I am aware of.
>
> The '$_' special parameter is specific to bash. It is partially
> supported in dash too but it always evaluates to the current script path
> (which causes the script to enter a loop recursively re-executing
> itself). This is why I have replaced the two occurences of '$_' with the
> explicit parameter.
>
> The 'local' builtin is another example of bash-specific code. Although
> it is supported by all POSIX-compliant shells I am aware of, it is not
> part of POSIX specification and thus the code should not rely on it
> assigning a specific value to the local variable. Moreover, the 'posh'
> shell has a limited version of 'local' builtin not supporting direct
> variable assignments. Thus, I have broken one of the 'local'
> declarations down into a (non-POSIX) 'local' declaration and a plain
> (POSIX-compliant) variable assignment.
>
> Signed-off-by: Michał Górny <gentoo@mgorny.alt.pl>

Thanks a lot, applied to the kbuild tree.


> ---
>
> There is one 'bashism' left which I wasn't able to fix -- the use of
> 'test -ef'. I'm not aware of any POSIX equivalent of that.

Me neither, POSIX does not know stat(1) AFAICS. Does it matter in real
life? Is there a distro that installs posh or a similarly strict shell
as /bin/sh? It seems to work with dash after your changes.

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-07-20 16:03    [W:0.048 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site