Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 353124 - sys-apps/openrc-0.7.0: bridge.sh uses non-POSIX test operator "=="
Summary: sys-apps/openrc-0.7.0: bridge.sh uses non-POSIX test operator "=="
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
: 357729 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-01-29 11:55 UTC by Christian
Modified: 2011-03-09 21:00 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch for /lib/rc/net/bridge.sh (openrc-POSIX.patch,808 bytes, text/plain)
2011-01-29 11:57 UTC, Christian
Details
new patch (openrc-POSIX.patch,564 bytes, patch)
2011-01-30 19:23 UTC, Christian
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian 2011-01-29 11:55:41 UTC
/lib/rc/net/bridge.sh isn't POSIX conform.
I made changes, to make it POSIX. Here it is working now, but maybe someone more experienced with shell-scripting can review it.

PS: maybe this http://sourceforge.net/projects/checkbaskisms/ can help avoid such hazzles.

Reproducible: Always
Comment 1 Christian 2011-01-29 11:57:10 UTC
Created attachment 260983 [details]
patch for /lib/rc/net/bridge.sh

Thanks to mv who pointed me to that file
Comment 2 Christian 2011-01-29 12:02:23 UTC
I forgot: it's openrc-0.7.0 which is affected here.
Comment 3 SpanKY gentoo-dev 2011-01-30 00:32:05 UTC
Comment on attachment 260983 [details]
patch for /lib/rc/net/bridge.sh

changing "==" to "=" is correct, but "-a" to "&&" is not.  -a is clearly specified in POSIX:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html

also, checkbasshisms throws too many false positives last i looked.
Comment 4 Christian 2011-01-30 10:46:30 UTC
you're right, -a/-o is defined, but && and || is also defined and so it isn't incorrect. I don't know much bout these things, I was only told that -a/-o isn't posix.
But furthermore, -a/-o is marked with that, according to your document:
Obsolescent
The functionality described may be removed in a future version of this volume of POSIX.1-2008. Strictly Conforming POSIX Applications and Strictly Conforming XSI Applications shall not use obsolescent features.

So, I dont't see the problem when using && and || instead of -a/-o
Comment 5 SpanKY gentoo-dev 2011-01-30 19:09:36 UTC
whoever told you that is wrong.  the obsolete aspect is irrelevant ... i highly doubt these are going anywhere considering it's the only way to test multiple things with a single `test` execution.

at that point, you're just changing style, and that is frowned upon.  fix what is incorrect (== -> =) and that's it.
Comment 6 Christian 2011-01-30 19:23:25 UTC
Created attachment 261121 [details, diff]
new patch

well, then here you go.
only changed == to =
Comment 7 William Hubbs gentoo-dev 2011-02-03 19:59:17 UTC
(In reply to comment #6)
> only changed == to =

This patch looks good.

Mike, what is your status on getting this into the tree?

Thanks,

William
Comment 8 William Hubbs gentoo-dev 2011-02-03 20:01:57 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > only changed == to =
> This patch looks good.
> Mike, what is your status on getting this into the tree?

I am thinking about spinning a new openrc release this weekend and I would like to see this and the makefile changes I sent to the alias as part of that release.

Thanks,

William
Comment 9 William Hubbs gentoo-dev 2011-02-05 13:30:38 UTC
This patch has been applied to git, commit 43678fd.

Christian, thanks for the report and the patch.
Comment 10 SpanKY gentoo-dev 2011-03-09 21:00:04 UTC
*** Bug 357729 has been marked as a duplicate of this bug. ***