Summary: | app-shells/bash-2.05b-r9 - parameter expansion with negative offset broken | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Carsten Lohrke (RETIRED) <carlo> |
Component: | New packages | Assignee: | Gentoo's Team for Core System packages <base-system> |
Status: | RESOLVED INVALID | ||
Severity: | normal | ||
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Carsten Lohrke (RETIRED)
![]() use ${blah:0:0-1} err ${blah:0-1} No. FOO="WORKS" echo ${FOO:-4:4} should result in "ORKS" i still say it's not a bug the two forms have the exact same syntax and it's easier to trick the offset than it is to trick the ${var:-default} form if you consider it a bug, convince upstream, because we're not going to change the behavior unless they do
>the two forms have the exact same syntax and it's easier to trick the offset than it is to trick the ${var:-default} form
Exactly. Something like ${FOO:-2:2} is ambiguous, so my guess is, that the negative offset is not allowed anymore and they missed to fix the man page. It's sad, if you don't think that is a bug, and that it is better to provide either incorrect information or to ship a buggy bash (POV thing, I don't care), but damn - it's maintainers job to sort that out.
the manpage does not say exactly what said form is they simply say 'if offset evaluates to a number less than zero' $ FOO=WORKS $ echo ${FOO:0-1} S doing ${FOO:-1} is ambigious, but they had to do something ... going the route they did makes more sense then going the opposite as for it being 'the maintainers job to sort this out', there really isnt any 'incorrent information being shipped' nor is there a 'buggy bash' ... thus it's *your* problem to convince people otherwise :P the ONLY thing i would change here is add a note under said section about such usage being ambigious Umm - now I got it. Confused /me learned something. Did not try your 0-1 sample before. Still don't think, that this bashism is well thought.
>thus it's *your* problem to convince people otherwise :P
That's why I don't stop commenting. I just like to get emails from you. ;p This time I have to admit that you're right.
|