git-secret icon indicating copy to clipboard operation
git-secret copied to clipboard

test with spaces in the parent directory

Open joshrabinowitz opened this issue 2 years ago • 0 comments

WIP for #135 Currently just shows problem

  • analysis shows error is happening in gitignore_add_pattern's call to _gawk_inplace when running git-secret-init
  • This is output from bash -x on git-secret-init in directory with spaces, showing problem:
(... LOTS REMOVED ...)
++ gawk -v 'RS='\''' -v 'FS='\''' 'END{ gsub(/^\s+/,""); print $1 }'
'\'' /home/examp/tmp/gitsec test/.gitignore'
+ dest_file='/home/examp/tmp/gitsec test/.gitignore'
+ _temporary_file
++ _os_based __temp_file
++ case "$(uname -s)" in
+++ uname -s
++ __temp_file_linux
++ local filename
+++ mktemp -p /tmp _git_secret.XXXXXX
++ filename=/tmp/_git_secret.RLgKjh
++ echo /tmp/_git_secret.RLgKjh
+ temporary_filename=/tmp/_git_secret.RLgKjh
+ trap 'if [[ -f "$temporary_filename" ]]; then if [[ -n "$_SECRETS_VERBOSE" ]] || [[ -n "$SECRETS_TEST_VERBOSE" ]]; then echo "git-secret: cleaning up: $temporary_filename"; fi; rm -f "$temporary_filename"; fi;' EXIT
+ bash -c 'gawk -v pattern=.gitsecret/keys/random_seed '\''
BEGIN {
  cnt=0
}

function check_print_line(line){
  if (line == pattern) {
    cnt++
  }
  print line
}

# main function
{
  check_print_line($0)      # check and print first line
  while (getline == 1) {    # check and print all other
    check_print_line($0)
  }
}

END {
  if ( cnt == 0) {         # if file did not contain pattern add
    print pattern
  }
}
'\'' /home/examp/tmp/gitsec test/.gitignore'
gawk: cmd. line:3: fatal: cannot open file `/home/examp/tmp/gitsec' for reading (No such file or directory)
+ [[ -f /tmp/_git_secret.RLgKjh ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ rm -f /tmp/_git_secret.RLgKjh

joshrabinowitz avatar Aug 07 '22 19:08 joshrabinowitz

@sobolevn this is as we discussed last

joshrabinowitz avatar Sep 05 '22 21:09 joshrabinowitz

Edit: we cannot easily depend on perl in place of awk in all cases; in particular; alpine's git packages (unlike most) do not install perl

joshrabinowitz avatar Sep 05 '22 22:09 joshrabinowitz

closing for now

joshrabinowitz avatar Sep 05 '22 22:09 joshrabinowitz