git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: CVS import [SOLVED]

From
Ferry Huberts (Pelagic) <ferry.huberts@pelagic.nl>
Date
Feb 17, 2009, 11:19 UTC
Message-ID
<50713.77.61.241.211.1234869582.squirrel@hupie.xs4all.nl>
In-Reply-To
<alpine.DEB.1.00.0902162157080.6289@intel-tinevez-2-302>
Ok.

I tested all combinations of autocrlf and safecrlf on an artificial cvs repository with only a dos text file and a Unix text file. Here are my results.

 autocrlf safecrlf
1 false    false
2 false     warn
3 false     true
4 input    false
5 input     warn
6 input     true
7 true     false
8 true      warn
9 true      true

1- correct import, no warnings 2- correct import, no warnings 3- correct import, no warnings 4- correct import, no warnings 5- correct import, warning on the dos text file 6- correct import, no warnings 7- correct import, no warnings 8- correct import, no warnings 9- fail:

Initialized empty Git repository in /data/home.f9/ferry/testarea/cvsimport/wc.git.true.true/.git/
Running cvsps...
cvs_direct initialized to CVSROOT /data/home.f9/ferry/testarea/cvsimport/cvs
cvs rlog: Logging master
* UNKNOWN LINE * Branches:
Fetching dos.txt   v 1.1
New dos.txt: 25 bytes
Fetching unix.txt   v 1.1
New unix.txt: 22 bytes
fatal: LF would be replaced by CRLF in /tmp/gitcvs.RT1XN8
Use of uninitialized value $sha in scalar chomp at /usr/bin/git-cvsimport line 928.
Use of uninitialized value in concatenation (.) or string at /usr/bin/git-cvsimport line 674, <CVS> line 14.
fatal: malformed index info 100666 	unix.txt
unable to write to git-update-index:  at /usr/bin/git-cvsimport line 679, <CVS> line 14.

So 9 crashes while 6 does not. Apparently the artificial repo with the 2 text files doesn't give enough coverage: my problem was with 6.

It seems that the import script does not detect a fatal from git. It seems to me that it does not check the return code because it tries to continue. Must be here (from line 923):

print "".($init ? "New" : "Update")." $fn: $size bytes\n" if $opt_v;
my $pid = open(my $F, '-|');
die $! unless defined $pid;
if (!$pid) {
	exec("git-hash-object", "-w", $tmpname)
	or die "Cannot create object: $!\n";
}
my $sha = <$F>;
chomp $sha;
close $F;
I think the culprit here is git-hash-object. Either it does return a non-zero
exit code or cvsimport does not see the exit code correctly.
I've traced it in the code to the file convert.c, function
static void check_safe_crlf(const char *path, int action,
                            struct text_stat *stats, enum safe_crlf checksafe)

It does do a 'die' which will exit with code 128, but apparently isn't picked up by perl. I'm stuck now as I don't know Perl well enough.

Back to the issue: I think requiring autocrlf = false is too strict. Requiring autocrlf = false should be enough. That combined with a bit of text in the manual page about these settings: autocrlf = false is strongly recommended. Also, safecrlf is required to be set to false.

Previous: Johannes SchindelinNext: Johannes Schindelin
Message 9 of 26 in “CVS import”
  1. Ferry Huberts (Pelagic)Feb 16, 2009
  2. Ferry Huberts (Pelagic)Feb 16, 2009
  3. Johannes SchindelinFeb 16, 2009
  4. Johannes SchindelinFeb 16, 2009
  5. Ferry Huberts (Pelagic)Feb 16, 2009
  6. Johannes SchindelinFeb 16, 2009
  7. Ferry Huberts (Pelagic)Feb 16, 2009
  8. Johannes SchindelinFeb 16, 2009
  9. Ferry Huberts (Pelagic)Feb 17, 2009
  10. Johannes SchindelinFeb 17, 2009
  11. Ferry Huberts (Pelagic)Feb 17, 2009
  12. Jeff KingFeb 20, 2009
  13. Ferry Huberts (Pelagic)Feb 20, 2009
  14. autocrlf=input and safecrlf (was Re: CVS import [SOLVED])Jeff King, Feb 20, 2009
  15. Ferry Huberts (Pelagic)Feb 20, 2009
  16. Jeff KingFeb 23, 2009
  17. Ferry Huberts (Pelagic)Feb 23, 2009
  18. Jeff KingFeb 23, 2009
  19. Ferry Huberts (Pelagic)Feb 23, 2009
  20. Jeff KingFeb 23, 2009
  21. Ferry Huberts (Pelagic)Feb 23, 2009
  22. Jeff KingFeb 24, 2009
  23. Ferry Huberts (Pelagic)Feb 24, 2009
  24. Jeff KingFeb 25, 2009
  25. Ferry Huberts (Pelagic)Feb 25, 2009
  26. Jeff KingFeb 25, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.