From: Matthieu Moy <Matthieu.Moy@imag.fr>
To: git <git@vger.kernel.org>
Subject: [BUG] assertion failure in builtin-mv.c with "git mv -k"
Date: Wed, 14 Jan 2009 14:20:07 +0100 [thread overview]
Message-ID: <vpqwscy81o8.fsf@bauges.imag.fr> (raw)
Hi,
Just found a bug in builtin-mv.c. Here's a script to reproduce:
mkdir git
cd git
git init
touch controled
git add controled && git commit -m "init"
touch foo1 foo2
mkdir dir
git mv -k foo* dir/
The output is the following:
Initialized empty Git repository in /tmp/git/.git/
[master (root-commit)]: created 694563b: "init"
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 controled
git: builtin-mv.c:216: cmd_mv: Assertion `pos >= 0' failed.
./bug.sh: line 10: 12919 Aborted git mv -k foo* dir/
Apparently, this happens when using "git mv -k" with more than one
unversionned file. The code ignores the first one, but still goes
through this
for (i = 0; i < argc; i++) {
const char *src = source[i], *dst = destination[i];
enum update_mode mode = modes[i];
int pos;
if (show_only || verbose)
printf("Renaming %s to %s\n", src, dst);
if (!show_only && mode != INDEX &&
rename(src, dst) < 0 && !ignore_errors)
die ("renaming %s failed: %s", src, strerror(errno));
if (mode == WORKING_DIRECTORY)
continue;
pos = cache_name_pos(src, strlen(src));
assert(pos >= 0); /* <----- this is the one */
if (!show_only)
rename_cache_entry_at(pos, dst);
}
for the second, and it crashes on the assertion (gdb says "pos" here
is an unversionned file name).
If anyone has time to fix this ...
Thanks,
--
Matthieu
next reply other threads:[~2009-01-14 13:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-14 13:20 Matthieu Moy [this message]
2009-01-14 14:53 ` [BUG] assertion failure in builtin-mv.c with "git mv -k" Michael J Gruber
2009-01-14 15:54 ` Johannes Schindelin
2009-01-14 16:04 ` Michael J Gruber
2009-01-14 16:47 ` Jeff King
2009-01-14 19:02 ` Junio C Hamano
2009-01-15 10:53 ` Michael J Gruber
2009-01-15 22:19 ` Junio C Hamano
2009-01-16 12:57 ` Matthieu Moy
2009-01-14 17:03 ` [PATCH v2 0/3] Add test cases for "git mv -k" and fix a known breakage Michael J Gruber
2009-01-14 17:03 ` [PATCH v2 1/3] add test cases for "git mv -k" Michael J Gruber
2009-01-14 17:03 ` [PATCH v2 2/3] fix handling of multiple untracked files for git mv -k Michael J Gruber
2009-01-14 17:03 ` [PATCH v2 3/3] mark fixed breakage as expect pass for "git mv -k" multiple files Michael J Gruber
2009-01-14 15:42 ` [PATCH] fix handling of multiple untracked files for git mv -k Michael J Gruber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vpqwscy81o8.fsf@bauges.imag.fr \
--to=matthieu.moy@imag.fr \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).