Has AudioScope found a bug in bash 4.4.5?


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Has AudioScope found a bug in bash 4.4.5?
# 8  
Old 05-29-2017
If you can limit your status values 0-127, with 0 for success, then you can do return "$status" and remove all your special return cases.

Also, you shouldn't do if [ $? -eq 1 ] since any code besides zero can mean error. You should do if [ $? -ne 0 ] to check if it's not zero, to catch every possible error value.

You could also do the precisely equivalent statement of
Code:
if ! KEYBOARD
then
        break
fi

for the exact same effect in something short and straightforward. Or even KEYBOARD || break

Last edited by Corona688; 05-29-2017 at 02:27 PM..
This User Gave Thanks to Corona688 For This Post:
# 9  
Old 05-29-2017
Hi Corona688...

(Will be back off holidays tomorrow for quicker replies.)

I like your 'return' method and it is now already coded for inside the next upload.
I researched the range of user available RCs and ended up using return 10 .

I used the number '1' in the example as proof of concept, no other reason.

I also checked any other of my break situations and all are valid.

Trust me to use a potential _exploit_ that I thought was valid. I knew Python was very strict, even from Version 1.4.0, (I still currently use this in AMIGA OS), but after using my getout method in bash I thought it was a_feature_ -- my bad. It has taught me to research deeper before commiting...

Thanks for that.

I am surprised however in all the years 'bash' has been around no-one has picked this up until some weeks ago...

'ksh' is fine as is 'dash' so I will test any ideas I get with those first before modifying to bash...

EDIT:
Just noticed your return $status and I like, very much. It will take a while to re-arrange but this will be added as I use statuses from 0 up to 255...

Last edited by wisecracker; 05-29-2017 at 03:46 PM.. Reason: See above...
# 10  
Old 06-06-2017
Quote:
Originally Posted by wisecracker
I researched the range of user available RCs and ended up using return 10 .
There's only two "predefined", as it were:
  • 0: Success
  • 127: Killed via interrupt. Highest possible return code.

Anything else can mean whatever error you want it to mean. Some specific programs might have a traditional meaning for certain codes, but since audioscope is not any of those specific traditional programs, it doesn't matter.
# 11  
Old 06-06-2017
Quote:
Originally Posted by Corona688
There's only two "predefined", as it were:
  • 0: Success
  • 127: Killed via interrupt. Highest possible return code.

Anything else can mean whatever error you want it to mean. Some specific programs might have a traditional meaning for certain codes, but since audioscope is not any of those specific traditional programs, it doesn't matter.
By convention, there are five classes of exit codes:
Code:
0		success
1-125		unspecified failure of some type
126		utility to be invoked found, but is not executable
127		utility to be invoked not found
128+signo	process terminated or stopped by signal number sig

The standards require the 0 exit status to mean successful termination for most standard utilities. And they require 126 and 127 as described above for the command, env, nice, nohup, time, and xargs utilities. A process killed by a signal will exit with the above mentioned exit status, but there is nothing that keeps a process from exiting with an exit code greater than 128 (up to 255) even if it was not terminated by a signal.

On UNIX systems, a process killed by a SIGTERM signal would exit with exit code 143 and a process killed by a SIGKILL signal would exit with exit code 137. On other systems, the standards do not specify the signal numbers assigned to the various signals defined by the standards.

As always, there are exceptions to these conventions. (For example, the false utility's successful exit code is an unspecified non-zero value; not 0.)
# 12  
Old 06-07-2017
Hi Don...

What I found from the mighty WWW was what you put, plus, an exit code of '1' was a general case reserved number too. I only needed one exit code so '10' was easy to remember.

'QUIT' and 'EXIT' are not the same in the AudioScope.sh code anymore.
'QUIT' requires Corona688's return 10 whereas 'EXIT' uses exit 0 .
They both do different things now...
(AudioScope.sh with my major __bash_feature__ error corrected, is now ready for upload.)

Trust me to find a possible exploit that I thought was a feature.
It still surprises me it has taken this long to become apparent however.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. OS X (Apple)

AudioScope Project.

AudioScope Project. (Apologies for any typos.) For the few following...... AudioScope.sh... Now at Version 0.60.00. Well this baby has come a long way since its inception in January 2013. It is now at Version 0.60.00. It is MUCH more Apple centric now with a new OSX Sierra minimum _silent_... (7 Replies)
Discussion started by: wisecracker
7 Replies

2. What is on Your Mind?

AudioScope...

Boy oh boy, with only a MONO mic input to use AudioScope gets much more difficult when the ALTDC board is included. It needs, so far, two hits at the MIC input with a single hit at the HEADPHONE audio output. The first at the highest practical resolution for the AC component and the second... (0 Replies)
Discussion started by: wisecracker
0 Replies

3. Shell Programming and Scripting

-bash-3.2$: not found

I am wondering if someone can help me out. I am new to oracle and given a task to install Oracle 11g on Solaris. I am running into some major problems since last week since I can't seem to get it to work. I can't start GUI, tried different blogs but no luck. Then, I decided to install it in a... (4 Replies)
Discussion started by: newborndba
4 Replies

4. UNIX for Dummies Questions & Answers

Im new to bash scriping and i found this expression on a bash script what does this mean.

# check host value regex='^(||1|2|25)(\.(||1|2|25)){3}$' if ')" != "" ]; then if ]; then echo host $host not found exit 4 fi elif ]; then echo $host is an invalid host address exit 5 fi espeacailly the top regex part? ---------- Post updated at 06:58 PM ---------- Previous update was... (1 Reply)
Discussion started by: kevin298
1 Replies

5. Shell Programming and Scripting

bash:vi:command not found

I downloaded and installed "Cygwin yesterday onto my PC running Windows XP. When I tried to type "vi" in Cygwin's window, I got the following message bash: vi: Command not found What shud i do inorder to get into vi editor Thanks (10 Replies)
Discussion started by: bobby1015
10 Replies

6. Shell Programming and Scripting

mv command not found bug

foreach x ( *.foo) echo "move file?" set move=$< if($move == y) then echo "enter new pathname:" set path=$< mv $x $path/$x endif end ok guys, im creating this script so i can move files with *.foo extensions and *.bar... (6 Replies)
Discussion started by: pantelis
6 Replies

7. Shell Programming and Scripting

bash-function with array acting bizarre, bug?

Hello, basically what this script is supposed to do is showing a list of hosts that is given a number, that you will be able to choose from a list. A check is made to verify that the chosen number is within the array and this is where things go bad and I don't know why, bizarre. I've spent... (5 Replies)
Discussion started by: gand
5 Replies

8. Post Here to Contact Site Administrators and Moderators

Have I found a bug?

When searching for new posts, I see that my voting in one of the polls counts as a 'new post'. However, while the '<blah> minutes ago' entry updates correctly, the 'by <username>' is the last user to actually post a comment in the poll instead. Result: Poll: vB Guest Book 39... (4 Replies)
Discussion started by: Smiling Dragon
4 Replies
Login or Register to Ask a Question