Bug#1024536: git-crecord: fails on committing/stagin
Hey again. I think I also managed to reproduce the first error: $ git clone g...@github.com:calestyo/btrbk.git $ cd btrbk $ git checkout improve-ssh_filter_btrbk.sh $ git rebase --interactive 53b3290e14ea9c8df6288bec981d8b28655c8fa7 This shows: pick 9819fdc ssh_filter_btrbk.sh: convert to POSIX sh pick 3d87f27 ssh_filter_btrbk.sh: use printf instead of echo pick 2b53311 ssh_filter_btrbk.sh: set only needed directories in PATH pick ec8e7a1 ssh_filter_btrbk.sh: use more common exit statuses pick 0bd7374 ssh_filter_btrbk.sh: replace OpenSSH’s deprecated SSH_CLIENT pick 7c77f0a ssh_filter_btrbk.sh: minor improvements pick d3126c7 ssh_filter_btrbk.sh: further harden the shell execution environment pick 7729be4 ssh_filter_btrbk.sh: properly normalise pathnames pick 016e945 ssh_filter_btrbk.sh: forbid non-absolute pathnames to --restrict-path Now delete all lines except for the first: pick 9819fdc ssh_filter_btrbk.sh: convert to POSIX sh in order to get rid of all those commits. Then apply the attached patch (simulating the content that I had changed) with some of the next upcoming commits: $ patch < changes.patch Then: $ git crecord and only select the "printf" lines, i.e.: [~]diff --git a/ssh_filter_btrbk.sh b/ssh_filter_btrbk.sh index 262cbbb..21074ae 100755 3 hunks, 4 lines changed [ ] @@ -3,7 +3,7 @@ set -e set -u [ ] -export PATH=/sbin:/bin:/usr/sbin:/usr/bin [ ] +export PATH='/usr/bin:/bin' enable_log= restrict_path_list= [~] @@ -41,8 +41,8 @@ reject_and_die() { local reason="$1" log_cmd 'auth.err' 'btrbk REJECT' "$reason" [ ] -echo "ERROR: ssh_filter_btrbk.sh: ssh command rejected: $reason: $SSH_ORIGINAL_COMMAND" 1>&2 [ ] -exit 255 [x] +printf 'ERROR: ssh_filter_btrbk.sh: ssh command rejected: %s: %s\n' "$reason" "$SSH_ORIGINAL_COMMAND" 1>&2 [ ] +exit 1 } run_cmd() [~] @@ -171,7 +171,7 @@ while [ "$#" -ge 1 ]; do ;; *) [ ] - echo "ERROR: ssh_filter_btrbk.sh: failed to parse command line option: $key" 1>&2 [x] + printf 'ERROR: ssh_filter_btrbk.sh: failed to parse command line option: %s\n' "$key" 1>&2 exit 255 ;; esac Now "c", causes: error: patch fragment without header at line 16: @@ -171,7 +171,8 @@ while [ "$#" -ge 1 ]; do On branch improve-ssh_filter_btrbk.sh Your branch is behind 'origin/improve-ssh_filter_btrbk.sh' by 8 commits, and can be fast-forwarded. (use "git pull" to update your local branch) Untracked files: (use "git add ..." to include in what will be committed) changes.patch nothing added to commit but untracked files present (use "git add" to track) abort: commit failed: git exited with status 1 The same with --debug: $ git crecord --debug backup 'ssh_filter_btrbk.sh' as '/home/calestyo/foo/z/btrbk/.git/record-backups/ssh_filter_btrbk.sh.gu99sc7q' applying patch diff --git a/ssh_filter_btrbk.sh b/ssh_filter_btrbk.sh index 262cbbb..21074ae 100755 --- a/ssh_filter_btrbk.sh +++ b/ssh_filter_btrbk.sh @@ -41,8 +41,9 @@ reject_and_die() { local reason="$1" log_cmd 'auth.err' 'btrbk REJECT' "$reason" echo "ERROR: ssh_filter_btrbk.sh: ssh command rejected: $reason: $SSH_ORIGINAL_COMMAND" 1>&2 exit 255 +printf 'ERROR: ssh_filter_btrbk.sh: ssh command rejected: %s: %s\n' "$reason" "$SSH_ORIGINAL_COMMAND" 1>&2 exit 1 } run_cmd() @@ -171,7 +171,8 @@ while [ "$#" -ge 1 ]; do ;; *) echo "ERROR: ssh_filter_btrbk.sh: failed to parse command line option: $key" 1>&2 + printf 'ERROR: ssh_filter_btrbk.sh: failed to parse command line option: %s\n' "$key" 1>&2 exit 255 ;; esac error: patch fragment without header at line 16: @@ -171,7 +171,8 @@ while [ "$#" -ge 1 ]; do On branch improve-ssh_filter_btrbk.sh Your branch is behind 'origin/improve-ssh_filter_btrbk.sh' by 8 commits, and can be fast-forwarded. (use "git pull" to update your local branch) Untracked files: (use "git add ..." to include in what will be committed) changes.patch nothing added to commit but untracked files present (use "git add" to track) restoring '/home/calestyo/foo/z/btrbk/.git/record-backups/ssh_filter_btrbk.sh.gu99sc7q' to 'ssh_filter_btrbk.sh' abort: commit failed: git exited with status 1 Thanks, Chris. PS & offtopic: Is "s" (for staging) supposed to work in the current Debian sid version? And is bash completion supposed to work (i.e. $ git cre)? diff --git a/ssh_filter_btrbk.sh b/ssh_filter_btrbk.sh index 262cbbb..21074ae 100755 --- a/ssh_filter_btrbk.sh +++ b/ssh_filter_btrbk.sh @@ -3,7 +3,7 @@ set -e set -u -export PATH=/sbin:/bin:/usr/sbin:/usr/bin +export PATH='/usr/bin:/bin' enable_log= restrict_path_list=
Bug#1024536: git-crecord: fails on committing/stagin
On Fri, 2022-11-25 at 07:42 +0100, Andrej Shadura wrote: > > I’ve just run those commands, and it worked without an error. Given > that I use git-crecord daily, I’d have caught the breakage this basic > — are you sure it’s not something with your gitconfig? Hmm I just tried with moving my ~/.config/git out of the way, but same error as with: > Also, can you please try --debug? Sorry, completely forgot about that: $ git crecord --debug backup 'bar' as '/home/calestyo/foo/.git/record-backups/bar.1hhsrizs' applying patch diff --git a/bar b/bar index e69de29..de98044 100644 --- a/bar +++ b/bar @@ -0,0 +1,1 @@ a +b c error: corrupt patch at line 9 On branch master nothing to commit, working tree clean restoring '/home/calestyo/foo/.git/record-backups/bar.1hhsrizs' to 'bar' abort: commit failed: git exited with status 1 I had /etc/gitconfig but that only contains: [safe] bareRepository = explicit Thanks, Chris.
Bug#1024536: git-crecord: fails on committing/stagin
Hi, On Fri, 25 Nov 2022, at 02:19, Christoph Anton Mitterer wrote: >> 2) If it still fails, run with --debug, it’s going to print the patch >> 3) If possible, send me your working tree so that I can try it out > > > Could you possibly try this: > > $ git init foo > Initialized empty Git repository in /home/calestyo/foo/.git/ > $ cd foo/ > > $ touch bar > $ git add bar > $ git commit -m 'foo' > [master (root-commit) 157defb] foo > 1 file changed, 0 insertions(+), 0 deletions(-) > create mode 100644 bar > $ printf 'a\nb\nc\n' >| bar > > $ git crecord > > Now here, I first unselect all, and then select only one single line, > e.g. the "b" line, like so: > [~]diff --git a/bar b/bar >index e69de29..de98044 100644 >1 hunks, 3 lines changed > >[~] @@ -0,0 +1,3 @@ > [ ] +a > [x] +b > [ ] +c > > if I now "c" or "s", I get: > error: corrupt patch at line 9 > On branch master > nothing to commit, working tree clean > abort: commit failed: git exited with status 1 > > > In principle it's the same as what I did with the other repo, but maybe > that's another issue, though... cause the error message is different. I’ve just run those commands, and it worked without an error. Given that I use git-crecord daily, I’d have caught the breakage this basic — are you sure it’s not something with your gitconfig? Also, can you please try --debug? -- Cheers, Andrej
Bug#1024536: git-crecord: fails on committing/stagin
Hi, On Fri, 25 Nov 2022, at 02:19, Christoph Anton Mitterer wrote: > On Mon, 2022-11-21 at 08:42 +0100, Andrej Shadura wrote: >> Can you try these things please: >> 1) Try the latest Git version > That's a bit difficult right now in my setup. I’ve just realised my suggestion could be misread — I didn’t mean the latest version of Git, but the latest Git commit of git-crecord itself :) -- Cheers, Andrej
Bug#1024536: git-crecord: fails on committing/stagin
Hey Andrej On Mon, 2022-11-21 at 08:42 +0100, Andrej Shadura wrote: > Can you try these things please: > 1) Try the latest Git version That's a bit difficult right now in my setup. > 2) If it still fails, run with --debug, it’s going to print the patch > 3) If possible, send me your working tree so that I can try it out Could you possibly try this: $ git init foo Initialized empty Git repository in /home/calestyo/foo/.git/ $ cd foo/ $ touch bar $ git add bar $ git commit -m 'foo' [master (root-commit) 157defb] foo 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 bar $ printf 'a\nb\nc\n' >| bar $ git crecord Now here, I first unselect all, and then select only one single line, e.g. the "b" line, like so: [~]diff --git a/bar b/bar index e69de29..de98044 100644 1 hunks, 3 lines changed [~] @@ -0,0 +1,3 @@ [ ] +a [x] +b [ ] +c if I now "c" or "s", I get: error: corrupt patch at line 9 On branch master nothing to commit, working tree clean abort: commit failed: git exited with status 1 In principle it's the same as what I did with the other repo, but maybe that's another issue, though... cause the error message is different. Thanks, Chris.
Bug#1024536: git-crecord: fails on committing/stagin
Hi, On Mon, 21 Nov 2022, at 05:09, Christoph Anton Mitterer wrote: > I wanted to selectively stage (or commit) just two lines. > In both cases it fails with the same error: > $ git crecord > error: patch fragment without header at line 16: @@ -171,8 +171,8 @@ > while [ "$#" -ge 1 ]; do > On branch improve-ssh_filter_btrbk.sh > Your branch is ahead of 'origin/improve-ssh_filter_btrbk.sh' by 2 > commits. > (use "git push" to publish your local commits) > > nothing to commit, working tree clean > abort: commit failed: git exited with status 1 > > Any ideas? Can you try these things please: 1) Try the latest Git version 2) If it still fails, run with --debug, it’s going to print the patch 3) If possible, send me your working tree so that I can try it out -- Cheers, Andrej
Bug#1024536: git-crecord: fails on committing/stagin
Package: git-crecord Version: 20220324.0-1 Severity: important Hey. I wanted to selectively stage (or commit) just two lines. In both cases it fails with the same error: $ git crecord error: patch fragment without header at line 16: @@ -171,8 +171,8 @@ while [ "$#" -ge 1 ]; do On branch improve-ssh_filter_btrbk.sh Your branch is ahead of 'origin/improve-ssh_filter_btrbk.sh' by 2 commits. (use "git push" to publish your local commits) nothing to commit, working tree clean abort: commit failed: git exited with status 1 Any ideas? Thanks, Chris. -- System Information: Debian Release: bookworm/sid APT prefers unstable-debug APT policy: (500, 'unstable-debug'), (500, 'unstable') merged-usr: no Architecture: amd64 (x86_64) Kernel: Linux 6.0.0-4-amd64 (SMP w/16 CPU threads; PREEMPT) Kernel taint flags: TAINT_WARN Locale: LANG=en_DE.UTF-8, LC_CTYPE=en_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages git-crecord depends on: ii python3 3.10.6-3 ii sensible-utils 0.0.17 git-crecord recommends no packages. git-crecord suggests no packages. -- no debconf information