Qithub-BOT/QiiCipher

sign コマンドで失敗しても `*.sig` ファイルが作成されてしまう

KEINOS opened this issue · 1 comments

sign コマンドで、引数のパスが間違えていても *.sig ファイルが作成されてしまいます。(Issue #31 (comment) より)

  • 再現テスト
#shellcheck shell=sh

Describe 'sign with unexisting key'
    name_file_to_sign="dummy.txt"
    path_file_sig_out="${SHELLSPEC_TMPDIR}/${name_file_to_sign}.sig"

    It 'should print err with status 1 and should not create .enc file'
        When call sign KEINOS '/path/to/unknown/key.pub' "$name_file_to_sign" "$path_file_sig_out"

        The stdout should include '署名ファイルを生成できませんでした'
        The stderr should include 'No such file or directory'
        The status should be failure # status is 1-255

        Path file_sig="$path_file_sig_out"
        The path file_sig should not be exist
    End
End

- 実行結果

$ shellspec ./tests/issue31_test.sh
Running: /bin/sh [sh]
F

Examples:
  1) sign with unexisting key should print err with status 1 and should not create .enc file
     When call sign KEINOS /path/to/unknown/key.pub dummy.txt /tmp/dummy.txt.sig

     1.1) The path file_sig should not be exist

            The specified path exists
            path: /tmp/dummy.txt.sig

          # tests/issue31_test.sh:13

Finished in 0.37 seconds (user 0.10 seconds, sys 0.08 seconds)
1 example, 1 failure


Failure examples / Errors: (Listed here affect your suite's status)

shellspec tests/issue31_test.sh:7 # 1) sign with unexisting key should print err with status 1 and should not create .enc file FAILED

これやります