incomplete documentation of local?

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

 



Hey.

I noticed two things in dash’s "local" which seem to be missing from
dash’s manpage:


1) Like bash’s, dash’s local seem to support:
   local foo=bar
   which doesn't seem to be mentioned in the manpage.

   I guess many people nevertheless use this (with dash), so it should
   either be documented as working, or as something one cannot rely on
   in the future.


2) There is no clear documentation about "local"’s exit status.
   The section describing it doesn’t say anything and it doesn’t seem
   to follow from other sections, e.g. "Command Exit Status" says
   merely:
   > Additionally, the builtin commands return exit
   > codes, as does an executed shell function.

   This is especially important as dash’s local seems to do the
   something similar than e.g. bash’s, and return 0 unless used outside
   of a function or on some invalid variable name (e.g. "$").

   However, it does not fail, when called on a readonly variable.

   The main problem of this not being documented is IMO, that people
   may easily be tempted that:
     local foo="$(somecommmand)"
     rc="$?"
   works like:
     foo="$(somecommmand)"
     rc="$?"
   and gives back the exit status of somecommand, which it does not.


I could provide a patch with some wording if that helps.


Thanks,
Chris.



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux