Review Request 119285: Fix Empty String Test in kdevelop! Shell Script

Milian Wolff mail at milianw.de
Tue Jul 15 09:10:25 UTC 2014



> On July 15, 2014, 8:17 a.m., Kevin Funk wrote:
> > kdevelop! is a sh script -- '[[' is a bash thing only.
> > 
> > I'd suggest the following patch, which also doesn't fail if $@ contains a hyphen as the first char.
> > 
> > --- a/app/kdevelop!
> > +++ b/app/kdevelop!
> > @@ -23,7 +23,7 @@ export APPLICATION=KDevelop
> >  
> >  if ! [ "$KDEV_ATTACHED_PID" ]; then
> >      ARGS=""
> > -    if [[ -z "$@" ]]; then
> > +    if [ $# -eq 0 ]; then
> >          ARGS="-pss"
> >      else
> >          ARGS="$@"
> >          
> > Feel free to commit that one if that fixes it for you, too.
> 
> Kevin Funk wrote:
>     Okay. Reviewboard messed up my patch. But I think you get the idea...

You could just use 

if [ -z "$@" ]; then
  ...
  
no? That works just fine for me...

$ if [ -z "$a" ]; then echo 1; else echo 2; fi
1
$ a=1; 
$ if [ -z "$a" ]; then echo 1; else echo 2; fi
2


- Milian


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/119285/#review62379
-----------------------------------------------------------


On July 15, 2014, 3:17 a.m., David Narváez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/119285/
> -----------------------------------------------------------
> 
> (Updated July 15, 2014, 3:17 a.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Bugs: 337454
>     http://bugs.kde.org/show_bug.cgi?id=337454
> 
> 
> Repository: kdevelop
> 
> 
> Description
> -------
> 
> This empty string test was failing and causing the linked bug.
> 
> 
> Diffs
> -----
> 
>   app/kdevelop! 35dda2d 
> 
> Diff: https://git.reviewboard.kde.org/r/119285/diff/
> 
> 
> Testing
> -------
> 
> See the steps to reproduce the linked bug.
> 
> 
> Thanks,
> 
> David Narváez
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20140715/5450ba63/attachment-0001.html>


More information about the KDevelop-devel mailing list