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

Change return code of extract-rows #1510

Merged
merged 2 commits into from
Mar 23, 2017

Conversation

happyalu
Copy link
Contributor

num_done > 0 is success. Updated the return statement to return 0 when successful.

num_done > 0 is success. Updated the return statement to return 0 when successful.
@happyalu
Copy link
Contributor Author

POSIX utitilies use a zero return value to indicate success and a non-zero value to indicate failure. This is a pattern that most of the Kaldi utilities also follow, but extract-rows returns non-zero on success which breaks compatibility with bash options like set -e. Changed the return value to use zero to indicate success. Similar to extract-feature-segments.cc, assumed success when at least one segment is processed.

@@ -149,7 +149,7 @@ int main(int argc, char *argv[]) {
KALDI_LOG << "Processed " << num_done << " segments successfully; "
<< "errors on " << num_err;

return (num_done > 0);
return (num_done == 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that was a bug; that code has not been used much so far.
thanks, but can you please change it to
(num_done > 0 ? 0 : 1)
which is how we normally write it?
returning the truth value causes me to do a double-take when looking at the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks.

Changed the expression.

Changed the return statement to use the ternary operator
@danpovey danpovey merged commit ef415a7 into kaldi-asr:master Mar 23, 2017
@happyalu happyalu deleted the alok_fix_returncode branch March 23, 2017 03:50
kronos-cm added a commit to kronos-cm/kaldi that referenced this pull request Apr 5, 2017
* 'master' of https://github.com/kaldi-asr/kaldi:
  [src] Cosmetic change: remove 'train.tra' from usage messages (kaldi-asr#1529)
  [src] cudamatrix: speed up AddColSumMat with transfrom reduce kernel template (kaldi-asr#1530)
  [build]: remove openfst check (kaldi-asr#1531)
  [build,src,doc] Modify get_version.sh to deal better with whitespace (avoid space in version); minor fixes (kaldi-asr#1526)
  [scripts,egs] Adding options for using PCA instead of LDA+MLLT for ivectors used in ASR. Results are reported in the default TDNN recipe in AMI. Updating steps/online/nnet2/{train_diag_ubm.sh,train_ivector_extractor.sh} so that they now backup the contents of their destination directory if it already exists. (kaldi-asr#1514)
  [src] (minor) Added missing SetZero() to NaturalGradientAffineComponent::Scale() if scale==0.0 (kaldi-asr#1522)
  [src,doc] Fix several unrelated minor problems.  Thanks: gaoxinglong
  [src] Adding noexcept to hashing function objects (kaldi-asr#1519)
  [egs] Fix to egs/wsj/s5/run.sh (unset variable) (kaldi-asr#1517)
  [misc] remove eXecute permissions where not needed (kaldi-asr#1515)
  [src,scripts]: Several unrelated cosmetic changes
  [egs] fixes to babel pipeline; thanks to Fred Richardson (kaldi-asr#1509)
  [src] Fix exit code of extract-rows.cc (kaldi-asr#1510)
david-ryan-snyder pushed a commit to david-ryan-snyder/kaldi that referenced this pull request Apr 12, 2017
Skaiste pushed a commit to Skaiste/idlak that referenced this pull request Sep 26, 2018
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.

2 participants