Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#14452 closed enhancement (fixed)

select.sh produce unneeded warnings when the only option is "-n"

Reported by: ebgssth@… Owned by: raimue (Rainer Müller)
Priority: Normal Milestone:
Component: ports Version: 1.6.0
Keywords: gcc_select python_select select.sh Cc: raimue (Rainer Müller), mww@…
Port:

Description (last modified by raimue (Rainer Müller))

$ python_select -n
/opt/local/bin/python_select: line 83: [: ==: unary operator expected
/opt/local/bin/python_select: line 83: [: ==: unary operator expected
/opt/local/bin/python_select: line 83: [: ==: unary operator expected
/opt/local/bin/python_select: line 83: [: ==: unary operator expected
version "" is invalid!

easy fix would be

-                 if [ ${1} == ${version} ]; then
+                if [ x${1} == x${version} ]; then

might be better to stop script when python_select called with -n only

Attachments (1)

select.sh.diff (2.0 KB) - added by ebgssth@… 9 years ago.

Download all attachments as: .zip

Change History (8)

Changed 9 years ago by ebgssth@…

comment:1 Changed 9 years ago by ebgssth@…

attached a patch for this. also added -e option to sh so that any error causes script stop

comment:2 Changed 9 years ago by eridius@…

  • Owner changed from macports-tickets@… to raimue@…

comment:3 Changed 9 years ago by raimue (Rainer Müller)

  • Keywords gcc_select python_select select.sh added
  • Owner changed from raimue@… to mww@…
  • Summary changed from python_select produce unneeded warnings when the only option is "-n" to select.sh produce unneeded warnings when the only option is "-n"

This does not only affect python_select, but also gcc_select as both are using the general select.sh script. It was written by mww and resides in his user directory in svn, so I will reassign this issue to him.

comment:4 Changed 9 years ago by ebgssth@…

Any update?

comment:5 Changed 8 years ago by raimue (Rainer Müller)

  • Owner changed from mww@… to raimue@…

I tried to apply this patch today, but it did not work completely.

bash -e causes problems at the let command. As documented in help let in bash:

    If the last ARG evaluates to 0, let returns 1; 0 is returned
    otherwise.

It will always fail on this line using let with -e.

Committed the other parts of the patch in r39794 and r39795.

comment:6 Changed 8 years ago by raimue (Rainer Müller)

  • Description modified (diff)
  • Resolution set to fixed
  • Status changed from new to closed

Fixed with python_select 0.2 in r44662.

comment:7 Changed 8 years ago by anonymous

  • Milestone Port Enhancements deleted

Milestone Port Enhancements deleted

Note: See TracTickets for help on using tickets.