Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check-capture.sh: fix quoting and "ret=$?" warnings #1041

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

greg-intel
Copy link
Contributor

@greg-intel greg-intel commented May 25, 2023

Per issue #729, "Fix all shellcheck warnings".

Prior to this commit there were 13 issues in this file, now there are none.

check-capture.sh was run before and after the fixes, no change in output.

Signed off by Greg Galloway [email protected]

Per issue #729, "Fix all shellcheck warnings".

Prior to this commit there were 13 in this file, now zero.
@greg-intel greg-intel requested a review from marc-hb May 25, 2023 19:40
@greg-intel greg-intel requested a review from a team as a code owner May 25, 2023 19:40
Copy link
Collaborator

@marc-hb marc-hb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly OK, just one small concern below and the lack of a commit title (check-capture.sh: <blank>). I suggest check-capture.sh: fix quoting and "ret=$?" warnings)

func_lib_lsof_error_dump $snd
if ! arecord_opts -D"$dev" -r "$rate" -c "$channel" -f "$fmt_elem" -d $duration "$file" -v -q;
then
func_lib_lsof_error_dump "$snd"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I prefer arecord_opts ... || { fail ... because it reads more like plain english and avoids a negation. Also, ! can't be copied to the command line (try it!)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this pr only fix shellcheck warnings, maybe we leave this to next PR.

fi

for fmt_elem in $(echo $fmt)
for fmt_elem in $fmt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous code was really weird, I don't understand what it was trying to achieve so I'm a bit concerned that the fix seems "too simple". @aiChaoSONG you added this code in commit aedc851, can you please review this PR?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@greg-intel can you please test the -F option before and after this PR and compare the logs, try to spot any difference?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't spot a difference, but I think maybe the device only had one format. I did (during testing) check behavior of this line when there were two items in the list, and it iterated over each individually. (I added " testing" to fmt, it ran the known value first and the second generated an error because it didn't exist.)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not recall why it is $(echo $fmt), let's do a test see if $fmt is ok, if yes, it will be good then.

@greg-intel greg-intel changed the title check-capture.sh: check-capture.sh: fix quoting and "ret=$?" warnings May 25, 2023
@greg-intel greg-intel merged commit e203357 into main Jun 1, 2023
@greg-intel greg-intel deleted the check-capture-shellcheck-clean branch June 1, 2023 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants