Opened 17 years ago

Closed 16 years ago

Last modified 16 years ago

#14452 closed enhancement (fixed)

select.sh produce unneeded warnings when the only option is "-n" — at Version 6

Reported by: ebgssth@… Owned by: raimue@…
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

Change History (7)

Changed 17 years ago by ebgssth@…

Attachment: select.sh.diff added

comment:1 Changed 17 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 17 years ago by kballard (Lily Ballard)

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

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

Keywords: gcc_select python_select select.sh added
Owner: changed from raimue@… to mww@…
Summary: python_select produce unneeded warnings when the only option is "-n"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 17 years ago by ebgssth@…

Any update?

comment:5 Changed 16 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 16 years ago by raimue (Rainer Müller)

Description: modified (diff)
Resolution: fixed
Status: newclosed

Fixed with python_select 0.2 in r44662.

Note: See TracTickets for help on using tickets.