On Monday 23 February 2009 10:53:06 Chet Ramey wrote:
> Mike Frysinger wrote:
> > On Monday 23 February 2009 08:48:32 Chet Ramey wrote:
> >> Mike Frysinger wrote:
> >>> previous versions of bash would happily accept negative values (
> >>> treated as a signed integer and masked with like 0xff), but it seems
> >>> some changes related to option parsing has broken that
> >>>
> >>> $ f(){ return -1; }; f
> >>> -bash: return: -1: invalid option
> >>> return: usage: return [n]
> >>
> >> Bash still happily accepts the same negative return values; however, the
> >> `return' builtin was changed to use the standard option parsing rules
> >> like the rest of the builtins. The effect is that arguments
> >> beginning with a `-' that are not to be treated as options must follow
> >> a `--'.
> >
> > that makes negative values kind of useless imo and breaks backwards
> > compatibility. if 'return -1' isnt going to be fixed, then i'd just
> > break it completely so as to force people to migrate to POSIX compliant
> > behavior.
>
> By your logic, nothing could ever be fixed as long as someone was using
> it.no, by my logic, things behaving *differently from documented/spec* can be fixed. this falls into neither category and is an arbitrary change with no gain. > Are filenames beginning with a `-' useless because `rm' interprets > them as option arguments when, for instance, they're generated by the > expansion of `*'? Is `rm' broken for interpreting them as options? > I mean, there's no real difference between the two cases. If you have > an argument that looks like an option, and you don't want it interpreted > as an option, you protect it in some way. The standard way to do that is > to make it follow `--'. we arent talking about rm, nor does 'return' even take any options. > >> It's in the change log as having happened between bash-4.0-alpha and > >> bash-4.0 beta. > > > > the changelog mentions options, not negative values. they arent the same > > thing. > > Ummm...yes, they are. They are both arguments to the command that > begin with `-'. if you want to be pedantic, then say return accepts any numeric option and uses that in place of [n]. or just reject negative values *and document it*. the 'return' in the bash(1) man page still does not talk about options or -- or anything. that leaves the existing situation a confusing mess for no reason. -mike
signature.asc
Description: This is a digitally signed message part.
