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

some commands fail when there is a space in the filename #226

Closed
joshrabinowitz opened this issue Jul 3, 2018 · 3 comments
Closed

some commands fail when there is a space in the filename #226

joshrabinowitz opened this issue Jul 3, 2018 · 3 comments

Comments

@joshrabinowitz
Copy link
Collaborator

joshrabinowitz commented Jul 3, 2018

Try manipulating a file like file with spaces.txt with git-secret.

See branch displaying problems here:
joshrabinowitz#1

-- Problems are in 'changes', 'hide', and 'remove' commands.

Discovered after fixing #135, "some commands fail when the current directory's path includes spaces"

@joshrabinowitz
Copy link
Collaborator Author

joshrabinowitz commented Jul 3, 2018

Here are the particular test failures, with notes about each:

'git-secret changes' : At least one problem here is that _list_all_added_files() returns the list of files as a stringified list, which uses spaces as a delimiter.
Code: https://github.com/sobolevn/git-secret/blob/master/src/_utils/_git_secret_tools.sh#L465
(note: I've worked up a branch where this is fixed, except issues with _gawk_inplace(), whose code is at https://github.com/sobolevn/git-secret/blob/master/src/_utils/_git_secret_tools.sh#L465)

 ✗ run 'changes' with one file changed
   (in test file /Users/examp/gitsrc/git-secret/tests/test_changes.bats, line 39)
     `[ "$status" -eq 0 ]' failed
 ✓ run 'changes' with source file missing
 ✗ run 'changes' with hidden file missing
   (in test file /Users/examp/gitsrc/git-secret/tests/test_changes.bats, line 58)
     `rm "$encrypted_file"' failed
   rm: local.secret: No such file or directory
 ✗ run 'changes' with one file changed (with deletions)
   (in test file /Users/examp/gitsrc/git-secret/tests/test_changes.bats, line 71)
     `[ "$status" -eq 0 ]' failed
 ✗ run 'changes' without changes
   (in test file /Users/examp/gitsrc/git-secret/tests/test_changes.bats, line 85)
     `[ "$status" -eq 0 ]' failed
 ✗ run 'changes' with multiple files changed
   (in test file /Users/examp/gitsrc/git-secret/tests/test_changes.bats, line 97)
     `[ "$status" -eq 0 ]' failed
 ✗ run 'changes' with multiple selected files changed
   (in test file /Users/examp/gitsrc/git-secret/tests/test_changes.bats, line 120)
     `[ "$status" -eq 0 ]' failed

~~ git-secret hide -m': at least one problem is with 'hide -m' is the gawk used to replace the hash, see the end of the output at https://gist.github.com/joshrabinowitz/33eac5e039e1fa2a0a0767a6f2e73924~~
Note that there is no issue with git-secret hide when -m is not used.
I think the issue is with _gawk_inplace(), see above.
I have this fixed in a private branch, the issue is with quoting the key in the function _optional_fsdb_update_hash

 ✗ run 'hide' with '-m'
   (in test file /Users/examp/gitsrc/git-secret/tests/test_hide.bats, line 76)
     `[ "$status" -eq 0 ]' failed
 ✗ run 'hide' with '-m' twice
   (in test file /Users/examp/gitsrc/git-secret/tests/test_hide.bats, line 95)
     `[ "$status" -eq 0 ]' failed

'git-secret remove': the problem is at least that _fsdb_rm_record()'s gawk does not expect filenames with spaces something to do with the awk . The code for 'git-secret remove' is here
https://github.com/sobolevn/git-secret/blob/master/src/commands/git_secret_remove.sh
I have fixed this in a private branch, it was the same problem as with test_hide above, and there were also quoting bugs in the tests themselves.

 ✗ run 'remove' normally
   (in test file /Users/examp/gitsrc/git-secret/tests/test_remove.bats, line 43)
     `[ "$status" -eq 0 ]' failed
 ✗ run 'remove' with multiple arguments
   (in test file /Users/examp/gitsrc/git-secret/tests/test_remove.bats, line 68)
     `[ "$status" -eq 0 ]' failed
 ✓ run 'remove' with slashes in filename
 ✗ run 'remove' with '-c'
   (in test file /Users/examp/gitsrc/git-secret/tests/test_remove.bats, line 116)
     `[ "$status" -eq 0 ]' failed

@joshrabinowitz
Copy link
Collaborator Author

The only issues remaining are regarding git-secret remove. I have fixes worked up for the hide and changes issues.

@joshrabinowitz
Copy link
Collaborator Author

These issues are all resolved in #239

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

No branches or pull requests

1 participant