Projects
New Ticket     Wiki     Browse Source     Timeline     Roadmap     Bug Reports     Search

Ticket #14452 (new enhancement)

Opened 10 months ago

Last modified 3 months ago

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

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

Description

$ 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@… 10 months ago.

Change History

Changed 10 months ago by ebgssth@…

Changed 10 months ago by ebgssth@…

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

Changed 9 months ago by eridius@…

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

Changed 9 months ago by raimue@…

  • 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.

Changed 9 months ago by ebgssth@…

Any update?

Changed 3 months 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.

Note: See TracTickets for help on using tickets.