New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #14452 (closed enhancement: fixed)

Opened 6 years ago

Last modified 5 years ago

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

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

Description (last modified by raimue@…) (diff)

$ 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

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

Change History

Changed 6 years ago by ebgssth@…

comment:1 Changed 6 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 6 years ago by eridius@…

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

comment:3 Changed 6 years ago by raimue@…

  • Owner changed from raimue@… to mww@…
  • Keywords gcc_select python_select select.sh added
  • 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 6 years ago by ebgssth@…

Any update?

comment:5 Changed 6 years ago by raimue@…

  • 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 5 years ago by raimue@…

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

Fixed with python_select 0.2 in r44662.

comment:7 Changed 5 years ago by anonymous

  • Milestone Port Enhancements deleted

Milestone Port Enhancements deleted

Note: See TracTickets for help on using tickets.